Grigor Bezirganyan
Posted on September 8, 2019
Backstory
Nowadays, there are many text editors and IDEs present for developers and it is often a hard decision to choose a particular one. Since most of them offer quite similar interface and functionality, it doesn’t really matter what editor will a beginner developer use. Nevertheless, for an intermediate or advanced developer choosing the right editor can give a significant performance boost.
There are many modern and powerful editors and IDEs, such as JetBrains IDEs, Visual Studio Code, Atom, etc. Nevertheless I would like to concentrate on one of the relatively old text editors, which can be as powerful (or more powerful :) ) as the other text editors, while, giving you a better typing experience. If you haven’t guessed it, I am talking about vim: a text editor released in 1991, which is still very popular. Although vim isn’t very beginner-friendly and isn’t as powerful out-of-the-box as other IDEs, with several plug-ins and configurations it can give you a better performance than your standard IDE.
In my previous post I talked about configuring VIM to compete with other IDEs. It was more C/C++ oriented, as that time my main language of coding was C++. A year ago, I changed my workplace and Python became my main programming language. Since almost everyone was using PyCharm at my workplace for Python development, I decided to give it a shot. I have to admit, PyCharm is a really good IDE and I enjoyed it’s smart functionality. Nevertheless I missed my typing experience in VIM. Installing vim layout for PyCharm didn’t rally help as well, and I decided to spend a day and configure my vim to have all the functionalities of PyCharm that I really needed.
Now let’s go to some of the features I managed to bring to VIM that made not to miss the PyCharm IDE.
Note that the plugins mentioned here are not python specific, but since I have mostly tested them on python, I cannot say for sure how they will work on other languages. If you have tested them it would be interesting to hear about your experience in the comment section:
Configuration
Code Completion
In my previous post I talked about YouCompleteMe, which is an awesome and open-source plug-in that offers a very good code suggestion for many languages. It was one of the best plug-ins I found while I was developing in C++, nevertheless, for Python I found a better alternative. Kite claims to use Machine Learning to offer useful code completion. Since Kite is closed-source we can not be really sure whether they really use Machine Learning or not, but I can guarantee that you will like it’s code suggestion.
One of the disadvantages of Kite is the fact that it is closed-source, and if you are a sworn open-source person, YouCompleteMe is still a pretty good option.
Error Detection
For syntax checking and error detection I use the ALE (Asynchronous Lint Engine) plug-in, which allows you to check your syntax while you type. It uses
ALE makes use of NeoVim and Vim 8 job control functions and timers to run linters on the contents of text buffers and return errors as text is changed in Vim. This allows for displaying warnings and errors in files being edited in Vim before files have been saved back to a filesystem
Furthermore, after some configurations ALE can check whether the python code is PEP-8 compliant and fixes it if it is not.
Navigation
Fast and effective navigation across files is an essential feature for fast development. One of the well known plug-ins for navigation in vim is the NERD Tree. Nevertheless I found the vim-vinegar to be a better alternative. It offers a cleaner interface and better shortcuts for navigation.
crtl-p is another useful plug-in for easy navigation in vim. It is a
Full path fuzzy file, buffer, mru, tag, ... finder for Vim.
- Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
- Full support for Vim's regexp as search patterns.
- Built-in Most Recently Used (MRU) files monitoring.
- Built-in project's root finder.
- Open multiple files at once.
- Create new files and directories.
- Extensible.
tmux
Although tmux is not a vim plug-in, it really improves the experience while coding in vim. Not only I can ssh to my machine anytime I want from anywhere in the world and get my session and layout, but it also takes my multitasking ability to a whole level.
Other plugins?
As I mentioned in my previous post there is a very awesome website full of various vim plugins, called vimawesome.com. You can find many many more plugins there and make your vim much closer to an actual IDE.
You can comment about your vim configuration below. By the way this is my first blog post, so I am waiting for your positive criticism in the comment section.
Posted on September 8, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.