~kaction/config

ref: b2ccfe88c38ce7ed603694bcd7df44db84f42bd3 config/nixpkgs/overlays.d/config.d/vim/vim/share/vim/vim82/vimrc -rw-r--r-- 3.3 KiB
b2ccfe88 — Dmitry Bogatov vim: configure LSP 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
set nocompatible
syntax enable
highlight Folded ctermfg=Green ctermbg=Black

filetype plugin indent on
packadd matchit
packadd personal
runtime! plugin/gzip.vim

set keymap=russian-jcukenwin
set iminsert=0
set imsearch=0

set autoindent
set cmdwinheight=4
" This teaches vim to find files references by Python's pkgutil.get_data
set path+=.;.git
set cindent
set directory=/proc/self/fd/42/.cache/vim-backup
set complete+=t "tag completion
set copyindent
set exrc
set foldclose=all
set foldlevel=0
set foldmethod=marker
set incsearch
set list
set listchars=trail:-,tab:>.
" panic action to prevent cve-2019-12735
set nomodeline
set magic
set nohlsearch
set ruler
set secure
set showmatch
set showcmd
set smartcase
set textwidth=72
set wildmenu
set wildmode=list:longest,list:longest
set infercase
set colorcolumn=80
set laststatus=0
" I love column of line numbers on the left so much, but they consume
" horizontal space and define difference between font-18 and font-14.
set nonumber

" There is no reason for .viminfo file to survive reboot. This way it
" does not clutter ~/.
let &viminfofile = "/dev/shm/" . getenv("USER") . "/.viminfo"
let g:netrw_home = "/dev/shm/" . getenv("USER")
let g:sql_type_default = 'pgsql'
let g:pgsql_pl = ['python']

" Vim thinks, that /bin/sh scripts must use backticks for command
" substitution. Make it believe that shell is actually bash.
let g:is_bash=1
let g:sh_fold_enabled=7

map Q gq
noremap j gj
noremap k gk
set tags+=codex.tags
set tags+=../tags,../../tags,../../../tags,../../../../tags

au BufWrite *.hs :silent !git codex >/dev/null 2>&1 &
au BufNewFile,BufRead *.asy setf asy
au BufNewFile,BufRead manifest setf sh

" These are huge files (~150k lines) in nixpkgs, and they hang syntax
" highlight.
au BufNewFile,BufRead all-packages.nix set syntax=off
au BufNewFile,BufRead hackage-packages.nix set syntax=off

au BufNewFile,BufRead */.mail/*/[0123456789]* setf mail
au BufNewFile,BufRead /tmp/src* setf gitcommit
au BufNewFile,BufRead *.asy setfiletype asy
au BufNewFile,BufRead manifest setfiletype sh
au BufNewFile,BufRead *.ex set filetype=execline
au BufNewFile,BufRead *.fasm setfiletype fasm
au BufNewFile,BufRead,BufWritePost *.gmi set columns=80
au BufNewFile,BufRead */mail/*/[0123456789]* setfiletype mail
au BufNewFile,BufRead syntax sync minlines=200 "slower but more correct highlighting
au BufWritePre * :silent !mkdir -p %:p:h

imap <Tab> <Plug>snipMateNextOrTrigger
smap <Tab> <Plug>snipMateNextOrTrigger
vmap <Tab> <Plug>snipMateVisual

imap <S-Tab> <Plug>snipMateBack
smap <S-Tab> <Plug>snipMateBack

imap <C-s> <Plug>snipMateShow
let g:snipMate = { 'snippet_version': 1 }
let g:LanguageClient_serverCommands = {
  \ 'c': ['ccls'],
  \ 'python': ['pyls'],
  \ 'dhall': ['dhall-lsp-server'],
  \ 'tex': ['texlab'],
  \ 'go': ['gopls'],
  \ 'nix': ['rnix-lsp'],
  \ 'haskell': ['haskell-language-server-wrapper', '--lsp']
  \ }
nmap <silent> K  <Plug>(lcn-hover)
nmap <silent> gd <Plug>(lcn-definition)
nmap <silent> gr <Plug>(lcn-rename)
nmap <silent> g? <Plug>(lcn-references)
nmap <silent> gl <Plug>(lcn-symbols)
nmap <silent> g= <Plug>(lcn-format)
nmap <silent> g. <Plug>(lcn-explain-error)
nmap <silent> g' <Plug>(lcn-code-action)
nmap <silent> g; <Plug>(lcn-code-lens-action)
set completefunc=LanguageClient#complete
set formatexpr=LanguageClient#textDocument_rangeFormatting_sync()