Sujet : Re: Système D
De : bowman (at) *nospam* montana.com (rbowman)
Groupes : comp.os.linux.advocacyDate : 24. Apr 2024, 04:32:38
Autres entêtes
Message-ID : <l8r9a6Fc3dfU1@mid.individual.net>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Pan/0.149 (Bellevue; 4c157ba)
On Tue, 23 Apr 2024 21:32:50 -0000 (UTC), candycanearter07 wrote:
rbowman <bowman@montana.com> wrote at 21:26 this Tuesday (GMT):
On Tue, 23 Apr 2024 21:20:06 -0000 (UTC), candycanearter07 wrote:
>
I thought the paste key was p?
>
'.' repeats the last action so if you go into insert, add ' ha', and
exit insert mode '.' will insert ' ha'. 'p' inserts whatever is in
the default buffer.
Interesting, I didn't know that.
It can be handy. Suppose you want to change 'some_word' to 'some_phrase'
but not in every case and you don't want to change just 'word'
/word
will find all instances of 'word'. When you come to a 'some_word' that you
want to change, 'cw', edit it to 'phrase' and hit Esc to go back to
command mode. 'n' will take you to the next instance of 'word'. When you
get to a 'some_word' that you want to change, the cursor will be on 'w'.
'.' will repeat the 'cw' and replace 'word' with phrase.
This is sort of a contrived example but it's very useful to replay the
last command selectively where %s/_word/_phrase/g would change
everything.
Like everything else vim has a lot of tricks, a subset of which I use
frequently and some of which I'm completely ignorant about or have to look
up. There's usually different ways to skin the cat too and all the macros
you can set up in .vimrc or .gvimrc.