DEV Community

Ajeeb.K.P
Ajeeb.K.P

Posted on

Swim : Switch between multiple vimrcs

Intro

You might be interested in trying multiple vim configuration plugin etc. without affecting existing one. Swim is the exact solution as per my understanding. Swim support even multiple vim distributions.

Installation

Installation swim is simple in Linux (I didn't test Windows, I'm not sure it works in windows or not).

curl -s https://raw.githubusercontent.com/dawsonbotsford/swim/master/install | bash
# How ever it didn't work for me. Try swim ls
swim ls
# If above command worked, probably your installation is complete.
Enter fullscreen mode Exit fullscreen mode

Unfortunately, it didn't work well for me.

Below steps, are what I followed

# set user folder. Please put correct user in next command
export usrDir="/home/user/swimFolder"
# Install
curl -s https://raw.githubusercontent.com/dawsonbotsford/swim/master/install | bash

# Now add it path or by symlinking or setting path
sudo ln -s /home/user/swimFolder/swim /usr/local/bin/

# or you may create alias instead of symlinking (ie. ln) like below
alias swim=/home/user/swimFolder/swim
Enter fullscreen mode Exit fullscreen mode

Using

# Get the help
swim
# Or
swim help

## Please remember example is alias name used through out this code block

#  Create a new alias (alias is the name used for different set config files, ie. one .vimrc and .vim/ will be associated with one alias)
swim add https://raw.githubusercontent.com/dawsonbotsford/swim/master/exampleVimrcs/vimrcWikia.vim example

# Use file instead
swim add /path/to/file alias2

# view available aliases
swim ls

# select one among them
swim with example

# rename it
swim mv exampe example2

# delete it
swim mv example

# edit vimrc file
swim vim example
Enter fullscreen mode Exit fullscreen mode

How to use this with vim

# No more things, needed. Just use vim as usual.
vim
Enter fullscreen mode Exit fullscreen mode

How to install multiple distributions ?

Installing multiple distribution is easy. Just add one alias, make it active, then follow official tutorial of vim distribution.

I'm demonstrating installing 3 distributions here.

First, I'm trying to install https://vim.spf13.com/.

# This command adds a alias. The url in next command is a workaround.
swim add https://raw.githubusercontent.com/dawsonbotsford/swim/master/exampleVimrcs/vimrcWikia.vim spf13
# Now following official tutorial
curl http://j.mp/spf13-vim3 -L -o - | sh
Enter fullscreen mode Exit fullscreen mode

Second, I'm trying to install https://github.com/bling/dotvim

# This command adds a alias. The url in next command is a workaround.
swim add https://raw.githubusercontent.com/dawsonbotsford/swim/master/exampleVimrcs/vimrcWikia.vim dotvim
# Now follow official tutorial
# step:1
git clone https://github.com/bling/dotvim ~/.vim/
cd ~/.vim/
# step:2
git submodule init && git submodule update
# You can step:3
# mv ~/.vimrc ~/.vimrc.backup
# Edit ~/.vimrc, and add following file
let g:dotvim_settings = {}
let g:dotvim_settings.version = 2
source ~/.vim/vimrc

# After opening, startup vim and dein will detect and ask you install any missing plugins. you can also manually initiate this with
:call dein#install()
# That's it
Enter fullscreen mode Exit fullscreen mode

Third, I'm trying to install https://github.com/SpaceVim/SpaceVim (https://spacevim.org/quick-start-guide/)

# This command adds a alias. The url in next command is a workaround.
swim add https://raw.githubusercontent.com/dawsonbotsford/swim/master/exampleVimrcs/vimrcWikia.vim spacevim
# Follow official tutorial
curl -sLf https://spacevim.org/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Result

Now you have 3 distributions ready. Probably, many other configs.

# List them all
swim ls
# Select one
swim with dotvim
# Just start your vim
vim
Enter fullscreen mode Exit fullscreen mode

Source
https://github.com/dawsbot/swim

Top comments (0)