Compare commits
28 Commits
9bc804c8c6
...
master
Author | SHA1 | Date | |
---|---|---|---|
7fe844a3e5 | |||
235e926fed | |||
2bfe89e703 | |||
7560e9db95 | |||
440d78e368 | |||
43d9879276 | |||
34165aa5cf | |||
dc34138d9a | |||
5e4fd34529 | |||
04114e2bc5 | |||
cf9a4dc1e8 | |||
3f020a8b33 | |||
5aa61accd4 | |||
4d72304494 | |||
eaa475b08e | |||
176d2b15db | |||
3be304fc35 | |||
b297797d61 | |||
ba31625e03 | |||
b2d961aa32 | |||
1d5ffafb9d | |||
aa8c8ab374 | |||
979bc8f385 | |||
7d139bdaa6 | |||
2c607ce1e6 | |||
8397cc0c00 | |||
03c27be3c8 | |||
46f2972851 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.netrwhist
|
||||
plugged
|
||||
spell/ru.utf-8.add.spl
|
||||
autoload/plug.vim.old
|
||||
|
@ -5,3 +5,12 @@ git clone https://git.246060.ru/f1x1t/vimrc $HOME/.vim
|
||||
vim -c ':PlugUpdate'
|
||||
```
|
||||
|
||||
# Использование в NeoVim
|
||||
|
||||
Создать файл `$HOME/.config/nvim/init.vim`:
|
||||
|
||||
```vim
|
||||
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||
let &packpath=&runtimepath
|
||||
source ~/.vim/vimrc
|
||||
```
|
||||
|
@ -1,67 +1,36 @@
|
||||
" vim-plug: Vim plugin manager
|
||||
" ============================
|
||||
"
|
||||
" Download plug.vim and put it in ~/.vim/autoload
|
||||
" 1. Download plug.vim and put it in 'autoload' directory
|
||||
"
|
||||
" # Vim
|
||||
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
"
|
||||
" Edit your .vimrc
|
||||
" # Neovim
|
||||
" sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
||||
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
"
|
||||
" call plug#begin('~/.vim/plugged')
|
||||
" 2. Add a vim-plug section to your ~/.vimrc (or ~/.config/nvim/init.vim for Neovim)
|
||||
"
|
||||
" " Make sure you use single quotes
|
||||
" call plug#begin()
|
||||
"
|
||||
" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
|
||||
" Plug 'junegunn/vim-easy-align'
|
||||
" " List your plugins here
|
||||
" Plug 'tpope/vim-sensible'
|
||||
"
|
||||
" " Any valid git URL is allowed
|
||||
" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
|
||||
"
|
||||
" " Multiple Plug commands can be written in a single line using | separators
|
||||
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
||||
"
|
||||
" " On-demand loading
|
||||
" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||
" Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
||||
"
|
||||
" " Using a non-default branch
|
||||
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
|
||||
"
|
||||
" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
|
||||
" Plug 'fatih/vim-go', { 'tag': '*' }
|
||||
"
|
||||
" " Plugin options
|
||||
" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
||||
"
|
||||
" " Plugin outside ~/.vim/plugged with post-update hook
|
||||
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||
"
|
||||
" " Unmanaged plugin (manually installed and updated)
|
||||
" Plug '~/my-prototype-plugin'
|
||||
"
|
||||
" " Initialize plugin system
|
||||
" call plug#end()
|
||||
"
|
||||
" Then reload .vimrc and :PlugInstall to install plugins.
|
||||
" 3. Reload the file or restart Vim, then you can,
|
||||
"
|
||||
" Plug options:
|
||||
" :PlugInstall to install plugins
|
||||
" :PlugUpdate to update plugins
|
||||
" :PlugDiff to review the changes from the last update
|
||||
" :PlugClean to remove plugins no longer in the list
|
||||
"
|
||||
"| Option | Description |
|
||||
"| ----------------------- | ------------------------------------------------ |
|
||||
"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
|
||||
"| `rtp` | Subdirectory that contains Vim plugin |
|
||||
"| `dir` | Custom directory for the plugin |
|
||||
"| `as` | Use different name for the plugin |
|
||||
"| `do` | Post-update hook (string or funcref) |
|
||||
"| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
||||
"| `for` | On-demand loading: File types |
|
||||
"| `frozen` | Do not update unless explicitly specified |
|
||||
"
|
||||
" More information: https://github.com/junegunn/vim-plug
|
||||
" For more information, see https://github.com/junegunn/vim-plug
|
||||
"
|
||||
"
|
||||
" Copyright (c) 2017 Junegunn Choi
|
||||
" Copyright (c) 2024 Junegunn Choi
|
||||
"
|
||||
" MIT License
|
||||
"
|
||||
@ -238,10 +207,11 @@ endfunction
|
||||
|
||||
function! plug#begin(...)
|
||||
if a:0 > 0
|
||||
let s:plug_home_org = a:1
|
||||
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
|
||||
elseif exists('g:plug_home')
|
||||
let home = s:path(g:plug_home)
|
||||
elseif has('nvim')
|
||||
let home = stdpath('data') . '/plugged'
|
||||
elseif !empty(&rtp)
|
||||
let home = s:path(split(&rtp, ',')[0]) . '/plugged'
|
||||
else
|
||||
@ -350,7 +320,7 @@ function! plug#end()
|
||||
endif
|
||||
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
|
||||
|
||||
if exists('g:did_load_filetypes')
|
||||
if get(g:, 'did_load_filetypes', 0)
|
||||
filetype off
|
||||
endif
|
||||
for name in g:plugs_order
|
||||
@ -389,6 +359,9 @@ function! plug#end()
|
||||
if !empty(types)
|
||||
augroup filetypedetect
|
||||
call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim')
|
||||
if has('nvim-0.5.0')
|
||||
call s:source(s:rtp(plug), 'ftdetect/**/*.lua', 'after/ftdetect/**/*.lua')
|
||||
endif
|
||||
augroup END
|
||||
endif
|
||||
for type in types
|
||||
@ -399,13 +372,15 @@ function! plug#end()
|
||||
|
||||
for [cmd, names] in items(lod.cmd)
|
||||
execute printf(
|
||||
\ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)',
|
||||
\ cmd, string(cmd), string(names))
|
||||
\ has('patch-7.4.1898')
|
||||
\ ? 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, <q-mods> ,%s)'
|
||||
\ : 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)'
|
||||
\ , cmd, string(cmd), string(names))
|
||||
endfor
|
||||
|
||||
for [map, names] in items(lod.map)
|
||||
for [mode, map_prefix, key_prefix] in
|
||||
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
|
||||
\ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
|
||||
execute printf(
|
||||
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
|
||||
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
|
||||
@ -436,6 +411,9 @@ endfunction
|
||||
|
||||
function! s:load_plugin(spec)
|
||||
call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
|
||||
if has('nvim-0.5.0')
|
||||
call s:source(s:rtp(a:spec), 'plugin/**/*.lua', 'after/plugin/**/*.lua')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:reload_plugins()
|
||||
@ -653,6 +631,9 @@ function! s:lod(names, types, ...)
|
||||
let rtp = s:rtp(g:plugs[name])
|
||||
for dir in a:types
|
||||
call s:source(rtp, dir.'/**/*.vim')
|
||||
if has('nvim-0.5.0') " see neovim#14686
|
||||
call s:source(rtp, dir.'/**/*.lua')
|
||||
endif
|
||||
endfor
|
||||
if a:0
|
||||
if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
|
||||
@ -672,11 +653,19 @@ function! s:lod_ft(pat, names)
|
||||
call s:doautocmd('filetypeindent', 'FileType')
|
||||
endfunction
|
||||
|
||||
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
||||
if has('patch-7.4.1898')
|
||||
function! s:lod_cmd(cmd, bang, l1, l2, args, mods, names)
|
||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
call s:dobufread(a:names)
|
||||
execute printf('%s %s%s%s %s', a:mods, (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||
endfunction
|
||||
else
|
||||
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
call s:dobufread(a:names)
|
||||
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||
endfunction
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! s:lod_map(map, names, with_prefix, prefix)
|
||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
@ -804,10 +793,11 @@ endfunction
|
||||
function! s:syntax()
|
||||
syntax clear
|
||||
syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber
|
||||
syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX
|
||||
syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX,plugAbort
|
||||
syn match plugNumber /[0-9]\+[0-9.]*/ contained
|
||||
syn match plugBracket /[[\]]/ contained
|
||||
syn match plugX /x/ contained
|
||||
syn match plugAbort /\~/ contained
|
||||
syn match plugDash /^-\{1}\ /
|
||||
syn match plugPlus /^+/
|
||||
syn match plugStar /^*/
|
||||
@ -832,6 +822,7 @@ function! s:syntax()
|
||||
hi def link plug2 Repeat
|
||||
hi def link plugH2 Type
|
||||
hi def link plugX Exception
|
||||
hi def link plugAbort Ignore
|
||||
hi def link plugBracket Structure
|
||||
hi def link plugNumber Number
|
||||
|
||||
@ -867,7 +858,7 @@ function! s:lastline(msg)
|
||||
endfunction
|
||||
|
||||
function! s:new_window()
|
||||
execute get(g:, 'plug_window', 'vertical topleft new')
|
||||
execute get(g:, 'plug_window', '-tabnew')
|
||||
endfunction
|
||||
|
||||
function! s:plug_window_exists()
|
||||
@ -929,7 +920,7 @@ function! s:prepare(...)
|
||||
endif
|
||||
endfor
|
||||
|
||||
call s:job_abort()
|
||||
call s:job_abort(0)
|
||||
if s:switch_in()
|
||||
if b:plug_preview == 1
|
||||
pc
|
||||
@ -965,6 +956,8 @@ function! s:close_pane()
|
||||
if b:plug_preview == 1
|
||||
pc
|
||||
let b:plug_preview = -1
|
||||
elseif exists('s:jobs') && !empty(s:jobs)
|
||||
call s:job_abort(1)
|
||||
else
|
||||
bd
|
||||
endif
|
||||
@ -1029,6 +1022,11 @@ function! s:is_updated(dir)
|
||||
endfunction
|
||||
|
||||
function! s:do(pull, force, todo)
|
||||
if has('nvim')
|
||||
" Reset &rtp to invalidate Neovim cache of loaded Lua modules
|
||||
" See https://github.com/junegunn/vim-plug/pull/1157#issuecomment-1809226110
|
||||
let &rtp = &rtp
|
||||
endif
|
||||
for [name, spec] in items(a:todo)
|
||||
if !isdirectory(spec.dir)
|
||||
continue
|
||||
@ -1087,15 +1085,21 @@ function! s:hash_match(a, b)
|
||||
return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
|
||||
endfunction
|
||||
|
||||
function! s:disable_credential_helper()
|
||||
return s:git_version_requirement(2) && get(g:, 'plug_disable_credential_helper', 1)
|
||||
endfunction
|
||||
|
||||
function! s:checkout(spec)
|
||||
let sha = a:spec.commit
|
||||
let output = s:git_revision(a:spec.dir)
|
||||
let error = 0
|
||||
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
||||
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
|
||||
let credential_helper = s:disable_credential_helper() ? '-c credential.helper= ' : ''
|
||||
let output = s:system(
|
||||
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
||||
let error = v:shell_error
|
||||
endif
|
||||
return output
|
||||
return [output, error]
|
||||
endfunction
|
||||
|
||||
function! s:finish(pull)
|
||||
@ -1156,7 +1160,7 @@ function! s:update_impl(pull, force, args) abort
|
||||
let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
|
||||
\ remove(args, -1) : get(g:, 'plug_threads', 16)
|
||||
|
||||
let managed = filter(copy(g:plugs), 's:is_managed(v:key)')
|
||||
let managed = filter(deepcopy(g:plugs), 's:is_managed(v:key)')
|
||||
let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') :
|
||||
\ filter(managed, 'index(args, v:key) >= 0')
|
||||
|
||||
@ -1208,7 +1212,8 @@ function! s:update_impl(pull, force, args) abort
|
||||
normal! 2G
|
||||
silent! redraw
|
||||
|
||||
let s:clone_opt = []
|
||||
" Set remote name, overriding a possible user git config's clone.defaultRemoteName
|
||||
let s:clone_opt = ['--origin', 'origin']
|
||||
if get(g:, 'plug_shallow', 1)
|
||||
call extend(s:clone_opt, ['--depth', '1'])
|
||||
if s:git_version_requirement(1, 7, 10)
|
||||
@ -1289,9 +1294,11 @@ function! s:update_finish()
|
||||
if !pos
|
||||
continue
|
||||
endif
|
||||
let out = ''
|
||||
let error = 0
|
||||
if has_key(spec, 'commit')
|
||||
call s:log4(name, 'Checking out '.spec.commit)
|
||||
let out = s:checkout(spec)
|
||||
let [out, error] = s:checkout(spec)
|
||||
elseif has_key(spec, 'tag')
|
||||
let tag = spec.tag
|
||||
if tag =~ '\*'
|
||||
@ -1304,19 +1311,16 @@ function! s:update_finish()
|
||||
endif
|
||||
call s:log4(name, 'Checking out '.tag)
|
||||
let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
|
||||
else
|
||||
let branch = s:git_origin_branch(spec)
|
||||
call s:log4(name, 'Merging origin/'.s:esc(branch))
|
||||
let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1'
|
||||
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)
|
||||
let error = v:shell_error
|
||||
endif
|
||||
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
|
||||
if !error && filereadable(spec.dir.'/.gitmodules') &&
|
||||
\ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
|
||||
call s:log4(name, 'Updating submodules. This may take a while.')
|
||||
let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir)
|
||||
let error = v:shell_error
|
||||
endif
|
||||
let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
|
||||
if v:shell_error
|
||||
if error
|
||||
call add(s:update.errors, name)
|
||||
call s:regress_bar()
|
||||
silent execute pos 'd _'
|
||||
@ -1340,7 +1344,12 @@ function! s:update_finish()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:job_abort()
|
||||
function! s:mark_aborted(name, message)
|
||||
let attrs = { 'running': 0, 'error': 1, 'abort': 1, 'lines': [a:message] }
|
||||
let s:jobs[a:name] = extend(get(s:jobs, a:name, {}), attrs)
|
||||
endfunction
|
||||
|
||||
function! s:job_abort(cancel)
|
||||
if (!s:nvim && !s:vim8) || !exists('s:jobs')
|
||||
return
|
||||
endif
|
||||
@ -1354,8 +1363,18 @@ function! s:job_abort()
|
||||
if j.new
|
||||
call s:rm_rf(g:plugs[name].dir)
|
||||
endif
|
||||
if a:cancel
|
||||
call s:mark_aborted(name, 'Aborted')
|
||||
endif
|
||||
endfor
|
||||
|
||||
if a:cancel
|
||||
for todo in values(s:update.todo)
|
||||
let todo.abort = 1
|
||||
endfor
|
||||
else
|
||||
let s:jobs = {}
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:last_non_empty_line(lines)
|
||||
@ -1369,6 +1388,16 @@ function! s:last_non_empty_line(lines)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:bullet_for(job, ...)
|
||||
if a:job.running
|
||||
return a:job.new ? '+' : '*'
|
||||
endif
|
||||
if get(a:job, 'abort', 0)
|
||||
return '~'
|
||||
endif
|
||||
return a:job.error ? 'x' : get(a:000, 0, '-')
|
||||
endfunction
|
||||
|
||||
function! s:job_out_cb(self, data) abort
|
||||
let self = a:self
|
||||
let data = remove(self.lines, -1) . a:data
|
||||
@ -1377,9 +1406,10 @@ function! s:job_out_cb(self, data) abort
|
||||
" To reduce the number of buffer updates
|
||||
let self.tick = get(self, 'tick', -1) + 1
|
||||
if !self.running || self.tick % len(s:jobs) == 0
|
||||
let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-')
|
||||
let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
|
||||
call s:log(bullet, self.name, result)
|
||||
if len(result)
|
||||
call s:log(s:bullet_for(self), self.name, result)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -1392,7 +1422,7 @@ endfunction
|
||||
|
||||
function! s:job_cb(fn, job, ch, data)
|
||||
if !s:plug_window_exists() " plug window closed
|
||||
return s:job_abort()
|
||||
return s:job_abort(0)
|
||||
endif
|
||||
call call(a:fn, [a:job, a:data])
|
||||
endfunction
|
||||
@ -1403,16 +1433,17 @@ function! s:nvim_cb(job_id, data, event) dict abort
|
||||
\ s:job_cb('s:job_exit_cb', self, 0, a:data)
|
||||
endfunction
|
||||
|
||||
function! s:spawn(name, cmd, opts)
|
||||
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
|
||||
\ 'new': get(a:opts, 'new', 0) }
|
||||
function! s:spawn(name, spec, queue, opts)
|
||||
let job = { 'name': a:name, 'spec': a:spec, 'running': 1, 'error': 0, 'lines': [''],
|
||||
\ 'new': get(a:opts, 'new', 0), 'queue': copy(a:queue) }
|
||||
let Item = remove(job.queue, 0)
|
||||
let argv = type(Item) == s:TYPE.funcref ? call(Item, [a:spec]) : Item
|
||||
let s:jobs[a:name] = job
|
||||
|
||||
if s:nvim
|
||||
if has_key(a:opts, 'dir')
|
||||
let job.cwd = a:opts.dir
|
||||
endif
|
||||
let argv = a:cmd
|
||||
call extend(job, {
|
||||
\ 'on_stdout': function('s:nvim_cb'),
|
||||
\ 'on_stderr': function('s:nvim_cb'),
|
||||
@ -1428,7 +1459,7 @@ function! s:spawn(name, cmd, opts)
|
||||
\ 'Invalid arguments (or job table is full)']
|
||||
endif
|
||||
elseif s:vim8
|
||||
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"script": 0})'))
|
||||
let cmd = join(map(copy(argv), 'plug#shellescape(v:val, {"script": 0})'))
|
||||
if has_key(a:opts, 'dir')
|
||||
let cmd = s:with_cd(cmd, a:opts.dir, 0)
|
||||
endif
|
||||
@ -1448,27 +1479,33 @@ function! s:spawn(name, cmd, opts)
|
||||
let job.lines = ['Failed to start job']
|
||||
endif
|
||||
else
|
||||
let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]))
|
||||
let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [argv, a:opts.dir] : [argv]))
|
||||
let job.error = v:shell_error != 0
|
||||
let job.running = 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:reap(name)
|
||||
let job = s:jobs[a:name]
|
||||
let job = remove(s:jobs, a:name)
|
||||
if job.error
|
||||
call add(s:update.errors, a:name)
|
||||
elseif get(job, 'new', 0)
|
||||
let s:update.new[a:name] = 1
|
||||
endif
|
||||
let s:update.bar .= job.error ? 'x' : '='
|
||||
|
||||
let bullet = job.error ? 'x' : '-'
|
||||
let more = len(get(job, 'queue', []))
|
||||
let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
|
||||
call s:log(bullet, a:name, empty(result) ? 'OK' : result)
|
||||
call s:bar()
|
||||
if len(result)
|
||||
call s:log(s:bullet_for(job), a:name, result)
|
||||
endif
|
||||
|
||||
call remove(s:jobs, a:name)
|
||||
if !job.error && more
|
||||
let job.spec.queue = job.queue
|
||||
let s:update.todo[a:name] = job.spec
|
||||
else
|
||||
let s:update.bar .= s:bullet_for(job, '=')
|
||||
call s:bar()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:bar()
|
||||
@ -1521,6 +1558,16 @@ function! s:update_vim()
|
||||
call s:tick()
|
||||
endfunction
|
||||
|
||||
function! s:checkout_command(spec)
|
||||
let a:spec.branch = s:git_origin_branch(a:spec)
|
||||
return ['git', 'checkout', '-q', a:spec.branch, '--']
|
||||
endfunction
|
||||
|
||||
function! s:merge_command(spec)
|
||||
let a:spec.branch = s:git_origin_branch(a:spec)
|
||||
return ['git', 'merge', '--ff-only', 'origin/'.a:spec.branch]
|
||||
endfunction
|
||||
|
||||
function! s:tick()
|
||||
let pull = s:update.pull
|
||||
let prog = s:progress_opt(s:nvim || s:vim8)
|
||||
@ -1535,24 +1582,39 @@ while 1 " Without TCO, Vim stack is bound to explode
|
||||
|
||||
let name = keys(s:update.todo)[0]
|
||||
let spec = remove(s:update.todo, name)
|
||||
if get(spec, 'abort', 0)
|
||||
call s:mark_aborted(name, 'Skipped')
|
||||
call s:reap(name)
|
||||
continue
|
||||
endif
|
||||
|
||||
let queue = get(spec, 'queue', [])
|
||||
let new = empty(globpath(spec.dir, '.git', 1))
|
||||
|
||||
if empty(queue)
|
||||
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
|
||||
redraw
|
||||
endif
|
||||
|
||||
let has_tag = has_key(spec, 'tag')
|
||||
if !new
|
||||
if len(queue)
|
||||
call s:spawn(name, spec, queue, { 'dir': spec.dir })
|
||||
elseif !new
|
||||
let [error, _] = s:git_validate(spec, 0)
|
||||
if empty(error)
|
||||
if pull
|
||||
let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
|
||||
let cmd = s:disable_credential_helper() ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
|
||||
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
|
||||
call extend(cmd, ['--depth', '99999999'])
|
||||
endif
|
||||
if !empty(prog)
|
||||
call add(cmd, prog)
|
||||
endif
|
||||
call s:spawn(name, cmd, { 'dir': spec.dir })
|
||||
let queue = [cmd, split('git remote set-head origin -a')]
|
||||
if !has_tag && !has_key(spec, 'commit')
|
||||
call extend(queue, [function('s:checkout_command'), function('s:merge_command')])
|
||||
endif
|
||||
call s:spawn(name, spec, queue, { 'dir': spec.dir })
|
||||
else
|
||||
let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
|
||||
endif
|
||||
@ -1567,7 +1629,7 @@ while 1 " Without TCO, Vim stack is bound to explode
|
||||
if !empty(prog)
|
||||
call add(cmd, prog)
|
||||
endif
|
||||
call s:spawn(name, extend(cmd, [spec.uri, s:trim(spec.dir)]), { 'new': 1 })
|
||||
call s:spawn(name, spec, [extend(cmd, [spec.uri, s:trim(spec.dir)]), function('s:checkout_command'), function('s:merge_command')], { 'new': 1 })
|
||||
endif
|
||||
|
||||
if !s:jobs[name].running
|
||||
@ -2266,7 +2328,10 @@ endfunction
|
||||
|
||||
function! s:with_cd(cmd, dir, ...)
|
||||
let script = a:0 > 0 ? a:1 : 1
|
||||
return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd)
|
||||
let pwsh = s:is_powershell(&shell)
|
||||
let cd = s:is_win && !pwsh ? 'cd /d' : 'cd'
|
||||
let sep = pwsh ? ';' : '&&'
|
||||
return printf('%s %s %s %s', cd, plug#shellescape(a:dir, {'script': script, 'shell': &shell}), sep, a:cmd)
|
||||
endfunction
|
||||
|
||||
function! s:system(cmd, ...)
|
||||
@ -2343,18 +2408,21 @@ function! s:git_validate(spec, check_branch)
|
||||
\ current_branch, origin_branch)
|
||||
endif
|
||||
if empty(err)
|
||||
let [ahead, behind] = split(s:lastline(s:system([
|
||||
let ahead_behind = split(s:lastline(s:system([
|
||||
\ 'git', 'rev-list', '--count', '--left-right',
|
||||
\ printf('HEAD...origin/%s', origin_branch)
|
||||
\ ], a:spec.dir)), '\t')
|
||||
if !v:shell_error && ahead
|
||||
if behind
|
||||
if v:shell_error || len(ahead_behind) != 2
|
||||
let err = "Failed to compare with the origin. The default branch might have changed.\nPlugClean required."
|
||||
else
|
||||
let [ahead, behind] = ahead_behind
|
||||
if ahead && behind
|
||||
" Only mention PlugClean if diverged, otherwise it's likely to be
|
||||
" pushable (and probably not that messed up).
|
||||
let err = printf(
|
||||
\ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
|
||||
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind)
|
||||
else
|
||||
elseif ahead
|
||||
let err = printf("Ahead of origin/%s by %d commit(s).\n"
|
||||
\ .'Cannot update until local changes are pushed.',
|
||||
\ origin_branch, ahead)
|
||||
@ -2386,7 +2454,7 @@ function! s:clean(force)
|
||||
let errs = {}
|
||||
let [cnt, total] = [0, len(g:plugs)]
|
||||
for [name, spec] in items(g:plugs)
|
||||
if !s:is_managed(name)
|
||||
if !s:is_managed(name) || get(spec, 'frozen', 0)
|
||||
call add(dirs, spec.dir)
|
||||
else
|
||||
let [err, clean] = s:git_validate(spec, 1)
|
||||
@ -2618,26 +2686,34 @@ function! s:preview_commit()
|
||||
|
||||
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
|
||||
if empty(sha)
|
||||
let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$')
|
||||
if empty(name)
|
||||
return
|
||||
endif
|
||||
|
||||
let title = 'HEAD@{1}..'
|
||||
let command = 'git diff --no-color HEAD@{1}'
|
||||
else
|
||||
let title = sha
|
||||
let command = 'git show --no-color --pretty=medium '.sha
|
||||
let name = s:find_name(line('.'))
|
||||
endif
|
||||
|
||||
if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
|
||||
return
|
||||
endif
|
||||
|
||||
if exists('g:plug_pwindow') && !s:is_preview_window_open()
|
||||
execute g:plug_pwindow
|
||||
execute 'e' sha
|
||||
if !s:is_preview_window_open()
|
||||
execute get(g:, 'plug_pwindow', 'vertical rightbelow new')
|
||||
execute 'e' title
|
||||
else
|
||||
execute 'pedit' sha
|
||||
execute 'pedit' title
|
||||
wincmd P
|
||||
endif
|
||||
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
|
||||
setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable
|
||||
let batchfile = ''
|
||||
try
|
||||
let [sh, shellcmdflag, shrd] = s:chsh(1)
|
||||
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
|
||||
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command
|
||||
if s:is_win
|
||||
let [batchfile, cmd] = s:batchfile(cmd)
|
||||
endif
|
||||
@ -2763,9 +2839,9 @@ function! s:snapshot(force, ...) abort
|
||||
1
|
||||
let anchor = line('$') - 3
|
||||
let names = sort(keys(filter(copy(g:plugs),
|
||||
\'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
|
||||
\'has_key(v:val, "uri") && isdirectory(v:val.dir)')))
|
||||
for name in reverse(names)
|
||||
let sha = s:git_revision(g:plugs[name].dir)
|
||||
let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir)
|
||||
if !empty(sha)
|
||||
call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
|
||||
redraw
|
||||
|
@ -1 +1,3 @@
|
||||
set guifont=PragmataPro\ 18
|
||||
if has('gui_running') && !has('nvim')
|
||||
set guifont=Iosevka\ Prog\ Nerd\ Font\ Mono\ 18
|
||||
endif
|
||||
|
3
hosts/nbtp.vimrc
Normal file
3
hosts/nbtp.vimrc
Normal file
@ -0,0 +1,3 @@
|
||||
if has('gui_running') && !has('nvim')
|
||||
set guifont=Iosevka\ Prog\ Nerd\ Font\ Mono\ 10
|
||||
endif
|
@ -1 +1,3 @@
|
||||
set guifont=PragmataPro\ 18
|
||||
if has('gui_running') && !has('nvim')
|
||||
set guifont=Iosevka\ Prog\ Nerd\ Font\ Mono\ 18
|
||||
endif
|
||||
|
@ -1 +0,0 @@
|
||||
set guifont=PragmataPro\ 10
|
17
syntax/lyx.vim
Normal file
17
syntax/lyx.vim
Normal file
@ -0,0 +1,17 @@
|
||||
syntax clear
|
||||
|
||||
syntax keyword lyxCommand \\layout
|
||||
syntax keyword lyxCommand \\the_end
|
||||
syntax keyword lyxKey LatexCommand ERT Graphics Float FloatList
|
||||
syntax keyword lyxKey status Open Closed
|
||||
syntax keyword lyxKey wide collapsed
|
||||
syntax keyword lyxBinary true false
|
||||
syntax keyword lyxBinary Open Close
|
||||
syntax region lyxInset start=/\\begin_inset/ end=/\\end_inset/ contains=ALL fold
|
||||
syntax region lyxString start=/"/ end=/"/
|
||||
|
||||
highlight link lyxCommand Keyword
|
||||
highlight link lyxKey Keyword
|
||||
highlight link lyxString String
|
||||
highlight link lyxInset Comment
|
||||
highlight link lyxBinary Boolean
|
344
vimrc
344
vimrc
@ -13,275 +13,344 @@ call pathogen#infect()
|
||||
|
||||
|
||||
" https://github.com/junegunn/vim-plug
|
||||
" Менеджер плагинов "
|
||||
" Менеджер плагинов
|
||||
call plug#begin('~/.vim/plugged')
|
||||
|
||||
" https://github.com/skywind3000/asyncrun.vim
|
||||
" Запуск асинхронных команд "
|
||||
" Запуск асинхронных команд
|
||||
Plug 'skywind3000/asyncrun.vim'
|
||||
|
||||
" https://github.com/mhinz/vim-startify
|
||||
" Стартовый экран
|
||||
Plug 'mhinz/vim-startify'
|
||||
|
||||
" https://github.com/ryanoasis/vim-devicons
|
||||
" Поддержка иконок
|
||||
Plug 'ryanoasis/vim-devicons'
|
||||
|
||||
" https://github.com/lyokha/vim-xkbswitch
|
||||
" Автоматическое переключение раскладки клавиатуры в режиме вставки "
|
||||
" Автоматическое переключение раскладки клавиатуры в режиме вставки
|
||||
Plug 'lyokha/vim-xkbswitch'
|
||||
|
||||
" https://github.com/srcery-colors/srcery-vim
|
||||
" Тема srcery
|
||||
Plug 'srcery-colors/srcery-vim'
|
||||
|
||||
" https://github.com/wellle/context.vim
|
||||
" Отображение контекста
|
||||
Plug 'wellle/context.vim'
|
||||
|
||||
" https://github.com/itchyny/lightline.vim
|
||||
" Настраиваемая строка состояния "
|
||||
" Настраиваемая строка состояния
|
||||
" https://github.com/taohexxx/lightline-buffer
|
||||
" Строка с названиями буферов "
|
||||
" Строка с названиями буферов
|
||||
Plug 'itchyny/lightline.vim' | Plug 'taohexxx/lightline-buffer'
|
||||
|
||||
" https://github.com/oblitum/rainbow
|
||||
" Разноцветные скобки "
|
||||
Plug 'oblitum/rainbow'
|
||||
" https://github.com/Cheeto836/vim-rainbow
|
||||
" Разноцветные скобки
|
||||
Plug 'Cheeto836/vim-rainbow'
|
||||
|
||||
" https://github.com/ntpeters/vim-better-whitespace
|
||||
" Подсветка лишних пробельных символов "
|
||||
" Подсветка лишних пробельных символов
|
||||
Plug 'ntpeters/vim-better-whitespace'
|
||||
|
||||
" https://github.com/wincent/terminus
|
||||
" Улучшенная поддержка терминала "
|
||||
" Улучшенная поддержка терминала
|
||||
Plug 'wincent/terminus'
|
||||
|
||||
" https://www.vim.org/scripts/script.php?script_id=231
|
||||
" Tab для логической разметки, Space для выравнивания "
|
||||
Plug 'dpc/vim-smarttabs'
|
||||
" https://github.com/Thyrum/vim-stabs
|
||||
" Tab для логической разметки, Space для выравнивания
|
||||
Plug 'Thyrum/vim-stabs'
|
||||
|
||||
" https://github.com/tpope/vim-commentary
|
||||
" Комментарии
|
||||
Plug 'tpope/vim-commentary'
|
||||
|
||||
" https://github.com/ctrlpvim/ctrlp.vim
|
||||
" Поиск файлов и буферов "
|
||||
" Поиск файлов и буферов
|
||||
Plug 'ctrlpvim/ctrlp.vim'
|
||||
|
||||
" https://github.com/easymotion/vim-easymotion
|
||||
" Быстрая навигация "
|
||||
" Быстрая навигация
|
||||
Plug 'easymotion/vim-easymotion'
|
||||
|
||||
" https://github.com/haya14busa/incsearch.vim
|
||||
" Поиск "
|
||||
" Поиск
|
||||
Plug 'haya14busa/incsearch.vim' | Plug 'haya14busa/incsearch-easymotion.vim'
|
||||
|
||||
" https://github.com/mihaifm/bufstop
|
||||
Plug 'mihaifm/bufstop'
|
||||
|
||||
" https://github.com/moll/vim-bbye
|
||||
" Удаление буферов с сохранением расположения окон "
|
||||
" Удаление буферов с сохранением расположения окон
|
||||
Plug 'moll/vim-bbye'
|
||||
|
||||
" https://github.com/sstallion/vim-wildignore
|
||||
" Чтение масок файлов из файлов wildignore и suffixes "
|
||||
" Чтение масок файлов из файлов wildignore и suffixes
|
||||
Plug 'sstallion/vim-wildignore'
|
||||
|
||||
" https://github.com/tpope/vim-fugitive
|
||||
" Git "
|
||||
" Git
|
||||
" Plug 'tpope/vim-fugitive'
|
||||
|
||||
" https://github.com/airblade/vim-gitgutter
|
||||
" Отличия от Git в левой колонке "
|
||||
" Отличия от Git в левой колонке
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
|
||||
" https://github.com/neomake/neomake
|
||||
" Проверка синтаксиса в фоновом режиме "
|
||||
" Проверка синтаксиса в фоновом режиме
|
||||
Plug 'neomake/neomake'
|
||||
|
||||
" https://github.com/dense-analysis/ale
|
||||
" Проверка синтаксиса
|
||||
Plug 'dense-analysis/ale'
|
||||
|
||||
" https://github.com/ciaranm/securemodelines
|
||||
" Настраиваемая поддержка строки режима в файле
|
||||
Plug 'ciaranm/securemodelines'
|
||||
|
||||
" https://github.com/stephpy/vim-yaml
|
||||
" YAML "
|
||||
" YAML
|
||||
Plug 'stephpy/vim-yaml'
|
||||
|
||||
" https://github.com/plasticboy/vim-markdown
|
||||
" Markdown "
|
||||
" Markdown
|
||||
Plug 'plasticboy/vim-markdown'
|
||||
|
||||
"https://github.com/habamax/vim-asciidoctor
|
||||
" AsciiDoctor "
|
||||
" AsciiDoctor
|
||||
Plug 'habamax/vim-asciidoctor'
|
||||
|
||||
" https://github.com/SirVer/ultisnips
|
||||
" Вставка фрагментов кода "
|
||||
" Вставка фрагментов кода
|
||||
Plug 'sirver/ultisnips'
|
||||
|
||||
" https://github.com/honza/vim-snippets
|
||||
" Библиотека фрагментов кода "
|
||||
" Библиотека фрагментов кода
|
||||
Plug 'honza/vim-snippets'
|
||||
|
||||
" https://github.com/aklt/plantuml-syntax
|
||||
" Plantuml "
|
||||
" PlantUML
|
||||
Plug 'aklt/plantuml-syntax'
|
||||
|
||||
" https://github.com/JosefLitos/vim-i3config
|
||||
" Подсветка синтаксиса i3
|
||||
Plug 'JosefLitos/vim-i3config'
|
||||
|
||||
" https://github.com/dhruvasagar/vim-table-mode
|
||||
" Создание таблиц "
|
||||
" Создание таблиц
|
||||
Plug 'dhruvasagar/vim-table-mode'
|
||||
|
||||
" https://github.com/junegunn/vim-easy-align
|
||||
" Выравнивание строк "
|
||||
" Выравнивание строк
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
|
||||
" https://github.com/henry4k/vim-fontzoom
|
||||
" Изменение размера шрифта "
|
||||
" Изменение размера шрифта
|
||||
Plug 'henry4k/vim-fontzoom'
|
||||
|
||||
" https://dmitryfrank.com/projects/vimprj
|
||||
" Опции для отдельных проектов "
|
||||
" Опции для отдельных проектов
|
||||
Plug 'elnull/vim-dfutil' | Plug 'elnull/vimprj'
|
||||
|
||||
" https://github.com/vhdirk/vim-cmake
|
||||
" CMake "
|
||||
Plug 'vhdirk/vim-cmake'
|
||||
" https://github.com/ilyachur/cmake4vim
|
||||
" CMake
|
||||
Plug 'ilyachur/cmake4vim'
|
||||
|
||||
" LaTeX
|
||||
Plug 'lervag/vimtex'
|
||||
Plug 'xuhdev/vim-latex-live-preview'
|
||||
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
|
||||
|
||||
" https://github.com/python-mode/python-mode "
|
||||
" Python "
|
||||
" https://github.com/jez/vim-superman
|
||||
" MAN
|
||||
Plug 'jez/vim-superman'
|
||||
|
||||
" https://github.com/kergoth/vim-bitbake
|
||||
" Bitbake
|
||||
Plug 'kergoth/vim-bitbake'
|
||||
|
||||
" https://github.com/python-mode/python-mode
|
||||
" Python
|
||||
Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }
|
||||
|
||||
" https://github.com/itspriddle/vim-shellcheck "
|
||||
" Shell "
|
||||
" https://github.com/puremourning/vimspector
|
||||
" Multi language graphical debugger
|
||||
Plug 'puremourning/vimspector'
|
||||
|
||||
" https://github.com/itspriddle/vim-shellcheck
|
||||
" Shell
|
||||
Plug 'itspriddle/vim-shellcheck'
|
||||
|
||||
Plug 'rhysd/vim-grammarous'
|
||||
|
||||
" Перечисление плагинов заканчивается здесь "
|
||||
" https://github.com/mcchrish/nnn.vim
|
||||
" File manager for vim/neovim powered by n³
|
||||
Plug 'mcchrish/nnn.vim'
|
||||
|
||||
" Перечисление плагинов заканчивается здесь
|
||||
call plug#end()
|
||||
|
||||
|
||||
"{{{ Базовые настройки
|
||||
" Включена подсветка синтаксиса "
|
||||
" Plug устанавливает свои значения, нужно явно переопределить после plug#end "
|
||||
" Включена подсветка синтаксиса
|
||||
" Plug устанавливает свои значения, нужно явно переопределить после plug#end
|
||||
syntax on
|
||||
filetype plugin indent on
|
||||
|
||||
" Выбор движка для регулярных выражений
|
||||
autocmd FileType ruby,tex set regexpengine=1
|
||||
|
||||
" Отключен режим совместимости "
|
||||
" Отключен режим совместимости
|
||||
set nocompatible
|
||||
|
||||
" Проверка изменения файла другой программой "
|
||||
" Проверка изменения файла другой программой
|
||||
set autoread
|
||||
|
||||
" Автоматическая запись перед make, внешними командами и т.п. "
|
||||
" Автоматическая запись перед make, внешними командами и т.п.
|
||||
set autowrite
|
||||
|
||||
" Показывать парные скобки "
|
||||
" Показывать парные скобки
|
||||
set showmatch
|
||||
|
||||
" Размер табуляции "
|
||||
" Размер табуляции
|
||||
set tabstop=4
|
||||
|
||||
" Размер сдвига при нажатии на клавиши << и >> "
|
||||
" Размер сдвига при нажатии на клавиши << и >>
|
||||
set shiftwidth=4
|
||||
|
||||
" Количество пробелов, на которое будет заменена табуляция "
|
||||
" Количество пробелов, на которое будет заменена табуляция
|
||||
set softtabstop=4
|
||||
|
||||
" Не заменять <TAB> на пробелы "
|
||||
" Не заменять <TAB> на пробелы
|
||||
set noexpandtab
|
||||
|
||||
" Визуальный перенос строк "
|
||||
" Визуальный перенос строк
|
||||
set wrap
|
||||
|
||||
" Визуальный перенос строк по словам, а не по буквам "
|
||||
" Визуальный перенос строк по словам, а не по буквам
|
||||
set linebreak
|
||||
|
||||
" Визуальный перенос строки с учётом отступов "
|
||||
" Визуальный перенос строки с учётом отступов
|
||||
set breakindent
|
||||
|
||||
" Подсветка выражения, которое ищется в тексте "
|
||||
" Подсветка выражения, которое ищется в тексте
|
||||
set hlsearch
|
||||
|
||||
" Переход на найденный текст в процессе набора строки "
|
||||
" Переход на найденный текст в процессе набора строки
|
||||
set incsearch
|
||||
|
||||
" Не останавливать поиск при достижении конца файла "
|
||||
" Не останавливать поиск при достижении конца файла
|
||||
set wrapscan
|
||||
|
||||
" Игнорировать регистр букв при поиске, если в шаблоне нет заглавных букв "
|
||||
" Игнорировать регистр букв при поиске, если в шаблоне нет заглавных букв
|
||||
set smartcase
|
||||
|
||||
" Копирует отступ от предыдущей строки "
|
||||
" Копирует отступ от предыдущей строки
|
||||
set autoindent
|
||||
|
||||
" Автоматическая расстановка отступов "
|
||||
" Автоматическая расстановка отступов
|
||||
set smartindent
|
||||
|
||||
" По умолчанию не сворачивать "
|
||||
" По умолчанию не сворачивать
|
||||
set nofoldenable
|
||||
|
||||
" Сворачивание согласно синтаксису тормозит, нужно использовать что-то другое "
|
||||
" Сворачивание согласно синтаксису тормозит, нужно использовать что-то другое
|
||||
set foldmethod=marker
|
||||
|
||||
" Кодировка внутри Vim "
|
||||
" Разрешено использование строки режима в файле
|
||||
set modeline
|
||||
|
||||
" Количество строк, в которых производится поиск команд для настройки режима
|
||||
set modelines=5
|
||||
|
||||
" Кодировка внутри Vim
|
||||
set encoding=utf-8
|
||||
|
||||
" Кодировка терминала "
|
||||
" Кодировка терминала
|
||||
set termencoding=utf-8
|
||||
|
||||
" Кодировка для сохраняемого файла "
|
||||
" Кодировка для сохраняемого файла
|
||||
set fileencoding=utf-8
|
||||
|
||||
" Список предполагаемых кодировок в порядке предпочтения "
|
||||
" Список предполагаемых кодировок в порядке предпочтения
|
||||
set fileencodings=utf8,koi8r,cp1251,cp866,latin1,ucs-2le
|
||||
|
||||
" Включаем мышку даже в текстовом режиме "
|
||||
" (без этого символы табуляции раскладываются в кучу пробелов) "
|
||||
" Включаем мышку даже в текстовом режиме
|
||||
" (без этого символы табуляции раскладываются в кучу пробелов)
|
||||
set mouse=a
|
||||
|
||||
" Модель поведения правой кнопки мыши "
|
||||
" Модель поведения правой кнопки мыши
|
||||
set mousemodel=popup
|
||||
|
||||
" Тип переноса строк "
|
||||
" Тип переноса строк
|
||||
set fileformat=unix
|
||||
|
||||
" В графическом режиме: убрать меню "
|
||||
" В графическом режиме: убрать меню
|
||||
set guioptions-=m
|
||||
|
||||
" В графическом режиме: убрать панель инструментов "
|
||||
" В графическом режиме: убрать панель инструментов
|
||||
set guioptions-=T
|
||||
|
||||
" В графическом режиме: убрать прокрутку справа "
|
||||
" В графическом режиме: убрать прокрутку справа
|
||||
set guioptions-=r
|
||||
|
||||
" В графическом режиме: убрать прокрутку слева "
|
||||
" В графическом режиме: убрать прокрутку слева
|
||||
set guioptions-=L
|
||||
|
||||
" В графическом режиме: отключить графические вкладки "
|
||||
" В графическом режиме: отключить графические вкладки
|
||||
set guioptions-=e
|
||||
|
||||
" Шрифт в графическом режиме "
|
||||
set guifont=PragmataPro\ 10
|
||||
" Шрифт в графическом режиме
|
||||
if has('gui_running') && !has('nvim')
|
||||
set guifont=Iosevka\ Fixed\ SS08\ 10
|
||||
endif
|
||||
|
||||
" Количество отображаемых строк над/под курсором "
|
||||
" Количество отображаемых строк над/под курсором
|
||||
set scrolloff=6
|
||||
|
||||
" Количество отображаемых колонок слева/справа от курсора "
|
||||
" Количество отображаемых колонок слева/справа от курсора
|
||||
set sidescrolloff=5
|
||||
|
||||
" Нумерация строк включена "
|
||||
" Нумерация строк включена
|
||||
set number
|
||||
|
||||
" Нумерация строк абсолютная "
|
||||
" Нумерация строк абсолютная
|
||||
set nornu
|
||||
|
||||
" Использовать меню в статусной строке "
|
||||
" Использовать меню в статусной строке
|
||||
set wildmenu
|
||||
|
||||
" Клавиша для переключения между пунктами меню "
|
||||
" Клавиша для переключения между пунктами меню
|
||||
set wildcharm=<Tab>
|
||||
|
||||
" Всегда отображать статусную строку для каждого окна "
|
||||
" Всегда отображать статусную строку для каждого окна
|
||||
set laststatus=2
|
||||
|
||||
" Отображение набираемой в данный момент команды в правом нижнем углу экрана "
|
||||
" Отображение набираемой в данный момент команды в правом нижнем углу экрана
|
||||
set showcmd
|
||||
|
||||
" Пробельные символы "
|
||||
" Пробельные символы
|
||||
set listchars=tab:>·,trail:~,extends:>,precedes:<,space:␣
|
||||
|
||||
" Включение отображения пробельных символов "
|
||||
" Включение отображения пробельных символов
|
||||
set list
|
||||
|
||||
" Копирование выравнивания от предыдущей строки "
|
||||
" Копирование выравнивания от предыдущей строки
|
||||
set copyindent
|
||||
|
||||
"
|
||||
set clipboard^=unnamed,unnamedplus
|
||||
"}}}
|
||||
|
||||
map <leader>b :Bufstop<CR> " get a visual on the buffers
|
||||
map <leader>w :BufstopPreview<CR> " switch files by moving inside the window
|
||||
map <leader>a :BufstopModeFast<CR> " a command for quick switching
|
||||
map <C-tab> :BufstopBack<CR>
|
||||
map <S-tab> :BufstopForward<CR>
|
||||
let g:BufstopAutoSpeedToggle = 1 " now I can press ,3,3,3 to cycle the last 3 buffers
|
||||
let g:BufstopSorting = "none"
|
||||
|
||||
|
||||
"{{{ Раскладки клавиатуры
|
||||
let g:XkbSwitchEnabled = 1
|
||||
let g:XkbSwitchNLayout = 'us'
|
||||
@ -363,10 +432,10 @@ autocmd FileType javascript,c,cpp,java,html,python,ruby,tex,vim EnableStripWhite
|
||||
"}}}
|
||||
|
||||
"{{{1 Статусная строка
|
||||
" Всегда отображать статусную строку для каждого окна "
|
||||
" Всегда отображать статусную строку для каждого окна
|
||||
set laststatus=2
|
||||
|
||||
" Всегда отображать перечень буферов "
|
||||
" Всегда отображать перечень буферов
|
||||
set showtabline=2
|
||||
" \ [ 'fugitive', 'readonly', 'filename', 'modified' ] ],
|
||||
" \ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}',
|
||||
@ -468,6 +537,66 @@ if executable('ag')
|
||||
let g:ctrlp_use_caching = 0
|
||||
endif
|
||||
|
||||
"""
|
||||
""" Settings from mswin.vim
|
||||
"""
|
||||
if has("clipboard")
|
||||
" CTRL-X and SHIFT-Del are Cut
|
||||
vnoremap <C-X> "+x
|
||||
vnoremap <S-Del> "+x
|
||||
|
||||
" CTRL-C and CTRL-Insert are Copy
|
||||
vnoremap <C-C> "+y
|
||||
vnoremap <C-Insert> "+y
|
||||
|
||||
" CTRL-V and SHIFT-Insert are Paste
|
||||
map <C-V> "+gP
|
||||
map <S-Insert> "+gP
|
||||
|
||||
cmap <C-V> <C-R>+
|
||||
cmap <S-Insert> <C-R>+
|
||||
endif
|
||||
|
||||
" Pasting blockwise and linewise selections is not possible in Insert and
|
||||
" Visual mode without the +virtualedit feature. They are pasted as if they
|
||||
" were characterwise instead.
|
||||
" Uses the paste.vim autoload script.
|
||||
" Use CTRL-G u to have CTRL-Z only undo the paste.
|
||||
|
||||
if 1
|
||||
exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']
|
||||
exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']
|
||||
endif
|
||||
|
||||
imap <S-Insert> <C-V>
|
||||
vmap <S-Insert> <C-V>
|
||||
|
||||
" Use CTRL-Q to do what CTRL-V used to do
|
||||
noremap <C-Q> <C-V>
|
||||
|
||||
" Use CTRL-S for saving, also in Insert mode (<C-O> doesn't work well when
|
||||
" using completions).
|
||||
noremap <C-S> :update<CR>
|
||||
vnoremap <C-S> <C-C>:update<CR>
|
||||
inoremap <C-S> <Esc>:update<CR>gi
|
||||
|
||||
" For CTRL-V to work autoselect must be off.
|
||||
" On Unix we have two selections, autoselect can be used.
|
||||
if !has("unix")
|
||||
set guioptions-=a
|
||||
endif
|
||||
|
||||
" CTRL-Z is Undo; not in cmdline though
|
||||
noremap <C-Z> u
|
||||
inoremap <C-Z> <C-O>u
|
||||
|
||||
" CTRL-Y is Redo (although not repeat); not in cmdline though
|
||||
noremap <C-Y> <C-R>
|
||||
inoremap <C-Y> <C-O><C-R>
|
||||
"""
|
||||
"""
|
||||
"""
|
||||
|
||||
" Use a leader instead of the actual named binding
|
||||
nmap <leader>p :CtrlP<cr>
|
||||
|
||||
@ -487,15 +616,15 @@ for c in range('1', '9')
|
||||
endfor
|
||||
"1}}}
|
||||
|
||||
" Переход к последней позиции при открытии файла "
|
||||
" Переход к последней позиции при открытии файла
|
||||
if has("autocmd")
|
||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
|
||||
endif
|
||||
|
||||
" Открыть файл настроек "
|
||||
" Открыть файл настроек
|
||||
nmap <silent> <leader>vie :e $MYVIMRC<CR>
|
||||
|
||||
" Перезагрузить файл настроек "
|
||||
" Перезагрузить файл настроек
|
||||
nmap <silent> <leader>vis :so $MYVIMRC<CR>
|
||||
|
||||
augroup reload_vimrc
|
||||
@ -503,6 +632,9 @@ augroup reload_vimrc
|
||||
autocmd BufWritePost $MYVIMRC nested source $MYVIMRC
|
||||
augroup END
|
||||
|
||||
" Запись файл с использованием sudo
|
||||
cmap w!! w !sudo tee > /dev/null %
|
||||
|
||||
"{{{ Neomake
|
||||
" Запускать после записи или чтения файла
|
||||
if exists(":Neomake")
|
||||
@ -517,7 +649,7 @@ function! LocationNext()
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" <leader>e для перехода к следующей ошибке или предупреждению "
|
||||
" <leader>e для перехода к следующей ошибке или предупреждению
|
||||
nnoremap <leader>ee :call LocationNext()<cr>
|
||||
|
||||
let g:neomake_make_maker = {
|
||||
@ -527,10 +659,10 @@ let g:neomake_make_maker = {
|
||||
\ }
|
||||
"}}}
|
||||
|
||||
" Отмена автоматического комментирования кода при вставке из буфера "
|
||||
" Отмена автоматического комментирования кода при вставке из буфера
|
||||
autocmd FileType * setlocal formatoptions-=cro
|
||||
|
||||
" Запрет TAB для markdown "
|
||||
" Запрет TAB для markdown
|
||||
autocmd FileType markdown set expandtab
|
||||
|
||||
autocmd FileType cmake setlocal ts=2 sts=2 sw=2 et
|
||||
@ -563,11 +695,11 @@ fun! IgnoreSomeCasesSpell()
|
||||
endfun
|
||||
autocmd BufRead,BufNewFile * :call IgnoreSomeCasesSpell()
|
||||
|
||||
" Выбор Набора языков для проверки орфографии "
|
||||
" Выбор Набора языков для проверки орфографии
|
||||
map <C-F7> :call ChangeSpellLang()<CR>
|
||||
imap <C-F7> <Esc>:call ChangeSpellLang()<CR>
|
||||
|
||||
" Выбор альтернатив для исправления "
|
||||
" Выбор альтернатив для исправления
|
||||
imap <F7> <C-X>s
|
||||
map <F7> z=
|
||||
map <S-F7> ]s
|
||||
@ -603,28 +735,28 @@ map <F12> :emenu Encoding.<Tab>
|
||||
"}}}
|
||||
|
||||
"{{{ Easymotion
|
||||
" Не включать команды по умолчанию "
|
||||
" Не включать команды по умолчанию
|
||||
let g:EasyMotion_do_mapping = 0
|
||||
|
||||
" Умный регистр "
|
||||
" Умный регистр
|
||||
let g:EasyMotion_smartcase = 1
|
||||
|
||||
" <Leader>ec{char} для перехода к {char} "
|
||||
" <Leader>ec{char} для перехода к {char}
|
||||
map <Leader>ec <Plug>(easymotion-bd-f)
|
||||
nmap <Leader>ec <Plug>(easymotion-overwin-f)
|
||||
|
||||
" s{char}{char} для перехода к {char}{char} "
|
||||
" s{char}{char} для перехода к {char}{char}
|
||||
nmap s <Plug>(easymotion-overwin-f2)
|
||||
|
||||
" Переход к строке "
|
||||
" Переход к строке
|
||||
map <Leader>eg <Plug>(easymotion-bd-jk)
|
||||
nmap <Leader>eg <Plug>(easymotion-overwin-line)
|
||||
|
||||
" Переход к слову "
|
||||
" Переход к слову
|
||||
map <Leader>ew <Plug>(easymotion-bd-w)
|
||||
nmap <Leader>ew <Plug>(easymotion-overwin-w)
|
||||
|
||||
" Навигация по строкам "
|
||||
" Навигация по строкам
|
||||
map <Leader>el <Plug>(easymotion-lineforward)
|
||||
map <Leader>ej <Plug>(easymotion-j)
|
||||
map <Leader>ek <Plug>(easymotion-k)
|
||||
@ -675,6 +807,10 @@ xmap ga <Plug>(EasyAlign)
|
||||
nmap ga <Plug>(EasyAlign)
|
||||
"}}}
|
||||
|
||||
"{{{ Отключение обработки клавиши BackSpace в плагине vim-stabs
|
||||
let g:stabs_maps = 'toOc='
|
||||
"}}}
|
||||
|
||||
"{{{ AsciiDoctor
|
||||
" What to use for HTML, default `asciidoctor`.
|
||||
let g:asciidoctor_executable = 'asciidoctor'
|
||||
|
Reference in New Issue
Block a user