mirror of
https://github.com/vbrandl/dotfiles
synced 2024-11-26 17:35:12 +01:00
Update vom config
This commit is contained in:
parent
c070f39ba9
commit
65d7f4b3dd
@ -96,7 +96,7 @@ let s:plug_src = 'https://github.com/junegunn/vim-plug.git'
|
|||||||
let s:plug_tab = get(s:, 'plug_tab', -1)
|
let s:plug_tab = get(s:, 'plug_tab', -1)
|
||||||
let s:plug_buf = get(s:, 'plug_buf', -1)
|
let s:plug_buf = get(s:, 'plug_buf', -1)
|
||||||
let s:mac_gui = has('gui_macvim') && has('gui_running')
|
let s:mac_gui = has('gui_macvim') && has('gui_running')
|
||||||
let s:is_win = has('win32') || has('win64')
|
let s:is_win = has('win32')
|
||||||
let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win)
|
let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win)
|
||||||
let s:vim8 = has('patch-8.0.0039') && exists('*job_start')
|
let s:vim8 = has('patch-8.0.0039') && exists('*job_start')
|
||||||
let s:me = resolve(expand('<sfile>:p'))
|
let s:me = resolve(expand('<sfile>:p'))
|
||||||
@ -121,6 +121,9 @@ function! plug#begin(...)
|
|||||||
else
|
else
|
||||||
return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
|
return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
|
||||||
endif
|
endif
|
||||||
|
if fnamemodify(home, ':t') ==# 'plugin' && fnamemodify(home, ':h') ==# s:first_rtp
|
||||||
|
return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.')
|
||||||
|
endif
|
||||||
|
|
||||||
let g:plug_home = home
|
let g:plug_home = home
|
||||||
let g:plugs = {}
|
let g:plugs = {}
|
||||||
@ -190,6 +193,14 @@ function! s:ask_no_interrupt(...)
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:lazy(plug, opt)
|
||||||
|
return has_key(a:plug, a:opt) &&
|
||||||
|
\ (empty(s:to_a(a:plug[a:opt])) ||
|
||||||
|
\ !isdirectory(a:plug.dir) ||
|
||||||
|
\ len(s:glob(s:rtp(a:plug), 'plugin')) ||
|
||||||
|
\ len(s:glob(s:rtp(a:plug), 'after/plugin')))
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! plug#end()
|
function! plug#end()
|
||||||
if !exists('g:plugs')
|
if !exists('g:plugs')
|
||||||
return s:err('Call plug#begin() first')
|
return s:err('Call plug#begin() first')
|
||||||
@ -211,7 +222,7 @@ function! plug#end()
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
let plug = g:plugs[name]
|
let plug = g:plugs[name]
|
||||||
if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for')
|
if get(s:loaded, name, 0) || !s:lazy(plug, 'on') && !s:lazy(plug, 'for')
|
||||||
let s:loaded[name] = 1
|
let s:loaded[name] = 1
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@ -442,16 +453,21 @@ function! plug#load(...)
|
|||||||
if !exists('g:plugs')
|
if !exists('g:plugs')
|
||||||
return s:err('plug#begin was not called')
|
return s:err('plug#begin was not called')
|
||||||
endif
|
endif
|
||||||
let unknowns = filter(copy(a:000), '!has_key(g:plugs, v:val)')
|
let names = a:0 == 1 && type(a:1) == s:TYPE.list ? a:1 : a:000
|
||||||
|
let unknowns = filter(copy(names), '!has_key(g:plugs, v:val)')
|
||||||
if !empty(unknowns)
|
if !empty(unknowns)
|
||||||
let s = len(unknowns) > 1 ? 's' : ''
|
let s = len(unknowns) > 1 ? 's' : ''
|
||||||
return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', ')))
|
return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', ')))
|
||||||
end
|
end
|
||||||
for name in a:000
|
let unloaded = filter(copy(names), '!get(s:loaded, v:val, 0)')
|
||||||
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
if !empty(unloaded)
|
||||||
endfor
|
for name in unloaded
|
||||||
call s:dobufread(a:000)
|
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
return 1
|
endfor
|
||||||
|
call s:dobufread(unloaded)
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:remove_triggers(name)
|
function! s:remove_triggers(name)
|
||||||
@ -575,7 +591,7 @@ function! s:infer_properties(name, repo)
|
|||||||
let uri = repo
|
let uri = repo
|
||||||
else
|
else
|
||||||
if repo !~ '/'
|
if repo !~ '/'
|
||||||
let repo = 'vim-scripts/'. repo
|
throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo)
|
||||||
endif
|
endif
|
||||||
let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git')
|
let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git')
|
||||||
let uri = printf(fmt, repo)
|
let uri = printf(fmt, repo)
|
||||||
@ -597,7 +613,7 @@ function! plug#helptags()
|
|||||||
return s:err('plug#begin was not called')
|
return s:err('plug#begin was not called')
|
||||||
endif
|
endif
|
||||||
for spec in values(g:plugs)
|
for spec in values(g:plugs)
|
||||||
let docd = join([spec.dir, 'doc'], '/')
|
let docd = join([s:rtp(spec), 'doc'], '/')
|
||||||
if isdirectory(docd)
|
if isdirectory(docd)
|
||||||
silent! execute 'helptags' s:esc(docd)
|
silent! execute 'helptags' s:esc(docd)
|
||||||
endif
|
endif
|
||||||
@ -755,6 +771,9 @@ function! s:prepare(...)
|
|||||||
execute 'silent! unmap <buffer>' k
|
execute 'silent! unmap <buffer>' k
|
||||||
endfor
|
endfor
|
||||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell
|
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell
|
||||||
|
if exists('+colorcolumn')
|
||||||
|
setlocal colorcolumn=
|
||||||
|
endif
|
||||||
setf vim-plug
|
setf vim-plug
|
||||||
if exists('g:syntax_on')
|
if exists('g:syntax_on')
|
||||||
call s:syntax()
|
call s:syntax()
|
||||||
@ -774,8 +793,10 @@ function! s:assign_name()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:chsh(swap)
|
function! s:chsh(swap)
|
||||||
let prev = [&shell, &shellredir]
|
let prev = [&shell, &shellcmdflag, &shellredir]
|
||||||
if !s:is_win && a:swap
|
if s:is_win
|
||||||
|
set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1
|
||||||
|
elseif a:swap
|
||||||
set shell=sh shellredir=>%s\ 2>&1
|
set shell=sh shellredir=>%s\ 2>&1
|
||||||
endif
|
endif
|
||||||
return prev
|
return prev
|
||||||
@ -783,15 +804,23 @@ endfunction
|
|||||||
|
|
||||||
function! s:bang(cmd, ...)
|
function! s:bang(cmd, ...)
|
||||||
try
|
try
|
||||||
let [sh, shrd] = s:chsh(a:0)
|
let [sh, shellcmdflag, shrd] = s:chsh(a:0)
|
||||||
" FIXME: Escaping is incomplete. We could use shellescape with eval,
|
" FIXME: Escaping is incomplete. We could use shellescape with eval,
|
||||||
" but it won't work on Windows.
|
" but it won't work on Windows.
|
||||||
let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||||
let g:_plug_bang = '!'.escape(cmd, '#!%')
|
if s:is_win
|
||||||
|
let batchfile = tempname().'.bat'
|
||||||
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||||
|
let cmd = batchfile
|
||||||
|
endif
|
||||||
|
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
|
||||||
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
||||||
finally
|
finally
|
||||||
unlet g:_plug_bang
|
unlet g:_plug_bang
|
||||||
let [&shell, &shellredir] = [sh, shrd]
|
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
|
||||||
|
if s:is_win
|
||||||
|
call delete(batchfile)
|
||||||
|
endif
|
||||||
endtry
|
endtry
|
||||||
return v:shell_error ? 'Exit status: ' . v:shell_error : ''
|
return v:shell_error ? 'Exit status: ' . v:shell_error : ''
|
||||||
endfunction
|
endfunction
|
||||||
@ -890,7 +919,7 @@ function! s:finish(pull)
|
|||||||
call add(msgs, "Press 'R' to retry.")
|
call add(msgs, "Press 'R' to retry.")
|
||||||
endif
|
endif
|
||||||
if a:pull && len(s:update.new) < len(filter(getline(5, '$'),
|
if a:pull && len(s:update.new) < len(filter(getline(5, '$'),
|
||||||
\ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0"))
|
\ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'"))
|
||||||
call add(msgs, "Press 'D' to see the updated changes.")
|
call add(msgs, "Press 'D' to see the updated changes.")
|
||||||
endif
|
endif
|
||||||
echo join(msgs, ' ')
|
echo join(msgs, ' ')
|
||||||
@ -990,6 +1019,8 @@ function! s:update_impl(pull, force, args) abort
|
|||||||
let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input'
|
let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : ''
|
||||||
|
|
||||||
" Python version requirement (>= 2.7)
|
" Python version requirement (>= 2.7)
|
||||||
if python && !has('python3') && !ruby && !use_job && s:update.threads > 1
|
if python && !has('python3') && !ruby && !use_job && s:update.threads > 1
|
||||||
redir => pyv
|
redir => pyv
|
||||||
@ -1081,7 +1112,7 @@ function! s:update_finish()
|
|||||||
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
|
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
|
||||||
\ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
|
\ (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.')
|
call s:log4(name, 'Updating submodules. This may take a while.')
|
||||||
let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir)
|
let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir)
|
||||||
endif
|
endif
|
||||||
let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
|
let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
@ -1173,10 +1204,15 @@ endfunction
|
|||||||
|
|
||||||
function! s:spawn(name, cmd, opts)
|
function! s:spawn(name, cmd, opts)
|
||||||
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
|
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
|
||||||
|
\ 'batchfile': (s:is_win && (s:nvim || s:vim8)) ? tempname().'.bat' : '',
|
||||||
\ 'new': get(a:opts, 'new', 0) }
|
\ 'new': get(a:opts, 'new', 0) }
|
||||||
let s:jobs[a:name] = job
|
let s:jobs[a:name] = job
|
||||||
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'],
|
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
|
||||||
\ has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd)
|
if !empty(job.batchfile)
|
||||||
|
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
|
||||||
|
let cmd = job.batchfile
|
||||||
|
endif
|
||||||
|
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
|
||||||
|
|
||||||
if s:nvim
|
if s:nvim
|
||||||
call extend(job, {
|
call extend(job, {
|
||||||
@ -1206,8 +1242,7 @@ function! s:spawn(name, cmd, opts)
|
|||||||
let job.lines = ['Failed to start job']
|
let job.lines = ['Failed to start job']
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]
|
let job.lines = s:lines(call('s:system', [cmd]))
|
||||||
let job.lines = s:lines(call('s:system', params))
|
|
||||||
let job.error = v:shell_error != 0
|
let job.error = v:shell_error != 0
|
||||||
let job.running = 0
|
let job.running = 0
|
||||||
endif
|
endif
|
||||||
@ -1227,6 +1262,9 @@ function! s:reap(name)
|
|||||||
call s:log(bullet, a:name, empty(result) ? 'OK' : result)
|
call s:log(bullet, a:name, empty(result) ? 'OK' : result)
|
||||||
call s:bar()
|
call s:bar()
|
||||||
|
|
||||||
|
if has_key(job, 'batchfile') && !empty(job.batchfile)
|
||||||
|
call delete(job.batchfile)
|
||||||
|
endif
|
||||||
call remove(s:jobs, a:name)
|
call remove(s:jobs, a:name)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -1293,7 +1331,7 @@ while 1 " Without TCO, Vim stack is bound to explode
|
|||||||
|
|
||||||
let name = keys(s:update.todo)[0]
|
let name = keys(s:update.todo)[0]
|
||||||
let spec = remove(s:update.todo, name)
|
let spec = remove(s:update.todo, name)
|
||||||
let new = !isdirectory(spec.dir)
|
let new = empty(globpath(spec.dir, '.git', 1))
|
||||||
|
|
||||||
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
|
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
|
||||||
redraw
|
redraw
|
||||||
@ -1944,8 +1982,19 @@ function! s:update_ruby()
|
|||||||
EOF
|
EOF
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:shellesc_cmd(arg)
|
||||||
|
let escaped = substitute(a:arg, '[&|<>()@^]', '^&', 'g')
|
||||||
|
let escaped = substitute(escaped, '%', '%%', 'g')
|
||||||
|
let escaped = substitute(escaped, '"', '\\^&', 'g')
|
||||||
|
let escaped = substitute(escaped, '\(\\\+\)\(\\^\)', '\1\1\2', 'g')
|
||||||
|
return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"'
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:shellesc(arg)
|
function! s:shellesc(arg)
|
||||||
return '"'.escape(a:arg, '"').'"'
|
if &shell =~# 'cmd.exe$'
|
||||||
|
return s:shellesc_cmd(a:arg)
|
||||||
|
endif
|
||||||
|
return shellescape(a:arg)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:glob_dir(path)
|
function! s:glob_dir(path)
|
||||||
@ -1983,11 +2032,19 @@ endfunction
|
|||||||
|
|
||||||
function! s:system(cmd, ...)
|
function! s:system(cmd, ...)
|
||||||
try
|
try
|
||||||
let [sh, shrd] = s:chsh(1)
|
let [sh, shellcmdflag, shrd] = s:chsh(1)
|
||||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||||
|
if s:is_win
|
||||||
|
let batchfile = tempname().'.bat'
|
||||||
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||||
|
let cmd = batchfile
|
||||||
|
endif
|
||||||
return system(s:is_win ? '('.cmd.')' : cmd)
|
return system(s:is_win ? '('.cmd.')' : cmd)
|
||||||
finally
|
finally
|
||||||
let [&shell, &shellredir] = [sh, shrd]
|
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
|
||||||
|
if s:is_win
|
||||||
|
call delete(batchfile)
|
||||||
|
endif
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -2022,7 +2079,7 @@ function! s:git_validate(spec, check_branch)
|
|||||||
" Check tag
|
" Check tag
|
||||||
if has_key(a:spec, 'tag')
|
if has_key(a:spec, 'tag')
|
||||||
let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
|
let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
|
||||||
if a:spec.tag !=# tag
|
if a:spec.tag !=# tag && a:spec.tag !~ '\*'
|
||||||
let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.',
|
let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.',
|
||||||
\ (empty(tag) ? 'N/A' : tag), a:spec.tag)
|
\ (empty(tag) ? 'N/A' : tag), a:spec.tag)
|
||||||
endif
|
endif
|
||||||
@ -2202,15 +2259,16 @@ function! s:status()
|
|||||||
let unloaded = 0
|
let unloaded = 0
|
||||||
let [cnt, total] = [0, len(g:plugs)]
|
let [cnt, total] = [0, len(g:plugs)]
|
||||||
for [name, spec] in items(g:plugs)
|
for [name, spec] in items(g:plugs)
|
||||||
|
let is_dir = isdirectory(spec.dir)
|
||||||
if has_key(spec, 'uri')
|
if has_key(spec, 'uri')
|
||||||
if isdirectory(spec.dir)
|
if is_dir
|
||||||
let [err, _] = s:git_validate(spec, 1)
|
let [err, _] = s:git_validate(spec, 1)
|
||||||
let [valid, msg] = [empty(err), empty(err) ? 'OK' : err]
|
let [valid, msg] = [empty(err), empty(err) ? 'OK' : err]
|
||||||
else
|
else
|
||||||
let [valid, msg] = [0, 'Not found. Try PlugInstall.']
|
let [valid, msg] = [0, 'Not found. Try PlugInstall.']
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if isdirectory(spec.dir)
|
if is_dir
|
||||||
let [valid, msg] = [1, 'OK']
|
let [valid, msg] = [1, 'OK']
|
||||||
else
|
else
|
||||||
let [valid, msg] = [0, 'Not found.']
|
let [valid, msg] = [0, 'Not found.']
|
||||||
@ -2219,7 +2277,7 @@ function! s:status()
|
|||||||
let cnt += 1
|
let cnt += 1
|
||||||
let ecnt += !valid
|
let ecnt += !valid
|
||||||
" `s:loaded` entry can be missing if PlugUpgraded
|
" `s:loaded` entry can be missing if PlugUpgraded
|
||||||
if valid && get(s:loaded, name, -1) == 0
|
if is_dir && get(s:loaded, name, -1) == 0
|
||||||
let unloaded = 1
|
let unloaded = 1
|
||||||
let msg .= ' (not loaded)'
|
let msg .= ' (not loaded)'
|
||||||
endif
|
endif
|
||||||
@ -2308,10 +2366,19 @@ function! s:preview_commit()
|
|||||||
endif
|
endif
|
||||||
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
|
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
|
||||||
try
|
try
|
||||||
let [sh, shrd] = s:chsh(1)
|
let [sh, shellcmdflag, shrd] = s:chsh(1)
|
||||||
execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha
|
let cmd = 'cd '.s:shellesc(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
|
||||||
|
if s:is_win
|
||||||
|
let batchfile = tempname().'.bat'
|
||||||
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||||
|
let cmd = batchfile
|
||||||
|
endif
|
||||||
|
execute 'silent %!' cmd
|
||||||
finally
|
finally
|
||||||
let [&shell, &shellredir] = [sh, shrd]
|
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
|
||||||
|
if s:is_win
|
||||||
|
call delete(batchfile)
|
||||||
|
endif
|
||||||
endtry
|
endtry
|
||||||
setlocal nomodifiable
|
setlocal nomodifiable
|
||||||
nnoremap <silent> <buffer> q :q<cr>
|
nnoremap <silent> <buffer> q :q<cr>
|
||||||
@ -2353,7 +2420,11 @@ function! s:diff()
|
|||||||
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
|
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
|
||||||
for [k, v] in plugs
|
for [k, v] in plugs
|
||||||
let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
|
let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
|
||||||
let diff = s:system_chomp('git log --graph --color=never --pretty=format:"%x01%h%x01%d%x01%s%x01%cr" '.s:shellesc(range), v.dir)
|
let cmd = 'git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)'))
|
||||||
|
if has_key(v, 'rtp')
|
||||||
|
let cmd .= ' -- '.s:shellesc(v.rtp)
|
||||||
|
endif
|
||||||
|
let diff = s:system_chomp(cmd, v.dir)
|
||||||
if !empty(diff)
|
if !empty(diff)
|
||||||
let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : ''
|
let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : ''
|
||||||
call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
|
call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
|
||||||
@ -2372,8 +2443,13 @@ function! s:diff()
|
|||||||
\ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : ''))
|
\ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : ''))
|
||||||
|
|
||||||
if cnts[0] || cnts[1]
|
if cnts[0] || cnts[1]
|
||||||
nnoremap <silent> <buffer> <cr> :silent! call <SID>preview_commit()<cr>
|
nnoremap <silent> <buffer> <plug>(plug-preview) :silent! call <SID>preview_commit()<cr>
|
||||||
nnoremap <silent> <buffer> o :silent! call <SID>preview_commit()<cr>
|
if empty(maparg("\<cr>", 'n'))
|
||||||
|
nmap <buffer> <cr> <plug>(plug-preview)
|
||||||
|
endif
|
||||||
|
if empty(maparg('o', 'n'))
|
||||||
|
nmap <buffer> o <plug>(plug-preview)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
if cnts[0]
|
if cnts[0]
|
||||||
nnoremap <silent> <buffer> X :call <SID>revert()<cr>
|
nnoremap <silent> <buffer> X :call <SID>revert()<cr>
|
||||||
|
@ -1,75 +1,168 @@
|
|||||||
function! Cond(cond, ...)
|
function! Cond(cond, ...)
|
||||||
let opts = get(a:000, 0, {})
|
let opts=get(a:000, 0, {})
|
||||||
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
|
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call plug#begin('~/.vim/plugged')
|
call plug#begin('~/.vim/plugged')
|
||||||
|
|
||||||
Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes'
|
|
||||||
|
|
||||||
" colorschemes
|
" colorschemes
|
||||||
" Plug 'dracula/vim'
|
Plug 'lifepillar/vim-solarized8'
|
||||||
Plug 'joshdick/onedark.vim'
|
|
||||||
|
|
||||||
|
" editorconfig support
|
||||||
Plug 'editorconfig/editorconfig-vim'
|
Plug 'editorconfig/editorconfig-vim'
|
||||||
|
|
||||||
" Notetaking
|
" (un)comment
|
||||||
Plug 'xolox/vim-misc'
|
Plug 'tpope/vim-commentary'
|
||||||
Plug 'xolox/vim-notes'
|
|
||||||
|
|
||||||
Plug 'Rykka/riv.vim', { 'for': 'rst' } " reStructuredText
|
" handle surroundings
|
||||||
|
Plug 'tpope/vim-surround'
|
||||||
|
|
||||||
Plug 'ervandew/supertab' " simple autocomplete
|
" make plugin commands repeatable
|
||||||
Plug 'tpope/vim-commentary' " (un)comment
|
Plug 'tpope/vim-repeat'
|
||||||
Plug 'tpope/vim-surround' " handle surroundings
|
|
||||||
Plug 'tpope/vim-repeat' " make plugin commands repeatable
|
|
||||||
Plug 'tpope/vim-dispatch' " dispatch into tmux panes
|
|
||||||
Plug 'vim-scripts/ReplaceWithRegister'
|
|
||||||
Plug 'mattn/gist-vim' | Plug 'mattn/webapi-vim' " create gist from within vim
|
|
||||||
Plug 'Raimondi/delimitMate' " autoclose quotes and brackets
|
|
||||||
Plug 'tpope/vim-fugitive' " awesome git plugin
|
|
||||||
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
|
|
||||||
Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
|
|
||||||
Plug 'ctrlpvim/ctrlp.vim' " fuzzy file finder
|
|
||||||
Plug 'ryanoasis/vim-devicons' " icons
|
|
||||||
Plug 'neomake/neomake' " async linting and making
|
|
||||||
Plug 'benmills/vimux', Cond(!empty($TMUX)) " tmux support
|
|
||||||
Plug 'sickill/vim-pasta' " context aware pasting
|
|
||||||
Plug 'junegunn/goyo.vim' " distraction free writing
|
|
||||||
Plug 'bronson/vim-trailing-whitespace' " highlight unwanted whitespaces
|
|
||||||
|
|
||||||
Plug 'SirVer/ultisnips'
|
" dispatch into tmux panes
|
||||||
Plug 'honza/vim-snippets'
|
Plug 'tpope/vim-dispatch', Cond(!empty($TMUX))
|
||||||
Plug 'antoyo/vim-licenses'
|
|
||||||
|
|
||||||
" Python
|
" awesome git plugin
|
||||||
Plug 'davidhalter/jedi-vim', { 'for': 'python' } " python autocomplete
|
Plug 'tpope/vim-fugitive'
|
||||||
|
|
||||||
" Rust plugins
|
" create gist from within vim
|
||||||
Plug 'racer-rust/vim-racer', { 'for': 'rust' } " rust autocomplete
|
Plug 'mattn/gist-vim' | Plug 'mattn/webapi-vim'
|
||||||
if !empty($TMUX)
|
|
||||||
Plug 'jtdowney/vimux-cargo', { 'for': 'rust' } " run cargo in tmux using vimux
|
|
||||||
endif
|
|
||||||
|
|
||||||
Plug 'sheerun/vim-polyglot' " syntax support for many languages
|
" autoclose quotes and brackets
|
||||||
|
Plug 'Raimondi/delimitMate'
|
||||||
|
let delimitMate_expand_cr=1
|
||||||
|
|
||||||
function! BuildYCM(info)
|
" async linting and making
|
||||||
if a:info.status = 'installed' || a:info.force
|
Plug 'neomake/neomake'
|
||||||
!./install.py --clang-completer --racer-completer
|
|
||||||
endif
|
" tmux support if inside tmux
|
||||||
|
" run cargo in tmux using vimux
|
||||||
|
Plug 'benmills/vimux', Cond(!empty($TMUX)) | Plug 'jtdowney/vimux-cargo', { 'for': 'rust' }
|
||||||
|
" vimux mappings
|
||||||
|
" Prompt for a command
|
||||||
|
map <Leader>vp :VimuxPromptCommand<CR>
|
||||||
|
" Prompt for a make command
|
||||||
|
map <Leader>vm :VimuxPromptCommand("make ")<CR>
|
||||||
|
" Inspect runner pane
|
||||||
|
map <Leader>vi :VimuxInspectRunner<CR>
|
||||||
|
" Close runner
|
||||||
|
map <Leader>vq :VimuxCloseRunner<CR>
|
||||||
|
" Rerun last command
|
||||||
|
map <Leader>vv :VimuxRunLastCommand<CR>
|
||||||
|
" Stop running command
|
||||||
|
map <Leader>vs :VimuxInterruptRunner<CR>
|
||||||
|
|
||||||
|
" distraction free writing
|
||||||
|
Plug 'junegunn/goyo.vim'
|
||||||
|
" close Goyo *and* vim with :q
|
||||||
|
function! s:goyo_enter()
|
||||||
|
let b:quitting=0
|
||||||
|
let b:quitting_bang=0
|
||||||
|
autocmd QuitPre <buffer> let b:quitting=1
|
||||||
|
cabbrev <buffer> q! let b:quitting_bang=1 <bar> q!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:goyo_leave()
|
||||||
|
" Quit Vim if this is the only remaining buffer
|
||||||
|
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
|
||||||
|
if b:quitting_bang
|
||||||
|
qa!
|
||||||
|
else
|
||||||
|
qa
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
autocmd! User GoyoEnter call <SID>goyo_enter()
|
||||||
|
autocmd! User GoyoLeave call <SID>goyo_leave()
|
||||||
|
|
||||||
|
" highlight unwanted whitespace
|
||||||
|
Plug 'bronson/vim-trailing-whitespace'
|
||||||
|
|
||||||
|
" fuzzy file finder
|
||||||
|
Plug 'ctrlpvim/ctrlp.vim'
|
||||||
|
|
||||||
|
" replace text with the content of a register
|
||||||
|
Plug 'vim-scripts/ReplaceWithRegister'
|
||||||
|
|
||||||
|
" paste with indent adjusted to context
|
||||||
|
Plug 'sickill/vim-pasta'
|
||||||
|
|
||||||
|
" rust support
|
||||||
|
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
|
||||||
|
" run rustfmt when saving a file
|
||||||
|
let g:rustfmt_autosave=1
|
||||||
|
|
||||||
|
" deoplete for auto completion
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||||
|
else
|
||||||
|
Plug 'Shougo/deoplete.nvim'
|
||||||
|
Plug 'roxma/nvim-yarp'
|
||||||
|
Plug 'roxma/vim-hug-neovim-rpc'
|
||||||
|
endif
|
||||||
|
let g:deoplete#enable_at_startup=1
|
||||||
|
" deoplete completion for rust
|
||||||
|
Plug 'sebastianmarkow/deoplete-rust'
|
||||||
|
let g:deoplete#sources#rust#racer_binary='/usr/bin/racer'
|
||||||
|
" let g:deoplete#sources#rust#rust_source_path = '$(rustc --print sysroot)/lib/rustlib/src/rust/src'
|
||||||
|
if executable('rustc')
|
||||||
|
" if src installed via rustup, we can get it by running
|
||||||
|
" rustc --print sysroot then appending the rest of the path
|
||||||
|
let rustc_root = systemlist('rustc --print sysroot')[0]
|
||||||
|
let rustc_src_dir = rustc_root . '/lib/rustlib/src/rust/src'
|
||||||
|
if isdirectory(rustc_src_dir)
|
||||||
|
let g:deoplete#sources#rust#rust_source_path = rustc_src_dir
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has('vim')
|
" Plug 'racer-rust/vim-racer', { 'for': 'rust' } " rust autocomplete
|
||||||
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
|
" let g:racer_cmd = "/usr/bin/racer"
|
||||||
endif
|
|
||||||
|
" syntax support for many languages
|
||||||
|
Plug 'sheerun/vim-polyglot'
|
||||||
|
" disable latex in polyglot to use vimtex
|
||||||
|
let g:polyglot_disabled=['latex']
|
||||||
|
|
||||||
|
" latex support
|
||||||
|
Plug 'lervag/vimtex'
|
||||||
|
|
||||||
|
" Vimwiki
|
||||||
|
Plug 'vimwiki/vimwiki'
|
||||||
|
let g:vimwiki_list=[{'path': '~/Dokumente/notes',
|
||||||
|
\ 'syntax': 'markdown',
|
||||||
|
\ 'ext': '.md'}]
|
||||||
|
|
||||||
|
Plug 'antoyo/vim-licenses'
|
||||||
|
let g:licenses_copyright_holders_name='Brandl, Valentin <mail@vbrandl.net>'
|
||||||
|
let g:licenses_authors_name='Brandl, Valentin <mail@vbrandl.net>'
|
||||||
|
|
||||||
|
" haskell support
|
||||||
|
Plug 'neovimhaskell/haskell-vim'
|
||||||
|
|
||||||
|
" elm support
|
||||||
|
Plug 'elmcast/elm-vim'
|
||||||
|
|
||||||
|
"" nerdtree file manager
|
||||||
|
"Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
|
||||||
|
"Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
|
||||||
|
"" Toggle NERDTree
|
||||||
|
"nmap <silent> <leader>k :NERDTreeToggle<cr>
|
||||||
|
"" expand to the path of the file in the current buffer
|
||||||
|
"nmap <silent> <leader>y :NERDTreeFind<cr>
|
||||||
|
""autocmd BufWinEnter * NERDTreeMirror
|
||||||
|
"let NERDTreeShowHidden=1
|
||||||
|
""let NERDTreeDirArrowExpandable = '▷'
|
||||||
|
""let NERDTreeDirArrowCollapsible = '▼'
|
||||||
|
|
||||||
|
"Plug 'ervandew/supertab' " simple autocomplete
|
||||||
|
|
||||||
|
"Plug 'SirVer/ultisnips'
|
||||||
|
"Plug 'honza/vim-snippets'
|
||||||
|
|
||||||
|
" Python
|
||||||
|
"Plug 'davidhalter/jedi-vim', { 'for': 'python' } " python autocomplete
|
||||||
|
|
||||||
" Plug 'artur-shaik/vim-javacomplete2'
|
" Plug 'artur-shaik/vim-javacomplete2'
|
||||||
|
|
||||||
Plug 'lervag/vimtex'
|
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
" vim: set filetype=vim ts=4 sw=4 tw=120 noet :
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
" vundle
|
" set vim mode
|
||||||
" set vIM mode
|
|
||||||
set nocompatible
|
set nocompatible
|
||||||
|
|
||||||
source ~/.vim/plugins.vim
|
source ~/.vim/plugins.vim
|
||||||
@ -15,41 +14,53 @@ else
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !has('nvim')
|
syntax enable
|
||||||
" encrypt files using blowfish
|
" set transparent background
|
||||||
set cryptmethod=blowfish2
|
" let g:solarized_termtrans=1
|
||||||
|
" use italics
|
||||||
|
let g:solarized_term_italics=1
|
||||||
|
" filetype-specific syntax highlighting groups
|
||||||
|
let g:solarized_extra_hi_groups=1
|
||||||
|
" let g:solarized_contrast="high"
|
||||||
|
" let g:solarized_visibility="high"
|
||||||
|
set background=dark
|
||||||
|
colorscheme solarized8
|
||||||
|
" underline spelling
|
||||||
|
highlight clear SpellBad
|
||||||
|
highlight SpellBad cterm=undercurl
|
||||||
|
|
||||||
" Get the defaults that most users want.
|
" true color
|
||||||
source $VIMRUNTIME/defaults.vim
|
set termguicolors
|
||||||
endif
|
" make true colors work in tmux
|
||||||
|
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||||
|
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||||
|
|
||||||
syntax on
|
" make comments and HTML attributes italic
|
||||||
colorscheme onedark
|
"highlight Comment cterm=italic
|
||||||
|
"highlight htmlArg cterm=italic
|
||||||
|
|
||||||
|
"highlight Normal ctermbg=NONE guibg=NONE
|
||||||
|
"highlight NonText ctermbg=NONE guibg=NONE
|
||||||
|
|
||||||
" files and backups
|
" files and backups
|
||||||
set directory=$HOME/.vim/swapfiles//
|
set directory=$HOME/.vim/swapfiles//
|
||||||
" set backupdir=$HOME/.vim/backupdir//
|
" set backupdir=$HOME/.vim/backupdir//
|
||||||
set undodir=$HOME/.vim/undofiles//
|
set undodir=$HOME/.vim/undofiles//
|
||||||
" search tags file downwards from the direcotry of the edited file
|
|
||||||
set tags=./tags;
|
|
||||||
|
|
||||||
set clipboard=unnamedplus " yank into system clipboard
|
" yank into system clipboard
|
||||||
|
set clipboard=unnamedplus
|
||||||
|
|
||||||
" Only do this part when compiled with support for autocommands.
|
" Only do this part when compiled with support for autocommands.
|
||||||
if has("autocmd")
|
if has("autocmd")
|
||||||
|
|
||||||
" Put these in an autocmd group, so that we can delete them easily.
|
" Put these in an autocmd group, so that we can delete them easily.
|
||||||
augroup vimrcEx
|
augroup vimrcEx
|
||||||
au!
|
au!
|
||||||
|
|
||||||
" For all text files set 'textwidth' to 78 characters.
|
autocmd FileType text setlocal foldtext<
|
||||||
autocmd FileType text setlocal textwidth=120
|
|
||||||
|
|
||||||
autocmd FileType tex setlocal foldtext<
|
|
||||||
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" remember curser position
|
" remember cursor position
|
||||||
autocmd BufReadPost *
|
autocmd BufReadPost *
|
||||||
\ if line("'\"") > 1 && line("'\"") <= line("$") |
|
\ if line("'\"") > 1 && line("'\"") <= line("$") |
|
||||||
\ exe "normal! g`\"" |
|
\ exe "normal! g`\"" |
|
||||||
@ -57,48 +68,60 @@ if has("autocmd")
|
|||||||
|
|
||||||
endif " has("autocmd")
|
endif " has("autocmd")
|
||||||
|
|
||||||
" Add optional packages.
|
if !has('nvim')
|
||||||
"
|
" Get the defaults that most users want.
|
||||||
" The matchit plugin makes the % command work better, but it is not backwards
|
source $VIMRUNTIME/defaults.vim
|
||||||
" compatible.
|
" The matchit plugin makes the % command work better
|
||||||
if has('syntax') && has('eval') && !has('nvim')
|
packadd matchit
|
||||||
packadd matchit
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
set autoindent " always set autoindenting on
|
" always set autoindenting on
|
||||||
set smartindent " smart indent; stop indent when closing brackets etc
|
set autoindent
|
||||||
|
" smart indent; stop indent when closing brackets etc
|
||||||
|
set smartindent
|
||||||
|
|
||||||
" searching
|
" searching
|
||||||
set hlsearch " highlight search result
|
" highlight search result
|
||||||
set ignorecase " ignore case
|
set hlsearch
|
||||||
set smartcase " case-sensitive if expression contains capital letters
|
" ignore case
|
||||||
set incsearch " incremental search
|
set ignorecase
|
||||||
|
" case-sensitive if expression contains capital letters
|
||||||
|
set smartcase
|
||||||
|
" incremental search
|
||||||
|
set incsearch
|
||||||
set nolazyredraw
|
set nolazyredraw
|
||||||
|
|
||||||
" delete whitespace, line break and char using <BS>
|
" delete whitespace, line break and char using <BS>
|
||||||
set backspace=indent,eol,start
|
set backspace=indent,eol,start
|
||||||
set ruler " always show curser position
|
" always show curser position
|
||||||
set history=1000 " keep 1000 lines of history
|
set ruler
|
||||||
|
" keep 1000 lines of history
|
||||||
|
set history=1000
|
||||||
set textwidth=120
|
set textwidth=120
|
||||||
set colorcolumn=+1
|
set colorcolumn=+1
|
||||||
set number " display absolute number of current line
|
" display absolute number of current line
|
||||||
set relativenumber " display relative line numbers
|
set number
|
||||||
set cursorline " highlight current line
|
" display relative line numbers
|
||||||
|
set relativenumber
|
||||||
|
" highlight current line
|
||||||
|
set cursorline
|
||||||
" encoding
|
" encoding
|
||||||
set fileencoding=UTF-8
|
set fileencoding=utf-8
|
||||||
" break at last word instead of last char
|
" break at last word instead of last char
|
||||||
set linebreak
|
set linebreak
|
||||||
|
|
||||||
set autoread " autoload file changes
|
" autoload file changes
|
||||||
|
set autoread
|
||||||
|
|
||||||
" tab control
|
" tab control
|
||||||
set noexpandtab " insert tabs
|
" insert spaces
|
||||||
|
set expandtab
|
||||||
set smarttab
|
set smarttab
|
||||||
set tabstop=4
|
set tabstop=4
|
||||||
set softtabstop=4
|
set softtabstop=4
|
||||||
set shiftwidth=4
|
set shiftwidth=4
|
||||||
set shiftround
|
set shiftround
|
||||||
set completeopt+=longest
|
"set completeopt+=longest
|
||||||
|
|
||||||
" invisible characters
|
" invisible characters
|
||||||
set list
|
set list
|
||||||
@ -106,68 +129,72 @@ set listchars=tab:→\ ,eol:¬,trail:⋅,extends:❯,precedes:❮
|
|||||||
set showbreak=↪
|
set showbreak=↪
|
||||||
|
|
||||||
" code folding settings
|
" code folding settings
|
||||||
set foldmethod=syntax " fold based on indent
|
" fold based on syntax
|
||||||
set foldnestmax=10 " deepest fold is 10 levels
|
set foldmethod=indent
|
||||||
set nofoldenable " don't fold by default
|
" don't fold by default
|
||||||
|
set nofoldenable
|
||||||
set foldlevel=1
|
set foldlevel=1
|
||||||
|
|
||||||
set ttyfast " faster redrawing
|
" smoother redrawing
|
||||||
|
set ttyfast
|
||||||
|
" diff with vertical split
|
||||||
set diffopt+=vertical
|
set diffopt+=vertical
|
||||||
set laststatus=2 " show the status line all the time
|
" show the status line all the time
|
||||||
set so=7 " set 7 lines to the cursors - when moving vertical
|
set laststatus=2
|
||||||
set wildmenu " enhanced command line completion
|
" keep 5 lines on the screen when scrolling
|
||||||
|
set scrolloff=5
|
||||||
|
" enhanced command line completion
|
||||||
|
set wildmenu
|
||||||
" Search down into subfolders
|
" Search down into subfolders
|
||||||
" Provides tab-completion for all file-related tasks
|
" Provides tab-completion for all file-related tasks
|
||||||
set path+=**
|
set path+=**
|
||||||
set hidden " current buffer can be put into background
|
" allow switching away from unsaved buffers
|
||||||
set showcmd " show incomplete commands
|
set hidden
|
||||||
set noshowmode " don't show which mode disabled for PowerLine
|
" show incomplete commands
|
||||||
set wildmode=list:longest " complete files like a shell
|
set showcmd
|
||||||
set scrolloff=3 " lines of text around cursor
|
"set noshowmode " don't show which mode disabled for PowerLine
|
||||||
|
" complete files like a shell
|
||||||
|
set wildmode=list:longest
|
||||||
set shell=$SHELL
|
set shell=$SHELL
|
||||||
set cmdheight=1 " command bar height
|
" command bar height
|
||||||
set title " set terminal title
|
set cmdheight=1
|
||||||
|
" set terminal title
|
||||||
|
set title
|
||||||
|
set shortmess+=TOFwat
|
||||||
|
|
||||||
set magic " set magic on, for regex
|
" show matching braces
|
||||||
|
set showmatch
|
||||||
|
" how many tenths of a second to blink
|
||||||
|
set mat=2
|
||||||
|
" set spell langs
|
||||||
|
set spelllang=de,en
|
||||||
|
|
||||||
set showmatch " show matching braces
|
"" user commands
|
||||||
set mat=2 " how many tenths of a second to blink
|
|
||||||
set complete +=kspell " autocomplete from the dictionary when spellchecking is enabled
|
|
||||||
set spelllang=de,en " set spell langs
|
|
||||||
|
|
||||||
" user commands
|
"" create tags file
|
||||||
|
"" ^] jump to tag under cursor
|
||||||
" create tags file
|
"" g^] for ambiguous tags
|
||||||
" ^] jump to tag under cursor
|
"" ^t jump back in the tag stack
|
||||||
" g^] for ambiguous tags
|
"command! MakeTags !ctags -R .
|
||||||
" ^t jump back in the tag stack
|
|
||||||
command! MakeTags !ctags -R .
|
|
||||||
|
|
||||||
" error bells
|
" error bells
|
||||||
set noerrorbells
|
set errorbells
|
||||||
set visualbell
|
set visualbell
|
||||||
set t_vb=
|
set timeoutlen=500
|
||||||
set tm=500
|
|
||||||
|
|
||||||
if !has('nvim')
|
" turn on manpages (:Man)
|
||||||
" turn on manpages (:Man)
|
runtime ftplugin/man.vim
|
||||||
runtime ftplugin/man.vim
|
|
||||||
endif
|
|
||||||
|
|
||||||
" make comments and HTML attributes italic
|
|
||||||
highlight Comment cterm=italic
|
|
||||||
highlight htmlArg cterm=italic
|
|
||||||
|
|
||||||
" set a map leader for more key combos
|
" set a map leader for more key combos
|
||||||
let mapleader = ','
|
let mapleader=','
|
||||||
|
|
||||||
" clear highlighted search
|
" clear highlighted search
|
||||||
" nnoremap <space> :set hlsearch! hlsearch?<cr>
|
|
||||||
noremap <space> :nohlsearch<cr>
|
noremap <space> :nohlsearch<cr>
|
||||||
|
|
||||||
" enable . command in visual mode
|
" enable . command in visual mode
|
||||||
vnoremap . :normal .<cr>
|
vnoremap . :normal .<cr>
|
||||||
|
|
||||||
|
" move between windows using CTRL+hjll
|
||||||
map <silent> <C-h> :call functions#WinMove('h')<cr>
|
map <silent> <C-h> :call functions#WinMove('h')<cr>
|
||||||
map <silent> <C-j> :call functions#WinMove('j')<cr>
|
map <silent> <C-j> :call functions#WinMove('j')<cr>
|
||||||
map <silent> <C-k> :call functions#WinMove('k')<cr>
|
map <silent> <C-k> :call functions#WinMove('k')<cr>
|
||||||
@ -180,26 +207,22 @@ noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
|
|||||||
" scroll the viewport faster
|
" scroll the viewport faster
|
||||||
nnoremap <C-e> 3<C-e>
|
nnoremap <C-e> 3<C-e>
|
||||||
nnoremap <C-y> 3<C-y>
|
nnoremap <C-y> 3<C-y>
|
||||||
|
"
|
||||||
|
"" moving up and down work as you would expect
|
||||||
|
"nnoremap j gj
|
||||||
|
"nnoremap k gk
|
||||||
|
"nnoremap ^ g^
|
||||||
|
"nnoremap $ g$
|
||||||
|
|
||||||
" moving up and down work as you would expect
|
"" cool resizing
|
||||||
nnoremap j gj
|
"nnoremap <Left> :vertical resize +2<CR>
|
||||||
nnoremap k gk
|
"nnoremap <Right> :vertical resize -2<CR>
|
||||||
nnoremap ^ g^
|
"nnoremap <Up> :resize -2<CR>
|
||||||
nnoremap $ g$
|
"nnoremap <Down> :resize +2<CR><Paste>
|
||||||
|
|
||||||
" cool resizing
|
|
||||||
nnoremap <Left> :vertical resize +2<CR>
|
|
||||||
nnoremap <Right> :vertical resize -2<CR>
|
|
||||||
nnoremap <Up> :resize -2<CR>
|
|
||||||
nnoremap <Down> :resize +2<CR><Paste>
|
|
||||||
|
|
||||||
" search for word under the cursor
|
" search for word under the cursor
|
||||||
nnoremap <leader>/ "fyiw :/<c-r>f<cr>
|
nnoremap <leader>/ "fyiw :/<c-r>f<cr>
|
||||||
|
|
||||||
" helpers for dealing with other people's code
|
|
||||||
nmap \t :set ts=4 sts=4 sw=4 noet<cr>
|
|
||||||
nmap \s :set ts=4 sts=4 sw=4 et<cr>
|
|
||||||
|
|
||||||
" highlight conflicts
|
" highlight conflicts
|
||||||
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
||||||
|
|
||||||
@ -207,8 +230,8 @@ match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
|||||||
highlight SpecialKey ctermbg=none ctermfg=8
|
highlight SpecialKey ctermbg=none ctermfg=8
|
||||||
highlight NonText ctermbg=none ctermfg=8
|
highlight NonText ctermbg=none ctermfg=8
|
||||||
|
|
||||||
" Section AutoGroups {{{
|
"" Section AutoGroups {{{
|
||||||
" file type specific settings
|
"" file type specific settings
|
||||||
augroup configgroup
|
augroup configgroup
|
||||||
autocmd!
|
autocmd!
|
||||||
|
|
||||||
@ -223,22 +246,17 @@ augroup configgroup
|
|||||||
" when there are multiple windows open
|
" when there are multiple windows open
|
||||||
autocmd FileType qf wincmd J
|
autocmd FileType qf wincmd J
|
||||||
|
|
||||||
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
|
" autocmd BufNewFile,BufReadPost *.md set filetype=markdown
|
||||||
let g:markdown_fenced_languages = ['css', 'javascript', 'js=javascript', 'json=javascript', 'stylus', 'html']
|
" let g:markdown_fenced_languages = ['css', 'javascript', 'js=javascript', 'json=javascript', 'stylus', 'html']
|
||||||
|
|
||||||
" autocmd! BufEnter * call functions#ApplyLocalSettings(expand('<afile>:p:h'))
|
" " autocmd! BufEnter * call functions#ApplyLocalSettings(expand('<afile>:p:h'))
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/
|
" autocmd BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/
|
||||||
|
|
||||||
autocmd! BufWritePost * Neomake
|
autocmd! BufWritePost * Neomake
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" detect filetypes, use filetype plugins and autoindent
|
|
||||||
filetype plugin indent on
|
|
||||||
|
|
||||||
|
|
||||||
" paste without indention
|
" paste without indention
|
||||||
function! WrapForTmux(s)
|
function! WrapForTmux(s)
|
||||||
if !exists('$TMUX')
|
if !exists('$TMUX')
|
||||||
@ -251,8 +269,8 @@ function! WrapForTmux(s)
|
|||||||
return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
|
return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &t_SI .= WrapForTmux("\<Esc>[?2004h")
|
"let &t_SI .= WrapForTmux("\<Esc>[?2004h")
|
||||||
let &t_EI .= WrapForTmux("\<Esc>[?2004l")
|
"let &t_EI .= WrapForTmux("\<Esc>[?2004l")
|
||||||
|
|
||||||
function! XTermPasteBegin()
|
function! XTermPasteBegin()
|
||||||
set pastetoggle=<Esc>[201~
|
set pastetoggle=<Esc>[201~
|
||||||
@ -263,153 +281,69 @@ endfunction
|
|||||||
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
|
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
|
||||||
|
|
||||||
" ctrlp
|
" ctrlp
|
||||||
set runtimepath^=~/.vim/bundle/ctrlp.vim
|
" order top to bottom
|
||||||
let g:ctrlp_match_window = 'bottom,order::ttb' " order top to bottom
|
let g:ctrlp_match_window='bottom,order::ttb'
|
||||||
let g:ctrlp_switch_buffer = 0 " open files in new buffer
|
" open files in new buffer
|
||||||
let g:ctrlp_working_path_mode = 0 " honor working path changes in vim session
|
let g:ctrlp_switch_buffer=0
|
||||||
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""' " use ag to search for files (faster)
|
" use ripgrep if available
|
||||||
|
if executable('rg')
|
||||||
" true color
|
set grepprg=rg\ --color=never
|
||||||
set termguicolors
|
let g:ctrlp_user_command='rg %s --files --color=never --glob ""'
|
||||||
" make true colors in tmux work
|
let g:ctrlp_use_caching=0
|
||||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
endif
|
||||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
" use ag if available
|
||||||
|
if executable('ag')
|
||||||
highlight Normal ctermbg=NONE guibg=NONE
|
set grepprg=ag\ --nogroup\ --nocolor
|
||||||
highlight NonText ctermbg=NONE guibg=NONE
|
let g:ctrlp_user_command='ag %s -l --nocolor -g ""'
|
||||||
|
let g:ctrlp_use_caching=0
|
||||||
" airline options
|
|
||||||
if !exists('g:airline_symbols')
|
|
||||||
let g:airline_symbols = {}
|
|
||||||
endif
|
endif
|
||||||
let g:airline_powerline_fonts=1
|
|
||||||
let g:airline_left_sep = ''
|
|
||||||
let g:airline_left_alt_sep = ''
|
|
||||||
let g:airline_right_sep = ''
|
|
||||||
let g:airline_right_alt_sep = ''
|
|
||||||
let g:airline_theme='onedark'
|
|
||||||
let g:airline_symbols.branch = ''
|
|
||||||
let g:airline_symbols.readonly = ''
|
|
||||||
let g:airline_symbols.linenr = ''
|
|
||||||
let g:airline#extensions#tabline#enabled = 1 " enable airline tabline
|
|
||||||
let g:airline#extensions#tabline#tab_min_count = 2 " only show tabline if tabs are being used (more than 1 tab open)
|
|
||||||
let g:airline#extensions#tabline#show_buffers = 0 " do not show open buffers in tabline
|
|
||||||
let g:airline#extensions#tabline#show_splits = 0
|
|
||||||
|
|
||||||
let g:onedark_terminal_italics = 1 " italics for onedark
|
|
||||||
|
|
||||||
" Toggle NERDTree
|
|
||||||
nmap <silent> <leader>k :NERDTreeToggle<cr>
|
|
||||||
" expand to the path of the file in the current buffer
|
|
||||||
nmap <silent> <leader>y :NERDTreeFind<cr>
|
|
||||||
" autocmd BufWinEnter * NERDTreeMirror
|
|
||||||
|
|
||||||
let NERDTreeShowHidden=1
|
|
||||||
let NERDTreeDirArrowExpandable = '▷'
|
|
||||||
let NERDTreeDirArrowCollapsible = '▼'
|
|
||||||
|
|
||||||
" Append modeline after last line in buffer.
|
" Append modeline after last line in buffer.
|
||||||
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX
|
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX files.
|
||||||
" files.
|
|
||||||
function! AppendModeline()
|
function! AppendModeline()
|
||||||
let l:modeline = printf(" vim: set filetype=%s ts=%d sw=%d tw=%d %set :",
|
let l:modeline = printf(" vim: set filetype=%s ts=%d sw=%d tw=%d %set :",
|
||||||
\ &filetype, &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
|
\ &filetype, &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
|
||||||
let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
|
let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
|
||||||
call append(line("$"), l:modeline)
|
call append(line("$"), l:modeline)
|
||||||
endfunction
|
endfunction
|
||||||
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
||||||
|
|
||||||
" delimate config
|
|
||||||
let delimitMate_expand_cr = 1
|
|
||||||
|
|
||||||
" set textwidth for mails
|
" set textwidth for mails
|
||||||
" au BufRead /tmp/mutt-* set tw=72
|
|
||||||
autocmd FileType mail setlocal textwidth=72
|
autocmd FileType mail setlocal textwidth=72
|
||||||
|
|
||||||
" netrw settings
|
" netrw settings
|
||||||
" (vim builtin filebrowser which ist also just a plugin bundled with vim)
|
" disable banner
|
||||||
let g:netrw_banner = 0 " disable banner
|
let g:netrw_banner=0
|
||||||
let g:netrw_browse_split= 4 " open in prior window
|
" open in prior window
|
||||||
let g:netrw_altv = 1 " open splits to the right
|
let g:netrw_browse_split=4
|
||||||
let g:netrw_liststyle = 3 " treeview
|
" open splits to the right
|
||||||
let g:netrw_list_hide = netrw_gitignore#Hide()
|
let g:netrw_altv=1
|
||||||
let g:netrw_list_hide .= ',\(^\|\s\s\)\zs\.\S\+'
|
" treeview
|
||||||
|
let g:netrw_liststyle=3
|
||||||
|
let g:netrw_list_hide=netrw_gitignore#Hide()
|
||||||
|
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
|
||||||
|
|
||||||
" racer config (rust autocomplete)
|
"" racer config (rust autocomplete)
|
||||||
let g:racer_cmd = "/home/me/.cargo/bin/racer"
|
"let g:racer_cmd = "/home/me/.cargo/bin/racer"
|
||||||
let g:racer_experimental_completer = 1
|
"let g:racer_experimental_completer = 1
|
||||||
au FileType rust nmap gd <Plug>(rust-def)
|
"au FileType rust nmap gd <Plug>(rust-def)
|
||||||
au FileType rust nmap gs <Plug>(rust-def-split)
|
"au FileType rust nmap gs <Plug>(rust-def-split)
|
||||||
au FileType rust nmap gx <Plug>(rust-def-vertical)
|
"au FileType rust nmap gx <Plug>(rust-def-vertical)
|
||||||
au FileType rust nmap <leader>gd <Plug>(rust-doc)
|
"au FileType rust nmap <leader>gd <Plug>(rust-doc)
|
||||||
|
|
||||||
let g:rustfmt_autosave = 1 " run rustfmt when saving a file
|
"" " javacomplete2
|
||||||
|
"" autocmd FileType java setlocal omnifunc=javacomplete#Complete
|
||||||
|
"" " enable smart (trying to guess import option) inserting class imports with F4
|
||||||
|
"" nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
|
||||||
|
"" imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
|
||||||
|
"" " enable smart (trying to guess import option) inserting class imports with F4
|
||||||
|
"" nmap <F5> <Plug>(JavaComplete-Imports-Add)
|
||||||
|
"" imap <F5> <Plug>(JavaComplete-Imports-Add)
|
||||||
|
"" " add all missing imports with F6
|
||||||
|
"" nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
|
||||||
|
"" imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
|
||||||
|
"" " add all missing imports with F6
|
||||||
|
"" nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
|
||||||
|
"" imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
|
||||||
|
|
||||||
" close Goyo *and* vim with :q
|
|
||||||
function! s:goyo_enter()
|
|
||||||
let b:quitting = 0
|
|
||||||
let b:quitting_bang = 0
|
|
||||||
autocmd QuitPre <buffer> let b:quitting = 1
|
|
||||||
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:goyo_leave()
|
|
||||||
" Quit Vim if this is the only remaining buffer
|
|
||||||
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
|
|
||||||
if b:quitting_bang
|
|
||||||
qa!
|
|
||||||
else
|
|
||||||
qa
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
autocmd! User GoyoEnter call <SID>goyo_enter()
|
|
||||||
autocmd! User GoyoLeave call <SID>goyo_leave()
|
|
||||||
|
|
||||||
" vimux mappings
|
|
||||||
" Prompt for a command
|
|
||||||
map <Leader>vp :VimuxPromptCommand<CR>
|
|
||||||
" Prompt for a make command
|
|
||||||
map <Leader>vm :VimuxPromptCommand("make ")<CR>
|
|
||||||
" Inspect runner pane
|
|
||||||
map <Leader>vi :VimuxInspectRunner<CR>
|
|
||||||
" Close runner
|
|
||||||
map <Leader>vq :VimuxCloseRunner<CR>
|
|
||||||
" Rerun last command
|
|
||||||
map <Leader>vv :VimuxRunLastCommand<CR>
|
|
||||||
" Stop running command
|
|
||||||
map <Leader>vs :VimuxInterruptRunner<CR>
|
|
||||||
|
|
||||||
" vim-notes
|
|
||||||
let g:notes_directories = ['~/Dokumente/Notes']
|
|
||||||
|
|
||||||
let g:polyglot_disabled = ['latex'] " disable latex in polyglot to use vimtex
|
|
||||||
|
|
||||||
" you complete me
|
|
||||||
let g:ycm_rust_src_path = '~/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src'
|
|
||||||
let g:ycm_python_binary_path = 'python'
|
|
||||||
|
|
||||||
" " javacomplete2
|
|
||||||
" autocmd FileType java setlocal omnifunc=javacomplete#Complete
|
|
||||||
" " enable smart (trying to guess import option) inserting class imports with F4
|
|
||||||
" nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
|
|
||||||
" imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
|
|
||||||
" " enable smart (trying to guess import option) inserting class imports with F4
|
|
||||||
" nmap <F5> <Plug>(JavaComplete-Imports-Add)
|
|
||||||
" imap <F5> <Plug>(JavaComplete-Imports-Add)
|
|
||||||
" " add all missing imports with F6
|
|
||||||
" nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
|
|
||||||
" imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
|
|
||||||
" " add all missing imports with F6
|
|
||||||
" nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
|
|
||||||
" imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
|
|
||||||
|
|
||||||
if has('nvim')
|
|
||||||
let g:deoplete#enable_at_startup = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
let g:licenses_copyright_holders_name = 'Brandl, Valentin <mail+rust@vbrandl.net>'
|
|
||||||
let g:licenses_authors_name = 'Brandl, Valentin <mail+rust@vbrandl.net>'
|
|
||||||
|
|
||||||
" vim: set filetype=vim ts=8 sw=2 tw=120 noet :
|
|
||||||
|
Loading…
Reference in New Issue
Block a user