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




Internet
[EMAIL PROTECTED] - 07/18/2006 01:11 AM



To:    vim

cc:


Subject:    Re: ftplugin not detected

Charles E Campbell Jr wrote:
> [EMAIL PROTECTED] wrote:
>
>> When adding the "filetype plugin on" to my .vimrc file, my ftplugin
>> file is
>> indeed loaded when I edit *.adb files (Ada).
>> But it seems other stuff does not work in that case. I use vim 6.3.82.
>> So I made the following test: with no local filetype.vim file and no
file
>> in .vim/ftplugin directory, I added the line "filetype plugin on" to my
>> ..vimrc file.
>> Then the "Ctrl+]" shortcut which usually search my tagfile does not work
>> any more. Instead, it echos in the command-line ":call
>> JumpToTad_ada('')",
>> whereas without the new line in .vimrc it would return a list of choices
>> for the keyword under the cursor.
>>
>> In the end, adding that simple line to my .vimrc file seems to break the
>> default configuration from $VIMRUNTIME directory, even though no
>> particular
>> file lies in my local $RUNTIMEPATH.
>>
>> Any idea explaining that strange behaviour?
>>
>>
>
> Did you have a $HOME/.vimrc file before including the "filetype plugin
> indent on" line?  If you didn't,
> then you were using whatever your system had for a default (which can
> vary by linux distributor,
> for example).
>
> The "filetype plugin indent on" line turns on your plugins; ie. they're
> now being loaded, whereas they
> were not being loaded before.  Hence, the ctrl+] is likely to be
> invoking some mapping that you didn't
> have heretofore.
>
> :verbose map c_ctrl-v_]?

             :verbose map <C-]>

(The terminology isn't the same in the :map command as in :help).

Also, IIUC, the OP means Ctrl-] in Normal mode (jump to tag), not in
Command-line mode (trigger abbreviation).

>
> should show you what plugin is re-defining ctrl+] in the command line.
>
> Regards,
> Chip Campbell
>
>
>


Best regards,
Tony.



This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.

Reply via email to