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 \"
let c = v:count
let c2 = c - 1
let cmd = "normal " . c2 . "k" . c . "h"
if c | exe cmd | endif
endfu
Reply to message «Tweaking $ command»,
sent 03:05:13 21 August 2011, Sunday
by AK:
> Is there a better way to do this?
0. You said you want just
> to change $ command to go to N chars before the end of line
but what in this case `k' is doing in the second :normal command?
1. Y
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 \"
let c = v:count
let c2 = c - 1
let cmd = "normal " . c2 . "k"
On 08/20/2011 07:57 PM, ZyX wrote:
Reply to message «Tweaking $ command»,
sent 03:05:13 21 August 2011, Sunday
by AK:
Is there a better way to do this?
0. You said you want just
> to change $ command to go to N chars before the end of line
but what in this case `k' is doin
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 \"
let c = v:count
let c2 = c - 1
let cmd = "n
Reply to message «Re: Tweaking $ command»,
sent 22:17:27 21 August 2011, Sunday
by AK:
> The 'k' was fixing downward movement of $ command. After replacing with
> normal! $, it works without that fix.
`$' does not move downward on its own. I don't see why it should
On 08/22/2011 01:58 PM, ZyX wrote:
Reply to message «Re: Tweaking $ command»,
sent 22:17:27 21 August 2011, Sunday
by AK:
The 'k' was fixing downward movement of $ command. After replacing with
normal! $, it works without that fix.
`$' does not move downward on its own. I d
Reply to message «Re: Tweaking $ command»,
sent 22:26:44 22 August 2011, Monday
by AK:
> It does move downward. 3$ moves 2 lines downward, etc.
Now see this in help. For some reason it was not working before while testing
(perhaps forgot to add more lines).
> Ok, I see.. but why does
On 08/22/2011 02:56 PM, ZyX wrote:
Reply to message «Re: Tweaking $ command»,
sent 22:26:44 22 August 2011, Monday
by AK:
It does move downward. 3$ moves 2 lines downward, etc.
Now see this in help. For some reason it was not working before while testing
(perhaps forgot to add more lines
Reply to message «Re: Tweaking $ command»,
sent 23:08:55 22 August 2011, Monday
by AK:
> I think it's also a particularly bad kludge because it's hard for a user
> to know what to look for in help system.
If I am not mistaking, I found this just as you: from someboby's c
On 08/22/2011 04:01 PM, ZyX wrote:
Reply to message «Re: Tweaking $ command»,
sent 23:08:55 22 August 2011, Monday
by AK:
I think it's also a particularly bad kludge because it's hard for a user
to know what to look for in help system.
If I am not mistaking, I found this just as
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 $ :ex
On 08/22/2011 05:21 PM, Tim Chase wrote:
I got it working with:
:nnoremap $ :exec 'norm
'.((virtcol('$')-v:count)<0?0:(virtcol('$')-v:count)).''
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
13 matches
Mail list logo