tags:

views:

108

answers:

1

hi everyone, i 'm new to vim. now i'm writing a vim script. how can i get the word under the cursor and the text of the current line? i want to use it in my script. great thanks.

+7  A: 

You can with expand and getline:

let wordUnderCursor = expand("<cword>")
let currentLine   = getline(".")
CMS
great thanks CMS!
You're welcome!
CMS