Skip to content

Instantly share code, notes, and snippets.

@joesepi
Last active August 29, 2015 14:06
Show Gist options
  • Save joesepi/43fd990f983ca4b675bd to your computer and use it in GitHub Desktop.
Save joesepi/43fd990f983ca4b675bd to your computer and use it in GitHub Desktop.
Vim tips

so instead of going i to go to insert mode then moving left or right or up and down
a to insert after your cursor
I to insert at beginning of line
A to insert at end of line
o to insert a new line after your current line
O to insert a new line above your current line

:help

:retab

To shift left one line: <<
To shift right one line `>>

use the number you want to indent as a prefix to the visual block command
V to start visual block
select the lines
then 3>

12j for example will go 12 lines down
YOu can motion suffix a bunch of commands
like d$ to delete to end of line

so vib reads "visual mode select inner block of ( )"
that will show you what the block operation would be
then you can do shit like
dib to delete inner block
cib to change inner block (delete, go to start, enter insert mode)
cib is one of my most used commands.
Then there is B for "block of { }"

Also if you want to not think about indentation anymore and just go "Vim take the wheel"
select the visual block
then =

% shows block brackets and so, =% will appropriately indent the entire block

to search
:lv (location/vimgrep) and your results are in the location window :lw

in nerdTree: r over the top level directory
Or create the file in nerd tree with ma
Or create the file in vim with :new and saving it
Or create the file in vim with `:e file/path/name.ext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment