Jump between modificationsg;
- backwardg,
- forward`.
- to last<Ctrl>i
- backward through files<Ctrl>o
- forward through files
Editingct
+ character - delete till character with insert modedi
+ character - delete between charactes (quotes, brackets)cw
- replace word with insert modexp
- swap two characters~
- invert letter case (A->a, a->A)viw~
- flip case word under cursor
u
- undo<Ctrl>r
- redoS
- modify line
Find word/
+ pattern - by pattern/\c
+ pattern - case insensitivity*
- under cursor forwards#
- under cursor backwards<ctrl>r + 0
- paste yanked text in patterns input
Find characterf
+ character in line;
- next character,
- prev character
Copy and pasteyy
- copy linep
- paste lineVp
- replace line from yankyiw
- copy inner wordviwp
- replace word from yank"ayy
- copy line to register a"Ayy
- appned another line to register a"ap
- paste register a:.w !pbcopy
- copy current line to clipboard (Mac OS X)ggVG
and :w !pbcopy
- copy whole file to clipboard (Mac OS X)r !pbpaste
- paste from clipboard (Mac OS X)
Info:ls
- show buffers:f
- show current file info:pwd
- show current directory:ju
- show list of modifications:reg
- display contents of all registers
Open files:e
+ path - open one file:E
- file explorer
Open recent files
:bro ol
- open recent files listq
- open prompt terminal and type file numberFix indent=
- on line=%
- in the current bracesgg=G
- global file
Delete Window carriage return character ^M:%s/<Ctrl>v<Ctrl>m//g
Misc>>
- indent right line by tab<<
- indent left line by tab.
- repeat last command:%s= *$==
- delete end of line blanks
Visaul modev
- default mode<Ctrl>v
- vertical mode<Shift>v
- select by lines
View tabs, spaces...
:set list "show
:set nolist "hide
.vimrc
function! Tabs()
set softtabstop=8
set shiftwidth=8
set tabstop=8
set noexpandtab
endfunction
function! Spaces()
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab
endfunction
:execute Spaces()
and :execute Tabs()
Tiny search highlight
highlight Search ctermfg=Grey ctermbg=NONE cterm=NONE
UTF
set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8
Install Editorconfig
mkdir -p ~/.vim/autoload
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo "
call plug#begin('~/.vim/plugged')
Plug 'editorconfig/editorconfig-vim'
call plug#end()
" > ~/.vimrc
vim +PlugInstall editorconfig-vim +qall