I am using VIM and I would like to pass the current line number to an external program.
something like this:
map <F3> :!mycmd <linenumber><CR>
I tried to substitute <linenumber>
for line('.')
, line(".")
, .
and others, but nothing seems to work.
Thanks.
You must use :execute
to use a variable or expression in your mapping:
nnoremap <F3> :execute ":!echo " . line('.')<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With