Giter Site home page Giter Site logo

rtroxler / .emacs.d Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andyleejordan/.emacs.d

0.0 1.0 0.0 284 KB

:coffee: My Emacs configurations; but now I use Spacemacs.

Home Page: https://github.com/andschwa/dotfiles

License: GNU General Public License v3.0

Emacs Lisp 100.00%

.emacs.d's Introduction

Andrew Schwartzmeyer’s Emacs configurations

https://travis-ci.org/andschwa/.emacs.d.svg?branch=master

Utilizes jwiegley’s use-package macro to cleanly and quickly require, install via `package.el`, and setup various extensions. Enables lots of lovely minor modes, and conditionally loads operating and local system specific code.

Notable packages

  • Magit is a Git Porcelain
  • Evil for Vim emulation
  • Projectile to manage and interact with projects
  • use-package organizes init.el and manages packages
  • Company is the best auto-completion framework
  • Flycheck provides on-the-fly syntax and compilation checking
  • Ledger because double-entry bookkeeping is all the rage
  • Undo Tree records edits as a traversable graph
  • Whitespace Butler unobtrusively cleans up whitespace
  • YASnippet is a great template system

Evil

easy-motion aka ace-jump SPC<motion><char>

find tag aka definition gd

open link in browser gx

reselect visual aka region gv

comment with gc

select paragraph vip

