suppose I have a line like this: hello foo bar
and my cursor is on foo. I want to map a key that will call a function with foo without me having to first select it visually. How would I do this in vim?
you are looking for function expand(expression)
here your expression would be '<cword>'
If you love to put it as function argument, you could :yourFunction(expand('<cword>'))
:h expand( for more details.
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