Skip to content

Instantly share code, notes, and snippets.

@kirbysebastian
Last active February 1, 2020 17:10
Show Gist options
  • Select an option

  • Save kirbysebastian/82e66a559a6f9ae9dc44cdce81c56510 to your computer and use it in GitHub Desktop.

Select an option

Save kirbysebastian/82e66a559a6f9ae9dc44cdce81c56510 to your computer and use it in GitHub Desktop.

Revisions

  1. kirbysebastian revised this gist Feb 1, 2020. 1 changed file with 89 additions and 1 deletion.
    90 changes: 89 additions & 1 deletion VIM Essentials
    Original file line number Diff line number Diff line change
    @@ -63,5 +63,93 @@ REGISTERS
    Black Hole
    "_ - deletes text from any performed operation without affecting existing registers

    SEARCH/FIND TEXT
    'f' + <character> - search the character on the current line
    'F' + <character> - search the character backwards on the current line
    't' + <character> - place cursor 1 character befor the intended character
    'T' + <character> - place cursor 1 character after the intended character
    '/' + <text> - search the given text in the current file
    '?' + <text> - search the given text backwards in the current file
    ';' - repeat the previous search forward
    ',' - repeat the previous searc backwards
    'n' - repeat the latest '/' or '?'
    'N' - repeat the latest '/' or '?' backwards


    INSERT MODE
    'i' - before cursor
    'I' - beginning of the current line
    'a' - after cursor
    'A' - end of the current line
    's' - substitute character
    'S' / 'cc' - substitue whole line
    'C' - substitute line from cursor
    'o' - new line below the current line
    'O' - new line above the current line

    * insert image here *

    VISUAL MODE
    '~' - toggle case
    'c' - change
    'd' - delete
    'y' - copy
    'r' - replace
    'x' - delete
    'I' - insert
    'A' - append
    'J' - join
    'u' - make lowercase
    'U' - make uppercase
    '>' - shift right
    '<' - shift left
    'gv' - reselect previous selected text

    VIM BUFFERS
    ':ls' - list all current buffers
    ':e' + <file/buffer> - edit
    ':b' + <buffer> - switch buffer
    ':bn' - next buffer
    ':bp' - previous buffer
    ':bl' - last buffer
    ':bf' - first buffer
    ':badd' - load buffer in list
    ':bd' + <buffer> - delete buffer in list
    ':bufdo' - execute command to all buffers in the list
    [CTRL] + '^' - load back previous opened buffer

    MARKERS
    '%a' - currently loaded buffer
    '#' - alternate buffer

    [CTRL] + 'w' + ('<' | '>') - adjust width
    [CTRL] + 'w' + ('-' | '+') - adjust height
    [CTRL] + 'w' + '_' - maximize height
    [CTRL] + 'w' + '|' - maximize width
    [CTRL] + 'w' + '=' - make all buffers the same size
    [CTRL] + 'w' + ('r' | 'R') - rotate windows clockwise
    [CTRL] + 'w' + ('H' | 'J' | 'K' | 'L') - move window base on given direction

    REPLACE
    ':[RANGE]s/{PATTERN}/[TEXT]/[FLAG][COUNT]
    - for each line in RANGE, replace a match of PATTERN with TEXT

    TEXT OBJECTS
    [OPERATOR] + ('a' | 'i') + [OBJECT]
    'a' - around an object, including the delimitter
    'i' - inner object only or the object itself

    ~OBJECTS
    WORD - ('w' | 'W')
    SENTENCE - 's'
    PARAGRAPH - 'p'
    BLOCK - 'b'
    TAG<> - 't'

    MACROS
    'q' + [REGISTER] - save macro command on the given register
    '@' + [REGISTER] - apply macro that saved on the register
    '@@' - repeat previously executed macro


    [END]

  2. kirbysebastian revised this gist Feb 1, 2020. 2 changed files with 67 additions and 9 deletions.
    9 changes: 0 additions & 9 deletions VIM
    Original file line number Diff line number Diff line change
    @@ -1,9 +0,0 @@
    MODES
    Normal Mode - [ESC]
    Insert Mode - i
    Line Mode
    Visual Mode
    Replace Mode

    NAVIGATION

    67 changes: 67 additions & 0 deletions VIM Essentials
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    MODES
    Normal Mode - [ESC]
    Insert Mode - 'i'
    Line Mode - ':'
    Visual Mode - 'v'
    Replace Mode - 'R'

    NAVIGATION / MOTION
    'j' - move cursor down
    'k' - move cursor up
    'l' - move cursor left
    'h' - move cursor right

    *insert image here*

    'H' - move cursor on the first character of the top line of the current screen
    'M' - move cursor on the first character of the middle line of the current screen
    'L' - move cursor on the first character of the last line of the current screen

    [CTRL] + 'y' - scroll up
    [CTRL] + 'e' - scroll down
    [CTRL] + 'b' - page up
    [CTRL] + 'f' - page down
    [CTRL] + 'u' -
    [CTRL] + 'd' -

    'w' - move cursor 1 word to the right without punctuation
    'W' - move cursor 1 word to the right including punctuation
    'b' - move cursor 1 word to the left without punctuation
    'B' - move cursor 1 word to the left including punctuation

    'z' + [ENTER] - move the screen view with the cursor at the middle of the screen
    'zz' -
    'zb' -
    'zt' -

    '^' - move cursor at the first character of the first word in the current line
    '0' - move cursor at the first column of the current line
    '$' - move cursor at the last colimn of the current line
    'gg' - move cursor at the first character of the top of the file
    'G' - move cursor at the first character of last line of the file
    [LINE NUMBER] + ('gg' | 'G') or ':' + [LINE NUMBER] + [ENTER]
    -move cursor at the given line number

    OPERATIONS
    'D' - delete an entire line from where cursor is currently located and leave a blank line
    'dd' - delete an entire line
    'yy' - copies the entire line
    'd' + [MOTION] - delete a text from fursor until the motion given
    'y' + [MOTION] - copy text from cursor until the given motion
    'c' + [MOTION] - change the text from the cursor until the given motion

    REGISTERS
    TYPES
    Unnamed
    -> ""
    Named
    -> "a, "b, ..., "z
    Numbered
    -> "0, "1, "2, ..., "9
    "0 - holds the last copied text
    "1 - holds the last deleted(d) or changed(c) text
    Black Hole
    "_ - deletes text from any performed operation without affecting existing registers



  3. kirbysebastian created this gist Feb 1, 2020.
    9 changes: 9 additions & 0 deletions VIM
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    MODES
    Normal Mode - [ESC]
    Insert Mode - i
    Line Mode
    Visual Mode
    Replace Mode

    NAVIGATION