Integrated development environment (IDE) is an important tool for software developers. In simple terms, IDE is a powerful text editor for creating programs.
Vim is a lightweight, fast, and free text editor. Vim is well known for its hotkeys that make coding faster and more comfortable. Developers created a lot of plugins for Vim.
So we’re going to build a fast, flexible, lightweight IDE using Vim with plugins. Let’s define the necessary functions of IDE:
- Syntax highlighting
- Lint (analyzes source code to flag programming errors, bugs)
- Code formatting tool
The commands below are intended for Linux. I use Ubuntu 16.04.
We are going to use modern Vim plugins which require Vim 8 (latest version). Install Vim 8 using:
Put this at the top of your
~/.vimrc to use Vundle:
Launch Vim and run
Install the syntax highlighting plugin
We need add this line to
.vimrc into the plugins section:
Then we need to install the plugin using vundle. Start Vim and type
:PluginInstall command. The plugin is installed:
Now it looks better.
Snippets make coding faster. You can quickly insert loops, conditions, functions and other language constructions by using hotkeys.
Also remap the hotkey to
A lint checks a source code for bugs, stylistic errors. It’s an important tool for writing high-quality code.
ALE is a modern lint plugin for Vim. ALE checks your code in the real time mode (while you edit your code). Actually, ALE is a layer between Vim and a lint tool. We will use ESlint as a lint tool for a JS code.
The lint works but I would like to adjust messages style. I added these lines to
Line numbers are disabled by default.
Add this to
A code formatter (a code beautifier) converts your code into the correct format. You can quickly write some code and to format it with just one click. ESLint and ALE will do this job.
These options activate code formatting on saving a file:
Autocomplete increases your typing speed. It predicts the word a user intends to enter. Install plugin dependencies:
Install the plugin:
YCM has a client-server architecture. The commands above installs the client. Here we install YCM server:
Cool, it works!
NERDTree is a file system explorer https://github.com/scrooloose/nerdtree
I added this to my
.vimrc to open
NERDTree with Ctrl+n:
These line configure different highlighting for different file extensions:
System copy provides copying/pasting text to the system clipboard.
Plugin 'christoomey/vim-system-copy' to
cp to copy into your system clipboard and
cv to paste from system clipboard.
My current .vimrc
You can find the latest version of my .vimrc in my repository: https://github.com/maxim-danilov/vim-config-maxim-danilov
We just made a good tool to write a JS code and edit any config files. It’s lightweight, fast, сustomizable and I can use it on any device via SSH.