It has been a while since the last posts from this series, so the title weekly doesn’t really apply. The previous 2 bite-sized commitments to improve my Vim skills worked well, with about 75% of the things I tried to internalize now in daily use. This week I will focus on some movements, sticking to the number 4.
L move to top and bottom screen.
ctlr+B move a page forward and back.
I find the behaviour of this a bit strange, because it places you on the second to last line of the current page.
' followed by a mark moves to the line of that mark.
Useful automatic marks are
. for the location of the last edit and
' for the location before the last jump.
nG moves to line n.
I used to use
:n for this, but that is not really a movement and thus can’t be combined with other commands.
For more movements also have a look at this Vim Movements Wallpaper. I won’t use it personally, but it makes for a handy reference.
Week 1 of my vim productivity boosting experiment went well. During the week most of the commands I aimed for ended up being used often.
I got a lot of helpful comments, both here and on Hacker News. I ended up unmapping my arrow keys, and I do feel like this made a difference, I am now comfortable with those keys. As a bonus, it feels a lot more natural using hjkl in compound movement commands than it did with the arrow keys.
This week I will focus on repeating previously issued commands. Since 4 at a time worked well for me last time, I will stick to that number.
. repeats the last edit
gv marks the previous visual mark
& repeats a substitution
@: repeats a command
For next week I will go through the comments and pick the ones I found most useful in there.
I’m a long time user of vim, but sometimes I feel I have retained some bad habits from when I first started using it, or that I am stagnating in my skills. Sure, I learn a new trick every now and then, but most of them I tend to forget again. So I am going to pick a few commands, and make an effort to stick to them consciously for a week. Hopefully. they will make it into my permanent repertoire that way. Depending on how well this goes, I might make a series out of it.
Here’s what I am going for this week:
- use c for change instead of deleting and then going to insert mode
- use ctrl-O to jump to the previous location (I just found out this also works across buffers)
- use ctrl-R to paste registers in insert mode
- use hjkl instead of arrow keys for navigation. (this is a big one, tried it before, and failed. But it makes a lot of sense to keep the fingers on home row as much as possible. Might go as far as remapping the arrow keys to force myself to do this.)
Seems like a short enough list to be tractable. More to come next week if I find this approach to be helpful.