summaryrefslogtreecommitdiff
path: root/.config/nvim/init.vim
blob: 74302ceab0a6042719d6896d7077510071225fbb (plain)
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
"        _
"       (_)
" __   ___ _ __ ___  _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
"  \ V /| | | | | | | | | (__
"   \_/ |_|_| |_| |_|_|  \___|
"
"
" #---Plug Installer---# "
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

" #---Vim Plugins---# "
call plug#begin()
" if has('nvim')
  " Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" else
  " Plug 'Shougo/deoplete.nvim'
  " Plug 'roxma/nvim-yarp'
  " Plug 'roxma/vim-hug-neovim-rpc'
" endif
" Latex Deoplete source
" Plug 'hisaknown/deoplete-latex'
" Comment frames (for comment aesthetics)
Plug 'cometsong/CommentFrame.vim'
" Deoplete
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" Go Deoplete sources
Plug 'stamblerre/gocode', { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' }
Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'}
" LaTeX deoplete
Plug 'hisaknown/deoplete-latex'
" Turning vim into an R IDE
Plug 'jalvesaq/Nvim-R'
" Vim Sensible
Plug 'tpope/vim-sensible'
" Vim org tables
Plug 'dhruvasagar/vim-table-mode'
" Html linter enabler (for prettier AUR package)
Plug 'dense-analysis/ale'
" Vim css hex highlight
Plug 'chrisbra/Colorizer'
" Bracket Completion
Plug 'jiangmiao/auto-pairs'
" csv filetype for vim
Plug 'chrisbra/csv.vim'
" Go developement
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
" sxhkd syntax
Plug 'kovetskiy/sxhkd-vim'
" Vim-Bling Search
Plug 'ivyl/vim-bling'
" Vim Hard Mode
Plug 'wikitopian/hardmode'
" I want to be a python ninja!
Plug 'metakirby5/codi.vim'
" Quickrun for python
Plug 'thinca/vim-quickrun'
" markdown preview vim
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }}
" Emmet expansion for html
Plug 'mattn/emmet-vim'
" html preview
Plug 'turbio/bracey.vim'
" VimCompletesMe for VimTex
Plug 'ajh17/VimCompletesMe'
" Xresources colors
Plug 'dylanaraps/wal.vim'
" Nord colors
Plug 'arcticicestudio/nord-vim'
" My personal colorscheme
Plug 'ChausseBenjamin/friffle-vim'
" Vim Fugitive
Plug 'tpope/vim-fugitive'
" Vim-Surround
Plug 'tpope/vim-surround'
" Vim repeat for dot command on vim surround
Plug 'tpope/vim-repeat'
" Vimtex
Plug 'lervag/vimtex'
" Tags for latex
" Plug 'ludovicchabant/vim-gutentags'
" C developement in vim
Plug 'vim-scripts/c.vim'
" NERDTree
Plug 'scrooloose/nerdtree'
" Git plugin for NERDTree
Plug 'Xuyuanp/nerdtree-git-plugin'
" Icons in NERDTree and Airline
Plug 'ryanoasis/vim-devicons'
" lightline
Plug 'itchyny/lightline.vim'
" Commentary
Plug 'tpope/vim-commentary'
" Vim markdown
Plug 'godlygeek/tabular'
" Ctrl-P fuzzy file finder
Plug 'ctrlpvim/ctrlp.vim'
" Vim snippet manager/tool
Plug 'sirver/UltiSnips'
" Vim snippet library
Plug 'honza/vim-snippets'
" Async shell commands
Plug 'skywind3000/asyncrun.vim'
" French grammar checker
Plug 'dpelle/vim-Grammalecte'
" All purpose grammar checker
Plug 'dpelle/vim-LanguageTool'
call plug#end()


