summaryrefslogtreecommitdiff
path: root/.config/nvim/init.vim
blob: d7d3f0a8c2a8710d1622fcce6fd9429c755ac82d (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
"        _
"       (_)
" __   ___ _ __ ___  _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
"  \ V /| | | | | | | | | (__
"   \_/ |_|_| |_| |_|_|  \___|
"
"

" Vim Plug {{{

" Plug Autoinstall {{{
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
	echo "Downloading junegunn/vim-plug to manage plugins..."
	silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
	silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
	autocmd VimEnter * PlugInstall
endif
" }}}

" Plugins
call plug#begin()
" Bracket Completion
Plug 'jiangmiao/auto-pairs'
" Automated vim bulletpoints
Plug 'dkarter/bullets.vim'
" Vim css hex highlight
Plug 'chrisbra/Colorizer'
" Deoplete
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" LaTeX deoplete
Plug 'hisaknown/deoplete-latex'
" Todoist with vim?
Plug 'romgrk/todoist.nvim', { 'do': ':TodoistInstall' }
" Minimal writing environment
Plug 'junegunn/goyo.vim'
" markdown preview vim
Plug 'iamcco/markdown-preview.nvim'
" Nice markdown formatting
Plug 'godlygeek/tabular', { 'for': 'markdown' }
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
" Generate buffers
Plug 'AndrewRadev/bufferize.vim'
" Emmet
Plug 'mattn/emmet-vim', { 'for': [ 'markdown', 'html' ] }
" html preview
Plug 'turbio/bracey.vim', { 'for': [ 'html', 'stylesheet', 'javascript'] }
" My colorscheme
Plug 'ChausseBenjamin/friffle-vim'
" Elly colorscheme
Plug 'ryuta69/elly.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', { 'for': ['tex', 'aux', 'bib'] }
" Commentary
Plug 'tpope/vim-commentary'
" Vim snippet manager/tool
Plug 'sirver/UltiSnips'
" Vim snippet library
Plug 'honza/vim-snippets'
" French grammar checker
Plug 'dpelle/vim-Grammalecte'
" All purpose grammar checker
Plug 'dpelle/vim-LanguageTool'
" sxhkd syntax
Plug 'kovetskiy/sxhkd-vim', { 'for': 'sxhkdrc' }
" Google cal inside vim
Plug 'itchyny/calendar.vim'
" Turning vim into an R IDE
Plug 'jalvesaq/Nvim-R', { 'for': [ 'R', 'Rnoweb', 'tex', 'aux', 'bib' ] }
" csv filetype for vim
Plug 'chrisbra/csv.vim'
" Quick highlighting
Plug 'qxxxb/vim-searchhi'
" Split resizing made easy
Plug 'simeji/winresizer'
call plug#end()
" }}}
" Sensible defaults {{{
" Aesthetics & basics
syntax on
colo friffle
" colorscheme tweaks {{{
hi Normal guibg=NONE
hi CursorLineNr guibg=NONE
hi Constant guibg=NONE
hi Conceal guibg=NONE
hi Folded guibg=NONE
hi ColorColumn guibg='#738c9c'
hi Todo guibg='#acb3b5' guifg='#340001'
hi Search guifg='#810002' guibg='#738c9c'
" }}}
" weird Goyo behavior fix {{{
au User GoyoEnter,GoyoLeave hi Normal guibg=NONE
au User GoyoEnter,GoyoLeave hi StatusLineNC guibg=NONE
au User GoyoEnter,GoyoLeave hi StatusLine guibg=NONE
au User GoyoEnter,GoyoLeave hi VertSplit guibg=NONE
" }}}
set tgc " Use my terminal's colors
set lz " Lazy redraw -> Quicker vim
set t_Co=256 " 256 colors
set enc=utf-8
set wmnu " Display all matching file when we tab complete
set nosc " Don't show the previously typed command
set nu rnu " Ablolute Relative number hybrid
set ru " View column count
set ls=0 " Disable the statusline
set sb spr " Sensible split directions
set ts=2 " A sensible tab width
set shiftwidth=2 " A sensible tab width
set et " Expanding tabs
set foldmethod=marker " vim folding

" Completion
set path+=** " Provides tab-completion for all file related tasks
set wim=longest,list,full " set completion mode
set runtimepath+=~/.config/nvim/plugged/deoplete.nvim
let g:deoplete#enable_at_startup = 1

" Wrapping
set wrap
set lbr

" Custom semicolon leader
let mapleader=";"
" Tab space for quick commands
nnoremap <space> :

" Spelling
set complete+=kspell " Better Spell Checking
set spl=fr " French prose

" Tag Editing
inoremap <leader>t <++>
inoremap <leader>: <Esc>/<++><CR>"_c4l

" Quickly save
nnoremap <silent> <Leader>w :update<CR>

" Logical way to Y ank
nnoremap Y y$

" Easily escape terminal mode
tnoremap <Esc> <C-\><C-n>

" Split motion
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

" Saving and quitting buffers
nnoremap ZF ZQ
nnoremap <silent> <leader>w :update<CR>

" Remove trailing white spaces
autocmd BufWritePre * %s/\s\+$//e

" }}}
" Workflow specific {{{

" 'o'pen pdf for the current document
nnoremap <silent> <leader>o :!opout <c-r>%<CR><CR>
nnoremap <silent> <leader>c :update \| :!compiler <c-r>%<CR><CR>
nnoremap <silent> <leader>r :update \| :!compiler <c-r>%<CR><CR> \| :!sage %:r.sagetex.sage && compiler %<CR><CR>

" Auto-enable Goyo for certain filetypes
au filetype mail,todoist Goyo

" }}}
" Plugin related {{{

" Todoist.nvim
let todoist = {
\ 'icons': {
\   'unchecked': ' ',
\   'checked':   ' ',
\   'loading':   ' ',
\   'error':     ' ',
\ },
\}

" Markdown syntax
let g:vim_markdown_strikethrough = 1
let g:vim_markdown_folding_disabled = 1
set conceallevel=2

" Bufferize
let g:bufferize_command = 'vnew'

" Bracey
let g:bracey_browser_command = "firefox"

" Grammalecte
let g:grammalecte_cli_py = "/usr/bin/grammalecte-cli"

" Calendar.vim
let g:calendar_google_calendar = 1
let g:calendar_frame = 'default'
source ~/.cache/calendar.vim/credentials.vim

" Emmet.vim
let g:user_emmet_leader_key=','

" Vimtex
"  pdf viewer
   let g:vimtex_view_general_viewer = 'open'
   let g:vimtex_view_general_options = '-a zathura'
   let g:tex_flavor = 'latex'
"  TOC
   nnoremap <C-n> :VimtexTocToggle<cr>
"  Underscore errors
   let g:tex_no_error=1

" Nvim-R
"  Folding
   let r_syntax_folding = 1
   set foldnestmax=1
   set foldmethod=marker
"  Follow colorscheme
   let rout_follow_colorscheme = 0

" Arduino
let g:arduino_cmd = '/usr/bin/arduino'
let g:arduino_dir = '/usr/share/arduino'

" Ultisnips
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']

" }}}

" See immediate results when edditing this file
autocmd BufWritePost ~/.config/nvim/init.vim :source %