[EMAIL PROTECTED] wrote:
Hi Tony and Chip,Yes indeed. When processing with my test there was a local $HOME/.vimrc file. First case: without line "filetype plugin on" in $HOME/.vimrc file. Second case: with line "filetype plugin on" in $HOME/.vimrc file. In both cases: no $HOME/.vim/filetype.vim file and no file in $HOME/.vim/ftplugin directory. In the first case, the Ctrl-] shortcut calls the tag in my ./tags file. The :verbose map <C-]> echos: "No mapping found" on the command line. In the second case, the Ctrl-] shortcut echos ":call JumpToTag_ada('')" on the command line. The :verbose map <C-]> echos: "n <C-]> *@:call JumpToTag_ada('')<CR>" on the command line. JumpToTag() lies in the default ada ftplugin: $ grep -n -R JumpToTag_ada /usr/share/vim/ /usr/share/vim/vim63/ftplugin/ada.vim:37: nnoremap <unique> <buffer> <C-]> :call JumpToTag_ada('')<cr> /usr/share/vim/vim63/ftplugin/ada.vim:40: nnoremap <unique> <buffer> g<C-]> :call JumpToTag_ada('','stj')<cr> /usr/share/vim/vim63/ftplugin/ada.vim:168:function! JumpToTag_ada(word,...) So in the first case, the <C-]> was no particular mapping but the default behaviour which works. In the second case, the <C-]> is mapped to the special function JumpToTag_ada() from $VIMRUNTIME/ftplugin/ada.vim filetype plugin file. That function is: function! JumpToTag_ada(word,...) if a:word == '' " Get current word let word = AdaWord() if word == '' return endif else let word = a:word endif if a:0 > 0 let mode = a:1 else let mode = 'tj' endif let v:errmsg = '' execute 'silent!' mode word if v:errmsg != '' if v:errmsg =~ '^E426:' " Tag not found let ignorecase = &ignorecase set ignorecase execute mode word let &ignorecase = ignorecase else " Repeat to give error execute mode word endif endif endfunction if mapcheck('<C-]>','n') == '' nnoremap <unique> <buffer> <C-]> :call JumpToTag_ada('')<cr> endif which is supposed to call ":tj" on the word under the cursor. The word under the cursor is indeed the right one. I called an "word = AdaWord(); echo word" to be sure. The bug is in the function JumpToTag_ada(). To convince everyone, I added the following lines in my local ada.vim ftplugin file (which overwrites that of $VIMRUNTIME)): function! GetToTag(...) let word = AdaWord() execute "tj" word endfunction noremap <unique> <buffer> <C-]> :call GetToTag()<cr> Those lines make everything work fine. So the few lines of JumpToTag_ada() seem to be bugged. What to you think? Regards, Julien
Mappings defined in an ftplugin ought, for sanity, to have the <buffer> attribute so they don't interfere with other filetypes. If the mapping defined by the ada ftplugin remains active even when the active cursor is in a file of a different filetype, then IMHO it's a bug in the ada ftplugin and in that case you should contact its maintainer (look for a comment near the top of $VIMRUNTIME/ftplugin/ada.vim).
OTOH, if you experience the disturbing behaviour _only_ when editing an ada source file, then it could be either a "bug" or a "feature". In that case, since I don't know ada myself, I'm not qualified to offer an opinion.
Best regards, Tony.
