Skip to content

Instantly share code, notes, and snippets.

@tvon

tvon/init.vim

Created Nov 2, 2015
Embed
What would you like to do?
neovim init
" https://github.com/junegunn/vim-plug
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:plug_window = 'botright new | resize 10'
call plug#begin('~/.config/nvim/plugged')
"Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-jdaddy'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-endwise'
Plug 'fatih/vim-go'
" fanciness
Plug 'bling/vim-airline'
" github flavored markdown sytanx
Plug 'jtratner/vim-flavored-markdown'
" colorschemes
Plug 'junegunn/seoul256.vim'
Plug 'altercation/vim-colors-solarized'
" other shit
Plug 'vim-utils/vim-man'
Plug 'thoughtbot/vim-rspec'
" nvim specific
Plug 'janko-m/vim-test' " Some duplication with what neoterm provides
Plug 'kassio/neoterm'
Plug 'mhinz/vim-grepper'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'benekastah/neomake'
Plug 'pgdouyon/vim-accio'
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set explicit environment variable so shell configs can alter behavior
let $NEOVIM=1
filetype plugin indent on
syntax enable
" NOTE: solarized doesn't init correctly for some reason
let g:solarized_termcolors=256
colo solarized
"colo Tomorrow-Night
"colo xoria256
"colo wombat256mod
set background=dark
set number
" Nicer listchars
set listchars=tab:»·,trail:·
set list
set display+=lastline
set laststatus=2
" Persistent undo
set undofile
set undodir=$HOME/.config/nvim-undo
set undolevels=1000
set undoreload=10000
set splitbelow
set splitright
let mapleader=","
" Open quickfix window when Ggrep is run
autocmd QuickFixCmdPost *grep* cwindow
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" python configuration
"
" requires pyenv installations
let g:python_host_prog = '~/.pyenv/versions/2.7.10/bin/python2.7'
let g:python3_host_prog = '~/.pyenv/versions/3.5.0/bin/python3'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" neomake configuration
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" fzf-vim configuration
"
let g:fzf_layout = { 'bot': '40%' }
" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
" ctrl-p
nmap <c-p> :FZF<CR>
nmap <leader>b :Buffers<CR>
nmap <leader>h :Helptags<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" airline configuration
"
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#whitespace#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-grepper configuration
"
" TODO: Do we need this at all with fzf?
nnoremap <leader>git :Grepper -tool git -open -nojump
nnoremap <leader>ag :Grepper! -tool ag -open -switch
command! -nargs=* -complete=file GG Grepper! -tool git -query <args>
command! -nargs=* -complete=file Ag Grepper! -tool ag -query <args>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" neoterm configuration
"
let g:neoterm_position = 'horizontal'
let g:neoterm_automap_keys = ',tt'
" Note: need to adjust plugin to use 'bin/rails test'
"nnoremap <silent> <leader>T :call neoterm#test#run('all')<cr>
"nnoremap <silent> <leader>t :call neoterm#test#run('current')<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-test configuration
let test#strategy = "neoterm"
"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>
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-rspec configuration
let g:rspec_command = "T bundle exec rspec {spec}"
"let g:rspec_command = "belowright new | terminal bundle exec rspec {spec}"
map <leader>t :call RunCurrentSpecFile()<CR>
map <leader>s :call RunNearestSpec()<CR>
map <leader>l :call RunLastSpec()<CR>
map <leader>a :call RunAllSpecs()<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" accio configuration
let g:accio_auto_copen = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mappings
map <leader>S :source ~/.config/nvim/init.vim<cr>
nnoremap <space> :noh<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Local configs
" Source `/.config/nvim/host-`hostname`.vim if it exists
let s:host_nvimrc = expand('~/.config/nvim/host-') . hostname() . '.vim'
if filereadable(s:host_nvimrc)
execute 'source '.fnameescape(s:host_nvimrc)
endif
" Source `/.config/nvim/local.vim.`hostname` if it exists
let s:host_nvimrc = expand('~/.config/nvim/local.vim') . "." . hostname()
if filereadable(s:host_nvimrc)
execute 'source '.fnameescape(s:host_nvimrc)
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.