28 Jun 2023 - rich
I was just chatting with a younger friend who isn’t really a power user on the command line or particularly fond of vi/vim. He was surprised by what you could actually do within the editor. I took a trip down memory lane and was explaining to him that VI would have had a windowing management system had it not been for the fact that Bill Joy didn’t back up his code - I think because, back then you had to switch back and forth between VAX/VMS and VAX/UNIX BSD if/when the DEC support guys came in to upgrade the VAX-11s…
Anyway, just a few tricks…
:split and :vsplit to split your editor window horizontally or vertically…
C-w w C-w h C-w j C-w k C-w l the above commands move the cursor between your split windows, w moves in a ‘z pattern’ and the h/j/k/l move in the direction associated with those keys (so left/down/up/right)
And even though there are many ways to copy a line and paste it elsewhere… moving the cursor to that line, typing ‘dd’ then moving to the location where you want to insert that line and typing either ‘P’ or ‘p’ for either above or below the current cursor location, is not always the most efficient way of doing this.
Another way is to search for the line you want (or just move to it if you now where it is and how else to get there) then typing ‘yy’ will yank the entire line (without first deleting it) then going back to where you want to insert that line (possibly using (C-o) which is the jump list (jump back from whence you came) and THEN using the ‘p’ or ‘P’ command to paste that line.
I hope this helps!