On 08/20/2011 08:03 PM, Tim Chase wrote:
On 08/20/2011 06:05 PM, AK wrote:
Hi, I was trying to change $ command to go to N chars before the end of
line, and found it surprisingly hard to do. Here's what I come up with:
func! EndOfLine()
exe "normal \<End>"
let c = v:count
let c2 = c - 1
let cmd = "normal " . c2 . "k" . c . "h"
if c | exe cmd | endif
endfu
nnoremap $ :<c-u>call EndOfLine()<cr>
Is there a better way to do this?
I got it working with:
:nnoremap <silent> $ :<c-u>exec 'norm
'.((virtcol('$')-v:count)<0?0:(virtcol('$')-v:count)).'<bar>'<cr>
Thanks, but that doesn't work right for me without the count (vim 7.3).
I think the function version is preferable for readability, as well. -ak
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php