Skip to content

Instantly share code, notes, and snippets.

@MikeLarned
Last active March 23, 2016 19:15
Show Gist options
  • Save MikeLarned/705856066967eefa6d90 to your computer and use it in GitHub Desktop.
Save MikeLarned/705856066967eefa6d90 to your computer and use it in GitHub Desktop.
VIM Commands
#http://vim.wikia.com/wiki/Open_vimrc_file
#http://www.viemu.com/a-why-vi-vim.html - why vim
git clean -xfd -e ConnectionStrings.local.config
#Plugins
https://github.com/maksimr/vim-jsbeautify
https://www.digitalocean.com/community/tutorials/how-to-use-vundle-to-manage-vim-plugins-on-a-linux-vps
#Basic Commands
h - left
j - down
k - up
l - right
x - delete under cursor
dd - delete line
u - undo
CTRL-R - redo
o - open a line below cursor
O - open line before cursor
ZZ - save and exit
" Cut, Copy, Paste
d - cut
y - copy
P - paste before cursor
p - paste after cursor
# Moving Around
w - word (3w move 3 words)
b - moves backward to the start of the previous word
e - moves to end of next word
ge - moves to previous end of a word.
$ - move to end of line
G - eof
gg - bof
# Acting on Lines
:p - act on lines containing pattern
:p/#/d - act on lines with # issue d command
> - indent
5>> - indent five lines
Vjj> - mark a block of lines and indent
>% - from a starting curly brace - indet lines in curly braces
# Highlight to Certain Characters
#Pipe Console to MVIM
xmlline --format test.xml | mvim -
:echo $HOME
:e $MYVIMRC
:e. - home directory
/ - search
? - search back
n - next
p - previous
N - reverse next
A - end insert
I - begin insert
bd - buffer delete
bw - buffer write close
- up
buffers - in memory tabs
# - current buffer
# Mac Show Hidden Files
# directorydefaults write com.apple.finder AppleShowAllFiles YES
" - register
+ - clipboard
y - yank
" - yank into a register
a
y
"*y - yank into selection
"*p - paste the selection
v3j"+y - copy three lines in the system clipboard
v - visual block
f - find ex: fd - find the next d and put the cursor on d
t - find one character before ex: td - find next d put cursor before d
yit - yank inner tags
:44 - Go to line 44
G - go to the last line
c - change
i - inner "
" NerdTree
m - Filesytem menu
ma - add a childnode
au VimEnter * NERDTree - automatically open NERDTree
c - change current root node to tree
r - refresh
u - move back one level in directory tree
x - close directory tree you are in
shift-i - show hidden file
" Vundle Setup
git clone https://github.com/gmarik/Vundle.vim.git ~/vimfiles/bundle/vundle.vim
# Vim Setup
Locating your current vimrc file used by the editor. :version will show you the system
vimrc file "$VIM/vimrc".
# Vim Dropbox Windows
mklink C:\Users\mlarn\_vimrc C:\Users\mlarn\Dropbox\vimfiles\.vimrc
mklink C:\Users\mlarn\.vimrc.bundles C:\Users\mlarn\Dropbox\vimfiles\.vimrc.bundles
mklink C:\Users\mlarn\.vim C:\Users\mlarn\Dropbox\vimfiles\.vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment