Switch back to vim again.

January 21, 2016

Unlike most of my programmer friends, my first editor in programming is vi and second is vim as a slightly more powerful editor. (I don’t know about plugins at that time). C# as a first programming language with mono as a compiler and vim as an editor. vim’s like a best friend back then. But when I started working extensively on C#, I embrace VisualStudio as my new editor and tool to work on real application projects.

Some years after that I’ve started on the new path, Python and Ruby. That’s when I went to TextMate and eventually Sublime 2. Great experiences compare to big and slow VisualStudio. But I still have to work with vim sometimes when I have to work on server configurations.

Over the last few years, I’ve been working on a lot of server and deployment stuffs. Swapping between vim and Sublime a lot in the process. Eventually, have some thoughts that should I switch to using just vim to make thing easier.

Then the boss of my team just purpose that we should have a month of vim, a month that we all have to rely on vim alone as a practice and also let others that normally do everything in Sublime to try vim for certain period.

It’s been a week since then. I’ve gained most of my speed in using Vim that I’ve lost over years of Textmate and Sublime. One good thing that happened to me after I switched back to vim is, My coding style have changed to the way that it will suit Vim better than what I used to have in Sublime. Cleaner and mind a lot more when to use spaces and newline. The markdown of this new post is also done using vim. Feel great that it’s worked with most of my works even with my blog posts.

As a reminder for myself and everyone else who stumble apon this page. Below is my current .vimrc that I use in my OSX. I thought I will stick with this for a while before I add anything new since this’s sufficient for me now.

This .vimrc require vim-plug and the_silver_searcher to run properly.

.vimrc
set nu
set showcmd
set tabstop=2
set shiftwidth=2
set expandtab
set mouse=a
set ls=2
set backspace=2
syntax on
autocmd BufWritePre * :%s/\s\+$//e
autocmd BufNewFile,BufRead Gemfile set filetype=ruby
autocmd BufNewFile,BufRead *.ru set filetype=ruby
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'ruby']
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -l --nocolor -U -p ~/.agignore --hidden -g ""'
let g:ctrlp_use_caching = 0
end
command -nargs=1 E execute('silent! !mkdir -p "$(dirname "<args>")"') <Bar> e <args>
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
nmap <silent> <leader>a :TestSuite<CR>
nmap <silent> <leader>l :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
map <C-k><C-b> :NERDTreeToggle<CR>
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-rails'
Plug 'pbrisbin/vim-mkdir'
Plug 'ntpeters/vim-better-whitespace'
Plug 'elixir-lang/vim-elixir'
Plug 'fatih/vim-go'
Plug 'ngmy/vim-rubocop'
Plug 'cakebaker/scss-syntax.vim'
Plug 'tpope/vim-haml'
Plug 'mxw/vim-jsx'
Plug 'ekalinin/Dockerfile.vim'
Plug 'rking/ag.vim'
Plug 'kien/ctrlp.vim'
Plug 'tomtom/tcomment_vim'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-bundler'
Plug 'janko-m/vim-test'
Plug 'terryma/vim-multiple-cursors'
Plug 'kchmck/vim-coffee-script'
Plug 'isRuslan/vim-es6'
Plug 'scrooloose/nerdtree'
call plug#end()