VIM: A Workflow Improvement
My obsession for over a year now has been VIM. VIM, according to vim’s official website is “a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as “vi” with most UNIX systems and with Apple OS X.” Using VIM alongside with Git – using mostly Bitbucket these days – I’ve noticed high quality workflow improvements for my personal writing, music lyrics, vector artwork, and code projects. VIM works with Windows, Apple, Linux which gives me full control on how I want to config it on different systems.
Vim is also soda pop for Fallout 4: Far Harbor. Just between my readers and me, I prefer playing and modding Fallout 3 and Fallout New Vegas.
VIM is like learning to play a new instrument. Overtime, you depend on muscle memory to finish the job. Components of VIM can be configured and extended in the VIMRC file. There are three modes I use: Normal, Visual, and Insert. There’s also Execute mode which I haven’t adopted in my workflow as of yet.
It may seem abnormal when VIM is up in your terminal and while typing nothing comes up at first. While in normal mode, you can navigate using j to go down, k to go up, l to go right, and h to go left. Use b to go back jumping from each word and use w to go forward jumping from each word. While in normal mode, you can save by pressing the colon and w ( :w ). To exit out of VIM, press the colon and q ( :q ). You can save and quit by pressing colon, w, and q ( :wq ); However, I have been preferring to just clear the buffer in lieu of exiting out of vim with colon bd ( :bd ). When in any other mode, you can quickly go back to normal mode by pressing the esc key. The idea of vim is to never use the mouse. If you need to go down to the bottom of your file, press shift g. If you need to go to the top of the document, press g twice ( gg ). To delete a word press daw. To delete an entire line, press dd. To change a word, which is sort of like deleting a word with the exception that you’re instantly in insert mode, press caw.
To search a file for a particular word, colon forward slash and the word you are looking for, i.e., :/magic. To search and replace a word in the entire file, colon + percent sign + the letter s + forward slash + word you are searching for + word you want to replace it with, i.e., :%s/magic/science. By taking out the percent sign, the search and replace will only be focused on the current line you’re on.
To enter into insert mode, you will need to press either the i or the a key. By including shift, the i will take you to the beginning of the line while the shift + a will take you to the end of the line no matter where your cursor is at. To exit back into normal mode, you’ll need to hit the esc key.
Visual mode is activated once you hit the v key. You can also activate visual line mode by combining shift + v. Let’s say you want to select a group of lines and move it. Shift + v then use j or k to move down or up. You could also select every line in the file by hitting gg, shift + v, and shift + g. All that without touching the mouse.
Vim is a highly flexible and extensive editor with the use of Plugins. I install my plugins with Vundle. Some of my favorite plugins are below:
- Vim Snippets
- Syntastic : Checks for active and passive voice
The more plugins you have the more conflicts you might run into. Sometimes it’s best to learn Vim the hard way. I highly recommend checking out Laracasts series on Vim.