When I say from zero I mean from none configuration, so I will not write about how to use it or install it; I will leave that to you.

… but why?

I have been using ViM for a few years (8 aprox). But I am currently learning to use some IDEs like Intellij and Visual Studio Code to expand my toolbox… and always, I come back to ViM. Despite the simulator plugins available for those IDEs, they do not fully simulate the behavior and that’s quite a shame.

What do I need

I have a non-fresh but unconfigured installation. I use ViM when I need to edit text, so I will use it from programming to editing CSV or blog posts. Because of it, my requirements are as follow:

Visuals:

Customized input

Navigation:

  • File tree navigation.
  • Search in files.

Programming languages:

  • Golang
  • Python
  • Javascript

    • ES5/ES6
    • jQuery
    • reactJS
  • Java

And respectives language lynters.

Web:

  • HTML
  • LESS
  • SASS
  • CSS3

Documentation:

Other file support:

  • XML
  • JSON (pretty JSON and/or transformations)

Plugin source and management:

Hands on!

This is what I have and see:

raw vim

Visuals

I create an empty ~/.vimrc file to put the initial customizations.

" Visuals
set number  " show line numbers
set ruler  " cursor position
set cursorline  " highlight current line
set colorcolumn=80  " 80 chars mark

visuals

Pathogen

I just follow the instructions described in its GitHub site and it’s done: this creates the directories in ~/.vim/autoload and ~/.vim/bundle. All future plugins will be placed on ~/.vim/bundle.

$ mkdir -p ~/.vim/autoload ~/.vim/bundle && \
	curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

This is required on ~/.vimrc to make it work:

" Pathogen configuration
execute pathogen#infect()
syntax on
filetype plugin indent on

Now I am ready to put some plugins in.

Solarized

$ cd ~/.vim/bundle
$ git clone git://github.com/altercation/vim-colors-solarized.git
syntax enable
set background=dark
let g:solarized_termcolors=256
colorscheme solarized

solarized

Airline

$ cd ~/.vim/bundle  
$ git clone https://github.com/bling/vim-airline  
set laststatus=2  
set t_Co=256 
set noshowmode
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif

" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'

" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''

Font

I use Source Code Pro (by now). This only applies to GViM, to this configuration must be placed on ~/.gvimrc:

$ echo "set guifont=Source\ Code\ Pro:h15" > ~/.gvimrc

Tabs

set tabstop=4
set expandtab

Delete

set backspace=indent,eol,start

Golang

faith/vim-go is the mainstream plugin for Golang. Since I have installed Pathogen for plugin management, I just need to clone the project on its bundle directory:

$ git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go

When I execute the command vim a.go, I see the following:

vim-go

I prefer goimports to resolve missing imports and adjust code layout, also I want to do it every time I save the file. Adding this to .vimrc will do:

let g:go_fmt_command = "goimports"
augroup auto_go
	autocmd!
	autocmd BufWritePost *.go :GoBuild
	autocmd BufWritePost *_test.go :GoTest
augroup end

It is because the vim-go plugin is placing some code snippet into our empty file, proof of correct installation. Now I can run some commands like :GoBuild, :GoInstall or :GoRun. Have fun.

Markdown

I was using the default support for Markdown files, but I will give a try to the Gabriele Lana’s plugin; it seems very simple yet promising on correct rendering when editing files.

$ cd ~/.vim/bundle
$ git clone https://github.com/gabrielelana/vim-markdown.git

API Blueprint

$ git clone https://github.com/kylef/apiblueprint.vim.git ~/.vim/bundle/apiblueprint.vim

Syntastic

$ cd ~/.vim/bundle && git clone --depth=1 https://github.com/vim-syntastic/syntastic.git
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

More to come

And this is all for now too. I will keep posting on my progress.