nvim: init.vim: Update & cleanup neovim config

This commit is contained in:
Sanchayan Maity 2019-09-25 09:04:51 +05:30
parent 2ad25de443
commit dcd38e5b2d

View file

@ -37,8 +37,8 @@ Plug 'sodapopcan/vim-twiggy'
Plug 'christoomey/vim-conflicted' Plug 'christoomey/vim-conflicted'
" For tmux yank " For tmux yank
Plug 'vim-utils/vim-husk' Plug 'vim-utils/vim-husk'
" gtags " Tags
Plug 'jsfaint/gen_tags.vim' Plug 'ludovicchabant/vim-gutentags'
" GDB " GDB
Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh \| UpdateRemotePlugins' } Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh \| UpdateRemotePlugins' }
" Lisp " Lisp
@ -76,20 +76,13 @@ call plug#end()
syntax on syntax on
filetype plugin indent on filetype plugin indent on
" Highlight 80th column
set colorcolumn=80
" Always show status bar
set laststatus=2
" Let plugins show effects after 500ms, not 4s
set updatetime=500
" Disable mouse click to go to position
set mouse-=a
" Don't let autocomplete affect usual typing habits
set completeopt=menuone,preview,noinsert
" Set up leaders " Set up leaders
let mapleader="\<SPACE>" let mapleader="\<SPACE>"
set colorcolumn=80 " Highlight 80th column
set laststatus=2 " Always show status bar
set updatetime=500 " Let plugins show effects after 500ms
set mouse-=a " Disable mouse click to go to position
set encoding=utf-8 set encoding=utf-8
set exrc " Allow loading local .nvimrc files set exrc " Allow loading local .nvimrc files
set secure " Disallow use of autocmd, shell and write in local rc set secure " Disallow use of autocmd, shell and write in local rc
@ -105,13 +98,10 @@ set tabstop=4 " Render TABs using this many spaces.
set shiftwidth=4 " Indentation amount for < and > commands. set shiftwidth=4 " Indentation amount for < and > commands.
set smarttab " Indent with tabs, align with spaces. set smarttab " Indent with tabs, align with spaces.
set expandtab " When on, uses space instead of tabs. set expandtab " When on, uses space instead of tabs.
set noerrorbells " No beeps. set noerrorbells " No beeps.
set modeline " Enable modeline. set modeline " Enable modeline.
set linespace=0 " Set line-spacing to minimum. set linespace=0 " Set line-spacing to minimum.
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
" More natural splits
set splitbelow " Horizontal split below current. set splitbelow " Horizontal split below current.
set splitright " Vertical split to right of current. set splitright " Vertical split to right of current.
@ -130,10 +120,13 @@ set magic " Use 'magic' patterns (extended regular expressions).
set autoread " Autoload file if it changes on disk set autoread " Autoload file if it changes on disk
set termguicolors " Enable colors for terminal set termguicolors " Enable colors for terminal
set clipboard^=unnamed,unnamedplus
set completeopt=menuone,preview,noinsert
set rtp+=/usr/bin/fzf set rtp+=/usr/bin/fzf
set completeopt-=preview " Theme
set clipboard^=unnamed,unnamedplus syntax enable
colorscheme monokai
" Use <C-L> to clear the highlighting of :set hlsearch. " Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# '' if maparg('<C-L>', 'n') ==# ''
@ -161,14 +154,6 @@ noremap <Leader>d :exe ':Rg ' . expand('<cword>')<CR>
" For git messenger " For git messenger
nnoremap <Leader>gm :GitMessenger<CR> nnoremap <Leader>gm :GitMessenger<CR>
" Manage splits
set splitbelow
set splitright
" Theme
syntax enable
colorscheme monokai
" Key Bindings to help with terminal mode " Key Bindings to help with terminal mode
:tnoremap <Esc> <C-\><C-n> :tnoremap <Esc> <C-\><C-n>
" Key bindings to move between window splits " Key bindings to move between window splits
@ -187,15 +172,6 @@ noremap <Down> <NOP>
noremap <Left> <NOP> noremap <Left> <NOP>
noremap <Right> <NOP> noremap <Right> <NOP>
let g:LanguageClient_autoStart = 0
let g:LanguageClient_loggingFile = expand('$HOME/LC.log')
let g:LanguageClient_rootMarkers = ['stack.yaml']
let g:LanguageClient_serverCommands = {
\ 'haskell': ['$HOME/.local/bin/hie-wrapper'],
\ 'go' : ['$HOME/go/bin/gopls'],
\ 'clojure': ['bash', '-c', 'clojure-lsp'],
\ }
nnoremap <Leader>ld :call LanguageClient#textDocument_definition()<CR> nnoremap <Leader>ld :call LanguageClient#textDocument_definition()<CR>
nnoremap <Leader>lr :call LanguageClient#textDocument_rename()<CR> nnoremap <Leader>lr :call LanguageClient#textDocument_rename()<CR>
nnoremap <Leader>lf :call LanguageClient#textDocument_formatting()<CR> nnoremap <Leader>lf :call LanguageClient#textDocument_formatting()<CR>
@ -240,27 +216,6 @@ function! ToggleLspAutoHoverAndHilight() abort
endfunction endfunction
nnoremap <Leader>lg :call ToggleLspAutoHoverAndHilight()<CR> nnoremap <Leader>lg :call ToggleLspAutoHoverAndHilight()<CR>
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
let g:haskell_classic_highlighting = 1
let g:haskell_indent_if = 3
let g:haskell_indent_case = 2
let g:haskell_indent_let = 4
let g:haskell_indent_where = 6
let g:haskell_indent_before_where = 2
let g:haskell_indent_after_bare_where = 2
let g:haskell_indent_do = 3
let g:haskell_indent_in = 1
let g:haskell_indent_guard = 2
let g:haskell_indent_case_alternative = 1
let g:cabal_indent_section = 2
augroup interoMaps augroup interoMaps
au! au!
" Maps for intero. Restrict to Haskell buffers so the bindings don't collide. " Maps for intero. Restrict to Haskell buffers so the bindings don't collide.
@ -300,21 +255,6 @@ augroup interoMaps
au FileType haskell nnoremap <leader>ist :InteroSetTargets<SPACE> au FileType haskell nnoremap <leader>ist :InteroSetTargets<SPACE>
augroup END augroup END
" Intero starts automatically. Set this if you'd like to prevent that.
let g:intero_start_immediately = 0
" Enable type information on hover (when holding cursor at point for ~1 second).
let g:intero_type_on_hover = 0
" Change the intero window size; default is 10.
let g:intero_window_size = 15
" Sets the intero window to split vertically; default is horizontal
let g:intero_vertical_split = 1
" OPTIONAL: Make the update time shorter, so the type info will trigger faster.
set updatetime=1000
augroup deopleteMaps augroup deopleteMaps
au! au!
" For deoplete Rust " For deoplete Rust
@ -325,41 +265,6 @@ augroup deopleteMaps
au FileType rust nmap <buffer> <Leader>rt <plug>DeopleteRustGoToDefinitionTab au FileType rust nmap <buffer> <Leader>rt <plug>DeopleteRustGoToDefinitionTab
augroup END augroup END
" Use deoplete
let g:deoplete#enable_at_startup = 1
" Disable autocomplete by default
" let b:deoplete_disable_auto_complete = 1
" let g:deoplete_disable_auto_complete = 1
" Let sources be empty by default
let g:deoplete#sources = {}
" Disable the candidates in Comment/String syntaxes.
call deoplete#custom#source('_',
\ 'disabled_syntaxes', ['Comment', 'String'])
call deoplete#custom#option('sources', {
\ 'rust': ['racer'],
\ 'haskell': ['LanguageClient'],
\ 'go': ['LanguageClient'],
\ 'clojure': ['LanguageClient'],
\})
let g:deoplete#sources#rust#disable_keymap = 1
let g:deoplete#sources#rust#racer_binary='/home/sanchayan/.cargo/bin/racer'
let g:deoplete#sources#rust#rust_source_path='/home/sanchayan/GitSources/rust/src'
" Use airline
let g:airline#extensions#tabline#enabled = 2
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#right_sep = ' '
let g:airline#extensions#tabline#right_alt_sep = '|'
let g:airline_left_sep = ' '
let g:airline_left_alt_sep = '|'
let g:airline_right_sep = ' '
let g:airline_right_alt_sep = '|'
" Let vim-gitgutter do its thing on large files
let g:gitgutter_max_signs=10000
" Run gofmt on save " Run gofmt on save
autocmd BufWritePre *.go :call LanguageClient#textDocument_formatting_sync() autocmd BufWritePre *.go :call LanguageClient#textDocument_formatting_sync()
@ -378,3 +283,94 @@ nnoremap <silent> crml :call LanguageClient#workspace_executeCommand('move-to-le
nnoremap <silent> cril :call LanguageClient#workspace_executeCommand('introduce-let', [Expand('%:p'), line('.') - 1, col('.') - 1, input('Binding name: ')])<CR> nnoremap <silent> cril :call LanguageClient#workspace_executeCommand('introduce-let', [Expand('%:p'), line('.') - 1, col('.') - 1, input('Binding name: ')])<CR>
nnoremap <silent> crel :call LanguageClient#workspace_executeCommand('expand-let', [Expand('%:p'), line('.') - 1, col('.') - 1])<CR> nnoremap <silent> crel :call LanguageClient#workspace_executeCommand('expand-let', [Expand('%:p'), line('.') - 1, col('.') - 1])<CR>
nnoremap <silent> cram :call LanguageClient#workspace_executeCommand('add-missing-libspec', [Expand('%:p'), line('.') - 1, col('.') - 1])<CR> nnoremap <silent> cram :call LanguageClient#workspace_executeCommand('add-missing-libspec', [Expand('%:p'), line('.') - 1, col('.') - 1])<CR>
let g:LanguageClient_autoStart = 0
let g:LanguageClient_loggingFile = expand('$HOME/LC.log')
let g:LanguageClient_rootMarkers = ['stack.yaml']
let g:LanguageClient_serverCommands = {
\ 'haskell': ['$HOME/.local/bin/hie-wrapper'],
\ 'go' : ['$HOME/go/bin/gopls'],
\ 'clojure': ['bash', '-c', 'clojure-lsp'],
\ }
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
let g:haskell_classic_highlighting = 1
let g:haskell_indent_if = 3
let g:haskell_indent_case = 2
let g:haskell_indent_let = 4
let g:haskell_indent_where = 6
let g:haskell_indent_before_where = 2
let g:haskell_indent_after_bare_where = 2
let g:haskell_indent_do = 3
let g:haskell_indent_in = 1
let g:haskell_indent_guard = 2
let g:haskell_indent_case_alternative = 1
let g:cabal_indent_section = 2
" Intero starts automatically. Set this if you'd like to prevent that.
let g:intero_start_immediately = 0
" Enable type information on hover (when holding cursor at point for ~1 second).
let g:intero_type_on_hover = 0
" Change the intero window size; default is 10.
let g:intero_window_size = 15
" Sets the intero window to split vertically; default is horizontal
let g:intero_vertical_split = 1
" Use deoplete
let g:deoplete#enable_at_startup = 1
" Disable autocomplete by default
" let b:deoplete_disable_auto_complete = 1
" let g:deoplete_disable_auto_complete = 1
" Let sources be empty by default
let g:deoplete#sources = {}
" Disable the candidates in Comment/String syntaxes.
call deoplete#custom#source('_',
\ 'disabled_syntaxes', ['Comment', 'String'])
call deoplete#custom#option('sources', {
\ '_' : ['buffer', 'tag'],
\ 'rust': ['racer'],
\ 'haskell': ['LanguageClient'],
\ 'go': ['LanguageClient'],
\ 'clojure': ['LanguageClient'],
\})
let g:deoplete#sources#rust#disable_keymap = 1
let g:deoplete#sources#rust#racer_binary=expand('$HOME/.cargo/bin/racer')
let g:deoplete#sources#rust#rust_source_path=expand('$HOME/GitSources/rust/src')
" Use airline
let g:airline#extensions#tabline#enabled = 2
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#right_sep = ' '
let g:airline#extensions#tabline#right_alt_sep = '|'
let g:airline_left_sep = ' '
let g:airline_left_alt_sep = '|'
let g:airline_right_sep = ' '
let g:airline_right_alt_sep = '|'
" Let vim-gitgutter do its thing on large files
let g:gitgutter_max_signs=10000
" gutentags configuration
" https://www.reddit.com/r/vim/comments/d77t6j/guide_how_to_setup_ctags_with_gutentags_properly/
let g:gutentags_add_default_project_roots = 0
let g:gutentags_project_root = ['.git']
let g:gutentags_cache_dir = expand('$HOME/.cache/vim/ctags/')
let g:gutentags_generate_on_new = 1
let g:gutentags_generate_on_missing = 1
let g:gutentags_generate_on_write = 1
let g:gutentags_generate_on_empty_buffer = 0
let g:gutentags_ctags_extra_args = [
\ '--tag-relative=yes',
\ '--fields=+ailmnS',
\ ]