* Chuck Mason [2006.12.13 17:15]:
> In :help it follows links
> (Maybe there's a helptags file?).
Bingo.
:h helptags
> [...]
> 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:
One way:
Define a function which will determine if your line
matches and act accordingly:
function! Foo()
if getline(".") =~ "^\\.\\.\\."
" extract somenumber1 and
" do something with it
else
" do nothing
endif
endfunction
And use autocommands to determine whether your
function should be called or not depending on
which buffer you're in:
autocmd BufEnter *.tmp map <C-]> :call Foo()<CR>
autocmd BufLeave *.tmp unmap <C-]>
All that is left is extracting "somenumber1".
--
JR