Vim to an IDE and Back
Thu, Nov 13, 2014Out of all of the available editors that came preinstalled on whatever distribution of Linux or version of FreeBSD I was working wtih at the time, I always found myself using vi(m). I’ve used pico, nano, ed, and emacs though none have had the grace and finesse of vi though.
Editing config files was fine with the default settings though when I started writing shell scripts and further more, Perl scripts, I needed something more. Then came syntax on
, set expandtab
, and set softtabstop=4
. Just those 3 settings alone kept me happy for awhile.
Once Python and Java came into the picture I had another couple standard libraries to learn. That presented a bit more of a problem which Eclipse seemed to solve for both Python and Java but was so heavy that I’d actually see a different in my system’s performance so hving mutliple projects open in Python, Java, or even Scala proved impossible.
The search was on again for another IDE that could provide me the basics that I was looking for and also needed to be lightweight. IntelliJ stepped up and solved my performance problems and I still use it now for JVM based development but still I wanted something else. I wanted that familiar workflow and environment back again that I had and missed in vim. So I took some time to really make my .vimrc file robust enough to do that as well as installed as many vim packages as I could that would provide me that functionality..
General Goodness
NERDTree has provided me so much time savings since it allows me to access a number of different files without ever leaving the editor. vsplit
does the trick too but isn’t as quick or effective if I can’t remember the file name or just flat out don’t know it.
<ctrl> e
and <ctrl> y
moves the cursor 3 lines up or down respectively. That feature makes up for <ctrl> f
and <ctrl> b
being too greedy.
Bundle "tpope/vim-markdown"
Bundle "nerdtree"
set title
set titlestring=%F
set number
set ruler
noremap <C-e> 3<C-e>
noremap <C-y> 3<C-y>
Python
My Python settings are really simple. Automatic formatting and <ctrl> space
for auto-complete.
Bundle 'python.vim'
set wildignore+=*.pyc,*.pyo
Go
The Go settings below allow me to build applications so much faster than using the IntelliJ or Exclipse plugins. :GoImport <pkg_name>
makes it easy no matter where I am in the file to import a package. <ctrl> x o
gives me an auto-complete dropdown that shows every available feature for whatever I’ve called it on. Everytime I save a file, go fmt
runs and reports anything that doens’t jive. :GoVet
does exactly as you’d assume and in conjunction with :GoLint
I can be as proactive as possible to make sure my code is Go-like and as good as possible.
set runtimepath+=$GOROOT/misc/vim
Bundle "nsf/gocode"
Bundle "fatih/vim-go"
let g:go_fmt_fail_silently = 1
let g:go_fmt_command = "gofmt"
au FileType go nmap gd <Plug>(go-def)
au FileType go nmap <Leader>s <Plug>(go-def-split)
au FileType go nmap <Leader>v <Plug>(go-def-vertical)
au FileType go nmap <Leader>t <Plug>(go-def-tab)
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <Leader>d <Plug>(go-doc)
au BufNewFile,BufRead *.go setlocal noet ts=4 sw=4 sts=4
If any of the above viml is of interest, you can feel free to checkout my dotFiles repo.