Skip to content

Latest commit

 

History

History
191 lines (161 loc) · 6.13 KB

emacs.org

File metadata and controls

191 lines (161 loc) · 6.13 KB

Emacs

General

Useful commands

proced
show running processes
delete-duplicate-lines
delete duplicate lines in the active region
auto-revert-tail-mode
like tail -f
calculator
calculator
quick-calc
evaluate expression in minibuffer (can be used for bin/oct/hex conversions)

Useful key-bindings

C-x C-e
evaluate sexp
C-x (, C-x ), C-x e
start/end/execute keyboard macro
M-<, M->
move to the beginning/end of file
M-$
correct word (spell check)
M-g M-g
goto line
C-x z z z z
repeat last command
C-x C-{+,-,0}
change font size
C-S-<BACKSPACE>
kill whole line
C-x h
select whole buffer (like C-a)
C-x 0
delete windows (i.e. maximize other window)
C-x C-j
dired-jump (show current file in dired)
M-g <TAB>
goto column
C-x <SPACE>
rectangular selection
M-q
fill paragraph
M-%
query-replace
C-g C-z
stop undoing and start redoing
M-s .
search symbol at point
C-s, C-r
i-search forward/backward
C-M-s, C-M-r
regexp i-search forward/backward
C-x C-q
toggle read-only
M-g n, C-x `
next error (also works in occur)
M-g p
previous error (also works in occur)
C-c left/right
undo/redo window layout (winner-mode)

Key-bindings (custom)

M-<up>, M-<down>
move up/down the current line (move-text)
M-y
show kill ring (helm)
C-c i
helm-semantic-or-imenu (like Ctrl+F3 in Eclipse)
C-c b
helm-bookmarks (list, jump, add)
C-=
expand-region

Tips and Tricks

Duplicate line

C-a C-k C-y C-y Note: this requires (setq kill-whole-line t)

C-S-Backspace C-v C-v Note: this requires cua-mode and doesn’t work in all terminals

todo list

Figure out redo functionality (and bind to C-y if possible), try undo-tree package

(?) Key-binding go to terminal (C-C t)

(?) Copy file name into clipboard (function and key-binding)

Modes

haskell-mode

Key-bindings (custom)

C-c C-c
compile
C-c C-z
switch to/from haskell interactive console
C-c C-l
load file in the interactive interpreter
C-c C-i
show information about function/variable at cursor
C-c C-t
show type of function/variable at cursor

golang-mode

Key-bindings (standard)

C-c C-d
show declaration
C-c C-j
go to definition
C-M-a
go to the beginning of the current function
C-M-e
go to the end of the current function

Key-bindings (custom)

M-.
go to definition
M-*
go back
C-c C-c
compile
C-c d
godoc-at-point
C-c t t
go-test-current-test
C-c t f
go-test-current-file
C-c t p
go-test-current-project
C-c g f
debug current function (dlv-current-func)

Snippets

  • if, for, ierr
  • struct, interface

Commands (M-x)

  • godoc

Other notes

“C-c i” to show imenu “C-c p c” to compile project

org-mode

todo list

Enable flyspell mode for org-mode automatically

Markup

  • bold
  • italic
  • underlined
  • verbatim
  • code
  • strike-through
  • #+BEGIN_SRC lang … #+END_SRC

Easy templates

<s followed by <TAB>
SRC template

Key-bindings (global, custom)

C-c c
capture
C-c l
store link
C-c a
agenda
C-c b
switch buffer

Key-bindings (standard)

<TAB>, S-<TAB>
visibility cycling
C-c C-j
org-goto (similar to Ctrl+F3 in Eclipse)
M-<arrow>, M-S-<arrow>
promote/demote to the next/prev level
C-c ^
sort list
C-c .
insert timestamp
C-c C-s
insert SCHEDULED along with a stamp
C-c C-d
insert DEADLINE along with a stamp
C-c C-c
ask and insert tags
C-c ’
edit code block (in begin_src/end_src)

Working with tables

Realigning and moving around: <TAB>, S-<TAB>, C-c C-c, <RET>, M-a, M-e

Inserting/deleting/moving rows columns: M-<Arrow>, M-S-<Arrow>

Inserting a hline: C-c -, C-c <RET>

Calcs key-bindings:

C-c +
show sum of the current column
C-c *
recalculate the current row
C-u C-c C-c
recalculate whole table
C-c C-c
recalculate whole table (on TBLFM line)
C-c ’
enter formula editor (use S+arrow, M+arrow)
C-c ?
show how to reference the current cell in the formula
C-c }
toggle visualization of line and row numbers

Sample Table with formulas:

Nformula
12
22.4142136
43
53.2360680

helm-mode

Key-bindings

C-s
grep (in files or buffers)
C-u C-s
recursive grep (in files or buffers)

Key-bindings (custom, global)

M-y
show kill ring (helm)
C-c i
helm-semantic-or-imenu (like Ctrl+F3 in Eclipse)
C-x p
helm-projectile-find-file-in-known-projects

projectile

Key-bindings

C-c p p
switch project
M-g
magit
M-d
dired
M-e
eshell
C-c p f
find file in current project
C-c p i
invalidate current project cache
C-c p c
compile current project

magit-mode

Key-bindings (custom)

C-c m
magit-status

smartscan-mode

Key-bindings

M-n
jump to the next occurrence of the symbol under the cursor
M-p
previous occurrence

dired

Key-bindings

M-RET
open file using default tool

Key-bindings

C-x C-q
enter wdired to rename/move files
Q
search and replace in marked files (dired-do-query-replace-regexp)
t
toggle marks
U
remove all marks