commit 0c2220769d4af96dea58d60f4242313779a5fa89 Author: andrey1s Date: Sun Jan 2 13:15:06 2022 +0300 first commit diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cd04d85 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,33 @@ +[submodule "bundle/nerdtree"] + path = bundle/nerdtree + url = https://github.com/scrooloose/nerdtree.git +[submodule "bundle/bufexplorer"] + path = bundle/bufexplorer + url = https://github.com/vim-scripts/bufexplorer.zip.git +[submodule "bundle/syntastic"] + path = bundle/syntastic + url = https://github.com/vim-syntastic/syntastic.git +[submodule "bundle/vim-go"] + path = bundle/vim-go + url = https://github.com/fatih/vim-go.git +[submodule "bundle/supertab"] + path = bundle/supertab + url = https://github.com/ervandew/supertab.git +[submodule "bundle/vim-fugitive"] + path = bundle/vim-fugitive + url = https://github.com/tpope/vim-fugitive.git +[submodule "bundle/vim-gitgutter"] + path = bundle/vim-gitgutter + url = https://github.com/airblade/vim-gitgutter.git +[submodule "bundle/auto-pairs"] + path = bundle/auto-pairs + url = https://github.com/jiangmiao/auto-pairs.git +[submodule "bundle/vim-airline"] + path = bundle/vim-airline + url = https://github.com/vim-airline/vim-airline.git +[submodule "bundle/ultisnips"] + path = bundle/ultisnips + url = https://github.com/SirVer/ultisnips.git +[submodule "bundle/ctrlp.vim"] + path = bundle/ctrlp.vim + url = https://github.com/ctrlpvim/ctrlp.vim.git diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..0f3e816 --- /dev/null +++ b/.vimrc @@ -0,0 +1,173 @@ + +execute pathogen#infect() + +syntax on +set backup +set backupdir=~/.vim/backup/ +set dir=~/.vim/tmp + +set enc=utf-8 +set fenc=utf-8 +set termencoding=utf-8 +set nu +set backspace=indent,eol,start "http://vimhelp.appspot.com/options.txt.html#%27backspace%27 + +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set smartindent +set smarttab +set expandtab + +set t_Co=256 +colorscheme wombat256mod +"colorscheme foursee +let mapleader = "," + +filetype on +filetype plugin on + +map :cnext +map :cprevious +nnoremap a :cclose + +" map splits +nnoremap +nnoremap +nnoremap +nnoremap +"------------------------------------------------------------------------------ +" F4 - NERDTree +"------------------------------------------------------------------------------ +let g:NERDTreeDirArrowExpandable = '~' +let g:NERDTreeDirArrowCollapsible = '+' +let g:NERDTreeMinimalUI = 1 +let g:NERDTreeAutoDeleteBuffer = 1 +let g:NERDTreeStatusLine = -1 +let NERDTreeIgnore=['\.pyc', '\.swp', '\.git$', '\.hg', '\.svn', '\.bzr'] +let NERDTreeShowHidden=1 +hi Normal ctermbg=233 +hi Directory cterm=bold ctermfg=blue +nmap \e :NERDTreeToggle + +" NERDTress File highlighting +function! NERDTreeHighlightFile(extension, fg, bg) + exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg + exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' +endfunction + +call NERDTreeHighlightFile('ini', '143', 'none') +call NERDTreeHighlightFile('md', '184', 'none') +call NERDTreeHighlightFile('yml', '208', 'none') +call NERDTreeHighlightFile('log', '178', 'none') +call NERDTreeHighlightFile('txt', '192', 'none') + +call NERDTreeHighlightFile('png', '65', 'none') +call NERDTreeHighlightFile('jpg', '66', 'none') +call NERDTreeHighlightFile('ico', '73', 'none') + +call NERDTreeHighlightFile('php', '250', 'none') +call NERDTreeHighlightFile('js', '130', 'none') +call NERDTreeHighlightFile('json', '166', 'none') +call NERDTreeHighlightFile('html', '205', 'none') +call NERDTreeHighlightFile('twig', '204', 'none') +call NERDTreeHighlightFile('css', '210', 'none') +call NERDTreeHighlightFile('scss', '210', 'none') +call NERDTreeHighlightFile('xml', '170', 'none') + +call NERDTreeHighlightFile('gitignore', '240', 'none') +call NERDTreeHighlightFile('gitignore', '240', 'none') +call NERDTreeHighlightFile('gitkeep', '240', 'none') +call NERDTreeHighlightFile('htaccess', '240', 'none') +call NERDTreeHighlightFile('lock', '245', 'none') + +"let NERDTreeKeepTreeInNewTab=1 + +" show buffer list +nmap \b :BufExplorer + +" Shift-Tab - next buffer +nmap :bn +imap :bni +vmap :bni + +"------------------------------------------------------------------------------ +" syntastic +"------------------------------------------------------------------------------ +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +let g:syntastic_aggregate_errors = 1 +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 + +"------------------------------------------------------------------------------ +" SuperTab +"------------------------------------------------------------------------------ +let g:SuperTabDefaultCompletionType = "context" + +"------------------------------------------------------------------------------ +" Vim-go +"------------------------------------------------------------------------------ +let g:go_fmt_fail_silently = 1 +let g:go_fmt_command = "goimports" "Explicited the formater plugin (gofmt, goimports, goreturn...) +let g:go_auto_type_info = 1 + +" Show a list of interfaces which is implemented by the type under your cursor +au FileType go nmap s (go-implements) + +" Show type info for the word under your cursor +au FileType go nmap i (go-info) + +" Open the relevant Godoc for the word under the cursor +au FileType go nmap gd (go-doc) +au FileType go nmap gv (go-doc-vertical) + +" Open the Godoc in browser +au FileType go nmap gb (go-doc-browser) + +" Run/build/test/coverage +au FileType go nmap r (go-run) +au FileType go nmap b (go-build) +au FileType go nmap t (go-test) +au FileType go nmap c (go-coverage) + +" By default syntax-highlighting for Functions, Methods and Structs is disabled. +" Let's enable them! +let g:go_highlight_functions = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_structs = 1 + +nmap :TagbarToggle +let g:tagbar_type_go = { + \ 'ctagstype' : 'go', + \ 'kinds' : [ + \ 'p:package', + \ 'i:imports:1', + \ 'c:constants', + \ 'v:variables', + \ 't:types', + \ 'n:interfaces', + \ 'w:fields', + \ 'e:embedded', + \ 'm:methods', + \ 'r:constructor', + \ 'f:functions' + \ ], + \ 'sro' : '.', + \ 'kind2scope' : { + \ 't' : 'ctype', + \ 'n' : 'ntype' + \ }, + \ 'scope2kind' : { + \ 'ctype' : 't', + \ 'ntype' : 'n' + \ }, + \ 'ctagsbin' : 'gotags', + \ 'ctagsargs' : '-sort -silent' +\ } + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7e4c749 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 andrey + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9577b7b --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# dotvim + +deprecated move to https://gitoa.ru/andrey1s/dotvim + +## Installation + +```bash +cd ~ +git clone --recursive https://github.com/andrey1s/dotvim.git .vim +ln -s .vim/.vimrc +``` + +## Bundles + +- [NERDTree][1] +- [bufexplorer][2] +- [syntastic][3] +- [vim-go][4] +- [supertab][5] +- [fugitive][6] +- [gitgutter][7] +- [auto-pairs][8] +- [vim-airline][9] +- [ultisnips][10] +- [CtrlP][11] + +## Hotkeys + +`\e` - NERDTree +`\b` - Buffer list +`` - Next buffer + +## More Link +- https://vim-adventures.com +- http://vimcolors.com +- https://vimawesome.com +- http://vimcasts.org + +## More dotvim + - https://github.com/qbbr/dotvim + - https://github.com/kasyaar/vim_config + - https://github.com/statico/dotfiles + - https://github.com/farazdagi/vim-go-ide + - https://github.com/ik5/dotvim + +[1]: https://github.com/scrooloose/nerdtree "NERDTree" +[2]: https://github.com/vim-scripts/bufexplorer.zip "bufexplorer" +[3]: https://github.com/vim-syntastic/syntastic "Syntax checking hacks" +[4]: https://github.com/fatih/vim-go "Go development plugin for Vim" +[5]: https://github.com/ervandew/supertab "Perform all your vim insert mode completions with Tab" +[6]: https://github.com/tpope/vim-fugitive "A Git wrapper so awesome" +[7]: https://github.com/airblade/vim-gitgutter "shows a git diff in the gutter" +[8]: https://github.com/jiangmiao/auto-pairs "insert or delete brackets, parens, quotes in pair" +[9]: https://github.com/vim-airline/vim-airline "lean & mean status/tabline for vim that's light as air" +[10]: https://github.com/sirver/ultisnips "The ultimate snippet solution" +[11]: https://github.com/ctrlpvim/ctrlp.vim "Full path fuzzy file, buffer, mru, tag, ... finder for Vim." + diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim new file mode 100644 index 0000000..3582fbf --- /dev/null +++ b/autoload/pathogen.vim @@ -0,0 +1,264 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" Version: 2.4 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. +" +" The API is documented inline below. + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#interpose() or an absolute path to invoke pathogen#surround(). +" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all +" subdirectories inside "bundle" inside all directories in the runtime path. +" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}" +" on versions of Vim without native package support. +function! pathogen#infect(...) abort + if a:0 + let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")') + else + let paths = ['bundle/{}', 'pack/{}/start/{}'] + endif + if has('packages') + call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"') + endif + let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$' + for path in filter(copy(paths), 'v:val =~# static') + call pathogen#surround(path) + endfor + for path in filter(copy(paths), 'v:val !~# static') + if path =~# '^\%([$~\\/]\|\w:[\\/]\)' + call pathogen#surround(path) + else + call pathogen#interpose(path) + endif + endfor + call pathogen#cycle_filetype() + if pathogen#is_disabled($MYVIMRC) + return 'finish' + endif + return '' +endfunction + +" Split a path into a list. +function! pathogen#split(path) abort + if type(a:path) == type([]) | return a:path | endif + if empty(a:path) | return [] | endif + let split = split(a:path,'\\\@]','\\&','') + endif +endfunction + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) abort + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction + +" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/backup/.gitignore b/backup/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/backup/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/colors/foursee.vim b/colors/foursee.vim new file mode 100644 index 0000000..93900e3 --- /dev/null +++ b/colors/foursee.vim @@ -0,0 +1,83 @@ +" Maintainer: Victor Farazdagi +" Last Change: May 12, 2011 +" Base Theme: wombat + +set background=dark + +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name = "foursee" + + +" Vim >= 7.0 specific colors +if version >= 700 + hi CursorLine guibg=#2d2d2d + hi CursorColumn guibg=#2d2d2d + hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=bold + hi Pmenu guifg=#f6f3e8 guibg=#444444 + hi PmenuSel guifg=#000000 guibg=#cae682 + hi ColorColumn guibg=#2d2d2d +endif + +" Tabs/ViewPorts +hi TabLineSel guibg=#252525 guifg=#C8C77E gui=none +hi TabLine guibg=#444444 guifg=#868686 gui=none +hi TabLineFill guibg=#444444 guifg=#868686 gui=bold + +" General colors +hi Cursor guifg=NONE guibg=#656565 gui=none +hi Normal guifg=#f6f3e8 guibg=#242424 gui=none +hi NonText guifg=#808080 guibg=#303030 gui=none +hi LineNr guifg=#857b6f guibg=#000000 gui=none +hi SignColumn guifg=#857b6f guibg=#262526 gui=none +hi StatusLine guifg=#f6f3e8 guibg=#444444 gui=italic +hi StatusLineNC guifg=#857b6f guibg=#444444 gui=none +hi VertSplit guifg=#444444 guibg=#444444 gui=none +hi Folded guifg=#99968b guibg=#242424 gui=italic gui=none +hi Title guifg=#f6f3e8 guibg=NONE gui=bold +hi Visual guifg=#f6f3e8 guibg=#444444 gui=none +hi SpecialKey guifg=#808080 guibg=#343434 gui=none +hi Search guifg=#8ac6f2 guibg=#444444 +hi IncSearch guibg=#444444 guifg=#8ac6f2 + +" Syntax highlighting +hi Comment guifg=#99968b gui=italic +hi Todo guifg=#f4a460 guibg=NONE gui=italic +hi Constant guifg=#e5786d gui=none +hi String guifg=#95e454 gui=italic +hi Identifier guifg=#cae682 gui=none +hi Function guifg=#cae682 gui=none +hi Type guifg=#cae682 gui=none +hi Statement guifg=#8ac6f2 gui=none +hi Keyword guifg=#8ac6f2 gui=none +hi PreProc guifg=#e5786d gui=none +hi Number guifg=#e5786d gui=none +hi Special guifg=#e7f6da gui=none + +" Diff highlighting +hi DiffDelete guibg=#444444 guifg=#99968b +hi DiffAdd guibg=#2A5447 +hi DiffChange guibg=#53868B +hi DiffText guibg=#990909 gui=none + +" Git Syntax Highlighting +hi gitcommitSummary guifg=#8ac6f2 gui=none +hi gitcommitOnBranch guifg=#99968b gui=italic +hi gitcommitBranch guifg=#FFCC66 gui=none + +hi gitcommitHeader guifg=#C4C4C4 gui=none + +hi gitcommitDiscardedType guifg=#99968b gui=none +hi gitcommitSelectedType guifg=#99968b gui=none +hi gitcommitUnmergedType guifg=#99968b gui=none + +hi gitcommitUntrackedFile guifg=#FF6347 gui=none +hi gitcommitSelectedFile guifg=#CCFF66 gui=none +hi gitcommitUnmergedFile guifg=#FF6666 gui=none +hi gitcommitDiscardedFile guifg=#FF6347 gui=none + + diff --git a/colors/wombat256mod.vim b/colors/wombat256mod.vim new file mode 100644 index 0000000..1137eb8 --- /dev/null +++ b/colors/wombat256mod.vim @@ -0,0 +1,96 @@ +" Vim color file +" Original Maintainer: Lars H. Nielsen (dengmao@gmail.com) +" Last Change: 2010-07-23 +" +" Modified version of wombat for 256-color terminals by +" David Liang (bmdavll@gmail.com) +" based on version by +" Danila Bespalov (danila.bespalov@gmail.com) + +set background=dark + +if version > 580 + hi clear + if exists("syntax_on") + syntax reset + endif +endif + +let colors_name = "wombat256mod" + + +" General colors +hi Normal ctermfg=252 ctermbg=234 cterm=none guifg=#e3e0d7 guibg=#242424 gui=none +hi Cursor ctermfg=234 ctermbg=228 cterm=none guifg=#242424 guibg=#eae788 gui=none +hi Visual ctermfg=251 ctermbg=239 cterm=none guifg=#c3c6ca guibg=#554d4b gui=none +hi VisualNOS ctermfg=251 ctermbg=236 cterm=none guifg=#c3c6ca guibg=#303030 gui=none +hi Search ctermfg=177 ctermbg=241 cterm=none guifg=#d787ff guibg=#636066 gui=none +hi Folded ctermfg=103 ctermbg=237 cterm=none guifg=#a0a8b0 guibg=#3a4046 gui=none +hi Title ctermfg=230 cterm=bold guifg=#ffffd7 gui=bold +hi StatusLine ctermfg=230 ctermbg=238 cterm=none guifg=#ffffd7 guibg=#444444 gui=italic +hi VertSplit ctermfg=238 ctermbg=238 cterm=none guifg=#444444 guibg=#444444 gui=none +hi StatusLineNC ctermfg=241 ctermbg=238 cterm=none guifg=#857b6f guibg=#444444 gui=none +hi LineNr ctermfg=241 ctermbg=232 cterm=none guifg=#857b6f guibg=#080808 gui=none +hi SpecialKey ctermfg=241 ctermbg=235 cterm=none guifg=#626262 guibg=#2b2b2b gui=none +hi WarningMsg ctermfg=203 guifg=#ff5f55 +hi ErrorMsg ctermfg=196 ctermbg=236 cterm=bold guifg=#ff2026 guibg=#3a3a3a gui=bold + +" Vim >= 7.0 specific colors +if version >= 700 +hi CursorLine ctermbg=236 cterm=none guibg=#32322f +hi MatchParen ctermfg=228 ctermbg=101 cterm=bold guifg=#eae788 guibg=#857b6f gui=bold +hi Pmenu ctermfg=230 ctermbg=238 guifg=#ffffd7 guibg=#444444 +hi PmenuSel ctermfg=232 ctermbg=192 guifg=#080808 guibg=#cae982 +endif + +" Diff highlighting +hi DiffAdd ctermbg=17 guibg=#2a0d6a +hi DiffDelete ctermfg=234 ctermbg=60 cterm=none guifg=#242424 guibg=#3e3969 gui=none +hi DiffText ctermbg=53 cterm=none guibg=#73186e gui=none +hi DiffChange ctermbg=237 guibg=#382a37 + +"hi CursorIM +"hi Directory +"hi IncSearch +"hi Menu +"hi ModeMsg +"hi MoreMsg +"hi PmenuSbar +"hi PmenuThumb +"hi Question +"hi Scrollbar +"hi SignColumn +"hi SpellBad +"hi SpellCap +"hi SpellLocal +"hi SpellRare +"hi TabLine +"hi TabLineFill +"hi TabLineSel +"hi Tooltip +"hi User1 +"hi User9 +"hi WildMenu + + +" Syntax highlighting +hi Keyword ctermfg=111 cterm=none guifg=#88b8f6 gui=none +hi Statement ctermfg=111 cterm=none guifg=#88b8f6 gui=none +hi Constant ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Number ctermfg=173 cterm=none guifg=#e5786d gui=none +hi PreProc ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Function ctermfg=192 cterm=none guifg=#cae982 gui=none +hi Identifier ctermfg=192 cterm=none guifg=#cae982 gui=none +hi Type ctermfg=186 cterm=none guifg=#d4d987 gui=none +hi Special ctermfg=229 cterm=none guifg=#eadead gui=none +hi String ctermfg=113 cterm=none guifg=#95e454 gui=italic +hi Comment ctermfg=246 cterm=none guifg=#9c998e gui=italic +hi Todo ctermfg=101 cterm=none guifg=#857b6f gui=italic + + +" Links +hi! link FoldColumn Folded +hi! link CursorColumn CursorLine +hi! link NonText LineNr + +" vim:set ts=4 sw=4 noet: diff --git a/keymap.ru.md b/keymap.ru.md new file mode 100644 index 0000000..319531d --- /dev/null +++ b/keymap.ru.md @@ -0,0 +1,214 @@ +Файл настройки: ~/.vimrc +Можно редактировать файлы через сеть, например +:e ://user@host/path/to/the/file.txt +:Ex или :e ./ - файловый менеджер + +## Основы +``` +hjkl перемещение в разные стороны +i режим вставки +I добавление в начало строки +a режим добавления +A добавление в конец строки +o добавить строку сразу за текущей +O добавить строку перед текущей +R писать поверх имеющегося текста +u, :u[ndo] отмена предыдущего действия (undo) +CTR-R, :red[o] отмена отмены предыдущего действия (redo) +dd вырезать (удалить) строку +cc удалить и начать редактирование +yy копировать строку +p вставить из буфера обмена +d удалить n+1 строку +y скопировать n+1 строку +ESC перейти в режим просмотра +DEL удалить следующий символ +: перейти на строку #n +% перейти к парной скобке +:e **/filename.c редактировать файл (с поиском по имени) +:w [fname] записать изменения +:wa сохранить изменения во всех файлах +:q выйти из редактора +:q! выйти из редактора, не сохраняя изменения +:color выбор цветовой схемы. цветвые схемы: + /usr/local/share/vim/vim72/colors/*.vim +:pwd текущий каталог +:cd [path] перейти в другой каталог +:!команда выполнить команду - man, git, и так далее + стрелочками веерх и вниз можно автодополнять + команды и искать по истории +CTR+p или CTR+n автоматическое дополнение текста + (в режиме редактирования) +CTR+r,=, вставить выражение, например 5 * 2 - 3 + (в режиме редактирования) +CTR+u, CTR+d Page Up / Page Down +CTR+y, CTR+e Перемотка вверх/вниз без движения курсора +``` + +## Подсветка синтаксиса +``` +:syntax on включить подсветку +:syntax off выключить подсветку (по умолчанию) +``` +## Перенос строк +``` +:set wrap разрешить word wrap (по умолчанию) +:set nowrap запретить word wrap +``` +## Печать +``` +:ha[rdcopy] распечатать документ +:set printoptions=duplex:off отключить двустороннюю печать +``` + +## Сворачивание +``` +zc свернуть блок +zo развернуть блок +zM закрыть все блоки +zR открыть все блоки +za инвертирование +zf см :set foldmethod=manual +:set foldenable включить свoрачивание +:set foldmethod=syntax сворачивание на основе синтаксиса +:set foldmethod=indent сворачивание на основе отступов +:set foldmethod=manual выделяем участок с помощью v и говорим zf +:set foldmethod=marker сворачивание на основе маркеров в тексте +:set foldmarker=bigin,end задаем маркеры начала и конца блока +``` +## Маркеры +``` +ma установить локальный маркер a +mB установить глобальный маркер B +`c перейти к локальному маркеру c +`0 вернуться на позицию, на которой закончили + работу при закрытии vim +:marks просмотр маркеров +set viminfo='1000,f1 маркеры пишутся в ~/.viminfo, восстанавливаясь + при следующем запуске vim. маркер " хранит + последнюю позицию курсора в файле +``` +## Сессии +``` +mksession file.session сохранить текущую сессию +source file.session восстановить ранее сохраненную сессию +``` +## Макросы +``` +qa записать макрос с именем a +q в режиме записи макроса: закончить запись +@a выполнить макрос с именем a +@@ повторить последний макрос +``` + +## Регистры +``` +"ayy скопировать строку в регистр a +"bdd вырезать строку и поместить в регистр b +"С2d вырезать три строки и дописать в конец + регистра C +:reg [name1][name2][...] просмотреть содержимое регистров +``` + +## Выделение +``` +v + hjkl выделение текста +SHIFT + v выделить строку +CTR + v выделение прямоугольника +p вставить +y копировать +d удалить +gu к нижнему регистру +gU к верхнему регистру +``` +## Отступы +``` +[#]> сдвинуть выделенное вправо +[#]< сдвинуть выделенное влево +[#]>> сдвинуть строку вправо +[#]<< сдвинуть строку влево +set tabstop=# для табуляции используется # пробелов +set shiftwidth=# в командах отступа используется # пробелов +set [no]expandtab заменять ли табуляцию на соответствующее + число пробелов +``` +## Поиск и замена в файле +``` +/Выражение поиск выражения в файле +\cВыражение поиск без учета регистра +n следующее совпадение +N предыдущее совпадение +:%s/foo/bar/gi замена строк, см http://eax.me/regular-expr/ +``` +## Поиск по всему проекту +``` +:vimgrep /EXPR/ **/ .c поиск по регулярному выражению +:copen показать все найденные места +:close скрыть все найденные места +:cn переход к следующему результату +:cp переход к предыдущему результату +``` +## Нумерация строк +``` +:set number включить нумерацию строк +:set nonumber отключить нумерацию строк +``` +## Работа с вкладками (a.k.a табами) +``` +:tabnew [fname] создать таб +:tabs вывести список табов +:tabn следующий таб +:tabp предыдущий таб +gt перейти на таб #n +gt следующий таб +gT предыдущий таб +:tabm +1 переместить таб вперед на одну позицию +:tabm -1 переместить таб назад на одну позицию +:tabm 2 переместить таб на заданную позицию + (нумерация начинается с нуля) +``` +## Работа с окнами +``` +:split горизонтальное разбиение +:vsplit вертикальное разбиение +Ctr+W, затем + с закрыть окно + +- изменение высоты текущего окна + <> изменение ширины текущего окна + = установить равный размер окон + hjkl или стрелочки перемещение между окнами +``` +## Проверка орфографии +``` + mkdir -p ~/.vim/spell + cd ~/.vim/spell + wget http://ftp.vim.org/vim/runtime/spell/ru.koi8-r.sug + wget http://ftp.vim.org/vim/runtime/spell/ru.koi8-r.spl + wget http://ftp.vim.org/vim/runtime/spell/en.ascii.sug + wget http://ftp.vim.org/vim/runtime/spell/en.ascii.spl + +:set spell spelllang=ru,en включить проверку орфографии +:set nospell выключить проверку орфографии +]s следующее слово с ошибкой +[s предыдущее слово с ошибкой +z= замена слова на альтернативу из списка +zg good word +zw wrong word +zG ignore word +``` +## Работа с кодировкой +``` +e ++enc=<имя кодировки> Редактирование файла в ??? кодировке +w ++enc=<имя кодировки> Сохранить файл в новой кодировке +set fileencodings=utf-8,koi8-r Список автоматически определяемых + кодировок в порядке убывания + приоритета +``` +## Другое +``` +:set [no]wildmenu При авто-дополнении в командной строке над + ней выводятся возможные варианты +:set list Отображать табуляцию и переводы строк +q: История команд +. Повторение последней команды +``` diff --git a/tmp/.gitignore b/tmp/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/tmp/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore