sponsor Vim development Vim logo Vim Book Ad

qnamebuf : QuickNameBuf: A quick general manager

 script karma  Rating 61/18, Downloaded by 2004  Comments, bugs, improvements  Vim wiki

created by
Matt Spear
 
script type
utility
 
description
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 ;-).

qnamebuf Usage:
<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

qnamefile Usage:
<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.

qnamepicker Usage:
See the documentation for a detailed description of how to call the function, and examples.  Essentially provides a function:
    QNamePickerStart(list, dict)
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).

Customization:
qnamebuf and qnamefile can be customized (in slightly different manners).  See the documentation for details on these.

Hints:
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)!
 
install details
Extract $HOME/.vim/
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
qnamebuf.zip 0.08 2013-11-25 7.0 Matt Spear Minor changes:
* 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
qnamebuf.zip 0.07 2011-05-20 7.0 Matt Spear Complete redesign, now has a flexible core that scripts can plug into to get a lusty picker.
qnamebuf.zip 0.05 2011-01-31 7.0 Matt Spear Fixed a bug which would cause operations to fail on a filtered list.
qnamebuf.zip 0.04 2010-12-18 7.0 Matt Spear Fixed overwriting the @y register.  Made the cmap silent.  Thanks to Peter for the patch!
qnamebuf.zip 0.03 2010-12-17 7.0 Matt Spear Made a mistake to always define the mapping for QNameBufInit even if a mapping to it existed.
qnamebuf.zip 0.02 2010-12-17 7.0 Matt Spear Added support for <LEADER>X being a synonym for <M-X>.  Some minor code cleanup.
qnamebuf.vim 0.01 2010-08-24 7.0 Matt Spear Initial upload
ip used for rating: 3.235.42.157

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github