Skip to content

Instantly share code, notes, and snippets.

@cameck
Last active October 3, 2018 15:46
Show Gist options
  • Save cameck/23db323fbd21744e653ad936f2d0c893 to your computer and use it in GitHub Desktop.
Save cameck/23db323fbd21744e653ad936f2d0c893 to your computer and use it in GitHub Desktop.

Revisions

  1. cameck revised this gist Oct 3, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,10 @@
    - Forward multiple letters: `5l`
    - Back multiple letters: `5h`
    - Forward to the next 'y': `fy` (case sensitive)
    - `Ctrl-d` move half-page down
    - `Ctrl-u` move half-page up
    - `Ctrl-b` page up
    - `Ctrl-f` page down


    ### Editing
  2. cameck revised this gist Oct 3, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -90,6 +90,7 @@
    - Open file in vertical pane: `conrol + v`
    #### NERDTree Plugin
    - Open file in vertical pane: `s`
    - Open file and don't move focus it (preview it): `go`


    ### Search
  3. cameck revised this gist Oct 2, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -200,4 +200,8 @@ touch .vimrc; mkdir .vim
    ##### Seeing is Believing Plugin
    - Annotate every line: `,b`
    - Annotate marked lines: `,n`
    - Clean up annotations: `,c`
    - Clean up annotations: `,c`
    #### Node Code
    ##### Vim-Node
    - Go to file path: `gf`
    - Look for keyword in required files: `[I`
  4. cameck revised this gist Oct 1, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@
    - Insert at the end of the line: `A`
    - Append at end of word: `ea`
    - Insert at beginning of word: `bi`
    - Copy to system clipboard (on mac os): `v`, `:w !pbcopy`
    - Copy whole line to system clipboard (on mac os): `"*yy`


    ### Deleting
  5. cameck revised this gist Oct 1, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -86,6 +86,10 @@
    - Switch from left to right: control + w + l
    - Switch from bottom to top: control + w + j
    - Switch from right to left: control + w + h
    #### Ctrlp plugin
    - Open file in vertical pane: `conrol + v`
    #### NERDTree Plugin
    - Open file in vertical pane: `s`


    ### Search
  6. cameck revised this gist Sep 28, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -121,6 +121,7 @@
    - ctrl + wv - Split windows vertically
    - `:qa` close all open vim windows
    - `:wqa` save work in all tabs and quit
    - `:ls` show all files in buffer (open)

    ### Indenting

  7. cameck revised this gist Sep 27, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -184,6 +184,8 @@ touch .vimrc; mkdir .vim

    ### Using grep for searching all files
    - `grep '<seach_term>' **/*.<file_type>` use `-i` for case insensitive search
    #### Use within VIM
    - `:grep -ir '<search_term>' .`. This willl open the first matched pattern, to browse through them use `:cn` and `:cp`. To see the quick list use `:copen` and `:cclose` to close the quickfix list.

    ### Running Javascript without saving file
    - `w !node`
  8. cameck revised this gist Sep 26, 2018. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -183,4 +183,14 @@ touch .vimrc; mkdir .vim
    - `3@r` the number can change for how many times you want to repeat

    ### Using grep for searching all files
    - `grep '<seach_term>' **/*.<file_type>` use `-i` for case insensitive search
    - `grep '<seach_term>' **/*.<file_type>` use `-i` for case insensitive search

    ### Running Javascript without saving file
    - `w !node`

    ### Personal settings
    #### Ruby Code
    ##### Seeing is Believing Plugin
    - Annotate every line: `,b`
    - Annotate marked lines: `,n`
    - Clean up annotations: `,c`
  9. cameck revised this gist Sep 26, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -119,7 +119,8 @@
    - ctrl + ww - switch between windows
    - ctrl + wq - Quit a window
    - ctrl + wv - Split windows vertically

    - `:qa` close all open vim windows
    - `:wqa` save work in all tabs and quit

    ### Indenting

  10. cameck revised this gist Sep 26, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@
    - Insert at the end of the line: `A`
    - Append at end of word: `ea`
    - Insert at beginning of word: `bi`
    - Copy to system clipboard: `v`, `:w !pbcopy`
    - Copy to system clipboard (on mac os): `v`, `:w !pbcopy`


    ### Deleting
  11. cameck revised this gist Sep 26, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -34,6 +34,7 @@
    - Insert at the end of the line: `A`
    - Append at end of word: `ea`
    - Insert at beginning of word: `bi`
    - Copy to system clipboard: `v`, `:w !pbcopy`


    ### Deleting
  12. cameck revised this gist Sep 25, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,8 @@
    - Paste from System Clipboard: `"+P`
    - Change multiple words: `5cw`
    - Insert at the end of the line: `A`
    - Append at end of word: `ea`
    - Insert at beginning of word: `bi`


    ### Deleting
  13. cameck revised this gist Sep 25, 2018. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -176,4 +176,7 @@ touch .vimrc; mkdir .vim
    - `qr`
    - Do the actions you want repeated
    - hit escape and then `q`
    - `3@r` the number can change for how many times you want to repeat
    - `3@r` the number can change for how many times you want to repeat

    ### Using grep for searching all files
    - `grep '<seach_term>' **/*.<file_type>` use `-i` for case insensitive search
  14. cameck revised this gist Sep 25, 2018. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -163,7 +163,7 @@ touch .vimrc; mkdir .vim
    - `c + i + t` will remove the code between HTML tags, such as: `<div>Some content</div>`
    - `c + i + }` will remove the code inside of a JavaScript function

    ### Running terminal commands
    ### Running terminal commands (without closing vim completely)
    - `:! <your command here>`

    ### Suspend File (close file without saving and without losing your work)
    @@ -172,3 +172,8 @@ touch .vimrc; mkdir .vim
    - open job with `fg`
    - open specific job with `fg %<specific job number>`

    ### Running Macros
    - `qr`
    - Do the actions you want repeated
    - hit escape and then `q`
    - `3@r` the number can change for how many times you want to repeat
  15. cameck revised this gist Sep 21, 2018. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -164,4 +164,11 @@ touch .vimrc; mkdir .vim
    - `c + i + }` will remove the code inside of a JavaScript function

    ### Running terminal commands
    - `:! <your command here>`
    - `:! <your command here>`

    ### Suspend File (close file without saving and without losing your work)
    - `<ctrl> + z`
    - View "open files" with `jobs`
    - open job with `fg`
    - open specific job with `fg %<specific job number>`

  16. cameck revised this gist Sep 21, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -121,8 +121,8 @@
    ### Indenting

    - Fix indenting when pasting: set paste in .vimrc file
    - Indenting: visual mode + > or <
    - Repeat indenting: .
    - Indenting: visual mode `+ >` or `<`
    - Repeat indenting: `.` (The period repeats the last action done)


    ## Commenting/Uncommenting
  17. cameck revised this gist Sep 21, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -162,3 +162,6 @@ touch .vimrc; mkdir .vim

    - `c + i + t` will remove the code between HTML tags, such as: `<div>Some content</div>`
    - `c + i + }` will remove the code inside of a JavaScript function

    ### Running terminal commands
    - `:! <your command here>`
  18. cameck revised this gist Sep 12, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,7 @@
    - Inserting text at the start of the line: `I`
    - Insert at the end of the line: `shift + a`
    - Copy entire line: `yy or Y`
    - Copy word: `yw`
    - Paste copied line: `p`
    - Paste from System Clipboard: `"+P`
    - Change multiple words: `5cw`
    @@ -41,6 +42,8 @@
    - d0 will delete from current backward to beginning of line
    - dw deletes current to end of current word (including trailing space)
    - db deletes current to beginning of current word
    - `dt#{insert_character}` will delete up to but not including the character
    - `df#{insert_character}` will delete up to and including the character
    - Delete current line: dd
    - Join the line below: shift + j
    - Delete entire word: cw
  19. cameck revised this gist Sep 10, 2018. No changes.
  20. cameck revised this gist Sep 10, 2018. 1 changed file with 25 additions and 25 deletions.
    50 changes: 25 additions & 25 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -2,35 +2,35 @@

    ### Navigation

    - End of the file: shift + g
    - Next line: j
    - Go down a defined number of lines: number + j
    - Skip to next word: w
    - Skip back a word: b
    - Skip to next section: W
    - Skip back to previous section: B
    - Go to end of the line: $
    - Go to beginning of the line: 0
    - Go to top of the screen: shift + h
    - Go to bottom of the screen: shift + l
    - Forward multiple words: 5w
    - Forward multiple letters: 5l
    - Back multiple letters: 5h
    - Forward to the next 'y': fy (case sensitive)
    - End of the file: `shift + g`
    - Next line: `j`
    - Go down a defined number of lines: `number + j`
    - Skip to next word: `w`
    - Skip back a word: `b`
    - Skip to next section: `W`
    - Skip back to previous section: `B`
    - Go to end of the line: `$`
    - Go to beginning of the line: `0`
    - Go to top of the screen: `shift + h`
    - Go to bottom of the screen: `shift + l`
    - Forward multiple words: `5w`
    - Forward multiple letters: `5l`
    - Back multiple letters: `5h`
    - Forward to the next 'y': `fy` (case sensitive)


    ### Editing

    - Undo: u
    - Redo: ctrl + r
    - Inserting text where the cursor is: i
    - Inserting text at the start of the line: I
    - Insert at the end of the line: shift + a
    - Copy entire line: yy or Y
    - Paste copied line: p
    - Paste from System Clipboard: "+P
    - Change multiple words: 5cw
    - Insert at the end of the line: A
    - Undo: `u`
    - Redo: `ctrl + r`
    - Inserting text where the cursor is: `i`
    - Inserting text at the start of the line: `I`
    - Insert at the end of the line: `shift + a`
    - Copy entire line: `yy or Y`
    - Paste copied line: `p`
    - Paste from System Clipboard: `"+P`
    - Change multiple words: `5cw`
    - Insert at the end of the line: `A`


    ### Deleting
  21. cameck revised this gist Sep 10, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,7 @@
    - Insert at the end of the line: shift + a
    - Copy entire line: yy or Y
    - Paste copied line: p
    - Paste from System Clipboard: "+P
    - Change multiple words: 5cw
    - Insert at the end of the line: A

  22. cameck created this gist Sep 10, 2018.
    160 changes: 160 additions & 0 deletions vim-cheats.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,160 @@
    ## Vim Cheat Sheet

    ### Navigation

    - End of the file: shift + g
    - Next line: j
    - Go down a defined number of lines: number + j
    - Skip to next word: w
    - Skip back a word: b
    - Skip to next section: W
    - Skip back to previous section: B
    - Go to end of the line: $
    - Go to beginning of the line: 0
    - Go to top of the screen: shift + h
    - Go to bottom of the screen: shift + l
    - Forward multiple words: 5w
    - Forward multiple letters: 5l
    - Back multiple letters: 5h
    - Forward to the next 'y': fy (case sensitive)


    ### Editing

    - Undo: u
    - Redo: ctrl + r
    - Inserting text where the cursor is: i
    - Inserting text at the start of the line: I
    - Insert at the end of the line: shift + a
    - Copy entire line: yy or Y
    - Paste copied line: p
    - Change multiple words: 5cw
    - Insert at the end of the line: A


    ### Deleting

    - d<leftArrow> will delete current and left character
    - d$ will delete from current position to end of line
    - d^ will delete from current backward to first non-white-space character
    - d0 will delete from current backward to beginning of line
    - dw deletes current to end of current word (including trailing space)
    - db deletes current to beginning of current word
    - Delete current line: dd
    - Join the line below: shift + j
    - Delete entire word: cw
    - Delete to the end of the line: shift + C
    - Delete multiple lines: d + number of lines + enter
    - Delete from current position to a specific line number: d<line number>G
    - Deleting all items in a file that start with a pattern: :g/< search term>/d
    - Deleting all lines that are empty or that contain only whitespace: :g/^\s*$/d


    ### Selecting

    - Select the entire line: V
    - Select a range of text: v
    - Select a column: control + v
    - Reselect a block: gv
    - Select all: ggVG


    ### Find and Replace

    - %s/pattern/text to replace


    ### Saving

    - Save the file: :w
    - Save the file and quit: :wq
    - Quit without saving: :q!


    ### Views

    - Use horizontal split: :sp filename
    - Use vertical split: :vsp filename
    - Switch from top to bottom: control + w + j
    - Switch from left to right: control + w + l
    - Switch from bottom to top: control + w + j
    - Switch from right to left: control + w + h


    ### Search

    - While on current line: f + <queried item>
    - Search for word in file: /word + enter
    - Find next search result: n
    - Search backwards: N
    - Go to first result: ggn
    - Go to last result: GN
    - To remove search highlighting: :noh


    ### Modes

    - Normal
    - Insert
    - Visual
    - Replace
    - Command Line


    ### Multiple Files

    - :e filename - Edit a file in a new buffer
    - :bnext (or :bn) - go to next buffer
    - :bprev (of :bp) - go to previous buffer
    - :bd - delete a buffer (close a file)
    - :sp filename - Open a file in a new buffer and split window
    - ctrl + ws - Split windows
    - ctrl + ww - switch between windows
    - ctrl + wq - Quit a window
    - ctrl + wv - Split windows vertically


    ### Indenting

    - Fix indenting when pasting: set paste in .vimrc file
    - Indenting: visual mode + > or <
    - Repeat indenting: .


    ## Commenting/Uncommenting

    - Comment: visual block select with CTRL-V then I# (insert # in the begining)
    - Uncomment: visual block select with CTRL-V then X (delete the first symbol on the line)


    ### Visual Mode

    - Changing multiple lines of text: control + v + shift + i + action + esc
    - Select elements in paragraph: v + / + content


    ### Display settings

    - Turning on line numbers: :set nu
    - Turning on syntax highlighting: :syntax on


    ### Reseting Vim Settings

    ```
    cd
    mv .vimrc .vimrc-old
    mv .vim .vim-old
    touch .vimrc; mkdir .vim
    ```

    ### Help

    - To get help: :h <topic>
    - To exit help: :bd


    ### Removing blocks of text in code files

    - `c + i + t` will remove the code between HTML tags, such as: `<div>Some content</div>`
    - `c + i + }` will remove the code inside of a JavaScript function