You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
VIM Cheat Sheet
Setup
Install vim-plug:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
clone repo and
ln -s /path/to/cloned/repo/.vimrc ~/.vimrc
then open vim and
:PlugInstall
then
source ~/.vimrc
or reopen vim
Split
<ctrl-w>sor:spsplit with line running horizontally<ctrl-w>vor:vspsplit with line running verticall<ctrl-w>arrowmove to pane:qclose tab:tab splitmove split to new tab
Buffers
:b[num]use buffer [num]:bnnext buffer:[num]bdunload buffer [num]
Tabs
gtgo to next tabgTgo to next tab[num]gtgo to tab [num]:tabnewopen new tab:tabcclose tab:tabeedit file in new tab
Auto Complete
<ctrl-x><ctrl-o>omni completion<ctrl-y>,emmet<ctrl-]>abbreviations<ctrl-n>word completion
Navigation
<ctrl-f>page down<ctrl-b>page up
Editing
dwdelete forward to end of worddbdelete backward to beginning of wordxdelete current charXdelete previous char
Formatting
=auto indent selection/linegg=Gauto indent entire bufferJjoin current line with next line
Comments
\cc- Nerdcommentor<ctrl-v>then select block. Then<shift-i>to enter insert. Enter text and hitEsc
Selection
<shift-V>visual-line<ctrl-v>visual block<option-click>visual block, highlight from start to click point
Commands
:%s/\s\+$//etrim ending whitespace:%retab!convert spaces to tabsNERDTreeopen up nerd tree file explorer
NERDTree
rrefresh tree