vim-bufonly
This commit is contained in:
parent
f2eb142ffb
commit
c6b5286a3e
@ -149,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)
|
||||||
@ -425,9 +432,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
|
||||||
for file in a:000
|
if a:0
|
||||||
call s:source(rtp, file)
|
if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
|
||||||
endfor
|
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
|
||||||
@ -556,8 +566,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.*/
|
||||||
@ -581,6 +593,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
|
||||||
|
|
||||||
@ -1728,7 +1741,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)
|
||||||
@ -2005,7 +2018,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
|
||||||
@ -2030,10 +2043,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)
|
||||||
@ -2055,7 +2073,7 @@ 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 --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)')))
|
||||||
|
@ -13,6 +13,9 @@ nnoremap <silent> <kMinus> <C-W>-
|
|||||||
" vim-argwrap
|
" vim-argwrap
|
||||||
nnoremap <silent> <leader>a :ArgWrap<Cr>
|
nnoremap <silent> <leader>a :ArgWrap<Cr>
|
||||||
|
|
||||||
|
" vim-bufonly
|
||||||
|
nnoremap <silent> <S-Bs> :BufOnly<Cr>
|
||||||
|
|
||||||
" vim-easy-align
|
" vim-easy-align
|
||||||
vmap <Cr> <Plug>(EasyAlign)
|
vmap <Cr> <Plug>(EasyAlign)
|
||||||
nmap ga <Plug>(EasyAlign)
|
nmap ga <Plug>(EasyAlign)
|
||||||
|
@ -23,6 +23,7 @@ Plug 'https://github.com/pangloss/vim-javascript.git'
|
|||||||
Plug 'https://github.com/plasticboy/vim-markdown.git'
|
Plug 'https://github.com/plasticboy/vim-markdown.git'
|
||||||
Plug 'https://github.com/rking/ag.vim.git'
|
Plug 'https://github.com/rking/ag.vim.git'
|
||||||
Plug 'https://github.com/rust-lang/rust.vim'
|
Plug 'https://github.com/rust-lang/rust.vim'
|
||||||
|
Plug 'https://github.com/schickling/vim-bufonly.git'
|
||||||
Plug 'https://github.com/tomasr/molokai.git'
|
Plug 'https://github.com/tomasr/molokai.git'
|
||||||
Plug 'https://github.com/tpope/vim-abolish.git'
|
Plug 'https://github.com/tpope/vim-abolish.git'
|
||||||
Plug 'https://github.com/tpope/vim-bundler.git'
|
Plug 'https://github.com/tpope/vim-bundler.git'
|
||||||
|
Loading…
Reference in New Issue
Block a user