add rust completion and update plug
This commit is contained in:
parent
522c8b0bbd
commit
b9e2846b8e
@ -11,9 +11,13 @@
|
|||||||
" call plug#begin('~/.vim/plugged')
|
" call plug#begin('~/.vim/plugged')
|
||||||
"
|
"
|
||||||
" " Make sure you use single quotes
|
" " Make sure you use single quotes
|
||||||
" Plug 'junegunn/seoul256.vim'
|
"
|
||||||
|
" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
|
||||||
" Plug 'junegunn/vim-easy-align'
|
" Plug 'junegunn/vim-easy-align'
|
||||||
"
|
"
|
||||||
|
" " Any valid git URL is allowed
|
||||||
|
" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
|
||||||
|
"
|
||||||
" " Group dependencies, vim-snippets depends on ultisnips
|
" " Group dependencies, vim-snippets depends on ultisnips
|
||||||
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
||||||
"
|
"
|
||||||
@ -21,9 +25,6 @@
|
|||||||
" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||||
" Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
" Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
||||||
"
|
"
|
||||||
" " Using git URL
|
|
||||||
" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
|
|
||||||
"
|
|
||||||
" " Using a non-master branch
|
" " Using a non-master branch
|
||||||
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
|
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
|
||||||
"
|
"
|
||||||
@ -40,7 +41,21 @@
|
|||||||
" call plug#end()
|
" call plug#end()
|
||||||
"
|
"
|
||||||
" Then reload .vimrc and :PlugInstall to install plugins.
|
" Then reload .vimrc and :PlugInstall to install plugins.
|
||||||
" Visit https://github.com/junegunn/vim-plug for more information.
|
"
|
||||||
|
" Plug options:
|
||||||
|
"
|
||||||
|
"| 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
|
||||||
"
|
"
|
||||||
"
|
"
|
||||||
" Copyright (c) 2015 Junegunn Choi
|
" Copyright (c) 2015 Junegunn Choi
|
||||||
@ -113,9 +128,9 @@ function! plug#begin(...)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:define_commands()
|
function! s:define_commands()
|
||||||
command! -nargs=+ -bar Plug call s:add(<args>)
|
command! -nargs=+ -bar Plug call s:Plug(<args>)
|
||||||
if !executable('git')
|
if !executable('git')
|
||||||
return s:err('`git` executable not found. vim-plug requires git.')
|
return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.')
|
||||||
endif
|
endif
|
||||||
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(<bang>0, [<f-args>])
|
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(<bang>0, [<f-args>])
|
||||||
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
|
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
|
||||||
@ -134,12 +149,19 @@ function! s:to_s(v)
|
|||||||
return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n"
|
return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:glob(from, pattern)
|
||||||
|
return s:lines(globpath(a:from, a:pattern))
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:source(from, ...)
|
function! s:source(from, ...)
|
||||||
|
let found = 0
|
||||||
for pattern in a:000
|
for pattern in a:000
|
||||||
for vim in s:lines(globpath(a:from, pattern))
|
for vim in s:glob(a:from, pattern)
|
||||||
execute 'source' s:esc(vim)
|
execute 'source' s:esc(vim)
|
||||||
|
let found = 1
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
return found
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:assoc(dict, key, val)
|
function! s:assoc(dict, key, val)
|
||||||
@ -233,7 +255,9 @@ function! plug#end()
|
|||||||
call s:reorg_rtp()
|
call s:reorg_rtp()
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
if has('vim_starting')
|
if has('vim_starting')
|
||||||
syntax enable
|
if has('syntax') && !exists('g:syntax_on')
|
||||||
|
syntax enable
|
||||||
|
end
|
||||||
else
|
else
|
||||||
call s:reload()
|
call s:reload()
|
||||||
endif
|
endif
|
||||||
@ -264,8 +288,9 @@ function! s:version_requirement(val, min)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:git_version_requirement(...)
|
function! s:git_version_requirement(...)
|
||||||
let s:git_version = get(s:, 'git_version',
|
if !exists('s:git_version')
|
||||||
\ map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)'))
|
let s:git_version = map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)')
|
||||||
|
endif
|
||||||
return s:version_requirement(s:git_version, a:000)
|
return s:version_requirement(s:git_version, a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -396,7 +421,7 @@ function! s:remove_triggers(name)
|
|||||||
call remove(s:triggers, a:name)
|
call remove(s:triggers, a:name)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod(names, types)
|
function! s:lod(names, types, ...)
|
||||||
for name in a:names
|
for name in a:names
|
||||||
call s:remove_triggers(name)
|
call s:remove_triggers(name)
|
||||||
let s:loaded[name] = 1
|
let s:loaded[name] = 1
|
||||||
@ -408,6 +433,12 @@ function! s:lod(names, types)
|
|||||||
for dir in a:types
|
for dir in a:types
|
||||||
call s:source(rtp, dir.'/**/*.vim')
|
call s:source(rtp, dir.'/**/*.vim')
|
||||||
endfor
|
endfor
|
||||||
|
if a:0
|
||||||
|
if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
|
||||||
|
execute 'runtime' a:1
|
||||||
|
endif
|
||||||
|
call s:source(rtp, a:2)
|
||||||
|
endif
|
||||||
if exists('#User#'.name)
|
if exists('#User#'.name)
|
||||||
execute 'doautocmd User' name
|
execute 'doautocmd User' name
|
||||||
endif
|
endif
|
||||||
@ -415,7 +446,8 @@ function! s:lod(names, types)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_ft(pat, names)
|
function! s:lod_ft(pat, names)
|
||||||
call s:lod(a:names, ['plugin', 'after/plugin', 'syntax', 'after/syntax'])
|
let syn = 'syntax/'.a:pat.'.vim'
|
||||||
|
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
|
||||||
execute 'autocmd! PlugLOD FileType' a:pat
|
execute 'autocmd! PlugLOD FileType' a:pat
|
||||||
if exists('#filetypeplugin#FileType')
|
if exists('#filetypeplugin#FileType')
|
||||||
doautocmd filetypeplugin FileType
|
doautocmd filetypeplugin FileType
|
||||||
@ -443,16 +475,16 @@ function! s:lod_map(map, names, prefix)
|
|||||||
call feedkeys(a:prefix . substitute(a:map, '^<Plug>', "\<Plug>", '') . extra)
|
call feedkeys(a:prefix . substitute(a:map, '^<Plug>', "\<Plug>", '') . extra)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:add(repo, ...)
|
function! s:Plug(repo, ...)
|
||||||
if a:0 > 1
|
if a:0 > 1
|
||||||
return s:err('Invalid number of arguments (1..2)')
|
return s:err('Invalid number of arguments (1..2)')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
try
|
try
|
||||||
let repo = s:trim(a:repo)
|
let repo = s:trim(a:repo)
|
||||||
let name = fnamemodify(repo, ':t:s?\.git$??')
|
let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec
|
||||||
let spec = extend(s:infer_properties(name, repo),
|
let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??'))
|
||||||
\ a:0 == 1 ? s:parse_options(a:1) : s:base_spec)
|
let spec = extend(s:infer_properties(name, repo), opts)
|
||||||
if !has_key(g:plugs, name)
|
if !has_key(g:plugs, name)
|
||||||
call add(g:plugs_order, name)
|
call add(g:plugs_order, name)
|
||||||
endif
|
endif
|
||||||
@ -535,8 +567,10 @@ function! s:syntax()
|
|||||||
syn match plugTag /(tag: [^)]\+)/
|
syn match plugTag /(tag: [^)]\+)/
|
||||||
syn match plugInstall /\(^+ \)\@<=[^:]*/
|
syn match plugInstall /\(^+ \)\@<=[^:]*/
|
||||||
syn match plugUpdate /\(^* \)\@<=[^:]*/
|
syn match plugUpdate /\(^* \)\@<=[^:]*/
|
||||||
syn match plugCommit /^ [0-9a-z]\{7} .*/ contains=plugRelDate,plugSha,plugTag
|
syn match plugCommit /^ \X*[0-9a-z]\{7} .*/ contains=plugRelDate,plugEdge,plugTag
|
||||||
syn match plugSha /\(^ \)\@<=[0-9a-z]\{7}/ contained
|
syn match plugEdge /^ \X\+$/
|
||||||
|
syn match plugEdge /^ \X*/ contained nextgroup=plugSha
|
||||||
|
syn match plugSha /[0-9a-z]\{7}/ contained
|
||||||
syn match plugRelDate /([^)]*)$/ contained
|
syn match plugRelDate /([^)]*)$/ contained
|
||||||
syn match plugNotLoaded /(not loaded)$/
|
syn match plugNotLoaded /(not loaded)$/
|
||||||
syn match plugError /^x.*/
|
syn match plugError /^x.*/
|
||||||
@ -560,6 +594,7 @@ function! s:syntax()
|
|||||||
|
|
||||||
hi def link plugError Error
|
hi def link plugError Error
|
||||||
hi def link plugRelDate Comment
|
hi def link plugRelDate Comment
|
||||||
|
hi def link plugEdge PreProc
|
||||||
hi def link plugSha Identifier
|
hi def link plugSha Identifier
|
||||||
hi def link plugTag Constant
|
hi def link plugTag Constant
|
||||||
|
|
||||||
@ -620,32 +655,45 @@ function! s:switch_out(...)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:prepare()
|
function! s:finish_bindings()
|
||||||
|
nnoremap <silent> <buffer> R :silent! call <SID>retry()<cr>
|
||||||
|
nnoremap <silent> <buffer> D :PlugDiff<cr>
|
||||||
|
nnoremap <silent> <buffer> S :PlugStatus<cr>
|
||||||
|
nnoremap <silent> <buffer> U :call <SID>status_update()<cr>
|
||||||
|
xnoremap <silent> <buffer> U :call <SID>status_update()<cr>
|
||||||
|
nnoremap <silent> <buffer> ]] :silent! call <SID>section('')<cr>
|
||||||
|
nnoremap <silent> <buffer> [[ :silent! call <SID>section('b')<cr>
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:prepare(...)
|
||||||
|
if empty(getcwd())
|
||||||
|
throw 'Invalid current working directory. Cannot proceed.'
|
||||||
|
endif
|
||||||
|
|
||||||
call s:job_abort()
|
call s:job_abort()
|
||||||
if s:switch_in()
|
if s:switch_in()
|
||||||
silent %d _
|
normal q
|
||||||
else
|
|
||||||
call s:new_window()
|
|
||||||
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
|
|
||||||
nnoremap <silent> <buffer> R :silent! call <SID>retry()<cr>
|
|
||||||
nnoremap <silent> <buffer> D :PlugDiff<cr>
|
|
||||||
nnoremap <silent> <buffer> S :PlugStatus<cr>
|
|
||||||
nnoremap <silent> <buffer> U :call <SID>status_update()<cr>
|
|
||||||
xnoremap <silent> <buffer> U :call <SID>status_update()<cr>
|
|
||||||
nnoremap <silent> <buffer> ]] :silent! call <SID>section('')<cr>
|
|
||||||
nnoremap <silent> <buffer> [[ :silent! call <SID>section('b')<cr>
|
|
||||||
let b:plug_preview = -1
|
|
||||||
let s:plug_tab = tabpagenr()
|
|
||||||
let s:plug_buf = winbufnr(0)
|
|
||||||
call s:assign_name()
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call s:new_window()
|
||||||
|
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
|
||||||
|
if a:0 == 0
|
||||||
|
call s:finish_bindings()
|
||||||
|
endif
|
||||||
|
let b:plug_preview = -1
|
||||||
|
let s:plug_tab = tabpagenr()
|
||||||
|
let s:plug_buf = winbufnr(0)
|
||||||
|
call s:assign_name()
|
||||||
|
|
||||||
silent! unmap <buffer> <cr>
|
silent! unmap <buffer> <cr>
|
||||||
silent! unmap <buffer> L
|
silent! unmap <buffer> L
|
||||||
silent! unmap <buffer> o
|
silent! unmap <buffer> o
|
||||||
silent! unmap <buffer> X
|
silent! unmap <buffer> X
|
||||||
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable
|
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable
|
||||||
setf vim-plug
|
setf vim-plug
|
||||||
call s:syntax()
|
if exists('g:syntax_on')
|
||||||
|
call s:syntax()
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:assign_name()
|
function! s:assign_name()
|
||||||
@ -755,6 +803,7 @@ function! s:finish(pull)
|
|||||||
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, ' ')
|
||||||
|
call s:finish_bindings()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:retry()
|
function! s:retry()
|
||||||
@ -829,7 +878,7 @@ function! s:update_impl(pull, force, args) abort
|
|||||||
\ 'fin': 0
|
\ 'fin': 0
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
call s:prepare()
|
call s:prepare(1)
|
||||||
call append(0, ['', ''])
|
call append(0, ['', ''])
|
||||||
normal! 2G
|
normal! 2G
|
||||||
silent! redraw
|
silent! redraw
|
||||||
@ -840,7 +889,7 @@ function! s:update_impl(pull, force, args) abort
|
|||||||
" Python version requirement (>= 2.7)
|
" Python version requirement (>= 2.7)
|
||||||
if python && !has('python3') && !ruby && !s:nvim && s:update.threads > 1
|
if python && !has('python3') && !ruby && !s:nvim && s:update.threads > 1
|
||||||
redir => pyv
|
redir => pyv
|
||||||
silent python import platform; print(platform.python_version())
|
silent python import platform; print platform.python_version()
|
||||||
redir END
|
redir END
|
||||||
let python = s:version_requirement(
|
let python = s:version_requirement(
|
||||||
\ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6])
|
\ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6])
|
||||||
@ -1697,7 +1746,7 @@ function! s:shellesc(arg)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:glob_dir(path)
|
function! s:glob_dir(path)
|
||||||
return map(filter(s:lines(globpath(a:path, '**')), 'isdirectory(v:val)'), 's:dirpath(v:val)')
|
return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:progress_bar(line, bar, total)
|
function! s:progress_bar(line, bar, total)
|
||||||
@ -1974,7 +2023,7 @@ function! s:preview_commit()
|
|||||||
let b:plug_preview = !s:is_preview_window_open()
|
let b:plug_preview = !s:is_preview_window_open()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let sha = matchstr(getline('.'), '\(^ \)\@<=[0-9a-z]\{7}')
|
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-z]\{7}')
|
||||||
if empty(sha)
|
if empty(sha)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@ -1999,10 +2048,15 @@ function! s:section(flags)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:format_git_log(line)
|
function! s:format_git_log(line)
|
||||||
let [sha, refs, subject, date] = split(a:line, nr2char(1))
|
let indent = ' '
|
||||||
|
let tokens = split(a:line, nr2char(1))
|
||||||
|
if len(tokens) != 5
|
||||||
|
return indent.substitute(a:line, '\s*$', '', '')
|
||||||
|
endif
|
||||||
|
let [graph, sha, refs, subject, date] = tokens
|
||||||
let tag = matchstr(refs, 'tag: [^,)]\+')
|
let tag = matchstr(refs, 'tag: [^,)]\+')
|
||||||
let tag = empty(tag) ? ' ' : ' ('.tag.') '
|
let tag = empty(tag) ? ' ' : ' ('.tag.') '
|
||||||
return printf(' %s%s%s (%s)', sha, tag, subject, date)
|
return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:append_ul(lnum, text)
|
function! s:append_ul(lnum, text)
|
||||||
@ -2017,10 +2071,14 @@ function! s:diff()
|
|||||||
let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)')
|
let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)')
|
||||||
call s:progress_bar(2, bar, len(total))
|
call s:progress_bar(2, bar, len(total))
|
||||||
for origin in [1, 0]
|
for origin in [1, 0]
|
||||||
|
let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))'))))
|
||||||
|
if empty(plugs)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
|
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
|
||||||
for [k, v] in reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))'))))
|
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 --pretty=format:"%h%x01%d%x01%s%x01%cr" '.s:shellesc(range), v.dir)
|
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)
|
||||||
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)')))
|
||||||
|
@ -8,6 +8,7 @@ syntax enable
|
|||||||
set background=dark
|
set background=dark
|
||||||
colorscheme darkblue
|
colorscheme darkblue
|
||||||
|
|
||||||
|
set mouse=n " fuck you, mouse
|
||||||
set number " line numbers on the right side
|
set number " line numbers on the right side
|
||||||
set showcmd " show the commands while typing
|
set showcmd " show the commands while typing
|
||||||
set splitright " open new splits on the right
|
set splitright " open new splits on the right
|
||||||
@ -110,6 +111,7 @@ map N <Plug>(easymotion-prev)
|
|||||||
set nohlsearch
|
set nohlsearch
|
||||||
|
|
||||||
let g:ycm_global_ycm_extra_conf='~/.config/nvim/ycm_extra_conf.py'
|
let g:ycm_global_ycm_extra_conf='~/.config/nvim/ycm_extra_conf.py'
|
||||||
|
let g:ycm_rust_src_path='/data/programming/rustc-1.7.0/src'
|
||||||
set completeopt=menu
|
set completeopt=menu
|
||||||
|
|
||||||
let base16colorspace=256
|
let base16colorspace=256
|
||||||
|
Loading…
Reference in New Issue
Block a user