-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.vimrc
198 lines (165 loc) · 5.73 KB
/
.vimrc
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
set encoding=utf-8 " The encoding displayed.
set fileencoding=utf-8 " The encoding written to file.
scriptencoding utf-8
" allow all vim cool things
set nocompatible
" add custom directory to runtimepath
set runtimepath+=~/.vim/templates
" vim-plug settings
call plug#begin('~/.vim/plugged')
if v:version >= 800
Plug 'lervag/vimtex'
Plug 'SirVer/ultisnips', { 'tag': '*' }
Plug 'honza/vim-snippets'
endif
" disable on other hosts and for .C files (ROOT macros).
" -- not sure if this is the best way to do it --
if (has('macunix') || hostname() ==# 'lxpertoldi' || hostname() ==# 'thinkpad')
\ && expand('%:e') !=# 'C' && &filetype !=# 'julia' && &filetype !=# 'asm'
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer' }
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
endif
Plug 'matze/vim-tex-fold'
Plug 'Konfekt/FastFold'
Plug 'reedes/vim-wheel'
Plug 'JuliaEditorSupport/julia-vim'
Plug 'xu-cheng/brew.vim'
Plug 'tpope/vim-sensible'
if $TERM !=? '' || has('gui_running')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
endif
Plug 'tpope/vim-fugitive'
Plug 'w0rp/ale'
Plug 'matze/vim-move'
Plug 'altercation/vim-colors-solarized'
Plug 'morhetz/gruvbox'
Plug 'leafgarland/typescript-vim'
Plug 'posva/vim-vue'
Plug 'neomutt/neomutt.vim'
Plug 'tpope/vim-commentary'
Plug 'godlygeek/tabular'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'wesQ3/vim-windowswap'
Plug 'sersorrel/vim-lilypond', { 'branch': 'main' }
Plug 'singularityware/singularity.lang', {'rtp': 'vim/'}
Plug 'rhysd/vim-clang-format'
Plug 'snakemake/snakemake', {'rtp': 'misc/vim'}
Plug 'vim-scripts/ck.vim'
call plug#end()
" auto-install missing plugins at startup
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
" this is to make sure that vim-sensible is loaded at this point
runtime! plugin/sensible.vim
" kitty compatibility
" see :h xterm-kitty
if $TERM ==? 'xterm-kitty'
set term=kitty
endif
" set shell
if executable('zsh')
set shell=zsh
else
set shell=bash
endif
if has('mouse') " mouse support?
set mouse=a
endif
set nowrap " auto-wrap is evil
set incsearch " highlights what you are searching for as you type
set ignorecase " ignores case in search patterns
set smartcase " don't ignore case when the search pattern has uppercase
set infercase " during keyword completion, fix case of new word (when ignore case is on)
set number " line numbers
set tabstop=4 " tab width is 4 spaces
set shiftwidth=4 " indent also with 4 spaces
set expandtab " expand tabs to spaces
set wildmode=longest:full,full " the default tab-completion behaviour is simply annoying
set list " cool chars to highlight trailing spaces, end-of-lines and tabs
set listchars=eol:¬,tab:>-,trail:~,extends:>,precedes:<
" remove <F1> help and Ex mode keybind, I always hit it by mistake
nnoremap <F1> <Nop>
nnoremap Q <Nop>
" set 72 max line width when composing in mutt
augroup my_mutt
autocmd BufRead /tmp/mutt-* set tw=72
augroup END
" command to remove trailing whitespace
command StripWhitespace %s/\s\+$//e
" enable undercurl (needs to be done manually somehow)
let &t_Cs = "\e[4:3m"
let &t_Ce = "\e[4:0m"
" color scheme settings
colorscheme gruvbox
set background=dark
syntax on
" Highlight TODO, FIXME, NOTE, INFO, BUG etc.
if v:version > 701
augroup my_high
autocmd Syntax * call matchadd('Todo', '\W\zs\(TODO\|FIXME\|CHANGED\|XXX\|BUG\|HACK\)')
autocmd Syntax * call matchadd('Debug', '\W\zs\(NOTE\|INFO\|IDEA\)')
augroup END
endif
" better colors for list chars
highlight NonText ctermfg=238
highlight SpecialKey ctermfg=238
" italic comments?
if $TERM !=? '' || has('gui_running')
highlight Comment cterm=italic
else
colorscheme solarized
endif
" ultisnips
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger = '<F1>'
let g:UltiSnipsJumpForwardTrigger = '<c-j>'
let g:UltiSnipsJumpBackwardTrigger = '<c-k>'
let g:UltiSnipsEditSplit = 'vertical'
let g:UltiSnipsSnippetsDir = '~/.vim/templates/UltiSnips'
let g:UltiSnipsNoPythonWarning = 1
let g:templates_no_autocmd = 1
let g:templates_no_builtin_templates = 1
" vim-airline settings
set noshowmode
let g:bufferline_echo = 0
let g:airline_powerline_fonts = 1
" ale settings
" Enable completion where available.
let g:ale_lint_delay = 2000
let g:ale_pattern_options = {'\.C': {'ale_enabled': 1}} " this is for ROOT macros
let g:ale_completion_enabled = 1
let g:ale_linters = { 'cpp': [], 'asm': [] } " let YCM do its job
let g:ale_python_flake8_options = '--max-line-length 999'
" gutter options
if v:version >= 750
hi SignColumn ctermbg = black
set signcolumn=yes
endif
" YouCompleteMe settings
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
let g:ycm_confirm_extra_conf = 0
let g:ycm_add_preview_to_completeopt = 1
let g:ycm_seed_identifiers_with_syntax = 0
let g:ycm_min_num_of_chars_for_completion = 2
let g:ycm_autoclose_preview_window_after_completion = 1
" vim-move settings
let g:move_key_modifier = 'C'
" vim-commentary settings
augroup commentary
autocmd FileType c,cpp,cs,java,asy,ck setlocal commentstring=//\ %s
autocmd FileType asm,julia,singularity,snakemake setlocal commentstring=#\ %s
autocmd FileType lilypond setlocal commentstring=%\ %s
autocmd FileType sql setlocal commentstring=--\ %s
augroup END
augroup filetypedetect
au BufNewFile,BufRead *.asy setf asy
au BufNewFile,BufRead *.ck setf ck
augroup END
" Julia-Vim
let g:latex_to_unicode_auto = 1
" configuration file for c++ is ~/.vim/ftplugin/cpp.vim
" configuration file for tex in ~/.vim/ftplugin/tex.vim
" vim: tabstop=2 shiftwidth=2 expandtab