On 08/21/2011 01:20 PM, AK wrote:
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:

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

I'm not sure what you mean about it not working right without the count. Without the count, it just acts like "$" normally does (with the small exception that Vim remembers that it's in column-X instead of at-the-EOL, so subsequent vertical movements such as j/k stay in the same column instead of jumping raggedly to the EOL on each line).

-tim





--
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

Reply via email to