andrey1s
3 years ago
commit
0c2220769d
10 changed files with 945 additions and 0 deletions
@ -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 |
@ -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 <C-n> :cnext<CR> |
||||
|
map <C-m> :cprevious<CR> |
||||
|
nnoremap <leader>a :cclose<CR> |
||||
|
|
||||
|
" map splits |
||||
|
nnoremap <C-J> <C-W><C-J> |
||||
|
nnoremap <C-K> <C-W><C-K> |
||||
|
nnoremap <C-L> <C-W><C-L> |
||||
|
nnoremap <C-H> <C-W><C-H> |
||||
|
"------------------------------------------------------------------------------ |
||||
|
" 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<CR> |
||||
|
|
||||
|
" 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 <Esc>:BufExplorer<cr> |
||||
|
|
||||
|
" Shift-Tab - next buffer |
||||
|
nmap <S-Tab> :bn<cr> |
||||
|
imap <S-Tab> <esc>:bn<cr>i |
||||
|
vmap <S-Tab> <esc>:bn<cr>i |
||||
|
|
||||
|
"------------------------------------------------------------------------------ |
||||
|
" 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 <Leader>s <Plug>(go-implements) |
||||
|
|
||||
|
" Show type info for the word under your cursor |
||||
|
au FileType go nmap <Leader>i <Plug>(go-info) |
||||
|
|
||||
|
" Open the relevant Godoc for the word under the cursor |
||||
|
au FileType go nmap <Leader>gd <Plug>(go-doc) |
||||
|
au FileType go nmap <Leader>gv <Plug>(go-doc-vertical) |
||||
|
|
||||
|
" Open the Godoc in browser |
||||
|
au FileType go nmap <Leader>gb <Plug>(go-doc-browser) |
||||
|
|
||||
|
" Run/build/test/coverage |
||||
|
au FileType go nmap <leader>r <Plug>(go-run) |
||||
|
au FileType go nmap <leader>b <Plug>(go-build) |
||||
|
au FileType go nmap <leader>t <Plug>(go-test) |
||||
|
au FileType go nmap <leader>c <Plug>(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 <F8> :TagbarToggle<CR> |
||||
|
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' |
||||
|
\ } |
||||
|
|
||||
|
|
@ -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. |
@ -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 |
||||
|
`<Shift-Tab>` - 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." |
||||
|
|
@ -0,0 +1,264 @@ |
|||||
|
" pathogen.vim - path option manipulation |
||||
|
" Maintainer: Tim Pope <http://tpo.pe/> |
||||
|
" 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,'\\\@<!\%(\\\\\)*\zs,') |
||||
|
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")') |
||||
|
endfunction |
||||
|
|
||||
|
" Convert a list to a path. |
||||
|
function! pathogen#join(...) abort |
||||
|
if type(a:1) == type(1) && a:1 |
||||
|
let i = 1 |
||||
|
let space = ' ' |
||||
|
else |
||||
|
let i = 0 |
||||
|
let space = '' |
||||
|
endif |
||||
|
let path = "" |
||||
|
while i < a:0 |
||||
|
if type(a:000[i]) == type([]) |
||||
|
let list = a:000[i] |
||||
|
let j = 0 |
||||
|
while j < len(list) |
||||
|
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g') |
||||
|
let path .= ',' . escaped |
||||
|
let j += 1 |
||||
|
endwhile |
||||
|
else |
||||
|
let path .= "," . a:000[i] |
||||
|
endif |
||||
|
let i += 1 |
||||
|
endwhile |
||||
|
return substitute(path,'^,','','') |
||||
|
endfunction |
||||
|
|
||||
|
" Convert a list to a path with escaped spaces for 'path', 'tag', etc. |
||||
|
function! pathogen#legacyjoin(...) abort |
||||
|
return call('pathogen#join',[1] + a:000) |
||||
|
endfunction |
||||
|
|
||||
|
" Turn filetype detection off and back on again if it was already enabled. |
||||
|
function! pathogen#cycle_filetype() abort |
||||
|
if exists('g:did_load_filetypes') |
||||
|
filetype off |
||||
|
filetype on |
||||
|
endif |
||||
|
endfunction |
||||
|
|
||||
|
" Check if a bundle is disabled. A bundle is considered disabled if its |
||||
|
" basename or full name is included in the list g:pathogen_blacklist or the |
||||
|
" comma delimited environment variable $VIMBLACKLIST. |
||||
|
function! pathogen#is_disabled(path) abort |
||||
|
if a:path =~# '\~$' |
||||
|
return 1 |
||||
|
endif |
||||
|
let sep = pathogen#slash() |
||||
|
let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST) |
||||
|
if !empty(blacklist) |
||||
|
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")') |
||||
|
endif |
||||
|
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 |
||||
|
endfunction |
||||
|
|
||||
|
" Prepend the given directory to the runtime path and append its corresponding |
||||
|
" after directory. Curly braces are expanded with pathogen#expand(). |
||||
|
function! pathogen#surround(path) abort |
||||
|
let sep = pathogen#slash() |
||||
|
let rtp = pathogen#split(&rtp) |
||||
|
let path = fnamemodify(a:path, ':s?[\\/]\=$??') |
||||
|
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)') |
||||
|
let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])') |
||||
|
call filter(rtp, 'index(before + after, v:val) == -1') |
||||
|
let &rtp = pathogen#join(before, rtp, after) |
||||
|
return &rtp |
||||
|
endfunction |
||||
|
|
||||
|
" For each directory in the runtime path, add a second entry with the given |
||||
|
" argument appended. Curly braces are expanded with pathogen#expand(). |
||||
|
function! pathogen#interpose(name) abort |
||||
|
let sep = pathogen#slash() |
||||
|
let name = a:name |
||||
|
if has_key(s:done_bundles, name) |
||||
|
return "" |
||||
|
endif |
||||
|
let s:done_bundles[name] = 1 |
||||
|
let list = [] |
||||
|
for dir in pathogen#split(&rtp) |
||||
|
if dir =~# '\<after$' |
||||
|
let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir] |
||||
|
else |
||||
|
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)') |
||||
|
endif |
||||
|
endfor |
||||
|
let &rtp = pathogen#join(pathogen#uniq(list)) |
||||
|
return 1 |
||||
|
endfunction |
||||
|
|
||||
|
let s:done_bundles = {} |
||||
|
|
||||
|
" Invoke :helptags on all non-$VIM doc directories in runtimepath. |
||||
|
function! pathogen#helptags() abort |
||||
|
let sep = pathogen#slash() |
||||
|
for glob in pathogen#split(&rtp) |
||||
|
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep') |
||||
|
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags')) |
||||
|
silent! execute 'helptags' pathogen#fnameescape(dir) |
||||
|
endif |
||||
|
endfor |
||||
|
endfor |
||||
|
endfunction |
||||
|
|
||||
|
command! -bar Helptags :call pathogen#helptags() |
||||
|
|
||||
|
" Execute the given command. This is basically a backdoor for --remote-expr. |
||||
|
function! pathogen#execute(...) abort |
||||
|
for command in a:000 |
||||
|
execute command |
||||
|
endfor |
||||
|
return '' |
||||
|
endfunction |
||||
|
|
||||
|
" Section: Unofficial |
||||
|
|
||||
|
function! pathogen#is_absolute(path) abort |
||||
|
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]') |
||||
|
endfunction |
||||
|
|
||||
|
" Given a string, returns all possible permutations of comma delimited braced |
||||
|
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields |
||||
|
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard |
||||
|
" and globbed. Actual globs are preserved. |
||||
|
function! pathogen#expand(pattern, ...) abort |
||||
|
let after = a:0 ? a:1 : '' |
||||
|
let pattern = substitute(a:pattern, '^[~$][^\/]*', '\=expand(submatch(0))', '') |
||||
|
if pattern =~# '{[^{}]\+}' |
||||
|
let [pre, pat, post] = split(substitute(pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1) |
||||
|
let found = map(split(pat, ',', 1), 'pre.v:val.post') |
||||
|
let results = [] |
||||
|
for pattern in found |
||||
|
call extend(results, pathogen#expand(pattern)) |
||||
|
endfor |
||||
|
elseif pattern =~# '{}' |
||||
|
let pat = matchstr(pattern, '^.*{}[^*]*\%($\|[\\/]\)') |
||||
|
let post = pattern[strlen(pat) : -1] |
||||
|
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post') |
||||
|
else |
||||
|
let results = [pattern] |
||||
|
endif |
||||
|
let vf = pathogen#slash() . 'vimfiles' |
||||
|
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""') |
||||
|
return filter(results, '!empty(v:val)') |
||||
|
endfunction |
||||
|
|
||||
|
" \ on Windows unless shellslash is set, / everywhere else. |
||||
|
function! pathogen#slash() abort |
||||
|
return !exists("+shellslash") || &shellslash ? '/' : '\' |
||||
|
endfunction |
||||
|
|
||||
|
function! pathogen#separator() abort |
||||
|
return pathogen#slash() |
||||
|
endfunction |
||||
|
|
||||
|
" Convenience wrapper around glob() which returns a list. |
||||
|
function! pathogen#glob(pattern) abort |
||||
|
let files = split(glob(a:pattern),"\n") |
||||
|
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")') |
||||
|
endfunction |
||||
|
|
||||
|
" Like pathogen#glob(), only limit the results to directories. |
||||
|
function! pathogen#glob_directories(pattern) abort |
||||
|
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)') |
||||
|
endfunction |
||||
|
|
||||
|
" Remove duplicates from a list. |
||||
|
function! pathogen#uniq(list) abort |
||||
|
let i = 0 |
||||
|
let seen = {} |
||||
|
while i < len(a:list) |
||||
|
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i]) |
||||
|
call remove(a:list,i) |
||||
|
elseif a:list[i] ==# '' |
||||
|
let i += 1 |
||||
|
let empty = 1 |
||||
|
else |
||||
|
let seen[a:list[i]] = 1 |
||||
|
let i += 1 |
||||
|
endif |
||||
|
endwhile |
||||
|
return a:list |
||||
|
endfunction |
||||
|
|
||||
|
" Backport of fnameescape(). |
||||
|
function! pathogen#fnameescape(string) abort |
||||
|
if exists('*fnameescape') |
||||
|
return fnameescape(a:string) |
||||
|
elseif a:string ==# '-' |
||||
|
return '\-' |
||||
|
else |
||||
|
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','') |
||||
|
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'\:'=': |
@ -0,0 +1,2 @@ |
|||||
|
* |
||||
|
!.gitignore |
@ -0,0 +1,83 @@ |
|||||
|
" Maintainer: Victor Farazdagi <simple.square@gmail.com> |
||||
|
" 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 |
||||
|
|
||||
|
|
@ -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: |
@ -0,0 +1,214 @@ |
|||||
|
Файл настройки: ~/.vimrc |
||||
|
Можно редактировать файлы через сеть, например |
||||
|
:e <scp|ftp|ftps>://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 вставить из буфера обмена |
||||
|
<n>d удалить n+1 строку |
||||
|
<n>y скопировать n+1 строку |
||||
|
ESC перейти в режим просмотра |
||||
|
DEL удалить следующий символ |
||||
|
:<n> перейти на строку #n |
||||
|
% перейти к парной скобке |
||||
|
:e **/filename.c редактировать файл (с поиском по имени) |
||||
|
:w [fname] записать изменения |
||||
|
:wa сохранить изменения во всех файлах |
||||
|
:q выйти из редактора |
||||
|
:q! выйти из редактора, не сохраняя изменения |
||||
|
:color <name> выбор цветовой схемы. цветвые схемы: |
||||
|
/usr/local/share/vim/vim72/colors/*.vim |
||||
|
:pwd текущий каталог |
||||
|
:cd [path] перейти в другой каталог |
||||
|
:!команда выполнить команду - man, git, и так далее |
||||
|
стрелочками веерх и вниз можно автодополнять |
||||
|
команды и искать по истории |
||||
|
CTR+p или CTR+n автоматическое дополнение текста |
||||
|
(в режиме редактирования) |
||||
|
CTR+r,=,<expr> вставить выражение, например 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 предыдущий таб |
||||
|
<n>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: История команд |
||||
|
. Повторение последней команды |
||||
|
``` |
@ -0,0 +1,2 @@ |
|||||
|
* |
||||
|
!.gitignore |
Loading…
Reference in new issue