SpaceVim as IDE
7 min read
All of us at some part of our software development journey has most likely heard of Vim.
Vim 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.
Vim is rock stable and is continuously being developed to become even better. Among its features are: persistent, multi-level undo tree extensive plugin system support for hundreds of programming languages and file formats powerful search and replace integrates with many tools
Vim is an old school, too linux way editor, and it takes a bit of effort to do all the customizations. This is where SpaceVim steps in, it makes things way easier for the user.
SpaceVim is a distribution of the Vim editor that’s inspired by spacemacs. It manages collections of plugins in layers, which help collect related packages together to provide features. This approach helps keep configuration organized and reduces overhead for the user by keeping them from having to think about what packages to install.
What is SpaceVim?
.vim in your home directory, this is the simplest explanation of SpaceVim. In general, vim will try to find
~/.vimrc in your home directory. If there is no such file. vim will use
~/.vim/vimrc as the init file.
This is how and why SpaceVim can be loaded. If you create a
~/.vimrc in your home directory, SpaceVim will not be loaded automatically.
Difference between SpaceVim and Vim
SpaceVim use layers to manager plugins and config. Users do not need to searching for plugins, also do not need to config them. For example, if you are a golang developer, and want to use use SpaceVim as a simple GO ide. You just need to install SpaceVim, and enable
lang#go layer. All plugins will be downloaded automatically.
Why use Vim or specifically SpaceVim?
VIM is from the era when text mode was the norm, GUI wasn't present and having a mouse was a novelty. Developers at that time didn't have any interest in mimicking GUI in text mode. nor there were any frameworks to do so. the computer wasn't common and the only users were either programmers or mathematicians.
To create a program for such an audience in that era would result in what you see as VIM or similar. a blank screen with convoluted and absurd shortcut keys (to quit VI you press
so the VIM creators designed the app for their target audience according to what was then available- a large blank screen as the work area and various key combinations to invoke some functionality. No menus, no buttons, no progress bars etc.
My personal experience with Vim:
It was problematic at first but within a day or two when I got hold of various key combinations and installed various plugins, I was able to code pretty quickly as no cursor was needed it was just a keyboard.
- You need to install Vim with Python support (click here for the installation steps)
- You need to have git and curl installed in your system, which are needed for downloading plugins and fonts.
The default configuration file of SpaceVim is
~/.SpaceVim.d/init.toml. Users can edit this file to change the configs.
Here is my
For those who are new to vim, visit devhints.io/vim to learn basic vim commands.
There are different kinds of shortcuts, start with different prefix:
|Prefix||Prefix name||Example||Description||More info|
|open/close filetree||just press space key and wait 1s|
|split window, equal to ||link|
|jump to other tab or buffer||just press |
|go to||go to first tab||link|
|fold||toggle a fold||link|
Most frequently used shortcuts :
|wait 1 second to get hint for more shortcuts|
|trigger file tree|
|Open tab manager|
|switch to different tabs or buffers|
|switch to different windows|
|switch to different windows|
|open file tree and locate to current directory|
|open file and split window horizontally|
|open file split window vertically|
|comment/uncomment current line|
|comment/uncomment current paragraph|
|comment num lines|
|open a new tab, equal to |
|clear search highlight|
|highlight any character past the 80th column|
|toggle highlight of the current line|
|toggle highlight indentation current column|
|Searching in current file|
|Searching in current directory|
|Searching in all loaded buffers|
|Searching in current proj, equal to |
|insert space above|
|insert space below|
|Go to function definition|
|format code according to pep8 standard|
|run code (for any language be it python or c)|
Note: These are the shortcuts that I use the most there are many more that you might use. You can explore them by pressing
space-barin the spacevim, wait a sec and you'll see a window which contains all kinds of shortcuts.
github.com/Jackiexiao/10-minutes-to-SpaceVi.. will give you a good idea about all the shortcuts do visit it :)
Customizing SpaceVim to adapt as IDE for different languages
The trick is simple you just need to add a layer in
~/.SpaceVim.d/init.tomlof that particular language. For example if I want to use SpaceVim for python I'll add:
[[layers]] name = "lang#python"
Similarly for other languages they have different layers visit their guide of programming language support (click here) for more details.
Thank you for reading, hope you enjoyed the article! Queries and feedback are most welcome :) kindly leave them below.
Follow me on Twitter | LinkedIn for more web development-related tips and posts.
That's all for today! You have read the article till the end.
Did you find this article valuable?
Support Ankur Patil by becoming a sponsor. Any amount is appreciated!