summaryrefslogtreecommitdiff
path: root/.config/nvim/init.vim
blob: 421a5b48980d7981ca8bad6e03a8b774550c2213 (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
set nocompatible
" Scripts-----------------------------
" Required:
set runtimepath+=/home/lys/.local/share/dein/repos/github.com/Shougo/dein.vim

" Required:
if dein#load_state('/home/lys/.local/share/dein')
  call dein#begin('/home/lys/.local/share/dein')

  " Let dein manage dein
  " Required:
  call dein#add('/home/lys/.local/share/dein/repos/github.com/Shougo/dein.vim')

  " Add or remove your plugins here:
  " After removing a plugin you should call:
  "     call map(dein#check_clean(), "delete(v:val, 'rf')")
  "     call dein#recache_runtimepath()

  call dein#add('Shougo/denite.nvim')

  call dein#add('SirVer/ultisnips')

  call dein#add('vim-airline/vim-airline')
  call dein#add('vim-airline/vim-airline-themes')

  call dein#add('tpope/vim-fugitive')
  call dein#add('tpope/vim-commentary')
  call dein#add('tpope/vim-obsession')
  call dein#add('tpope/vim-abolish')
  call dein#add('tpope/vim-unimpaired')
  call dein#add('tpope/vim-dispatch')
  call dein#add('tpope/vim-markdown')

  call dein#add('machakann/vim-sandwich')

  call dein#add('AndrewRadev/splitjoin.vim')
  call dein#add('wellle/targets.vim')
  call dein#add('luochen1990/rainbow')
  call dein#add('justinmk/vim-sneak')
  call dein#add('prabirshrestha/async.vim')
  call dein#add('prabirshrestha/vim-lsp')
  call dein#add('jpalardy/vim-slime')

  call dein#add('dpelle/vim-LanguageTool')
  call dein#add('lervag/vimtex')
  call dein#add('junegunn/goyo.vim')
  call dein#add('wsdjeg/FlyGrep.vim')
  call dein#add('junegunn/vim-easy-align')

  " Additional Colorschemes
  call dein#add('NLKNguyen/papercolor-theme')
  call dein#add('noahfrederick/vim-hemisu')
  call dein#add('srcery-colors/srcery-vim')

  " Required:
  call dein#end()
  call dein#save_state()
endif

" Required:
filetype plugin indent on
syntax enable

" If you want to install not installed plugins on startup.
"if dein#check_install()
"  call dein#install()
"endif

"End dein Scripts-------------------------

" General settings
"""""""""""""""""""
set number relativenumber
augroup numbertoggle
  autocmd!
  autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
  autocmd BufLeave,FocusLost,InsertEnter   * set norelativenumber
augroup END

set expandtab
set tabstop=2
set tw=80
set shiftwidth=2
set t_Co=256
colorscheme PaperColor
set laststatus=2
set wildoptions=
set foldlevel=99

set list
set showbreak=↪\ 
set listchars=tab:→\ ,nbsp:␣,trail:•,extends:⟩,precedes:⟨
set fillchars=fold:\ 

" my leader my space
noremap <Space> <nop>
vnoremap <Space> <nop>
map <Space> <Leader>

" Spelling Settings
"""""""""""""""""""
map <silent> <F5> "<Esc>:silent setlocal spell! spelllang=en<CR>"
map <silent> <F6> "<Esc>:silent setlocal spell! spelllang=fr<CR>"

hi clear SpellBad
hi SpellBad cterm=underline

let g:languagetool_jar = "/home/lys/.local/repos/languagetool/languagetool-standalone/target/LanguageTool-4.6-SNAPSHOT/LanguageTool-4.6-SNAPSHOT/languagetool-commandline.jar"

" Airline
"""""""""
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline_extensions = ['coc', 'tabline']

" vimtex
""""""""
let g:tex_flavor  = "latex"
" let g:tex_fold_enabled = 1
" let g:vimtex_text_obj_variant="vimtex"

" goyo
""""""
let g:goyo_width  = "80"
let g:goyo_height = "95%"

" Denite
"""""""""

" Define mappings
autocmd FileType denite call s:denite_my_settings()
function! s:denite_my_settings() abort
  nnoremap <silent><buffer><expr> <CR>
        \ denite#do_map('do_action')
  nnoremap <silent><buffer><expr> d
        \ denite#do_map('do_action', 'delete')
  nnoremap <silent><buffer><expr> p
        \ denite#do_map('do_action', 'preview')
  nnoremap <silent><buffer><expr> q
        \ denite#do_map('quit')
  nnoremap <silent><buffer><expr> i
        \ denite#do_map('open_filter_buffer')
  nnoremap <silent><buffer><expr> <Space>
        \ denite#do_map('toggle_select').'j'
endfunction


" Easy Align
"""""""""""""
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)

" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)

" Vimsneak remapping
"""""""""""""""""
" 2-character Sneak (default)
nmap <tab> <Plug>Sneak_s
nmap <s-tab> <Plug>Sneak_S
" visual-mode
xmap <tab> <Plug>Sneak_s
xmap <s-tab>  <Plug>Sneak_S
" operator-pending-mode
omap <tab> <Plug>Sneak_s
omap <s-tab>  <Plug>Sneak_S
" repeat motion (enforced)
nmap ;; <Plug>Sneak_;
omap ;; <Plug>Sneak_;
xmap ;; <Plug>Sneak_;
nnoremap ;i <c-i>
nnoremap ;o <c-o>


" lsp configuration
"""""""""""""""""""
if executable('clangd')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'clangd',
        \ 'cmd': {server_info->['clangd', '-background-index']},
        \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
        \ })
endif

" \ 'workspace_config': {'rust': {'clippy_preference': 'off'}},
if executable('rls')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'rls',
        \ 'cmd': {server_info->['rustup', 'run', 'stable', 'rls']},
        \ 'whitelist': ['rust'],
        \ })
endif

let g:lsp_diagnostics_enabled = 0 " disable diagnostics support
let g:lsp_signs_enabled = 1       " enable signs

" highlight code within markdown
""""""""""""""""""""""""""""""""
let g:markdown_fenced_languages = [
      \ 'lisp',
      \ 'ocaml',
      \ 'c',
      \ 'erb=eruby',
      \ 'cpp',
      \ 'js=javascript',
      \ 'json=javascript',
      \ 'ruby',
      \ 'haskell',
      \ 'html',
      \ 'css'
      \ ]

" transparency toggle switch
""""""""""""""""""""""""""""
function! GetHighlightTerm(group, term)
   let output = execute('hi ' . a:group)
   return matchstr(output, a:term.'=\zs\S*')
endfunction

let g:_ctermbg = GetHighlightTerm("Normal", "ctermbg")
function! ToogleTransparency()
  let ctermbg = GetHighlightTerm("Normal", "ctermbg")
  if ctermbg ==# ""
    execute('hi Normal ctermbg=' . g:_ctermbg)
  else
    hi Normal ctermbg=NONE
  endif
endfunction
nnoremap yot :call ToogleTransparency()<CR>

" Rainbow mode & toggle switch
""""""""""""""""""""""""""""""
let g:rainbow_active = 1
let g:rainbow_conf = {
\   'separately': {
\     'rust': {
\       'parentheses': [
\         'start=/(/ end=/)/ fold',
\         'start=/\[/ end=/\]/ fold',
\         'start=/{/ end=/}/ fold',
\         'start=/</ end=/>/ fold'
\       ],
\     }
\   }
\ }
nnoremap yok :RainbowToggle<CR>

" slime
"""""""
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": ":.1"}
let g:slime_dont_ask_default = 1