Gentleman,
Simple question about Vim!
How can I check if the cursor is at the end of a line using a function in vimrc?
[]'s
gvimmacvimvimvim-pluginsvimrc
Gentleman,
Simple question about Vim!
How can I check if the cursor is at the end of a line using a function in vimrc?
[]'s
Best Answer
You don't need a function to determine this, but you could wrap the following test in a function if you needed to. That would depend on what you are trying to do and what you need from the function.
The
col()
function returns the column of its argument. The last column of a row iscol("$")-1
and the cursor column iscol(".")
, sowill echo
1
when the cursor is at the last column and0
otherwise.See: