summaryrefslogtreecommitdiff
path: root/lindy/dot_vimrc
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-03-14 15:09:26 +0100
committerAlex Auvolat <alex@adnab.me>2021-03-14 15:09:26 +0100
commit9d6c55653eab4510fcaa4e91685bab11d0a3ccbb (patch)
treef71a1f9db3395bf4335dff13933ec98c384eec60 /lindy/dot_vimrc
parent7eae9189492cc0372382cf808a8dbcb9cb722639 (diff)
downloaduser-config-9d6c55653eab4510fcaa4e91685bab11d0a3ccbb.tar.gz
user-config-9d6c55653eab4510fcaa4e91685bab11d0a3ccbb.zip
Add lindy files
Diffstat (limited to 'lindy/dot_vimrc')
-rw-r--r--lindy/dot_vimrc133
1 files changed, 133 insertions, 0 deletions
diff --git a/lindy/dot_vimrc b/lindy/dot_vimrc
new file mode 100644
index 0000000..d62b7b8
--- /dev/null
+++ b/lindy/dot_vimrc
@@ -0,0 +1,133 @@
+source /usr/share/vim/vim82/defaults.vim
+source /etc/vimrc
+
+let NERDTreeIgnore=['\.o$', '\.cmo$', '\.cmx$', '\.cmi$', '\.lib$', '\.pyc$', '^__pycache__$', '\.class$']
+
+set encoding=utf-8
+
+set cmdheight=2
+
+if has("patch-8.1.1564")
+ " Recently vim can merge signcolumn and number column into one
+ set signcolumn=number
+else
+ set signcolumn=yes
+endif
+
+set exrc
+set hlsearch
+
+set number
+set relativenumber
+
+let mapleader=","
+
+" Tab modes.
+map <leader>m <Esc>:set expandtab ts=2 sw=2 sts=2<CR>
+map <leader>t <Esc>:set noexpandtab ts=4 sw=4 sts=4<CR>
+map <leader>T <Esc>:set expandtab ts=4 sw=4 sts=4<CR>
+
+set pastetoggle=<F2>
+
+" reload config
+map <leader>c <Esc>:source ~/.vimrc<CR>
+
+" FZF bindings
+"
+" map <leader>f <Esc>:FZF<CR>
+map ; <Esc>:FZF<CR>
+
+map \ <Esc>:Vista finder coc<CR>
+map <leader>b <Esc>:Vista<CR>
+
+" Diagnostic messages
+
+map <leader>d <Esc>:CocDiagnostics<CR>
+
+" map <leader>l <Esc>:ALENextWrap<CR>
+nmap <silent> <leader>s <Plug>(coc-diagnostic-prev)
+nmap <silent> <leader>f <Plug>(coc-diagnostic-next)
+" map <C-n> <Esc>:cnext<CR>
+" map <C-m> <Esc>:cprevious<CR>
+
+" GoTo code navigation.
+nmap <silent> gd <Plug>(coc-definition)
+nmap <silent> gy <Plug>(coc-type-definition)
+nmap <silent> gi <Plug>(coc-implementation)
+nmap <silent> gr <Plug>(coc-references)
+
+" Use K to show documentation in preview window.
+nnoremap <silent> K :call <SID>show_documentation()<CR>
+
+function! s:show_documentation()
+ if (index(['vim','help'], &filetype) >= 0)
+ execute 'h '.expand('<cword>')
+ elseif (coc#rpc#ready())
+ call CocActionAsync('doHover')
+ else
+ execute '!' . &keywordprg . " " . expand('<cword>')
+ endif
+endfunction
+
+" tab completion (coc)
+inoremap <silent><expr> <TAB>
+ \ pumvisible() ? "\<C-n>" :
+ \ <SID>check_back_space() ? "\<TAB>" :
+ \ coc#refresh()
+inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
+
+function! s:check_back_space() abort
+ let col = col('.') - 1
+ return !col || getline('.')[col - 1] =~# '\s'
+endfunction
+
+
+" Symbol renaming.
+nmap <leader>rn <Plug>(coc-rename)
+
+" Formatting selected code.
+"xmap <leader>f <Plug>(coc-format-selected)
+"nmap <leader>f <Plug>(coc-format-selected)
+
+
+" Append modeline after last line in buffer.
+" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX
+" files.
+function! AppendModeline()
+ let l:modeline = printf(" vim: set sts=%d ts=%d sw=%d tw=%d %set :",
+ \ &softtabstop, &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
+ let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
+ call append(line("$"), l:modeline)
+endfunction
+nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
+
+filetype plugin indent on
+set autoindent
+set smartindent
+set ts=4 sw=4
+
+" indentation for long line wraps
+set wrap
+set linebreak
+set breakindent
+let &showbreak = '> '
+
+set bg=dark
+
+au FileType make setl noexpandtab
+au FileType python setl sw=4 sts=4 et
+au FileType html setl sw=2 sts=2 et
+au FileType htmldjango setl sw=2 sts=2 et
+au FileType json setl sw=2 sts=2 et
+au FileType javascript setl sw=2 sts=2 et
+au FileType yaml setl sw=2 sts=2 et
+au FileType css setl sw=4 sts=4 et
+au FileType lua setl ts=4 sw=4 noet
+au FileType trema setl ts=2 sts=2 et
+au FileType trema setl ts=2 sts=2 et
+au FileType typescript.tsx setl ts=2 sts=2 et
+au FileType rust setl ts=4 sw=4 noet
+
+let g:ale_linters = {'rust': ['analyzer']}
+
+highlight Pmenu ctermbg=gray guibg=gray