Hi,

Enno schrieb am 02.12.2014 um 12:14:
> Le mardi 2 décembre 2014 12:00:30 UTC+1, jott...@googlemail.com a écrit :
>>
>> Enno schrieb am 02.12.2014 um 11:39:
>>> Le mardi 2 décembre 2014 11:38:10 UTC+1, Enno a écrit :
>>>>
>>>> Ok. Thank you for the clarification. It turns out that the harmless 
>>>> looking map
>>>>
>>>> cnoremap <expr> / getcmdtype() == '/' ? '\/' : '/' 
>>>>
>>>> to escape / in command line searches was the culprit and turned exe into 
>>>> normal commands. That is:
>>>>
>>>> Create an empty file ~/.gvimrc.light . and a file ~/.vimrc.light that 
>>>> reads 
>>>>
>>>> --
>>>> set nocompatible 
>>>> filetype plugin indent on 
>>>> syntax enable 
>>>>
>>>> cnoremap <expr> / getcmdtype() == '/' ? '\/' : '/' 
>>>> --
>>>>
>>>> Then create a file ~/file.txt that reads 
>>>>
>>>> --
>>>> a 
>>>> b 
>>>> c 
>>>> d 
>>>> e 
>>>> --
>>>>
>>>> Then 
>>>>
>>>> gvim --servername GVIM2 +5 file.txt 
>>>> gvim --servername GVIM2 +1 file.txt 
>>>>
>>>> Expected: Cursor is in line 1. Reality: Cursor is in line 5.
>>>
>>> CORRECTION: Replace
>>>
>>> gvim --servername GVIM2 +5 file.txt 
>>> gvim --servername GVIM2 +1 file.txt 
>>>
>>> by
>>>
>>> gvim -n -u ~\.vimrc.light -U ~\.gvimrc.light --servername GVIM2 +5 file.txt 
>>> gvim -n -u ~\.vimrc.light -U ~\.gvimrc.light --servername GVIM2 +1 file.txt
>>>
>>
>> that won't work either. Using --servername without any of the --remote
>> commands tries to start another instance of Vim as a server with the
>> given name. If the name is already taken by an instance started before,
>> "1", "2", "3", etc. is appended to the server name until an unused name
>> is found. So your second command line will start a new instance of GVim
>> and its server name will be "GVIM21" (given that no server "GVIM2" was
>> running before your two example commands).
>>
>> Regards,
>> Jürgen
> 
> Thank you Jürgen. It indeed hinges on the editexisting plugin. The following 
> .vimrc.light should reproduce the issue:
> 
> ==
> set nocompatible
> filetype plugin indent on
> syntax enable
> 
> runtime! macros/editexisting.vim
> 
> cnoremap <expr> / getcmdtype() == '/' ? '\/' : '/'
> nnoremap : ,
> ==
> 
> Both mappings are necessary to confuse Vim.

apart from the fact that the second mapping is a really bad idea (have
you tried :q to quit Vim?) it seems that it's also responsible for the
behavior you see. When I removed the last line from your ~/.vimrc.light
the following two commands showed the desired behavior: the cursor is on
line 1 after executing

  gvim -n -u ~/.vimrc.light -U NONE --servername GVIMTEST +5 file.txt
  gvim -n -u ~/.vimrc.light -U NONE --servername GVIMTEST +1 file.txt

(Note that I didn't source ~/.gvimrc.light, because it's superfluous.)

That behavior is with GVim 7.4.540 (32-bit) on Windows 7 (64-bit). Your
mileage with a different version on a different OS may vary.

Further testing showed that the combination of line 115 in
editexisting.vim with your second mapping is responsible for the
misbehaving of Vim.

If you change that line to

  exe "normal! " . a:command

(note the additional exclamation mark) the cursor is positioned
correctly even when the colon has been mapped.

@Bram: Any chance you might include that change in the distributed
editexisting.vim?

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to