" #---Basics/Recomended---# "
syntax on
filetype plugin on
set termguicolors
set t_Co=256
set encoding=utf-8
set path+=** " Provides tab-completion for all file related tasks
set wildmenu " Display all matching file when we tab complete
runtime macros/matchit.vim
" Spelling
set complete+=kspell " Better Spell Checking
set spelllang=fr
nnoremap ;h <Esc>zg
nnoremap ;j <Esc>]s
nnoremap ;k <Esc>[s
nnoremap ;l <Esc>z=1<CR><CR>
nnoremap ;<Space> <Esc>z=1<CR><CR>
" Enable autocompletion:
    set wildmode=longest,list,full
		set runtimepath+=~/.config/nvim/plugged/deoplete.nvim
    let g:deoplete#enable_at_startup = 1
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
set rtp+=/usr/local/opt/fzf " Fuzzy File Finder
set t_vi= " Autohide the cursor
" Automatic wordwrap without creating newlines!
set wrap
set linebreak

" #---Plugin Preferences---# "
" Nvim-R
let R_rconsole_width = 0
let R_openpdf = 0
au BufWritePost *.rmd,*.rnw,      silent! :call RWeave("nobib", 1, 1)
au VimLeave    *.rmd,*.rnw,*.tex !texclear %
" Emmet Expansion
let g:user_emmet_leader_key=','
" Enable kite autocompletion
let g:kite_auto_complete=1
" MarkdownPreview
" let g:mkdp_browser = 'surf'
" Bracey
let g:bracey_browser_command = "chromium"
" Grammalecte path
let g:grammalecte_cli_py = "/usr/bin/grammalecte-cli"
" Ale Linter with prettier
let g:ale_linters_explicit = 1
" autocmd BufWrite, *.css,*.html,*.js :ALEFix prettier
" Ultisnips
    " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
    let g:UltiSnipsExpandTrigger="<Tab>"
    let g:UltiSnipsJumpForwardTrigger=";<Space>"
    let g:UltiSnipsJumpBackwardTrigger=";n"
    " If you want :UltiSnipsEdit to split your window.
    let g:UltiSnipsEditSplit="vertical"
    " Snippet directory
    let g:UltiSnipsSnippetDirectories=[$HOME.'/.config/nvim/UltiSnips']
" Go deoplete
let g:deoplete#sources#go#gocode_binary = '$GOPATH/bin/gocode'
" Hexokinase
let g:Hexokinase_highlighters = ['virtual']
" GoRun Split Reuse
function! ReuseVimGoTerm(cmd) abort
    for w in nvim_list_wins()
        if "goterm" == nvim_buf_get_option(nvim_win_get_buf(w), 'filetype')
            call nvim_win_close(w, v:true)
            break
        endif
    endfor
    execute a:cmd
endfunction
let g:go_term_enabled = 1
let g:go_term_mode = "silent keepalt rightbelow 35 vsplit"
let g:go_def_reuse_buffer = 1
autocmd FileType go nmap <leader>r :call ReuseVimGoTerm('GoRun')<Return>
" Vimtex pdf viewer
let g:vimtex_view_general_viewer = 'open'
let g:vimtex_view_general_options = '-a zathura'
let g:tex_flavor = 'latex'

" #---Document Compilation/Visualisation---# "
" Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| AsyncRun compiler <c-r>%<CR><CR>
autocmd InsertLeave,TextChanged *.gd,*.ms,*.mom :w! | :execute 'silent AsyncRun compiler %'
" autocmd InsertLeave *.rmd,*.rnw,*.tex :w! | :execute 'silent AsyncRun compiler %; todotable % TODO FIXME CHANGED XXX IDEA HACK NOTE REVIEW NB BUG QUESTION COMBAK'
map <leader>x :w! \| AsyncRun todotable <c-r>% TODO FIXME CHANGED XXX IDEA HACK NOTE REVIEW NB BUG QUESTION COMBAK TEMP<CR><CR>
" Have dwmblocks automatically recompile and run when you edit this file in
autocmd BufWritePost ~/Compilation/dwmblocks/config.h !cd ~/Compilation/dwmblocks/; make && sudo make install && { killall -q dwmblocks;setsid dwmblocks & }
" Open corresponding .pdf/.html or preview
    map <leader>p :! opout <c-r>%<CR><CR>
" Open corresponding .pdf/.html or preview
    map <leader>o :! tdout <c-r>%<CR><CR>
" Width tabstop
set tabstop=2
" when indenting with '>', use 4 spaces width
set shiftwidth=2
" 80 col warning
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)

" #---Custom Keymaps---# "
" Tab Buffer Navigation
    nnoremap <S-k> :bp<CR>
    nnoremap <S-j> :bn<CR>
" Vim split resize
    map <Up>    <Esc>:resize<Space>+3<CR>
    map <Down>  <Esc>:resize<Space>-3<CR>
    map <Left>  <Esc>:vertical<Space>resize<Space>-3<CR>
    map <Right> <Esc>:vertical<Space>resize<Space>+3<CR>
    map <C-_>   <Esc>:split<CR>
    map <C-\>   <Esc>:vsplit<CR>
" Ninja python execution
    map <F5>    <Esc>:Codi!!<CR>
    map <F6>    <Esc>:QuickRun<CR>
" Shortcutting split navigation, saving a keypress:
    map <C-h> <C-w>h
    map <C-j> <C-w>j
    map <C-k> <C-w>k
    map <C-l> <C-w>l
" Create blank lines using Shift J and Shift K
    nnoremap J o<Esc>
    nnoremap K O<Esc>
" Figlet dotfile titles
command RcTitle .!figlet -s -f big
" Easily escape terminal mode
tnoremap <Esc> <C-\><C-n>
" Pressing shift semicolon was too long:
nnoremap <Space> :
" Fastest :w in the west
nnoremap <leader>w :w<CR>
" #---Visual Enhancements---# "
colorscheme friffle
" Remove latex underscore errors
let g:tex_no_error=1
" let g:airline_powerline_fonts = 1
" Lightline config
let g:lightline = {
      \ 'colorscheme': 'friffle',
      \ }
set noshowmode
" Vim-go breakpoints and debug
nnoremap mp :GoDebugBreakpoint<CR>
nnoremap mn :GoDebugNext<CR>
nnoremap ms :GoDebugStart<CR>
nnoremap mq :GoDebugStop<CR>

" #---Ease Of Use---# "
" Normal/relative number toggle
set number relativenumber
augroup numbertoggle
  autocmd!
  autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
  autocmd BufLeave,FocusLost,InsertEnter   * set norelativenumber
augroup END
" Remove all trailing spaces upon write {{{
autocmd BufWritePre * %s/\s\+$//e
" Soft Tabs
filetype plugin indent on
" NERDTRee Hotkey map
map <C-n> :NERDTreeToggle<CR>
    let NERDTreeDirArrowExpandable="|"
    let NERDTreeDirArrowCollapsible="-"
" Close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Other NERDTree Preferences
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let NERDTreeShowBookmarks=1
let NERDTreeAutoDeleteBuffer = 1
let NERDTreeQuitOnOpen = 1
" Nvim-R send line
nmap <C-Enter> <leader>l
" Nvim folding
    let r_syntax_folding = 1
    set foldnestmax=1


" #---Universal Macros---# "
" Create and navigate Markers
" inoremap ;m <++>
inoremap ;; <Esc>/<++><CR>"_c4l
inoremap << «
inoremap >> »
" #---Filetype Specific Settings---# "