DEV Community

darkmage
darkmage

Posted on

Getting Started with SpaceVim

Getting started with Spacevim

A friend of the channel (https://twitch.tv/darkmage666) recently suggested I check out Spacevim. Being a veteran of vim now for over 10 years, it might be time to play around with my setup, provided I have the patience to overcome small nuances and differences in the workflow.

To get started, install Spacevim:

curl -sLf https://spacevim.org/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Then run either vim or nvim.

vim
nvim
Enter fullscreen mode Exit fullscreen mode

To uninstall Spacevim:

curl -sLf https://spacevim.org/install.sh | bash -s -- --uninstall
Enter fullscreen mode Exit fullscreen mode

I wanted my Spacevim start to be relatively pain-free but basic navigation and things I had setup in my original .vimrc did not work out-of-the-box. Specifically, three big issues:

  1. The left-hand keybindings I'd written in my .vimrc were not migrated over.
  2. Attempting to run a python3 curses program inside of nvim results in an error.
  3. Page up and down is some odd 'smooth scrolling' thing.

I solved #2 by using 'vim' with Spacevim instead of nvim, so that was easy.

To solve #3, navigate to ~/.SpaceVim.d/init.toml and add this to the bottom:

[[layers]]
name = 'core'
enable_smooth_scrolling = false
Enter fullscreen mode Exit fullscreen mode

For #1, I added the following to the same file, ~/.SpaceVim.d/init.toml, in the [options] section:

bootstrap_before = "myspacevim#before"
bootstrap_after = "myspacevim#after"
Enter fullscreen mode Exit fullscreen mode

Then, I created a folder and file at: ~/.SpaceVim.d/autoload/myspacevim.vim and put the following in it:

function! myspacevim#before() abort
" Map Right Hand Directionals to Left Hand Commands
noremap s h
noremap d k
noremap f j
noremap g l
" Map Left Hand Commands to Right Hand Directionals
noremap h s
noremap k d
noremap j f
noremap l g
endfunction

function! myspacevim#after() abort
endfunction
Enter fullscreen mode Exit fullscreen mode

Now I think I am ready to learn some Spacevim! There are a lot of differences with the original Vim, and replicating my user experience (or improving on it) is going to take some time. I really like how it looks out-of-the-box in general, but maybe there's one more tweak I can make before I really get jamming.

To disable "relative line-numbering", I added the following to the same file, ~/.SpaceVim.d/init.toml, in the [options] section:

relativenumber = false
Enter fullscreen mode Exit fullscreen mode

Now we are cooking with GAS!!! :D

If you enjoyed this blog post, please consider subscribing to my Patreon for $5 a month for access to un-DMCA'd programming videos. I've been developing a text-based roguelike RPG in Python over the last couple months and would love your support. You can watch me live on Twitch at times through the week as well.

Head on over to my linktree at https://linktr.ee/evildojo for access to all of my social media information, including Github.

If you want a Free $100 VPS credit, head on over to https://www.vultr.com/?ref=8973037-8H for $100 free to try out Vultr's Virtual Private Servers and play with SpaceVim yourself :D

Thank you and have a great 2022!

Latest comments (0)