Skip to content

Instantly share code, notes, and snippets.

@gricard
Last active November 27, 2019 20:45
Show Gist options
  • Select an option

  • Save gricard/c94ccda5f591a6ad269a3b45a8db7afd to your computer and use it in GitHub Desktop.

Select an option

Save gricard/c94ccda5f591a6ad269a3b45a8db7afd to your computer and use it in GitHub Desktop.

Revisions

  1. gricard revised this gist Nov 27, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,7 @@ $ go to end of line
    #| go to column #
    '. go to last edited line
    `. go to last edited column in last edited line
    ctrl-o go to previously edited file (repeatable)



  2. gricard revised this gist Jul 1, 2019. 1 changed file with 23 additions and 16 deletions.
    39 changes: 23 additions & 16 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    :w save changes
    :wq save and exit
    :x save and exit
    :cq edit with error code
    :cq exit with error code

    MISC
    . repeat last command
    @@ -24,15 +24,25 @@ e go to end of word
    } end of paragraph/code block
    C-f page down
    C-b page up
    # enter line # and hit enter
    #gg go to line #
    ^ go to beginning of text in current line
    0 go to beginning of line
    $ go to end of line
    * go to next instance of word at cursor
    # go to prev instance of word at cursor
    % go to matching bracket
    #| go to column #
    '. go to last edited line
    `. go to last edited column in last edited line



    GO
    # enter line # and hit enter
    #G go to line #
    gg top of file
    G end of file
    gd go to definition



    SCREEN MOVEMENT
    @@ -44,14 +54,6 @@ M middle of screen
    L bottom of screen



    GO
    gg top of file
    G end of file
    #G go to line #
    gd go to definition


    EDITING
    i insert
    a append
    @@ -80,18 +82,20 @@ REPEATING TEXT
    3i-ESC insert "-" 3 times


    CASE
    U make selected text upper case (in visual selection)
    u make selected text lower case (in visual selection)
    ~ reverse case of selected text


    SELECTING
    v select by letter
    V select by line
    viw select word under cursor



    CASE
    U make selected text upper case (in visual selection)
    u make selected text lower case (in visual selection)
    ~ reverse case of selected text


    COMMENT SELECTED LINES
    Ctrl-V
    Up/Down to select lines
    @@ -107,6 +111,7 @@ Vjjy select next two lines and copy
    p paste after
    P paste before
    "+y copy selection to system clipboard
    "+p paste from system clipboard


    REGISTERS
    @@ -137,6 +142,8 @@ Ctrl-R 0 paste contents of register 0 into search input
    SEARCH & REPLACE
    :%s/[pattern]/[replacement]/g replace without confirmation
    :%s/[pattern]/[replacement]/gc replace with confirmation
    :.,+5s/foo/bar/g replace all "foo" with "bar" from current line (.) to 5 lines down (+5)
    :5,10s/foo/bar/g replace all "foo" with "bar" on lines 5 - 10


    TABS
  3. gricard revised this gist May 23, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vim.txt
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ e go to end of word
    C-f page down
    C-b page up
    # enter line # and hit enter
    #G go to line #
    #gg go to line #
    ^ go to beginning of text in current line
    0 go to beginning of line
    $ go to end of line
  4. gricard revised this gist May 23, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -73,6 +73,7 @@ di'' delete content inside next occurrence of '' characters
    u undo last command
    uu undo last block of commands
    C-r redo
    xp swap two characters


    REPEATING TEXT
  5. gricard revised this gist Mar 15, 2019. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -63,9 +63,13 @@ x delete character
    O insert line above
    o insert line below
    c change / delete & insert
    c$ change to end of line
    ci'' change content inside next occurrence of '' characters
    d delete
    dd delete line
    dw delete word
    diw delete current word cursor is inside of
    di'' delete content inside next occurrence of '' characters
    u undo last command
    uu undo last block of commands
    C-r redo
    @@ -76,8 +80,8 @@ REPEATING TEXT


    CASE
    U make selected text upper case
    u make selected text lower case
    U make selected text upper case (in visual selection)
    u make selected text lower case (in visual selection)
    ~ reverse case of selected text


  6. gricard revised this gist Feb 18, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,7 @@ $ go to end of line
    * go to next instance of word at cursor
    # go to prev instance of word at cursor
    % go to matching bracket
    #| go to column #


    SCREEN MOVEMENT
  7. gricard revised this gist Feb 18, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vim.txt
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    :w save changes
    :wq save and exit
    :x save and exit

    :cq edit with error code

    MISC
    . repeat last command
  8. gricard revised this gist Feb 6, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,7 @@
    MISC
    . repeat last command
    :source file reload config file (:source ~/.ideavimrc)
    Ctrl-o in insert mode, break out and run any command (e.g., `ctrl-o, "+p` to paste system clipboard while in insert mode)

    NAVIGATION
    h move left
  9. gricard revised this gist Feb 5, 2019. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -68,6 +68,7 @@ u undo last command
    uu undo last block of commands
    C-r redo


    REPEATING TEXT
    3i-ESC insert "-" 3 times

    @@ -84,6 +85,13 @@ V select by line
    viw select word under cursor


    COMMENT SELECTED LINES
    Ctrl-V
    Up/Down to select lines
    shift-I to insert text ("//" or "#" etc)
    Esc to finish and prepend all lines


    COPY/PASTE
    yy copy (yank) a line
    yw copy word
  10. gricard revised this gist Jan 31, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,7 @@ e go to end of word
    C-f page down
    C-b page up
    # enter line # and hit enter
    #G go to line #
    ^ go to beginning of text in current line
    0 go to beginning of line
    $ go to end of line
  11. gricard revised this gist Jan 31, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@

    MISC
    . repeat last command
    :source file reload config file (:source ~/.ideavimrc)

    NAVIGATION
    h move left
  12. gricard revised this gist Jan 31, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -89,6 +89,7 @@ y$ copy to end of line
    Vjjy select next two lines and copy
    p paste after
    P paste before
    "+y copy selection to system clipboard


    REGISTERS
  13. gricard revised this gist Jan 18, 2019. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -153,6 +153,10 @@ zo open fold
    zc close fold


    SETTINGS
    :set number turn on line numbers


    CUSTOM COMMANDS (in ~/.ideavimrc)
    nmap g] :action GotoImplementation<CR> go to definition of label under cursor
    vmap \c :s!^!//!<CR> type \c to comment selected lines
  14. gricard revised this gist Jan 12, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -157,6 +157,8 @@ CUSTOM COMMANDS (in ~/.ideavimrc)
    nmap g] :action GotoImplementation<CR> go to definition of label under cursor
    vmap \c :s!^!//!<CR> type \c to comment selected lines
    vmap \u :s!^//!!<CR> type \u to uncomment selected lines
    nnoremap <F5> "=strftime("%F%T")<CR>P type F5 to enter current date/time (formatted for gatsby frontmatter)




  15. gricard revised this gist Jan 11, 2019. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -153,6 +153,13 @@ zo open fold
    zc close fold


    CUSTOM COMMANDS (in ~/.ideavimrc)
    nmap g] :action GotoImplementation<CR> go to definition of label under cursor
    vmap \c :s!^!//!<CR> type \c to comment selected lines
    vmap \u :s!^//!!<CR> type \u to uncomment selected lines



    KEY NOTATION
    http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_2%29
    https://stackoverflow.com/questions/1764263/what-is-the-leader-in-a-vimrc-file
  16. gricard revised this gist Jan 10, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -113,6 +113,7 @@ n go to next match
    N go to prev match
    fX find next character "X"
    FX find prev character "X"
    Ctrl-R 0 paste contents of register 0 into search input


    SEARCH & REPLACE
  17. gricard revised this gist Jan 10, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -44,6 +44,7 @@ L bottom of screen
    GO
    gg top of file
    G end of file
    #G go to line #
    gd go to definition


  18. gricard revised this gist Jan 10, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -168,6 +168,7 @@ https://medium.com/@danidiaz/configuring-ideavimrc-de16a4da0715
    https://stackoverflow.com/questions/1764263/what-is-the-leader-in-a-vimrc-file
    https://guide.freecodecamp.org/vim/useful-commands/
    https://www.fprintf.net/vimCheatSheet.html
    https://www.openvim.com/


    REACT DEV
  19. gricard revised this gist Jan 10, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -110,6 +110,8 @@ SEARCH
    ?text find text (rev)
    n go to next match
    N go to prev match
    fX find next character "X"
    FX find prev character "X"


    SEARCH & REPLACE
  20. gricard revised this gist Jan 10, 2019. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,7 @@
    :q! quit without saving
    :w save changes
    :wq save and exit
    :x save and exit


    MISC
    @@ -64,6 +65,9 @@ u undo last command
    uu undo last block of commands
    C-r redo

    REPEATING TEXT
    3i-ESC insert "-" 3 times


    CASE
    U make selected text upper case
  21. gricard revised this gist Jan 9, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -161,6 +161,7 @@ https://www.keycdn.com/blog/vim-commands
    https://medium.com/@danidiaz/configuring-ideavimrc-de16a4da0715
    https://stackoverflow.com/questions/1764263/what-is-the-leader-in-a-vimrc-file
    https://guide.freecodecamp.org/vim/useful-commands/
    https://www.fprintf.net/vimCheatSheet.html


    REACT DEV
  22. gricard revised this gist Jan 9, 2019. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -65,9 +65,16 @@ uu undo last block of commands
    C-r redo


    CASE
    U make selected text upper case
    u make selected text lower case
    ~ reverse case of selected text


    SELECTING
    v select by letter
    V select by line
    viw select word under cursor


    COPY/PASTE
  23. gricard revised this gist Jan 9, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -55,6 +55,7 @@ C change to end of line
    r replace a charater
    x delete character
    O insert line above
    o insert line below
    c change / delete & insert
    d delete
    dd delete line
  24. gricard revised this gist Jan 9, 2019. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -25,14 +25,21 @@ C-b page up
    ^ go to beginning of text in current line
    0 go to beginning of line
    $ go to end of line
    H top of screen
    M middle of screen
    L bottom of screen
    * go to next instance of word at cursor
    # go to prev instance of word at cursor
    % go to matching bracket


    SCREEN MOVEMENT
    z. center screen on cursor
    zt move line with cursor to top of screen
    zb move line with cursor to bottom of screen
    H top of screen
    M middle of screen
    L bottom of screen



    GO
    gg top of file
    G end of file
  25. gricard revised this gist Jan 9, 2019. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -118,8 +118,10 @@ BUFFERS
    SPLITS
    :sp split window
    :vsp vertically split window
    C-w j next split
    C-w k prev split
    C-w j go to split above
    C-w k go to split below
    C-w h go to split left
    C-w l go to split right
    :q close split


  26. gricard revised this gist Jan 9, 2019. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -114,8 +114,13 @@ BUFFERS
    :new new window & buffer
    :e filename edit file


    SPLITS
    :sp split window
    :vsp vertically split window
    C-w j next split
    C-w k prev split
    :q close split


    FOLDING
  27. gricard revised this gist Jan 9, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -79,6 +79,7 @@ REGISTERS
    "+ OS clipboard
    "/ last search command
    ": last command
    "_ black hole register (/dev/null basically)

    INDENT
    > shift right
  28. gricard revised this gist Jan 9, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -75,10 +75,10 @@ REGISTERS
    "k___ ___ = command done on register k
    "kyy copy current line into register k
    "kp paste contents of register p after cursor
    "+yy copy line to OS clipboard
    "+p paste from OS clipboard
    :reg list registers

    "+ OS clipboard
    "/ last search command
    ": last command

    INDENT
    > shift right
  29. gricard revised this gist Jan 9, 2019. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -71,6 +71,15 @@ p paste after
    P paste before


    REGISTERS
    "k___ ___ = command done on register k
    "kyy copy current line into register k
    "kp paste contents of register p after cursor
    "+yy copy line to OS clipboard
    "+p paste from OS clipboard
    :reg list registers


    INDENT
    > shift right
    < shift left
  30. gricard revised this gist Jan 9, 2019. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions vim.txt
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,7 @@ M middle of screen
    L bottom of screen
    * go to next instance of word at cursor
    # go to prev instance of word at cursor
    % go to matching bracket


    GO
    @@ -42,6 +43,8 @@ EDITING
    i insert
    a append
    A append at end of line
    D delete to end of line
    C change to end of line
    r replace a charater
    x delete character
    O insert line above