mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 19:40:29 +01:00
Update buffergator
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
ScriptID SourceID Filename
|
ScriptID SourceID Filename
|
||||||
--------------------------
|
--------------------------
|
||||||
### plugins
|
### plugins
|
||||||
3619 15858 buffergator
|
3619 15879 buffergator
|
||||||
102 13435 DirDiff.vim
|
102 13435 DirDiff.vim
|
||||||
1984 13961 :AutoInstall: FuzzyFinder
|
1984 13961 :AutoInstall: FuzzyFinder
|
||||||
311 7645 grep.vim
|
311 7645 grep.vim
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ The following key mappings are available when in the viewer.
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Catalog Management~
|
Catalog Management~
|
||||||
|
|
||||||
s Cycle through sort regimes.
|
cs Cycle through sort regimes.
|
||||||
i Cycle through display regimes (alternate).
|
cd Cycle through display regimes (alternate).
|
||||||
u Update (rebuild/refresh) index.
|
r Update (rebuild/refresh) index.
|
||||||
d Delete the selected buffer.
|
d Delete the selected buffer.
|
||||||
D Unconditionally delete the selected buffer.
|
D Unconditionally delete the selected buffer.
|
||||||
x Wipe the selected buffer.
|
x Wipe the selected buffer.
|
||||||
@@ -84,63 +84,33 @@ q Quit the index/catalog window.
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Open Selected Buffer~
|
Open Selected Buffer~
|
||||||
|
|
||||||
<CR> Switch focus to the previous window and go to the current
|
The following keys all open the currently-selected buffer and switch focus to
|
||||||
entry. If "g:buffergator_autodismiss_on_select" is True,
|
it. The catalog buffer will be closed if 'g:buffergator_autodismiss_on_select'
|
||||||
then the catalog viewer is closed; otherwise it is kept
|
evaluates to true; otherwise it will be kept open.
|
||||||
open.
|
|
||||||
|
<CR>, o Open the currently-selected buffer in previous window.
|
||||||
|
s Open the currently-selected buffer in a new vertical
|
||||||
|
split.
|
||||||
|
i Open the currently-selected buffer in a new split.
|
||||||
|
t Open the currently-selected buffer in a new tab page.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Preview Selected Buffer Without Leaving the Catalog Viewer~
|
Preview Selected Buffer~
|
||||||
|
|
||||||
The following keys all open the currently-selected buffer, but retain focus on
|
The following keys all open the currently-selected buffer, but retain focus on
|
||||||
the catalog viewer.
|
the catalog viewer.
|
||||||
|
|
||||||
po, . Preview the currently-selected buffer in the previous
|
O, go Preview the currently-selected buffer in the previous
|
||||||
window, keeping focus on the catalog.
|
window.
|
||||||
ps Preview the currently-selected buffer is a new split,
|
S, gs Preview the currently-selected buffer is a new split.
|
||||||
keeping focus on the catalog.
|
V, gv Preview the currently-selected buffer is a new vertical
|
||||||
pv Preview the currently-selected buffer is a new vertical
|
split
|
||||||
split, keeping focus on the catalog.
|
T Preview the currently-selected buffer is a new tab
|
||||||
pt Preview the currently-selected buffer is a new tab
|
page.
|
||||||
page, keeping focus on the catalog.
|
|
||||||
<SPACE>, <C-N> Go to the next buffer entry and preview it in the previous
|
<SPACE>, <C-N> Go to the next buffer entry and preview it in the previous
|
||||||
window.
|
window.
|
||||||
<C-SPACE>, <C-P> Go to the previous buffer entry and preview it in the
|
<C-SPACE>, <C-P> Go to the previous buffer entry and preview it in the
|
||||||
previous window.
|
previous window.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Open Selected Buffer Without Closing the Catalog Viewer~
|
|
||||||
|
|
||||||
The following keys all open the currently-selected buffer and switch focus to
|
|
||||||
it, but keep the catalog viewer open.
|
|
||||||
|
|
||||||
o Keeping the catalog viewer open, switch focus to the
|
|
||||||
previous window and go to the currently-selected buffer
|
|
||||||
(as <CR> if "g:buffergator_autodismiss_on_select" is 0).
|
|
||||||
ws Keeping the catalog viewer open, split the previous window,
|
|
||||||
switch focus, and go to the currently-selected buffer.
|
|
||||||
wv Keeping the catalog viewer open, split the previous window
|
|
||||||
vertically, switch focus, and go to the currently-selected
|
|
||||||
buffer.
|
|
||||||
t Keeping the catalog viewer open, open the current selected
|
|
||||||
in a new tab page.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Open Selected Buffer and Close the Catalog Viewer~
|
|
||||||
|
|
||||||
The following keys all open the currently-selected buffer and switch focus to
|
|
||||||
it, closing the catalog viewer at the same time.
|
|
||||||
|
|
||||||
O Close catalog viewer and go to the currently-selected
|
|
||||||
buffer (as <CR> if "g:buffergator_autodismiss_on_select"
|
|
||||||
is 1).
|
|
||||||
wS Close the catalog viewer, split the previous window
|
|
||||||
and go to the currently-selected buffer.
|
|
||||||
wV Close the catalog viewer, split the previous window
|
|
||||||
vertically and go to the currently-selected buffer.
|
|
||||||
T Close the catalog viewer and open the currently-selected
|
|
||||||
buffer in a new tab page.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Window Control~
|
Window Control~
|
||||||
|
|
||||||
@@ -181,8 +151,10 @@ g:buffergator_sort_regime~
|
|||||||
Default: "bufnum"
|
Default: "bufnum"
|
||||||
Sets the default sort regime for buffer listing:
|
Sets the default sort regime for buffer listing:
|
||||||
"bufnum" : sort by buffer number [default]
|
"bufnum" : sort by buffer number [default]
|
||||||
"basename": sort by buffer file basename
|
"basename": sort by buffer file basename (followed by directory)
|
||||||
"filepath": sort by full buffer filepath
|
"filepath": sort by full buffer filepath
|
||||||
|
"extension": sort by buffer filename extension (followed by full
|
||||||
|
filepath)
|
||||||
|
|
||||||
g:buffergator_display_regime~
|
g:buffergator_display_regime~
|
||||||
Default: "basename"
|
Default: "basename"
|
||||||
|
|||||||
@@ -94,10 +94,11 @@ let s:buffergator_viewport_split_modes = {
|
|||||||
|
|
||||||
" Catalog Sort Regimes {{{2
|
" Catalog Sort Regimes {{{2
|
||||||
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
let s:buffergator_catalog_sort_regimes = ['basename', 'filepath', 'bufnum']
|
let s:buffergator_catalog_sort_regimes = ['basename', 'filepath', 'extension', 'bufnum']
|
||||||
let s:buffergator_catalog_sort_regime_desc = {
|
let s:buffergator_catalog_sort_regime_desc = {
|
||||||
\ 'basename' : ["basename", "by basename"],
|
\ 'basename' : ["basename", "by basename (followed by directory)"],
|
||||||
\ 'filepath' : ["filepath", "by (full) filepath"],
|
\ 'filepath' : ["filepath", "by (full) filepath"],
|
||||||
|
\ 'extension' : ["ext", "by extension (followed by full filepath)"],
|
||||||
\ 'bufnum' : ["bufnum", "by buffer number"],
|
\ 'bufnum' : ["bufnum", "by buffer number"],
|
||||||
\ }
|
\ }
|
||||||
let s:buffergator_default_catalog_sort_regime = "bufnum"
|
let s:buffergator_default_catalog_sort_regime = "bufnum"
|
||||||
@@ -107,7 +108,7 @@ let s:buffergator_default_catalog_sort_regime = "bufnum"
|
|||||||
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
let s:buffergator_catalog_display_regimes = ['basename', 'filepath', 'bufname']
|
let s:buffergator_catalog_display_regimes = ['basename', 'filepath', 'bufname']
|
||||||
let s:buffergator_catalog_display_regime_desc = {
|
let s:buffergator_catalog_display_regime_desc = {
|
||||||
\ 'basename' : ["basename", "basename"],
|
\ 'basename' : ["basename", "basename (followed by directory)"],
|
||||||
\ 'filepath' : ["filepath", "full filepath"],
|
\ 'filepath' : ["filepath", "full filepath"],
|
||||||
\ 'bufname' : ["bufname", "buffer name"],
|
\ 'bufname' : ["bufname", "buffer name"],
|
||||||
\ }
|
\ }
|
||||||
@@ -342,6 +343,17 @@ function! s:_compare_dicts_by_filepath(m1, m2)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" comparison function used for sorting buffers catalog by extension
|
||||||
|
function! s:_compare_dicts_by_extension(m1, m2)
|
||||||
|
if a:m1["extension"] < a:m2["extension"]
|
||||||
|
return -1
|
||||||
|
elseif a:m1["extension"] > a:m2["extension"]
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return s:_compare_dicts_by_filepath(a:m1, a:m2)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" comparison function used for sorting buffers catalog by basename
|
" comparison function used for sorting buffers catalog by basename
|
||||||
function! s:_compare_dicts_by_basename(m1, m2)
|
function! s:_compare_dicts_by_basename(m1, m2)
|
||||||
return s:_compare_dicts_by_value(a:m1, a:m2, "basename")
|
return s:_compare_dicts_by_value(a:m1, a:m2, "basename")
|
||||||
@@ -441,6 +453,7 @@ function! s:NewCatalogViewer()
|
|||||||
let l:info["filepath"] = fnamemodify(l:info["bufname"], ":p")
|
let l:info["filepath"] = fnamemodify(l:info["bufname"], ":p")
|
||||||
let l:info["basename"] = fnamemodify(l:info["bufname"], ":t")
|
let l:info["basename"] = fnamemodify(l:info["bufname"], ":t")
|
||||||
let l:info["parentdir"] = fnamemodify(l:info["bufname"], ":p:h")
|
let l:info["parentdir"] = fnamemodify(l:info["bufname"], ":p:h")
|
||||||
|
let l:info["extension"] = fnamemodify(l:info["bufname"], ":e")
|
||||||
call add(self.buffers_catalog, l:info)
|
call add(self.buffers_catalog, l:info)
|
||||||
" let l:buffers_info[l:info[l:key]] = l:info
|
" let l:buffers_info[l:info[l:key]] = l:info
|
||||||
endfor
|
endfor
|
||||||
@@ -608,13 +621,50 @@ function! s:NewCatalogViewer()
|
|||||||
function! l:catalog_viewer.setup_buffer_keymaps() dict
|
function! l:catalog_viewer.setup_buffer_keymaps() dict
|
||||||
|
|
||||||
"""" Disabling of unused modification keys
|
"""" Disabling of unused modification keys
|
||||||
for key in ["p", "P", "C", "x", "X", "r", "R", "i", "I", "a", "A", "D", "S", "U"]
|
for key in [".", "p", "P", "C", "x", "X", "r", "R", "i", "I", "a", "A", "D", "S", "U"]
|
||||||
try
|
try
|
||||||
execute "nnoremap <buffer> " . key . " <NOP>"
|
execute "nnoremap <buffer> " . key . " <NOP>"
|
||||||
catch //
|
catch //
|
||||||
endtry
|
endtry
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
if !exists("g:buffergator_use_new_keymap") || !g:buffergator_use_new_keymap
|
||||||
|
|
||||||
|
"""" Catalog management
|
||||||
|
noremap <buffer> <silent> cs :call b:buffergator_catalog_viewer.cycle_sort_regime()<CR>
|
||||||
|
noremap <buffer> <silent> cd :call b:buffergator_catalog_viewer.cycle_display_regime()<CR>
|
||||||
|
noremap <buffer> <silent> r :call b:buffergator_catalog_viewer.rebuild_catalog()<CR>
|
||||||
|
noremap <buffer> <silent> q :call b:buffergator_catalog_viewer.close()<CR>
|
||||||
|
noremap <buffer> <silent> d :call b:buffergator_catalog_viewer.delete_target(0, 0)<CR>
|
||||||
|
noremap <buffer> <silent> D :call b:buffergator_catalog_viewer.delete_target(0, 1)<CR>
|
||||||
|
noremap <buffer> <silent> x :call b:buffergator_catalog_viewer.delete_target(1, 0)<CR>
|
||||||
|
noremap <buffer> <silent> X :call b:buffergator_catalog_viewer.delete_target(1, 1)<CR>
|
||||||
|
|
||||||
|
""""" Selection: show target and switch focus
|
||||||
|
noremap <buffer> <silent> <CR> :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
|
||||||
|
noremap <buffer> <silent> o :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
|
||||||
|
" gryf: let's keep it stright: s should h split, v should vertical
|
||||||
|
" split
|
||||||
|
noremap <buffer> <silent> s :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "sb")<CR>
|
||||||
|
noremap <buffer> <silent> v :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb")<CR>
|
||||||
|
noremap <buffer> <silent> t :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "tab sb")<CR>
|
||||||
|
|
||||||
|
""""" Preview: show target , keeping focus on catalog
|
||||||
|
noremap <buffer> <silent> O :call b:buffergator_catalog_viewer.visit_target(1, 1, "")<CR>
|
||||||
|
noremap <buffer> <silent> go :call b:buffergator_catalog_viewer.visit_target(1, 1, "")<CR>
|
||||||
|
noremap <buffer> <silent> S :call b:buffergator_catalog_viewer.visit_target(1, 1, "sb")<CR>
|
||||||
|
noremap <buffer> <silent> gs :call b:buffergator_catalog_viewer.visit_target(1, 1, "sb")<CR>
|
||||||
|
noremap <buffer> <silent> V :call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb")<CR>
|
||||||
|
noremap <buffer> <silent> gv :call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb")<CR>
|
||||||
|
noremap <buffer> <silent> T :call b:buffergator_catalog_viewer.visit_target(1, 1, "tab sb")<CR>
|
||||||
|
noremap <buffer> <silent> <SPACE> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("n", 1, 1)<CR>
|
||||||
|
noremap <buffer> <silent> <C-SPACE> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR>
|
||||||
|
noremap <buffer> <silent> <C-@> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR>
|
||||||
|
noremap <buffer> <silent> <C-N> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("n", 1, 1)<CR>
|
||||||
|
noremap <buffer> <silent> <C-P> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR>
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
"""" Catalog management
|
"""" Catalog management
|
||||||
noremap <buffer> <silent> s :call b:buffergator_catalog_viewer.cycle_sort_regime()<CR>
|
noremap <buffer> <silent> s :call b:buffergator_catalog_viewer.cycle_sort_regime()<CR>
|
||||||
noremap <buffer> <silent> i :call b:buffergator_catalog_viewer.cycle_display_regime()<CR>
|
noremap <buffer> <silent> i :call b:buffergator_catalog_viewer.cycle_display_regime()<CR>
|
||||||
@@ -652,6 +702,8 @@ function! s:NewCatalogViewer()
|
|||||||
noremap <buffer> <silent> wV :call b:buffergator_catalog_viewer.visit_target(0, 0, "vert sb")<CR>
|
noremap <buffer> <silent> wV :call b:buffergator_catalog_viewer.visit_target(0, 0, "vert sb")<CR>
|
||||||
noremap <buffer> <silent> T :call b:buffergator_catalog_viewer.visit_target(0, 0, "tab sb")<CR>
|
noremap <buffer> <silent> T :call b:buffergator_catalog_viewer.visit_target(0, 0, "tab sb")<CR>
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
" other
|
" other
|
||||||
noremap <buffer> <silent> A :call b:buffergator_catalog_viewer.toggle_zoom()<CR>
|
noremap <buffer> <silent> A :call b:buffergator_catalog_viewer.toggle_zoom()<CR>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user