On 2017-03-19 03:51, Honggyu Kim wrote:
> I would like to ask a question regarding getting the current line
> number. I can get it as follows:
> 
>   :echo line(',')
> 
> It works fine but my question is in command execution with '!' in
> the front.
> 
>   :!echo line('.')
> 
> But "line" is not interpreted before going to shell and makes an
> error.
> 
> Can anyone give me some guide how I can pass the current line
> number to shell?
You can either pass it as an environment variable as h_east suggests,
or you can hard code it into the command you're running via a vim
"exec" command:
  :exec '!echo '.line('.')
Depending on your use case (and how much you need to reuse it) in
your command, one might be easier than the other.
-tim
-- 
-- 
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:
Post a Comment