Swim : Switch between multiple vimrcs
Tags: vim
Published: 2020-04-01 17:16:50

# 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).

```bash
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.
```

Unfortunately, it didn't work well for me.

Below steps, are what I followed
```bash
# 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
```

# Using

```bash
# 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
```

#### How to use this with vim

```bash
# No more things, needed. Just use vim as usual.
vim
```

# 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/.

```bash
# 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
```

Second, I'm trying to install https://github.com/bling/dotvim
```bash
# 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
```

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

```bash
# 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
```

# Result

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

```bash
# List them all
swim ls
# Select one
swim with dotvim
# Just start your vim
vim
```

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