Saturday, July 5, 2014

Re: Run External Command with specific buffer

On Saturday, July 5, 2014 4:40:06 AM UTC-5, Mohammod nazmuSakiB wrote:
> Lets say I split all my buffer with "sba" command
> Then I navigate to a window , lets say 2nd buffer.
> Now I want to run an external command with another buffer as argument
> For example
> :!g++ "Here I want to pass first buffer name as argument"
> how to do so?

Experimentation shows that you cannot reliably use '#' for alternate file if you have multiple split windows.

So you'll need to get the buffer name from the window instead. Here's an example retrieving the buffer name from the last visited window:

:echo bufname(winbufnr(winnr('#')))

Adapt to your needs.

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