Sunday, April 24, 2011

Re: vimdiff "-c next" breaks diff highlighting?

On 24.04.2011 23:54, Gary Johnson wrote:
>>
>> non-working:
>> $ vimdiff -c "saveas /tmp/rc.conf" -c next -c "setlocal noma readonly" -c prev
>> /etc/rc.conf /etc/._cfg0000_rc.conf
>>
>> works:
>> $ vimdiff -c "saveas /tmp/rc.conf" -c "setlocal noma readonly" /etc/rc.conf /
>> etc/._cfg0000_rc.conf
>
> :next means "edit the next file in the arglist". Vim loads the
> current buffer with the contents of the next file in the arglist,
> which turns off diff for that buffer.
>
> That is probably not what you wanted to do. You probably wanted to
> switch focus to the other diff window. You can do that with the
> :wincmd command, e.g.,
>
> -c "wincmd w"
>
> See
>
> :help wincmd
> :help CTRL-W_w
> :help window-move-cursor


Thanks for the tips. I've traced this particular problem down to having
https://github.com/tpope/vim-fugitive bundle loaded, something in there
breaks the original behavior.

Other than that, the :next, :prev sequence approach works to achieve the
desired goal after all. I'm not sure if there is any additional value to
converting the command line to wincmds?

--
Leho Kraav, M.Sc.

--
You received this message from the "vim_use" 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

No comments:

Post a Comment