DEV Community

Cover image for How useful is learning VI/VIM for a new programmer?
jones268
jones268

Posted on

How useful is learning VI/VIM for a new programmer?

I've been using a text editor called "vim" for more than a year now, and it has changed my programming life. Let's take a look.

If you are going to be writing code in Python, then it would be useful to learn to use a text editor called "Vim". I don't say that because I wrote the book on this topic (I didn't), but because it will help you be more efficient as a programmer.

Vim is an extremely powerful text editor used by programmers and system administrators around the world. Often described as a "programmer's editor", it's not always the easiest thing to get started with. If you've ever wanted to give it a try, but are unsure where to begin, try these exercises

Why vim?

Vim is one of the most popular text editors in the world. It’s been heavily used for over 30 years for its simplicity, flexibility and the speed at which it allows its users to navigate their files. Vim has a very steep learning curve, but if you’re willing to put in the work, the benefits are innumerable:

  • 1) you’ll learn one of the most powerful text editors in existence;
  • 2) you will gain a skill that will serve you for the rest of your life;
  • 3) you will be able to edit files and folders on remote computers;

Vim is a classic. It is a venerable text editor, and has been around since 1991 when Bram Moolenaar first announced that he had started working on it. Vim has stood the test of time, and there are good reasons to learn it today. Vim’s design is minimalist and follows the KISS (Keep It Simple Stupid) principle. The core editor is very small, with all additional features being optional plugins.

You can also use Vim inside popular IDE's. Getting all the benefits of the IDE plus all the benefits of vim.

vim inside vscode

Top comments (6)

Collapse
 
simchuck profile image
simchuck • Edited

vim actually has its roots much further back than when Bram Moolenar first shared in 1991. He was porting Bill Joy's vi editor, which was a visual terminal-based extension to the original ex line editor, or going back even further, to Dennis Ritchie's (or was it Ken Thompson?) ed editor in his original Unix build.

Why does this matter? Many of the keyboard shortcuts have are essentially unchanged from these ancestors, and have influenced even more applications that came afterward. vim includes 'ex' mode, which is essentially all of the commands that were available in ex, and also available in vim from the : 'command mode'. ls uses many of the vim shortcuts, as do many other command line utilities.

I discovered vim a few years ago after deciding that the graphical overhead of Windows was no longer able to support my needs, and quickly realizing that getting back to my text-based command line roots (DOS) provided a much more stable, and efficient, interface. I love working from the command line, and vim key bindings make so much sense to me. There are so .many advantages that I couldn't even begin to articulate them, however one disadvantage - many great applications do not provide sufficiently robust vim-like interface so I have to learn a "customized" hybrid interface for the best available experience.

Collapse
 
simchuck profile image
simchuck • Edited

Just feel the need to make another comment/observation...

The typical description of the uniqueness of vim is to characterize it as a "modal" editor, since you have to type a key to switch between editing, movement, etc. I believe that all editors are actually modal, it's just that those weened in graphical environments don't think of moving your hand onto the mouse, moving the mouse, and clicking, as a mode switch. When you really think about it, this a much more invasive interruption to your workflow, let alone the significantly more inefficient physical effort required to switch to this mode.

I believe the fundamental difference is that vim uses a "sticky" mode which defaults to one that allows you to navigate your document rather than to edit. This allows vim to use an extremely keyboard-centric interface, to the point that you can completely eliminate you mouse/trackpad. If it wasn't for those damn GUI applications that haven't fully appreciated what vim has proven to be so effective ..

This, along with the vim "grammar", which provides an extremely intuitive compostable syntax that greatly leverages the available features with a relatively small level of fundamental memorization... Overall, genius.

Collapse
 
psiho profile image
Mirko Vukušić

I started using vim last year, after 30 years of different OSs and editors. Personally, trigger for me was: mouse. I got sick of it, wanted to cut down using it as much as possible. Moved to tiling window manager and Vim the same day. Decided to build IDE-like config with Coc and other plugins. it's been serving me well since. Still a lot to learn, but I feel home.
My opinion is that there are ton of reasons to use (or not to use) Vim. Efficiency is often mentioned but in my opinion it is just one of many reasons (if at all). Personally, for me it's more like what Linux is to Windows. It's absolute freedom to tune it into your own editor/IDE. Also, it's "acquired taste", like a good Cognac. It takes time to love it but once you do, it's impossible not to love it, ever again.
Advice? if you're not a tinkerer, if you lack discipline or patience, if you're always in a hurry to make goals/deadlines and stressed out.... just don't even try it. if you do and don't like it.... just remember good old bottle of cognac. There is a reason it costs so much.

Collapse
 
psiho profile image
Mirko Vukušić

Oh to add another important experience.... it started bothering me that other software does not use vim keyboard shortcuts :) I have many :wq strings across my Google Docs, and if there was a :wq domain to buy, I definitely would buy it.
But that gets better too. Switched zsh to vi mode, vifm is my new file manager, etc.

Collapse
 
dproteus13 profile image
dproteus13

To be clear, generally speaking IDEs that offer "Vim" support aren't actually embedding Vim. They're providing key bindings and some level of modal support. You generally get all the benefits of the IDE, and a fraction of the benefits of Vim (though usually the most crucial portion that isn't offered by the IDE, like modal support).

I use the Vim plugin inside VSCode, and used to use the plugin for Eclipse, when I wanted other features of those IDEs... But now that I know how to use Vim (I highly recommend the book "An IDE Called Vim"), I mostly prefer to use the real deal Vim.

Collapse
 
grizzlysmit profile image
Francis Grizzly Smit • Edited

I prefer gvim on my own box, even more power, and the YouCompleteMe (YCM) makes it a full on IDE, and then I can fall back to vim in SSH sessions, gvim/vim is the best