-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
248 lines (237 loc) · 8.26 KB
/
init.vim
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
" Credits and sources {{{
" http://dougblack.io/words/a-good-vimrc.html
" https://github.com/davidpdrsn/dotfiles
" }}}
" Plugins {{{
call plug#begin('~/.config/nvim/plugins')
" Plug 'Valloric/YouCompleteMe' " Autocompletion
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/context_filetype.vim'
Plug 'Shougo/neoinclude.vim'
Plug 'zchee/deoplete-jedi'
Plug 'artur-shaik/vim-javacomplete2'
Plug 'c0r73x/neotags.nvim' " Tags for syntax highlighting (ie. class names, etc)
Plug 'sjl/gundo.vim' " graphical view of undo tree
Plug 'kien/ctrlp.vim' " Find stuff
Plug 'gmarik/Vundle.vim' " plugin mangement
Plug 'Raimondi/delimitMate' " insert matching quotes, braces, etc.
Plug 'bling/vim-airline' " status bar
Plug 'tpope/vim-commentary' " help for commenting
" Plug 'scrooloose/syntastic' " see compiler warnings in vim
Plug 'tpope/vim-surround' " surround selection with matching symbols
Plug 'SirVer/ultisnips' " snippet-engine
Plug 'honza/vim-snippets' " snippets
Plug 'tpope/vim-fugitive' " Use git from within vim
Plug 'rking/ag.vim' " The silver searcher
Plug 'sukima/xmledit' " XML editing functionality (tag closing, etc.)
Plug 'chrisbra/DistractFree' " Distraction free mode
Plug 'Floobits/floobits-neovim'
" Syntax highlighting
Plug 'Rykka/riv.vim'
Plug 'chriskempson/base16-vim'
Plug 'wannesm/wmnusmv.vim' " NuSMV
Plug 'tikhomirov/vim-glsl' " OpenGL Shading Language
Plug 'StanAngeloff/php.vim' " PHP
Plug 'travitch/hasksyn' " Haskell syntax
Plug 'vim-ruby/vim-ruby' " Ruby syntax
Plug 'vim-scripts/vim-json-bundle' " JSON syntax
Plug 'xolox/vim-misc' " miscellaneous vim autoload scripts
Plug 'xolox/vim-notes' " Note taking
Plug 'newclear/vim-pyclewn'
Plug 'jcfaria/Vim-R-plugin' " R language
Plug 'jaxbot/semantic-highlight.vim'
call plug#end()
" }}}
" Colors {{{
syntax enable " enable syntax processing
" base16 color stuff
let g:semanticTermColors = [28,1,2,3,4,5,6,7,25,9,10,34,12,13,14,15,16,125,124,19]
let base16colorspace=256
set t_Co=256
set background=dark
colorscheme base16-default-dark
" select colorscheme from dynamic-colors selected color
" let cs = split(readfile("/home/feo/.dynamic-colors/colorscheme")[0], '\.')
" let mstr = matchstr(cs[1], 'dark')
" if empty(mstr)
" set background=light
" else
" set background=dark
" endif
" execute 'colorscheme ' . cs[0] . '-' . cs[1]
"}}}
" Spaces and tabs {{{
set shiftwidth=4 " number of spaces to use when indenting
set softtabstop=4 " number of spaces a tab counts for when inserting
set tabstop=4 " number of spaces a tab counts for
set smartindent " automatically indent new lines
set backspace=2 " delete newlines with backspace
set modelines=1 " last line in file can be mode line
filetype indent on " load filetype-specific indent files
filetype plugin on " load filetype specific plugin files
"}}}
" UI Config {{{
set number " enable line numbers
set ruler " enable column and line number display
set showcmd " show command in bottom bar
set cursorline " highlight current line
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when we need to
set laststatus=2 " enable vim-airline statusbar
set list
set listchars=tab:▸\ " Char representing a tab
set listchars+=extends:❯ " Char representing an extending line
set listchars+=nbsp:␣ " Non breaking space
set listchars+=precedes:❮ " Char representing an extending line in the other direction
set listchars+=trail:· " Show trailing spaces as dots
" }}}
" Searching {{{
set incsearch " search as characters are entered
set hlsearch " highlight search matches
" }}}
" Folding {{{
set foldenable " enable folds
set foldlevelstart=10 " open most folds by default
set foldnestmax=10 " 10 nested fold max
" space
nnoremap <space> za
" }}}
" Movement {{{
" move correctly on wrapped lines
" while allowing counted g/j
noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
" highlight last inserted text
nnoremap gV `[v`]
" Resize horizontal split window
noremap <Right> :vertical resize +5<cr>
noremap <Left> :vertical resize -5<cr>
" Resize vertical split window
noremap <Down> :resize +5<cr>
noremap <Up> :resize -5<cr>
" }}}
" Leader Shortcuts {{{
let mapleader="," " leader is comma
" toggle gundo
nnoremap <leader>u :GundoToggle<cr>
" open ag.vim
nnoremap <leader>a :Ag
" reload .vimrc faster
noremap <leader>sv :source ~/.config/nvim/init.vim<cr>
" edit vimrc
noremap <leader>ev :e ~/.config/nvim/init.vim<cr>
" close current window
noremap <leader>l :clo<cr>
" next buffer
noremap <leader>n :bn<cr>
" previous buffer
noremap <leader>p :bp<cr>
" delete buffer
noremap <leader>d :bd<cr>
" CtrlP buffer selection
noremap <leader>b :CtrlPBuffer<cr>
" install plugin
noremap <leader>i :PlugInstall!<cr>
" create horizontal split window
noremap <leader>h :split<cr>
" create vertical split window
noremap <leader>v :vs<cr>
" toggle relative numbers
nnoremap <leader>r :call ToggleNumber()<cr>
" clear search
noremap <leader>c :let @/ = ""<cr>
" terminal escape
tnoremap <Esc>q <C-\><C-n>
" }}}
" Plugin Settings {{{
" neotags {{{
let g:neotags_enabled=1
" }}}
" deoplete.settings {{{
let g:deoplete#enable_at_startup = 1
"}}}
" CtrlP settings {{{
let g:ctrlp_match_window = 'bottom,order:ttb'
let g:ctrlp_switch_buffer = 0
let g:ctrlp_working_path_mode = 0
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
" }}}
" vimtex settings {{{
let g:vimtex_fold_enabledA = 0
let g:vimtex_view_method = 'mupdf'
let g:vimtex_latexmk_options = '-pdf -interaction=nonstopmode -synctex=1 -shell-escape'
let g:latex_indent_enabled = 0
" }}}
" vim-airline settings {{{
let g:airline_powerline_fonts = 1 " enable powerline fonts for vim-airline
" }}}
" ultisnips settings {{{
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<M-s>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:rehash256 = 1
" }}}
" YouCompleteMe settings {{{
let g:ycm_global_ycm_extra_conf = '~/.config/nvim/plugins/YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py'
let g:ycm_server_keep_logfiles = 1
let g:ycm_confirm_extra_conf = 0
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_python_binary_path = 'python'
" }}}
" syntastic settings {{{
" let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
" let g:syntastic_java_javac_classpath = '/opt/android-sdk/platforms/android-23/*.jar'
" let g:syntastic_enable_signs = 0
" let g:syntastic_enable_balloons = 0
" let g:syntastic_enable_highlighting = 0
" let g:syntastic_mode_map = { "mode": "passive" }
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
" let g:syntastic_always_populate_loc_list = 1
" let g:syntastic_auto_loc_list = 1
" let g:syntastic_check_on_open = 1
" let g:syntastic_check_on_wq = 0
" }}}
" }}}
" Auto commands {{{
augroup configgroup
autocmd!
autocmd BufWritePre *.c,*.cpp,*.h,*.hpp,*.php,*.py,*.js,*.txt,*.hs,*.java,*.md,*.rb :call <SID>StripTrailingWhitespaces()
autocmd FileType *.php,*.html,*.html,*.xml :
" autocmd BufReadPost *.tex setlocal textwidth=80
augroup END
au BufNewFile,BufRead *.fut set filetype=futhark
autocmd FileType java setlocal omnifunc=javacomplete#Complete
" }}}
" Backups {{{
set backup
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set backupskip=/tmp/*,/private/tmp/*
set directory=~/.vim-tmp,~/.tmp,~/.tmp,/var/tmp,/tmp
set writebackup
" }}}
" Custom Functions {{{
" toggle between number and relativenumber
function! ToggleNumber()
if(&relativenumber == 1)
set norelativenumber
set number
else
set relativenumber
endif
endfunction
" strips trailing whitespace at the end of files. this
" is called on buffer write in the autogroup above.
function! <SID>StripTrailingWhitespaces()
" save last search & cursor position
let _s=@/
let l = line(".")
let c = col(".")
%s/\s\+$//e
let @/=_s
call cursor(l, c)
endfunction
" }}}
" vim:foldmethod=marker:foldlevel=0