Day 21: Completing Side Quests in Vim

Today was honestly really fun. I finally finished the material from Lecture 3: Vim from the MIT course. I got to focus on reading some of the articles I had put off because they were not the most relevant to learning how to use Vim itself. For example, I starting reading through the Wikipedia article on the Editor War between Vim and Emacs.

TLDR;

Okay, so here are the highlights of what I did:

  • I learned about Vim autocompletion using the CTRL-N command
  • I installed CtrlP plugin into Vim and played around with it a bit. My coding life has not changed for good. Ther is no going back.
  • I read a great article called Seven habits of effective text editing that has really helped me improve my Vim skills even more.

Vim Progress

Here are my notes from today. They are somewhat random but I will be reorganizing them once I have gotten the chance to practice Vim some more and review my initial notes.

Quick Search with *

If you see a specific word and want to search for other occurrences of the same word, use the * command. It will grab the word from under the cursor and search for the next one.

Save your location for later with m

Instead of trying to refind where you were last while jumping within a file, you might want to mark the location with the m command, continue your repeated change and come back there later.

After you have marked with cursor position with m, you can go back to that marked position in the file with:

  • ' ' = Go to the first non-blank character in the line of the marked position. (single quote key)
  • ` `= Go to the exact position that was marked. (backtick key)

Autocomplete any text in vim with the Ctrl-n command.

When you start typing a word, function, variable name, etc and press Ctrl-n a list of potential word completions will be listed. This list can be navigated with:

  • CTRL-n for the next entry
  • CTRL-p for the previous entry

To learn more about this you can type :help popupmenu-keys while in Vim.

Make Abbreviations to avoid typs with :abbr

You can use an abbreviation following :ab[breviate] [<expr>] [<buffer>] {lhs} {rhs} syntax.

Conclusion

That’s all for today. If you are interested in the MIT course you can check out the video lecture I’m currently going through. The lecture is helpful but isn’t sufficient by itself. Anyways, until next time PEACE!

YouTube player