Saturday, August 4, 2012

Re: Good idea to remap s to $?

On 4 August 2012 12:59, Daan <bakdoa@gmail.com> wrote:
> I was thinking about remapping s to $, because:
>
> you would gain:
> sp to append what you yanked to the currently line
> si to start insert 1 character before the end
> [count]s to quickly go down [count]-1 lines and go to the end of that line
> sF[char] to find the last [char] on this line
> sciw to change the last word on the line
> scib to change the last block on line
> s[command][upwards motion] to include this entire line in the motion
>
> and also some arguably faster aliases:
> cs => C
> ds => D
> ys => Y
> sa => A
>
> s currently doesn't seem very deserving of home row, especially considering its equal to xi or dl anyway. so it seems to me like a cool idea to give it another function.
>
> What do you think?

It's entirely up to you of course! I use 's' a lot (particular in the
form of e.g. 3s to change three letters). It has the (significant in
my book) advantage over 3xi that if I then use '.' to repeat, it
repeats the change, not just the insertion. A common use case for me
is to want to change the prefix on a lot of variables so I do
something like:

/oldprefix<ENTER>
9snewprefix<ESC>
n.n.n.n.n.n.n.n.n. (with possible extra 'n's when I want to skip matches)

Okay, I could do this with :%s/.../gc, but the above sequence often
works better for me. Therefore, I consider 's' very much deserving of
the home row. If you find $ hard to get to, you could always map most
of your suggested benefit specifically, e.g.

nmap <Leader>p $p

or

nmap ,c C

The great thing about Vim (actually, in the spirit of Cardinal
Ximénez, amongst the great things about Vim) is that you can customise
the keys to work how you want to work and you can easily take your
configuration between different PCs. So if you want to remap s to $,
that's entirely up to you!

Al

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

No comments: