Posted on this blog as comments may be insightful. My other - more personal - blog doesn’t have comments, so this one will have to do. I’m hoping future comments will be helpful getting this running on Ubuntu 18 or something
I’m interested in text editors again. My main driver for the last 5(??) years only runs on OS X, but I’m not sure if my next laptop will be an OS X laptop. Maybe if I sit out the big couple-year USB-C transition…
Time to look into alternative text editors then. For the last 6 months I’ve been using Atom at work to write React. Atom feels like not a good long term fit for me, even if it’s React / JSX autocomplete stuff is exceptional (and the only reason I stuck with it).
Then SpaceVim caught my eye. It’s a set of configurations for Vim that Makes Vim Better (Again?). Decided to try it, and spent a couple afternoons setting up Ubuntu 16 and SpaceVim.
Spoilers: I like SpaceVim. Slightly undecided about Ubuntu).
Install Vim 8 on Ubuntu 16:
- Follow instructions on Vim 8 on Ubuntu page
- On Xbuntu (what I run on an old netbook), you may need to install vim-gtk3. However, this seemed to Just Work on my Ubuntu 16 install on my (VM) desktop machine.
sudo apt install exuberant-ctags
Install SpaceVim on Ubuntu 16
- Install dein, paste what it tells you into your
.vimrc, fire up vim and run the install command
- Install SpaceVim
apt install fcitx3 Configure fcitx (run
im-config. Yes, change your config, set to fcitx)
After all this, run
vim. It will download some plugins. Now run
vim something.js: it will download more/different plugins. Do this for other languages you use that SpaceVim supports, to cache their plugins.
Neat SpaceVim things
One of the reasons I persisted with SpaceVim was both because this group knows more about hthe state of the VIM art than I do, and because the GUI stuff looked really good. I hate remembering a ton of keyboard commands, so I like picking command options out of a menu, and SpaceVim, like Spacemacs before it, uses a neat type-ahead menu window to let me select what command I want to trigger. This certainly helps in a console app like Vim (even though I run with the menus on).
- See / trigger all commands in a GUI search-ahead style menu: (normal mode) f+.
- See all plugins installed: (normal mode): leader+lp
SpaceVim for Markdown
I wrote this blog entry in Spacevim - it has some neat features specifically for writers.
:Goyo. This puts Vim into a distraction free writing mode. Toggle out by reexecuting the ex command.
I created a user defined command alias for this called :Focus, because I’ll never remember :Goyo.
Making SpaceVim yours
SpaceVim has some opinionated defaults, some of which I don’t like. Check out
~/.vim/autoload/SpaceVim/default.vim. A couple of these opinions are:
- Menu bar off.
- Hide Toolbar
- Mouse off
- Font (Deja Sans Mono for Powerline, 11pt)
Luckily, SpaceVim has a couple customiation points: put your customized settings in ~/.local.vim OR in .local.vim (allowing you to have project specific VIM settings).
To reverse these customizations:
- Menu bar on:
set guifont=Courier 10
Disabling plugins you don’t like (or can’t use)
SpaceVim lets you disable plugins you’re never going to, or can’t, use. For example, I found that the version of Vim I installed had Python 3 instead of Python 2. IndentLines requires Python 2, and that choice is a compiletime, exclusively.
We can disable the plugin per normal SpaceVim conventions by adding this line to our
Force disabling IndentLines
IdentLines is a pretty foundational bit of SpaceVim tech, so SpaceVim doesn’t actually like us doing this. We need to provide a stub implementation for
IndentLinesToggle, the main Vim command in question. Also added to the
command! IndentLinesToggle ;
Loading your own Vim plugins
While most settings can be tweaked in the
~/.local.vim, this file is exec-ed before SpaceVim loads. This means that
dein, or your Vim plugin manager of choice, hasn’t loaded yet.
I’ve added some new functionality to my local copy of SpaceVim, to load a
.local.after.vim (in ~/ or ., just like the built in version). Here’s how:
function! LoadCustomAfterConfig() abort let custom_confs = SpaceVim#util#globpath(getcwd(), '.local.after.vim') let custom_glob_conf = expand('~/.local.after.vim') if filereadable(custom_glob_conf) exec 'source ' . custom_glob_conf endif if !empty(custom_confs) exec 'source ' . custom_confs endif endfunction call LoadCustomAfterConfig()
This allows me to keep my customizations - wither they need to be loaded before SpaceVim, or after SpaceVim, in a seperate file, with only this one change to the core configuration.
One thing worth noting: if you add a new package to your
.local.after.vim you’ll need to run
:call dein#install() to download the pcakage. (perhaps this runs too late for the auto-downloader to pick up).
SpaceVim is pretty good. There are some neat things I didn’t know Vim could do, and some stettings that my previous Vim configuration had set also. So, like coming home to Vim, with the old familiar armchair and a nice hyper modern sofa too.
TL; DR: pretty neat, especially it’s use of Unity Vim plugins that give a nice type-ahead GUI for commands, buffers, etc etc. A welcome jumpstart back into the world of Vim, and better / easier than anything I could have put tocgether myself.
Feels like there’s optimization that could be done (it lags pretty hard on my almost 8 year old netbook… on the other hand, 8 year old netbook…)
But that’s SpaceVim, and how to set it up on Ubuntu 16. Up, up and away!