Last active
November 15, 2017 03:40
-
-
Save tphecca/91c9e77ef1bdbb2c6543819bcf795fb7 to your computer and use it in GitHub Desktop.
My organized Neovim config, works on the latest version. My brain wouldn't let me work until I did this.
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 nocompatible | |
let g:vim_bootsrap_langs = "go,html,javascript,lua" | |
let g:vim_bootsrap_editor = "nvim" | |
" --- begin the plugging | |
call plug#begin(expand('~/.config/nvim/plugged')) | |
" - Plugins that are used by other plugins | |
Plug 'xolox/vim-misc' | |
Plug 'tpope/vim-repeat' | |
Plug 'kana/vim-textobj-user' | |
" - Plugins that add text editing commands | |
Plug 'tpope/vim-commentary' | |
Plug 'tpope/vim-unimpaired' | |
Plug 'godlygeek/tabular' | |
Plug 'terryma/vim-multiple-cursors' | |
Plug 'tpope/vim-abolish' | |
Plug 'tpope/vim-surround' | |
Plug 'tpope/vim-speeddating' | |
Plug 'tpope/vim-rsi' | |
Plug 'mattn/emmet-vim' | |
Plug 'amix/open_file_under_cursor.vim' | |
Plug 'terryma/vim-expand-region' | |
Plug 'salsifis/vim-transpose' | |
Plug 'tommcdo/vim-exchange' | |
Plug 'Rykka/easydigraph.vim' | |
let g:EasyDigraph_nmap='gb' | |
Plug 'junegunn/vim-easy-align' | |
xmap ge <Plug>(EasyAlign) | |
nmap ge <Plug>(EasyAlign) | |
" Text objects | |
Plug 'tpope/vim-jdaddy' | |
Plug 'andymass/vim-matchup' | |
Plug 'kana/vim-textobj-entire' | |
Plug 'kana/vim-textobj-lastpat' | |
Plug 'kana/vim-textobj-underscore' | |
Plug 'thinca/vim-textobj-between' | |
Plug 'kana/vim-textobj-syntax' | |
Plug 'saihoooooooo/vim-textobj-space' | |
Plug 'jceb/vim-textobj-uri' | |
Plug 'Julian/vim-textobj-variable-segment' | |
Plug 'whatyouhide/vim-textobj-xmlattr' | |
Plug 'kana/vim-textobj-indent' | |
Plug 'rhysd/vim-textobj-continuous-line' | |
Plug 'wellle/targets.vim' | |
" Snippets | |
Plug 'honza/vim-snippets' | |
Plug 'SirVer/ultisnips' | |
let g:UltiSnipsExpandTrigger="<tab>" | |
let g:UltiSnipsJumpForwardTrigger="<tab>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-b>" | |
let g:UltiSnipsEditSplit="vertical" | |
" - Plugins that add other text editing functionality | |
Plug 'sbdchd/neoformat' | |
Plug 'bronson/vim-trailing-whitespace' | |
Plug 'gko/vim-coloresque' | |
Plug 'tpope/vim-characterize' | |
Plug 'mbbill/undotree' | |
Plug 'justinmk/vim-sneak' | |
Plug 'kshenoy/vim-signature' | |
Plug 'vim-scripts/loremipsum' | |
Plug 'ervandew/supertab' | |
Plug 'dbmrq/vim-ditto' | |
Plug 'junegunn/limelight.vim' | |
nmap <Leader>l <Plug>(Limelight) | |
xmap <Leader>l <Plug>(Limelight) | |
Plug 'Raimondi/delimitMate' | |
let delimitMate_expand_space=1 | |
let delimitMate_expand_cr=1 | |
Plug 'vim-syntastic/syntastic' | |
let g:syntastic_always_populate_loc_list=1 | |
let g:syntastic_error_symbol='✗' | |
let g:syntastic_warning_symbol='⚠' | |
let g:syntastic_style_error_symbol = '✗' | |
let g:syntastic_style_warning_symbol = '⚠' | |
let g:syntastic_auto_loc_list=1 | |
let g:syntastic_aggregate_errors = 1 | |
let g:syntastic_go_checkers = ['golint', 'govet'] | |
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } | |
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
let g:deoplete#enable_at_startup = 1 | |
Plug 'junegunn/goyo.vim' | |
nmap <leader>z :Goyo<CR> | |
Plug 'fidian/hexmode' | |
let g:hexmode_autodetect = 1 | |
Plug 'Yggdroot/indentLine' | |
let g:indentLine_enabled = 1 | |
let g:indentLine_concealcursor = 0 | |
let g:indentLine_char = '┆' | |
let g:indentLine_faster = 1 | |
au FileType codi let g:indentLine_enabled = 0 " an attempt was made | |
" Reedes' Plugins | |
Plug 'reedes/vim-wordy' | |
Plug 'reedes/vim-lexical' | |
Plug 'reedes/vim-textobj-quote' | |
Plug 'reedes/vim-textobj-sentence' | |
Plug 'reedes/vim-pencil' | |
augroup reedesplugins | |
autocmd! | |
autocmd FileType markdown,mkd call lexical#init() | |
\ | call textobj#quote#init() | |
\ | call textobj#sentence#init() | |
\ | call pencil#init() | |
autocmd FileType textile call lexical#init() | |
\ | call textobj#quote#init() | |
\ | call textobj#sentence#init() | |
\ | call pencil#init() | |
autocmd FileType text call lexical#init({ 'spell': 0 }) | |
\ | call textobj#quote#init({ 'educate': 0 }) | |
\ | call textobj#sentence#init() | |
\ | call pencil#init() | |
augroup END | |
map <silent> <leader>qc <Plug>ReplaceWithCurly | |
map <silent> <leader>qs <Plug>ReplaceWithStraight | |
" Searching | |
Plug 'xolox/vim-easytags' | |
Plug 'majutsushi/tagbar' | |
nmap <silent> <F4> :TagbarToggle<CR> | |
let g:tagbar_autofocus = 1 | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } | |
Plug 'junegunn/fzf.vim' | |
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' | |
nnoremap <silent> <leader>b :Buffers<CR> | |
nnoremap <silent> <leader>e :FZF -m<CR> | |
Plug 'vim-scripts/grep.vim' | |
let Grep_Default_Options = '-IR' | |
let Grep_Skip_Files = '*.log *.db' | |
let Grep_Skip_Dirs = '.git node_modules' | |
Plug 'mileszs/ack.vim' | |
let g:ackprg = 'ag --vimgrep' | |
" - Plugins that add general features | |
Plug 'avelino/vim-bootstrap-updater' | |
Plug 'mhinz/vim-startify' | |
Plug 'lambdalisue/vim-gista' | |
Plug 'lambdalisue/vim-gista-ctrlp' | |
Plug 'tpope/vim-eunuch' | |
Plug 'xtal8/traces.vim' | |
Plug 'vim-scripts/utl.vim' | |
Plug 'neomake/neomake' | |
Plug 'metakirby5/codi.vim' | |
Plug 'Shougo/vimshell.vim' | |
let g:vimshell_user_prompt = 'fnamemodify(getcwd(), ":~")' | |
let g:vimshell_prompt = '$ ' | |
Plug 'xolox/vim-session' | |
let g:session_directory = "~/.config/nvim/session" | |
let g:session_autoload = "no" | |
let g:session_autosave = "no" | |
let g:session_command_aliases = 1 | |
nnoremap <leader>so :OpenSession<Space> | |
nnoremap <leader>ss :SaveSession<Space> | |
nnoremap <leader>sd :DeleteSession<CR> | |
nnoremap <leader>sc :CloseSession<CR> | |
let g:make = 'make' | |
Plug 'Shougo/vimproc.vim', {'do': g:make} | |
" Git | |
Plug 'airblade/vim-gitgutter' | |
Plug 'junegunn/gv.vim' | |
noremap <Leader>ga :Gwrite<CR> | |
noremap <Leader>gc :Gcommit<CR> | |
noremap <Leader>gsh :Gpush<CR> | |
noremap <Leader>gll :Gpull<CR> | |
noremap <Leader>gs :Gstatus<CR> | |
noremap <Leader>gb :Gblame<CR> | |
noremap <Leader>gd :Gvdiff<CR> | |
noremap <Leader>gr :Gremove<CR> | |
Plug 'tpope/vim-fugitive' | |
set statusline+=&{fugitive#statusline()} | |
" File management | |
Plug 'justinmk/vim-gtfo' | |
Plug 'tpope/vim-vinegar' | |
Plug 'will133/vim-dirdiff' | |
Plug 'ctrlpvim/ctrlp.vim' | |
let g:ctrlp_map = '<c-p>' | |
let g:ctrlp_cmd = 'CtrlP' | |
" - Plugins that change aesthetic properties | |
Plug 'arcticicestudio/nord-vim' | |
Plug 'vim-scripts/CSApprox' | |
let g:CSApprox_loaded = 1 | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
let g:airline#extensions#syntastic#enabled = 1 | |
let g:airline#extensions#branch#enabled = 1 | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tagbar#enabled = 1 | |
let g:airline_skip_empty_sections = 1 | |
let g:airline_powerline_fonts = 1 | |
" - Plugins that add language-specific functionality | |
Plug 'sheerun/vim-polyglot' | |
Plug 'tpope/vim-haml' | |
Plug 'xolox/vim-lua-ftplugin' | |
Plug 'xolox/vim-lua-inspect' | |
Plug 'plasticboy/vim-markdown' | |
Plug 'mattly/vim-markdown-enhancements' | |
Plug 'elzr/vim-json' | |
Plug 'cespare/vim-toml' | |
Plug 'elixir-editors/vim-elixir' | |
Plug 'slashmili/alchemist.vim' | |
Plug 'vim-scripts/crontab.vim' | |
" - Functionality for web development | |
autocmd Filetype html setlocal ts=2 sw=2 expandtab | |
Plug 'jelera/vim-javascript-syntax' | |
Plug 'pangloss/vim-javascript' | |
Plug 'hail2u/vim-css3-syntax' | |
Plug 'kchmck/vim-coffee-script' | |
let g:javascript_enable_domhtmlcss = 1 | |
augroup vimrc-javascript | |
autocmd! | |
autocmd FileType javascript set tabstop=4|set shiftwidth=4|set expandtab softtabstop=4 | |
augroup END | |
let g:javascript_conceal_function = "ƒ" | |
let g:javascript_conceal_null = "ø" | |
let g:javascript_conceal_this = "@" | |
let g:javascript_conceal_return = "⇚" | |
let g:javascript_conceal_undefined = "¿" | |
let g:javascript_conceal_NaN = "ℕ" | |
let g:javascript_conceal_prototype = "¶" | |
let g:javascript_conceal_static = "•" | |
let g:javascript_conceal_super = "Ω" | |
let g:javascript_conceal_arrow_function = "⇒" | |
let g:javascript_conceal_noarg_arrow_function = "🞅" | |
let g:javascript_conceal_underscore_arrow_function = "🞅" | |
" - Functionality for Golang | |
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 | |
Plug 'fatih/vim-go', {'do': ':GoInstallBinaries'} | |
function! s:build_go_files() | |
let l:file = expand('%') | |
if l:file =~# '^\f\+_test\.go$' | |
call go#test#Test(0, 1) | |
elseif l:file =~# '^\f\+\.go$' | |
call go#cmd#Build(0) | |
endif | |
endfunction | |
let g:go_list_type = "quickfix" | |
let g:go_fmt_command = "goimports" | |
let g:go_fmt_fail_silently = 1 | |
let g:go_highlight_types = 1 | |
let g:go_highlight_fields = 1 | |
let g:go_highlight_functions = 1 | |
let g:go_highlight_methods = 1 | |
let g:go_highlight_operators = 1 | |
let g:go_highlight_build_constraints = 1 | |
let g:go_highlight_structs = 1 | |
let g:go_highlight_generate_tags = 1 | |
let g:go_highlight_space_tab_error = 0 | |
let g:go_highlight_array_whitespace_error = 0 | |
let g:go_highlight_trailing_whitespace_error = 0 | |
let g:go_highlight_extra_types = 1 | |
augroup completion_preview_close | |
autocmd! | |
if v:version > 703 || v:version == 703 && has('patch598') | |
autocmd CompleteDone * if !&previewwindow && &completeopt =~ 'preview' | silent! pclose | endif | |
endif | |
augroup END | |
augroup go | |
au! | |
au Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit') | |
au Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit') | |
au Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split') | |
au Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe') | |
au FileType go nmap <Leader>dd <Plug>(go-def-vertical) | |
au FileType go nmap <Leader>dv <Plug>(go-doc-vertical) | |
au FileType go nmap <Leader>db <Plug>(go-doc-browser) | |
au FileType go nmap <leader>r <Plug>(go-run) | |
au FileType go nmap <leader>t <Plug>(go-test) | |
au FileType go nmap <Leader>gt <Plug>(go-coverage-toggle) | |
au FileType go nmap <Leader>i <Plug>(go-info) | |
au FileType go nmap <silent> <Leader>l <Plug>(go-metalinter) | |
au FileType go nmap <C-g> :GoDecls<cr> | |
au FileType go nmap <leader>dr :GoDeclsDir<cr> | |
au FileType go imap <C-g> <esc>:<C-u>GoDecls<cr> | |
au FileType go imap <leader>dr <esc>:<C-u>GoDeclsDir<cr> | |
au FileType go nmap <leader>rb :<C-u>call <SID>build_go_files()<CR> | |
augroup END | |
" - Your plugins | |
if filereadable(expand("~/.config/nvim/local_bundles.vim")) | |
source ~/.config/nvim/local_bundles.vim | |
endif | |
call plug#end() | |
" --- Custom options | |
filetype plugin indent on | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
set fileencodings=utf-8 | |
set bomb | |
set backspace=indent,eol,start | |
set tabstop=4 | |
set softtabstop=0 | |
set shiftwidth=2 | |
set expandtab | |
let mapleader=',' | |
set hidden | |
set autoread | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
set nobackup | |
set noswapfile | |
set fileformats=unix,dos,mac | |
if exists('$SHELL') | |
set shell=$SHELL | |
else | |
set shell=/bin/sh | |
endif | |
syntax on | |
set ruler | |
set number | |
let no_buffers_menu=1 | |
set mousemodel=popup | |
set scrolloff=4 | |
set laststatus=2 | |
set modeline | |
set modelines=10 | |
set title | |
set titleold="Terminal" | |
set titlestring=%f | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite | |
set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,__pycache__ | |
set autoread | |
set wildmode=list:longest,list:full | |
set grepprg=ag\ --nogroup\ --nocolor | |
set guioptions=egmrti | |
set gfn=Monospace\ 10 | |
set t_Co=256 | |
set background=dark | |
if !exists('g:not_finish_vimplug') | |
colorscheme nord | |
endif | |
" --- Custom functionality | |
if !exists('*s:setupWrapping') | |
function s:setupWrapping() | |
set wrap | |
set wm=2 | |
set textwidth=79 | |
endfunction | |
endif | |
augroup vimrc-sync-fromstart | |
autocmd! | |
autocmd BufEnter * :syntax sync maxlines=200 | |
augroup END | |
augroup vimrc-remember-cursor-position | |
autocmd! | |
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif | |
augroup END | |
augroup vimrc-wrapping | |
autocmd! | |
autocmd BufRead,BufNewFile *.txt call s:setupWrapping() | |
augroup END | |
augroup vimrc-make-cmake | |
autocmd! | |
autocmd FileType make setlocal noexpandtab | |
autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake | |
augroup END | |
" --- Custom maps | |
nnoremap n nzzzv | |
nnoremap N Nzzzv | |
nnoremap <silent> <leader>sh :terminal<CR> | |
noremap <Leader>h :<C-u>split<CR> | |
noremap <Leader>v :<C-u>vsplit<CR> | |
nnoremap <Tab> gt | |
nnoremap <S-Tab> gT | |
nnoremap <silent> <S-t> :tabnew<CR> | |
nnoremap <leader>. :lcd %:p:h<CR> | |
noremap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR> | |
noremap <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR> | |
cnoremap <C-P> <C-R>=expand("%:p:h") . "/" <CR> | |
nnoremap <silent> <leader><space> :noh<cr> | |
noremap <C-j> <C-w>j | |
noremap <C-k> <C-w>k | |
noremap <C-l> <C-w>l | |
noremap <C-h> <C-w>h | |
vmap < <gv | |
vmap > >gv | |
vnoremap J :m '>+1<CR>gv=gv | |
vnoremap K :m '<-2<CR>gv=gv | |
map <leader>l :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1"<CR> | |
" Hardcore mode (no unnecessary keys allowed) | |
inoremap jk <esc> | |
inoremap <special> <esc> <nop> | |
inoremap <esc>^[ <esc>^[ | |
nnoremap <up> <nop> | |
nnoremap <down> <nop> | |
nnoremap <left> <nop> | |
nnoremap <right> <nop> | |
inoremap <up> <nop> | |
inoremap <down> <nop> | |
inoremap <left> <nop> | |
inoremap <right> <nop> | |
inoremap <pageup> <nop> | |
inoremap <home> <nop> | |
inoremap <end> <Nop> | |
inoremap <home> <nop> | |
inoremap <del> <nop> | |
inoremap <insert> <nop> | |
" Helpful word capitalization commands | |
if (&tildeop) | |
nmap gcw guw~l | |
nmap gcW guW~l | |
nmap gciw guiw~l | |
nmap gciW guiW~l | |
nmap gcis guis~l | |
nmap gc$ gu$~l | |
nmap gcgc guu~l | |
nmap gcc guu~l | |
vmap gc gu~l | |
else | |
nmap gcw guw~h | |
nmap gcW guW~h | |
nmap gciw guiw~h | |
nmap gciW guiW~h | |
nmap gcis guis~h | |
nmap gc$ gu$~h | |
nmap gcgc guu~h | |
nmap gcc guu~h | |
vmap gc gu~h | |
endif | |
" Tmux-like buffer switching | |
nmap gbn :bn<CR> | |
nmap gbp :bp<CR> | |
nmap gbx :bd<CR> | |
nmap gbd :SSave<CR> | |
" --- Custom abbreviations | |
cnoreabbrev W! w! | |
cnoreabbrev Q! q! | |
cnoreabbrev Qall! qall! | |
cnoreabbrev Wq wq | |
cnoreabbrev Wa wa | |
cnoreabbrev wQ wq | |
cnoreabbrev WQ wq | |
cnoreabbrev W w | |
cnoreabbrev Q q | |
cnoreabbrev Qall qall | |
" --- Your config | |
if filereadable(expand("~/.config/nvim/local_init.vim")) | |
source ~/.config/nvim/local_init.vim | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment