Tip #258: how long is the current word?
tip karma |
Rating 4/4, Viewed by 686
|
created: |
|
June 10, 2002 9:05 |
|
complexity: |
|
intermediate |
author: |
|
colin dearing |
|
as of Vim: |
|
6.0 |
ever wondered how long the current word is? this can be quite useful when editing data files.
simply add the following to your .vimrc
nmap <C-_> :echo 'word' expand("<cword>") ' wordlen =' strlen(expand("<cword>"))<CR>
and it will tell you the word under the cursor, and how long it is.
and for things that arent words, this addition to your .vimrc works on sections of a line that have been hightligted in visual mode
vmap <C-_> "-y:echo 'word' @- ' wordlen =' strlen(@-)<CR>
again you see the "word", and its length
this may also work on vim 5.x, but i havent checked to make sure.
<<fast page up/down. |
removing the toolbar (icons) from gvim >>
Additional Notes
|