VIM FAQ
TBD ASAP! (chngd 2025-06-24)
- VIM in shorts:
- swap two character:
xp - join two strings:
J(normal) or:joincmd - redo:
Ctrl-Ror4Ctrl-Retc - delete in quotes:
di" - delete with quotes:
da" - copy visual to clipboard:
V+"+y - paste clipboard:
:put + - run current file:
:!% - insert CLIPBOARD:
:put + - paste mode (special):
set paste - Split windows ops:
:spsplit window:vspvertical split:sp filenameopen a file in new window- Split windows shrtcts:
ctrl-w wmovectrl-w jmove downctrl-w kmove upctrl-w hmove leftctrl-w lmove rightctrl-w =make equalctrl-w qclose
src on reddit
Run current file (not possible to set by modeline, use a lot while script debugging):
:set makeprg=bash\ %
:set autowrite
:make
PS: .vimrc (grep -v ^\" .vimrc | awk 'NF')
set nocompatible
filetype on
filetype plugin on
filetype indent on
syntax on
set number
set cursorline
set cursorcolumn
set shiftwidth=4
set tabstop=4
set expandtab
set nobackup
set scrolloff=10
set nowrap
set incsearch
set ignorecase
set smartcase
set showcmd
set showmode
set showmatch
set hlsearch
set history=1000
set wildmenu
set wildmode=list:longest
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
set statusline=
set statusline+=\ %F\ %M\ %Y\ %R
set statusline+=%=
set statusline+=\ ascii:\ %b\ hex:\ 0x%B\ row:\ %l\ col:\ %c\ percent:\ %p%%
set laststatus=2
:colorscheme evening
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
set langmap=йцукенгшщзхъфывапролджэячсмитьбю;qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.,ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<>
set mouse=a
set spell spelllang=ru_ru
set wrap linebreak
au BufNewFile,BufFilePre,BufRead *.md set filetype=markdown
function! AppendModeline()
let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :",
\ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
call append(line("$"), l:modeline)
endfunction
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
# Last update: 2025-06-24
# Version: 1.1
# changed:
# - 2025-06-24 windows ops
# fixed:
# TODO: typos