Chuck Mason wrote:
In source code, <C-]> follows a tags file. In :help it follows links
(Maybe there's a helptags file?).  But I've created a new temp buffer
from some vim code and I want <C-]> to do something different for only
this buffer. For instance I have a line that looks like:
... sometext somenumber1 someothertext2 And if the user presses <C-]> anywhere on the line I would like to take
somenumber1 and do something with it (follow it by replacing the current
buffer with another file referenced by the number). If the line doesn't
start with ... Then ignore the keypress.  I think I can handle all that
but I want to know if its possible to:
either set up a handler for <C-]> or must I just :map it?
If I must :map it, I can :map so it only affects the current buffer?
:bmap? Any help would surely help! Chuck



Yes there is a tags file for help, $VIMRUNTIME/doc/tags (and similarly $VIM/vimfiles/doc/tags and/or [on Windows] $HOME/vimfiles/doc/tags if you have installed "nonstandard" help files locally).

Here is (untested) an example of how to map Ctrl-] for only one particular file:

        function s:ControlBracketHandler()
        ...
        endfunction
        autocmd BufRead C:/path/to/filename.ext
                \ map <buffer> <C-]> :call <SID>ControlBracketHandler()<CR>


see ":help :map-<buffer>"


Best regards,
Tony.

Reply via email to