move up delimiter [( / [{

jump forward / backward aka pop / push mark C-o / C-i

repeat find / to (like .) ;

substitute s is replace r and stay in insert

Elisp

(some-minor-mode) enables a mode

Enables when the argument is nil or positive and disables when zero or negative.

add-hook and eval-after-load for conditional execution

expand-file-name and f-expand for filename expansion

file-name-basename and file-name-nondirectory etc.

message and princ for printing

get-buffer-create for buffers

add-to-list, append and list for lists

mapcar with list of results

mapconcat for string of results

dolist for mapc with implicit bind

concat and format for strings

cadr for last item of pair, as in, (car (cdr foo))

cons to append without copying

remove to filter items from list

getenv, setenv, compilation-environment for env

executable-find for binaries

ielm Inferior Elisp REPL

nth and elt

find-library to open library’s code

cond is better than if / else

let for friendly names should be used liberally

save-excursion to restore point

Tricks and tips

Global mark: push C-SPC C-SPC pop C-x C-SPC

Recording because C-x C-@ is horrible.

Narrowing C-x n region n defun d widen w

https://www.gnu.org/software/emacs/manual/html_node/emacs/Narrowing.html#Narrowing

Zap to char M-z

Sexps: mark C-M-SPC kill C-M-k

Defuns: move C-M-a C-M-e mark C-M-h

The opposite of C-l is M-r

Comment DWIM M-;

Select nearest symbol with M-s .

“Close” client buffer C-x # (server-edit)

Evaluate lisp code on buffer M-:

  • use eval-expression

Setting fill prefix C-x .

- Fill-Prefix with point after prefix

Setting fill column C-x f

Using quote marks within verbatim/code markup in org-mode

  • Unicode: <U200B> /xe2/x80/x8b ZERO WIDTH SPACE
  • Insert using: (C-x 8 RET 200b RET)

Quickly insert #+begin_src with <s <tab>

Sudo mode using Tramp C-x C-f /ssh:you@host|sudo:host:/file

Rename files in dired C-x C-q

Replace in files

From StackOverflow:

  1. M-x find-name-dired: you will be prompted for a root directory and a filename pattern.
  2. Press t to “toggle mark” for all files found.
  3. Press Q for “Query-Replace in Files…”: you will be prompted for query/substitution regexps.
  4. Proceed as with query-replace-regexp: SPACE to replace and move to next match, n to skip a match, etc.
  5. Press Y to finish replacing in all buffers.
  6. C-x C-s ! to save all buffers.

Replace with capture regexp

  • use regex groups like “ab\(c\)” where the parentheses are escaped because Emacs
  • refer to prior capture groups by \N where N is 1-indexed on the captured groups (e.g. back reference)

Renumber with regexp

  • see Wiki; the comma indicates elisp code to evaluate
  • e.g. [0-9]+ -> \,(+ 257 \#)
  • or by 8 starting at 10 \,(+ 10 (* 8 \#))

Capture all regexp matches

;; captures all non-terminals in Bison grammar
(save-excursion
  (while (re-search-forward "^\\([a-z_]+\\):" nil t)
    (princ (format "%s " (match-string 1)) (get-buffer-create "matches"))))

regexp-builder for replace

  • Use C-c C-i and choose the “string” syntax
  • Copy the regexp without the surrounding quotes
  • Use C-c C-q to close regexp-builder

Projectile commands

Project

switch
p
commander
m
command
!
async
&
make
c
make test
P
make tags
R
replace
r
dired
D
vcs
v
ag
ss
tag
j
buffers
b
kill
k
recent
e

File

alternate
a
test files
T
toggle test
t

Flycheck

(flycheck-compile) for debugging

ansi-term

  • Needs terminfo
  • Remove TERM from shell’s rc file
tic -o ~/.terminfo
/usr/local/Cellar/emacs/HEAD/share/emacs/24.4.50/etc/e/eterm-color.ti

Quoting characters C-q

newline
C-j

Partially evaluate list elements

  • (add-to-list ‘somelist `(symbol . ,(expression to be evaluated)))
  • The backquote is like a normal quote except it evaluates elements marked with commas. RTFM

Temporarily disable ido-completion C-j

Set directory local variable eval to execute arbitrary code

View Lossage

Use M-x view-lossage to see the most recent 300 keystrokes, per Emacs Redux

Smartparens

https://ebzzry.github.io/emacs-pairs.html

Compiling Emacs from source

See INSTALL.REPO

update

git clone --depth 1 -b emacs-24 git://git.sv.gnu.org/emacs.git

prepare

Can use build-dep emacs to get dependencies.

make distclean

Arch

sudo pacman -S texinfo libxft
# with GTK
sudo pacman -S gtk2 xorg-fonts-100dpi

CentOS 7

GTK+ and FreeType are needed to for the X11 build with proper font rendering. See other notes for X11 and Xft setup.

yum install gtk2-devel freetype gnutls-devel

Ubuntu 14.04

Still needs GTK and FreeType.

sudo apt-get install texi2html texinfo

Windows

Follow nt/INSTALL

  • Install MinGW and MSYS (see Getting Started)
  • Run C:\MinGW\msys\1.0\postinstall\pi.bat to setup fstab
  • Add shortcut to C:\MinGW\msys\1.0\msys.bat

Fix line endings

Otherwise autoreconf will fail cryptically.

dos2unix.exe configure.ac

autoreconf

./autogen.sh

This runs the usual autoreconf -i -I m4

configure

Arch

./configure --without-all --with-x-toolkit=no --with-xft --with-makeinfo

OS X

./configure --without-all --with-x-toolkit=no --with-ns --with-toolkit-scroll-bars --with-makeinfo

CentOS 7

./configure --without-all --with-xft --with-makeinfo

Ubuntu 14.04

./configure --without-all --with-xft --with-makeinfo

Windows

Toolkit scroll-bars are required on Windows but excluded by --without-all, so explicitly include them.

./configure --without-all --with-w32 --with-toolkit-scroll-bars

Optional

--with-sound --with-gnutls --with-zlib --without-compress-install --with-libotf

make

bootstrap

make bootstrap

build docs

make info doc

install

sudo make install install-info install-doc

OS X

Copy nextstep/Emacs.app to desired location

post-install

Remove old packages

rm -rf ~/.emacs.d/elpa

.emacs.d's People

Contributors

andyleejordan avatar

Watchers

Ryan Troxler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.