Evil Mode

Evil Mode


Evil CS #

tags
Vim, Emacs

Combos or Idioms #

  1. g; -> last change, in edit mode
  2. g, -> opposite of g;
  3. gx -> text exchange gX -> cancel exchange
  4. gi -> insert resume where ever edit was happening.
  5. gJ -> join white spaces
  6. cstt -> change sorrounding tag wo changing the attributes
  7. o, ctrl-o, p -> paste on new line
  8. ddp -> move line down
  9. ddkp -> move up line
  10. xp -> swap two characters
  11. ggg?G -> ROT-13 to hide what you are working on
  12. yygccp -> duplicate line mark orginal as comment copy -> comment -> paste
  13. V$% -> select from function name to , e.g. javascript function.
    1. V: highlight current line in visual line mode
    2. $: end of line
    3. %: jump to next end of ( or
  14. vaBV -> from within "" selection function
    1. highlight around B ()
    2. V: highlight top most line
  15. yiW -> word with “” w: single word W: word excluding space or including “
  16. C-i and C-o: jump forward and backward respectively

Insert mode #

  1. ctrl-i: indent
  2. ctrl-j: new-line or enter or indent
  3. ctrl-t: de-dent(tab)
  4. ctrl-k: kill line
  5. ctrl-p: auto complete from previous symbols in buffer
  6. ctrl-n: auto complete from next symbols in buffer
  7. ctrl-u: universal argument current config says not defined
  8. ctrl-r: register
  9. ctrl-l: recenter-top-bottom
  10. ctrl-o, ctrl-g: normal-mode

Operators #

  1. y: copy
  2. d: delete
  3. c: change
  4. >: indent
  5. <: de-indent
  6. g: go jump
  7. z: fold/unfold
  8. gc: comment
  9. s: surround
  10. ~: capitalize character
  11. g~: operator toggle capitalization
  12. gu: operator lower case
  13. gU: operator upper case

Motions #

b, B, p, s can be used as text objects: with “i” and “a”.

  1. ( or b: block
  2. or B:
  3. p: paragraph(/n)
  4. s: sentence(.)

Text objects fc #

positioneaseboxintervaldue
front2.5002022-02-09T11:20:17Z

They are always used with “i” or “a” i -> inner a -> around

Summary #

  1. ‘’, “”, [], ``,
  2. t, tag
  3. w, words
  4. (), b
  5. , B
  6. l
  7. s, sentence
  8. p, paragraph
  9. i, I
  10. J

Native #

  1. i’: ’this inner’
  2. i": “this inner”
  3. a": “this inner, including quotes”
  4. w: word -> this-word-copied
  5. o: symbol -> this-entire-symbol-will-be-copied

“evil-textobj-line” #

  1. iI or al: line object with

evil-indent-plus #

i -> inner indentation I -> inner indentation with white spaces j -> inner indentation with line above J -> inner indentation with line above and below

  1. ii or ai: inner indentation or higher
  2. iI: same as above, including live above
  3. aI: with white spaces
  4. iJ: including line above and below
  5. aJ: same as above plus white spaces

Org mode #

  1. C - j,k: navigate at node levels
  2. M - j,k: drag node
  3. M - h,l: move whole tree right/left

Things to remember #

  1. vim records all the keystrokes untill you are out of insert mode to normal mode. Micro macro, “.” operator, will repeat this action: powerful stuff. If edits are composed around this, the actions can be repeat with “.” and undone with “u”.
  2. Paste happens after the cursor.

Macro #

q<register><commands>q
qao<ESC>q
# then
@a # to run the macro

To apply macro to multiple lines use V(visual mode) to select lines and then @ followed by macro register.

Commands #

did not work <2022-07-21 Thu>

  1. :ex -> file explorer in current dir
  2. :Sex or :Vex -> split horizontally or vertically in current directory

Custom #

  1. C-c C-j -> previous buffer C-c j -> previous buffer
  2. C-c C-k -> next C-c k -> next

Emacs Tabs CS #

Emacs workspaces

  1. C-SPC t t -> select tab(emacs workspace)
  2. C-SPC t j,k -> previous or next tab

Evil Folding and Navigation CS #

z c
close fold
z m
close all folds
z B
outline-hide-body hide all leaving headings visible
z o
open fold
z O
open all sub folds
z r
open all folds
z =
spell check
z p
hide others open just current tree
z e
show entry
z t
move current cursor position to top
z z
move current cursor position to center
z b
move current cursor position to bottom
z d
jump to next(below) heading
[[
jump to previous heading
]]
jump to next heading
C-j
jump to below heading same level
C-k
jump to above heading same level

outline functions #

Python #

Yank ATTACH #

Text Object #

  • C -> class
  • c -> comment
  • f -> function/method
  • F -> call
  • l -> loop
  • v -> conditional

=counsel-imenu (SPC s i) #

  • list of functions/methods and jump

jump on symbols or index symbols(functions, classes) #

  • SPC-c-m-i consult-outline

  • SPC-c-m-l lsp-ui-imenu-


Previous Next