qnamebuf : QuickNameBuf: A quick general manager
| script karma
Downloaded by 806
Comments, bugs, improvements
script versions (upload new version)
|I really like qname (vimscript #2317) and qbuf (vimscript #1910) and decided that it would be nice to combine them. The author recommended I upload under my name.
Version 0.07 introduced a redesign, there are three files:
1) qnamepicker: A core that provides a generic function other scripts can call to allow the user to select an item from a list in the command prompt (in a lusty fashion).
2) qnamefile: Like command-t but in mostly pure vim (there is a requirement on the find utility).
3) qnamebuf: The classic buffer selector as before.
and there was a significant speedup by replacing a custom matcher function with a regular expression.
Also in the documentation for qnamepicker I show how one can utilize the script for the project (vimscript #69) to provide a lusty selector for the files in the project (complete with the shortcuts below!). I have found this to be a life-changing combination ;-).
<F4> opens a list of the current buffers, and typing a string filters the list (by default ala lustyexplorer vimscript #1890). All filtering is case insensitive (even if using Regular Expressions). If there are many files open goes to a simplified view (just relative buffer number, and the filename with path), when filtered enough shows more information:
1) Relative Buffer Number
2) Current Buffer (%), Alternative Buffer (#), or if it is open in a visible split (=)
3) File name
4) Buffer number
5) Relative file path
In addition to the common commands below, qnamebuf accepts:
<M-L> Toggle between listed and unlisted buffers
<M-D> bdelete the selected buffer, the explorer stays open and retains cursor position
<M-C> Close the window containing the buffer
<F4> Close the qnamebuf explorer
<S-F4> opens an explorer from the current working directory showing all files which are not in a hidden directory (one that starts with '.'). This script relies on the external find utility.
Common shortcuts to qnamefile and qnamebuf:
<BS> Delete last char entered
<C-U> Delete all entered chars
<ESC> or <C-G> close the explorer
<CR> Open the selected file in the current window
<M-S> Open the selected file in a split window
<M-V> Open the selected file in a vert split window
<M-T> Open the selected file in a new tab
<UP> <DOWN> <LEFT> <RIGHT> navigates the selection
<HOME> <END> move to the first/last item
<M-1>, ..., <M-0> open the first, ..., tenth file in the list
Note, I wanted these to be <C-...> but <C-1>...<C-0> are not real key sequences.
See the documentation for a detailed description of how to call the function, and examples. Essentially provides a function:
where a:list is the set of items, and a:dict provides a mechanism to customize various parts (e.g. rendering, extra keys for various actions, etcetera).
qnamebuf and qnamefile can be customized (in slightly different manners). See the documentation for details on these.
I find the following mappings very useful (jump to the ith file):
nmap <silent> <M-1> :brewind<CR>
nmap <silent> <M-2> :brewind \| 1bn<CR>
nmap <silent> <M-3> :brewind \| 2bn<CR>
nmap <silent> <M-4> :brewind \| 3bn<CR>
nmap <silent> <M-5> :brewind \| 4bn<CR>
nmap <silent> <M-6> :brewind \| 5bn<CR>
nmap <silent> <M-7> :brewind \| 6bn<CR>
nmap <silent> <M-8> :brewind \| 7bn<CR>
nmap <silent> <M-9> :brewind \| 8bn<CR>
nmap <silent> <M-0> :brewind \| 9bn<CR>
When starting qnamebuf the numbers are displayed and this allows consistent access.
Also be sure to check the hints section of qnamepicker's documentation for some code to add to .vimproject_mappings to provide a lusty picker for the files in a project (it is slightly too long to be useful here)!
Click on the package to download.
ip used for rating: 184.108.40.206
* History feature added
* ignore_case option added
* Change the prompt to show the current regexp versus fuzzy maching
* C-R to change between regexp and fuzzy matching
* M-P to do path matching in qnamefile
||Complete redesign, now has a flexible core that scripts can plug into to get a lusty picker.
||Fixed a bug which would cause operations to fail on a filtered list.
||Fixed overwriting the @y register. Made the cmap silent. Thanks to Peter for the patch!
||Made a mistake to always define the mapping for QNameBufInit even if a mapping to it existed.
||Added support for <LEADER>X being a synonym for <M-X>. Some minor code cleanup.