Saturday, January 9, 2016

Re: E749: empty buffer with vimdiff startup commands

On Saturday, January 9, 2016 at 3:41:35 AM UTC+1, ZyX wrote:
> ​I do not know why this happens, but I would really suggest to always avoid :bufdo.​ First, this command switches current buffer which is not wanted 99% of times. Second, it has strange interactions with at least my setup which results in absence of syntax highlighting (basically why I never use it). Third, 90% of times one is using :bufdo switching buffers is not needed at all. Specifically in your case I would use
>
>
>     vimdiff -f -c 'wincmd J' -c 'call map(range(1, bufnr("$")), "setbufvar(v:val, \"&modifiable\", v:val == 1)")' merged local base remote

Thanks, this is exactly what I was looking for :)

I did notice that Vim was switching buffers when I used bufdo, but did not find an easy alternative command that did not, and my Vimscript knowledge simply isn't that good yet.

> Alternative solution is to simply remap `dp` so it will put to first buffer always.

True, although I'm not exactly sure it would do the right thing with other uses of diff buffers, e.g. I have multiple buffers open and call 'Gdiff' (from Fugitive, opens a diff from a given commit).

> Note that -d is not present: Vim will start diff mode once executable is called vimdiff, thats the whole point of such naming (usually vimdiff is a simple sym- or hardlink to vim, if in your distribution it is not then maintainers are probably insane).

I actually copy-pasted this from https://github.com/git/git/blob/master/mergetools/vimdiff and did not modify it since I assumed it was there for a reason.

> And please do not use short versions of option names when asking for help, I have no idea WTF is ma option. It is also good for documentation purposes.

Noted!

--
--
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

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

No comments: