Last active
April 26, 2016 04:07
-
-
Save 5thWall/0e8eca31727a2c83885a to your computer and use it in GitHub Desktop.
Neovim config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Set Leader | |
let mapleader = "<Space>" | |
" PLUGINS FOR THE PLUGIN GOD | |
call plug#begin("~/.config/nvim/plug") | |
" Look and feel plugins | |
Plug 'altercation/vim-colors-solarized' | |
Plug 'itchyny/lightline.vim' | |
" Plug 'vim-airline/vim-airline' | |
" Plug 'vim-airline/vim-airline-themes' | |
" Language Specific Plugins | |
" Ruby! | |
Plug 'vim-ruby/vim-ruby' | |
Plug 'tpope/vim-rails' | |
Plug 'tpope/vim-bundler' | |
" Elixir! | |
Plug 'elixir-lang/vim-elixir' | |
Plug 'mattreduce/vim-mix' | |
" Elm! | |
" Plug 'lambdatoast/elm.vim' | |
Plug 'ElmCast/elm-vim' | |
" Markdown | |
Plug 'tpope/vim-markdown' | |
" Convenience Plugins | |
" Formatting | |
Plug 'godlygeek/tabular' | |
Plug 'dhruvasagar/vim-table-mode' | |
Plug 'tpope/vim-commentary' | |
Plug 'tpope/vim-surround' | |
Plug 'ntpeters/vim-better-whitespace' | |
" Navigating | |
Plug 'unblevable/quick-scope' | |
Plug 'tpope/vim-unimpaired' | |
Plug 'scrooloose/nerdtree' | |
Plug 'majutsushi/tagbar' | |
" Project Management | |
Plug 'tpope/vim-fugitive' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'tpope/vim-projectionist' | |
" Serch | |
Plug 'rking/ag.vim' | |
Plug 'kien/ctrlp.vim' | |
" Documentation | |
Plug 'rizzatti/funcoo.vim' | Plug 'rizzatti/dash.vim' | |
" Syntax and testing | |
Plug 'janko-m/vim-test' | |
Plug 'scrooloose/syntastic' | |
"Plug 'benekastah/neomake' | |
" Fun | |
Plug 'junegunn/goyo.vim' | |
call plug#end() | |
" Look and feel | |
syntax on | |
set background=dark | |
set cursorline | |
set cursorcolumn | |
colorscheme solarized | |
let g:solarized_hitrail=1 | |
let g:lightline = { | |
\ 'colorshceme': 'solarized', | |
\ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, | |
\ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" } | |
\ } | |
" let g:airline_theme = "solarized" | |
" let g:airline_powerline_fonts = 1 | |
set scrolloff=3 | |
set linebreak | |
nnoremap <CR> :nohlsearch<CR> | |
set mouse= | |
" Undo | |
set undodir=$HOME/.vim/undo | |
set undofile | |
set undolevels=1000 | |
set undoreload=10000 | |
" Tabs and Indenting | |
filetype plugin indent on | |
set tabstop=2 | |
set softtabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set autoindent | |
" Line numbers | |
set number | |
set relativenumber | |
nnoremap <C-n> :set rnu!<CR> | |
" Make ex-mode tab completion work like zsh | |
set wildmode=full | |
" Annoyance | |
nnoremap Q <nop> | |
nnoremap <up> gk | |
nnoremap <down> gj | |
cmap w!! %!sudo tee > /dev/null % | |
" Undo | |
set undodir=$HOME/.vim/undo | |
set undofile | |
set undolevels=1000 | |
set undoreload=10000 | |
" Project Specific .vimrc | |
set exrc | |
set secure | |
" Whitespace Cleanup | |
function! TrimWhiteSpace() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfunction | |
function! Cleanup() | |
let save_cursor = getpos(".") | |
let old_query = getreg('/') | |
:retab | |
:normal gg=G | |
:%s/\s\+$//e | |
:%s/\n\{3,}/\r\r/e | |
call setpos('.', save_cursor) | |
call setreg('/', old_query) | |
endfunction | |
nnoremap <leader>ws :silent call TrimWhiteSpace()<CR> | |
noremap <leader>cu :silent call Cleanup()<CR> | |
" Plugin Config | |
" TAGBAR CONFIG | |
let g:tagbar_type_elixir = { | |
\ 'ctagstype' : 'elixir', | |
\ 'kinds' : [ | |
\ 'f:functions (public)', | |
\ 'g:functions (private)', | |
\ 'c:callbacks', | |
\ 'd:delegates', | |
\ 'e:exceptions', | |
\ 'i:implementations', | |
\ 'a:macros', | |
\ 'o:operators', | |
\ 'm:modules', | |
\ 'p:protocols', | |
\ 'r:records', | |
\ 't:types', | |
\ 'z:foo' | |
\ ] | |
\ } | |
" END TAGBAR CONFIG | |
" Syntastic config | |
let syntastic_mode_map = { 'passive_filetypes': ['html', 'cucumber'] } | |
" END Syntastic config | |
" Only show quick-scope highlights after f/F/t/T is pressed | |
function! Quick_scope_selective(movement) | |
let needs_disabling = 0 | |
if !g:qs_enable | |
QuickScopeToggle | |
redraw | |
let needs_disabling = 1 | |
endif | |
let letter = nr2char(getchar()) | |
if needs_disabling | |
QuickScopeToggle | |
endif | |
return a:movement . letter | |
endfunction | |
let g:qs_enable = 0 | |
for i in [ 'f', 'F', 't', 'T' ] | |
execute 'noremap <expr> <silent>' . i . " Quick_scope_selective('". i . "')" | |
endfor | |
" End Quickscope stuff | |
" Dash | |
if !has('win32') && match(system('uname'), 'Darwin') == 0 | |
nmap <silent> <Leader>d <Plug>DashSearch | |
nmap <silent> <Leader>dg <Plug>DashGlobalSearch | |
endif | |
" Language support | |
" Cleanup whitespace on save | |
autocmd FileType ruby,javascript,haml,erb,elixir,eex,elm autocmd BufWritePre <buffer> :call TrimWhiteSpace() | |
" Indent all the html tags | |
let g:html_indent_inctags = "body,head,tbody,p" | |
" Markdown support | |
autocmd FileType markdown,mkd set spell | |
autocmd FileType markdown,mkd set formatprg=par |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment