Vi: word completion

For my new job I’m on the Linux platform, and due to the amount of software development that takes place on servers in remote locations, all of the developers on my team utilize the BASH shell, the konsole terminal program, and Vi for editing.  Though I learned the basics of Vi in college due to the lack of other editors on the computer science department servers, compared to the other developers, working with Vi and the terminal feels quite clumsy to me.  I’m working on weaning myself from graphical editors and eventually enjoying the productivity boost of using a solid editor and the more advanced features of the shell.  I hope to make a regular post with tips on improving one’s productivity in Vi, BASH, and even with konsole.

Today I’d like to introduce word completion.  It does not require any third party extensions or libraries and it is enabled by default.  If you’re typing a word in a file or in your code that already exists somewhere in the file, type at least one letter of the word and then do the following:


You should see a terminal-like pop-up containing all of the possible choices.  Press Cntl-n to traverse the list going downwards, and press Cntl-p to traverse the list in the opposite direction.  That is all there is to it.  It certainly helps with long_variable_names_like_this!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s