I decided to switch from Atom as my IDE quite some time ago to vim. However even with this switch, I remained using a fairly vanilla version of Vim purely because of having to switch between various servers where in a lot of cases my custom setup would not be present.
This all changes this week after I participated in our company’s Hackathon. Not only was it a lot of fun, but I also had the opportunity to work with some amazing folks and learn a lot, including improving my own workflow. Between all the screen sharing over the two days, I was able to pick up a few things.
One thing that caught my eye was a vim setup I have not seen in the past. I had just made the decision to switch from my Bash shell to ZSH earlier in the week and have been playing around with the .zshrc
and oh-my-zsh, it felt like the perfect time to expand on Vim as well and improve my overall workflow and experience, turning things to look like this:

Setup
The first thing that was suggested to me was to install pathogen for Vim, which is in a nutshell a package manager helping you install themes and plugins much easier. I used the instructions provided in the linked GitHub repo so I won’t be covering that in this article. What I will go over though are a few of the settings I’ve added to .vimrc
to get things rolling:
execute pathogen#infect()
syntax enable " Enable syntax highlighting
filetype plugin indent on
The most relevant part that relates to pathogen here is the first line, which will utilize the ~/.vim/bundle/
directory for your plugins and themes. Once I got pathogen going, I then installed the recommended theme, in this case tender by jacoborus which again was extremely simple to setup using the instructions found on the GitHub project.
As with pathogen, the trickier bit was configuring things mostly within .vimrc
to behave as I wanted it to. A lot of it based on my colleague’s setup. I used a number of resources to set things up and my current configuration is as follows:
" If you have vim >=8.0 or Neovim >= 0.1.5
if (has("termguicolors"))
set termguicolors
endif
" For Neovim 0.1.3 and 0.1.4
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
" Theme
syntax enable
colorscheme tender
set laststatus=2
" set lighline theme inside lightline config
let g:lightline = { 'colorscheme': 'tender' }
let macvim_skip_colorscheme=1
if !has('gui_running')
set t_Co=256
endif
My main configuration here was setting the colors as I initially had some issues getting certain elements of the color profile going. The color scheme that I use the color scheme from iterm2colorschemes.com. The theme colors were actually relatively well set, but I found some of the colors within Vim not working as expected, which was what the majority of my tweaking was for.
The last part of my setup was plugins. In this case the only additional plugin I installed was NERDTree, which is a file system explorer specifically for the Vim editor. I used the pathogen instructions found on their GitHub page to get things installed and subsequently made the following amendment to the .vimrc
file:
" nerdtree {{{
" Open nerdtree when vim is opening a directory
autocmd StdinReadPre * let s:std_in=1
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
map :NERDTreeToggle
map :NERDTreeFind
" nnoremap v :NERDTreeFind
" nnoremap f :NERDTreeToggle
let NERDTreeShowHidden=1
let NERDTreeShowLineNumbers=1
let NERDTreeWinSize=60
" }}}
The majority of the above settings can be found on the NERDTree GitHub, however what I enabled was to automatically start it up if I typed either vim
or vim .
on its own. I then went ahead and added some key bindings for improved navigation and set to show hidden files, line numbers and configured the default window size. This got me to the point as seen in the above screenshot.
Workflow
In a quick overview of my improved workflow using Vim as a whole should probably cover my old workflow first of all. This generally meant I would have Vim open in a tmux pane to edit the code. I then had a second pane open that was in the same working directory as the code I was editing. I would have to save the code in pane one, switch to pane two to run things and hop back and forth. Occasionally I would end up exiting Vim as a whole to run or check on the latest changes.
The improved workflow utilizes the native *nix
feature to send processes to the background. It is as easy as hitting CTRL + z
while in Vim which sends the active process in to the background much like this:
➜ vim .vimrc
[1] + 7401 suspended vim .vimrc
This allows me to run commands with the actual file remaining open in the background. When I am ready to continue editing the file I can just type fg
– which is short for foreground and this brings back the first job in the list from being a background process.:
➜ jobs
[1] + suspended vim .vimrc
[2] - running sleep 10
➜ fg
In the above block I have my active background process for editing the .vimrc
file and I created a test process which is marked as job [2]
. I feel that this is a much faster way to quickly hop out of the Vim in order to test a change after saving and then hop back in to continue working. It also reduces the need for me to have a number of panes open in tmux, working in the same directory. Hopefully you find the above workflow an improvement as well if you decide to try it out and good luck modifying Vim and ZSH to your liking!