My growing entanglement into vi

December 30, 2013

It started with vi becoming my sysadmin's editor, the editor that I used for quick edits because it was everywhere, worked in minimal environments, and it started fast. But of course it didn't stop there. Any good tool has a virtuous circle where more use makes you more familiar with it and thus makes it easier to use so you use it more; vi goes well beyond that in terms of rewarding extended use. Vi's march into my editing life has not been fast but it's feeling more and more relentless as time goes by, especially when I do things like specifically configure git to use vi instead of my normal default. I'm not using vi pervasively quite yet, but increasingly my major holdout (writing email in my full email environment) feels a little bit awkward.

(My normal default $EDITOR is a script that tries to intelligently pick the editor to use based on my current environment based on things like whether or not I have X available.)

This has not fundamentally changed my view of vi as a whole (it remains not my favorite editor). I am simply being seduced by convenience and familiarity, and running into the limits and issues in my major other editor. Not that vi is bad (rather the contrary), but I still miss things from my other editors and often would sort of prefer to be using them.

(Possibly this attachment to my major other editor is just emotion speaking.)

While I've been additional learning vi (well, vim) features slowly over time, I still have not really attempted to become solidly familiar with Vim's advancements over the core vi editing commands (I'm going to wave my hands about the reasons why, but see above about vi still not being my favorite editor). If I get more seriously into vi, and it seems inevitable that I will, I should probably change that. My obvious weak areas are the areas where vi itself is weak: working fluidly with multiple files and also with split screens for editing two files simultaneously. Mastering doing this in Vim would remove one significant reason that I revert to other editors.

(I will probably always edit Python, C, and Go code in GNU Emacs when I have a choice. But there is a fair amount of other multi-file work that would at least be more convenient if I knew what I was really doing in Vim.)

I know that Vim has a universe of advanced text movement and text manipulation commands but I'm honestly not sure that I feel much interest in learning them. The mere fact that there is a universe of them is kind of daunting and I have no confidence that they'd speed up the sort of editing work that I do very much. Probably some of them would, so I suppose I should at least glance over the list to see if anything stands out.

(This has come out more rambling and thinking aloud than I thought it would. I do think that there's something interesting about how vi has wormed its way into my computing life as more and more the editor I reach for, but I don't have the words for it right now.)


Comments on this page:

By dozzie at 2013-12-30 06:02:17:

My obvious weak areas [...]: working fluidly with multiple files and also with split screens for editing two files simultaneously.

Here's a small cheat sheet:

  • :new, :vnew -- new, empty file (split window horizontally or vertically)
  • :split, :split filename.txt, :vsplit -- open file (current or specified) as a new window
  • ^W f -- open file pointed by the cursor
  • ^W c, :close, ^W q, :quit -- close current window (first two never close the last window)
  • ^W #, where # is one of hjkl -- move cursor to different window, according to movement key
  • ^W #, where # is one of +-<> -- resize window vertically or horizontally
  • ^W # _, ^W # |, where # is a number -- make current window # lines high/columns wide
  • ^W = -- equalize width/height of windows

Generally you could want to read :help windows.

I spent years as a vi user, trying to ignore Vim features other than syntax highlighting. I now realize that was a horrible mistake. Vim features like text objects, visual modes (especially block visual mode), enhanced regex support, buffers, windows, etc., etc. make plain old vi feel positively primitive by comparison.

You might want to spend some time watching some of Drew Neil's Vimcasts, or maybe even pick up his book Practical Vim, to get an idea what you're missing by not embracing Vim fully.

Written on 30 December 2013.
« Broad thoughts on tags for blog entries
Link: Alex Gaynor's 'About Python 3' »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Dec 30 02:57:39 2013
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.