2020-05-20 07:28:20 +02:00
|
|
|
" plugins (vim-plug)
|
|
|
|
call plug#begin('~/.config/nvim/plugged')
|
2020-10-27 20:47:29 +01:00
|
|
|
Plug 'sheerun/vim-polyglot' " Many languages syntax support. Should be on top to be overwritten by pandoc
|
|
|
|
Plug 'tpope/vim-sensible' " Default sensible settings
|
|
|
|
Plug 'vim-pandoc/vim-pandoc' " Pandoc support
|
|
|
|
Plug 'vim-pandoc/vim-pandoc-syntax' " Markdown syntax support
|
|
|
|
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' } " Markdown preview
|
|
|
|
Plug 'dhruvasagar/vim-table-mode', { 'on': 'TableModeEnable' } " Helper for table in markdown
|
|
|
|
Plug 'junegunn/goyo.vim', { 'on': 'Goyo' } " Distraction free mode for writing
|
2021-02-21 17:32:32 +01:00
|
|
|
Plug 'lervag/vimtex' " Filetype and syntax plugin for LaTeX files
|
2020-10-27 20:47:29 +01:00
|
|
|
Plug 'dpelle/vim-Grammalecte' " French ortho/grammar spelling
|
|
|
|
Plug 'arcticicestudio/nord-vim' " Nord color scheme
|
|
|
|
Plug 'vim-airline/vim-airline' " Fancy bottom line in vim/neovim
|
|
|
|
Plug 'vim-airline/vim-airline-themes' " Themes for vim-airlines
|
|
|
|
Plug 'jiangmiao/auto-pairs' " Pairs autocomplete
|
|
|
|
Plug 'tpope/vim-surround' " To manipulate surroundings
|
|
|
|
Plug 'tpope/vim-unimpaired' " Toggle shortcut
|
|
|
|
Plug 'tpope/vim-commentary' " Easy commenting
|
2021-02-11 10:37:27 +01:00
|
|
|
Plug 'tpope/vim-repeat' " Add repeat support for plugin mapping
|
2020-10-27 20:47:29 +01:00
|
|
|
Plug 'osyo-manga/vim-over', { 'on': 'OverCommandLine' } " Search Multiple Highlighting
|
|
|
|
Plug 'scrooloose/nerdtree' " Side window files navigation
|
|
|
|
Plug 'tpope/vim-fugitive' " Git commands, useful for other plugins such as nerdtree or fzf
|
|
|
|
Plug 'Xuyuanp/nerdtree-git-plugin' " To see new or modified files in the nerdtree window
|
|
|
|
Plug 'https://github.com/editorconfig/editorconfig-vim' " Support of '.editorconfig' files
|
2021-04-15 15:20:09 +02:00
|
|
|
Plug 'shmargum/vim-sass-colors' " Highlight sass/scss/less/css colors and color variables
|
2020-10-27 20:47:29 +01:00
|
|
|
Plug 'vim-syntastic/syntastic' " Syntax checking (linting)
|
2020-05-20 07:28:20 +02:00
|
|
|
" Auto completion
|
2021-02-12 20:34:11 +01:00
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
Plug 'pappasam/coc-jedi', { 'do': 'yarn install --frozen-lockfile && yarn build' } "Python, using jedi
|
2020-05-20 07:28:20 +02:00
|
|
|
Plug 'stsewd/isort.nvim', { 'do': ':UpdateRemotePlugins' }
|
2021-02-12 20:34:11 +01:00
|
|
|
Plug 'vitalk/vim-simple-todo' " Allow to manage todo list easily
|
2020-10-14 16:18:43 +02:00
|
|
|
" Search
|
2020-10-27 20:47:29 +01:00
|
|
|
Plug 'kien/ctrlp.vim' " Search 'Ctrl+P' like
|
|
|
|
Plug 'jremmen/vim-ripgrep' " Use ripgrep as vimgrep
|
|
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Fuzzy search, ensure fzf is fresh installed
|
|
|
|
Plug 'junegunn/fzf.vim' " fzf for vim/neovim
|
2021-06-03 17:33:58 +02:00
|
|
|
Plug 'stsewd/fzf-checkout.vim' " Fuzzy search in git branches
|
2020-05-20 07:28:20 +02:00
|
|
|
call plug#end()
|
|
|
|
|
2017-07-13 10:06:09 +02:00
|
|
|
" Format indentation
|
|
|
|
if has("autocmd")
|
|
|
|
filetype plugin indent on
|
|
|
|
endif
|
|
|
|
|
2017-11-19 11:41:49 +01:00
|
|
|
" add some tags for html indentations
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:html_indent_inctags="html,body,head,tbody"
|
2017-07-13 10:44:10 +02:00
|
|
|
|
2017-12-10 10:48:12 +01:00
|
|
|
set smartindent
|
|
|
|
set tabstop=4
|
|
|
|
set expandtab
|
|
|
|
set softtabstop=4
|
|
|
|
set shiftwidth=4
|
2020-10-27 20:47:29 +01:00
|
|
|
set showcmd " Show (partial) command in status line.
|
|
|
|
set showmode " Show indication of having changed modes
|
|
|
|
set showmatch " Show matching brackets.
|
|
|
|
set ignorecase " Do case insensitive matching
|
|
|
|
set smartcase " Do smart case matching
|
|
|
|
let g:rg_highlight='true' " Activate ripgrep Highlighting
|
|
|
|
nnoremap <silent> <C-l> :nohlsearch<CR><C-l> " set C-l to :nohlsearch
|
|
|
|
set autowrite " Automatically save before commands like :next and :make
|
|
|
|
set hidden " Hide buffers when they are abandoned
|
|
|
|
set mouse=a " Enable mouse usage (all modes)
|
|
|
|
set linebreak " Line wrap
|
|
|
|
set tw=79 " Lines longer than 79 chars will be wrapped
|
|
|
|
autocmd FileType gitcommit set textwidth=72 " Wrap lines longer than 72 chars for git messages
|
|
|
|
set colorcolumn=+1 " Colors the tw+1 column
|
|
|
|
autocmd FileType gitcommit set colorcolumn+=51 " Add a colored column at 51 chars for git message titles
|
|
|
|
set number " Line numbering
|
|
|
|
set cursorline " Color the cursor line
|
|
|
|
set modeline " Support modelines
|
2021-04-15 15:20:09 +02:00
|
|
|
set termguicolors " Enable termguicolors
|
2021-02-11 10:37:27 +01:00
|
|
|
set shada+=r/home/igor/network " Do not keep history when opening files on autofs mounted directories
|
2021-01-17 18:01:51 +01:00
|
|
|
" Terminal
|
|
|
|
au TermOpen * setlocal listchars= nonumber norelativenumber " Start terminal buffer without line numbering
|
2017-07-13 10:06:09 +02:00
|
|
|
|
2020-10-27 20:22:42 +01:00
|
|
|
" Spelling activated, by default for French and English
|
2019-09-30 07:47:25 +02:00
|
|
|
set spell
|
2020-04-29 06:33:36 +02:00
|
|
|
set spelllang=fr,en
|
2020-10-27 20:22:42 +01:00
|
|
|
" Specific spelling configuration for git commit messages
|
2020-04-29 06:33:36 +02:00
|
|
|
autocmd FileType gitcommit setlocal spell
|
|
|
|
autocmd FileType gitcommit setlocal spelllang=en
|
2020-10-27 20:22:42 +01:00
|
|
|
" Path for grammalecte-cli to get grammar check in French
|
|
|
|
let g:grammalecte_cli_py='/usr/bin/grammalecte-cli'
|
2019-09-30 07:47:25 +02:00
|
|
|
|
2021-02-24 15:27:43 +01:00
|
|
|
" #########################################
|
|
|
|
" #########################################
|
2020-10-27 20:47:29 +01:00
|
|
|
" Fold
|
2020-04-29 06:33:36 +02:00
|
|
|
set foldmethod=syntax
|
|
|
|
set foldlevel=1
|
2021-02-24 15:27:43 +01:00
|
|
|
|
|
|
|
" #########################################
|
|
|
|
" #########################################
|
|
|
|
" Default filetype configuration
|
|
|
|
|
|
|
|
" Markdown
|
|
|
|
autocmd FileType pandoc set tabstop=2
|
|
|
|
autocmd FileType pandoc set softtabstop=2
|
|
|
|
autocmd FileType pandoc set shiftwidth=2
|
|
|
|
|
|
|
|
" JSON
|
|
|
|
" Consider `.jsonld` as JSON
|
|
|
|
autocmd BufNewFile,BufRead *.jsonld set filetype=json
|
2017-12-11 06:27:23 +01:00
|
|
|
autocmd FileType json setlocal foldmethod=syntax
|
|
|
|
autocmd FileType json set foldlevel=2
|
2018-10-19 09:08:27 +02:00
|
|
|
autocmd FileType json set tabstop=2
|
|
|
|
autocmd FileType json set softtabstop=2
|
2021-02-24 15:27:43 +01:00
|
|
|
au FileType json set shiftwidth=2
|
|
|
|
|
|
|
|
" HTML
|
2018-10-19 09:08:27 +02:00
|
|
|
autocmd FileType html set tabstop=2
|
|
|
|
autocmd FileType html set softtabstop=2
|
|
|
|
autocmd FileType html set shiftwidth=2
|
2021-02-24 15:27:43 +01:00
|
|
|
|
|
|
|
" XML
|
2017-07-19 11:57:50 +02:00
|
|
|
let g:xml_syntax_folding=3
|
|
|
|
au FileType xml setlocal foldmethod=syntax
|
2017-07-20 11:39:04 +02:00
|
|
|
autocmd FileType xml set foldlevel=1
|
2017-07-19 11:57:50 +02:00
|
|
|
|
2021-05-21 08:14:50 +02:00
|
|
|
" Use the system clipboard
|
2017-07-13 10:06:09 +02:00
|
|
|
set clipboard+=unnamedplus
|
|
|
|
|
2020-10-27 20:47:29 +01:00
|
|
|
" Airline
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:airline_powerline_fonts=1
|
2020-10-27 20:47:29 +01:00
|
|
|
let g:airline#extensions#wordcount#filetypes='pandoc\|text\|' "Add support when pandoc is activated
|
2020-05-13 21:20:53 +02:00
|
|
|
let g:airline_theme='nord'
|
2017-07-13 10:06:09 +02:00
|
|
|
|
2020-10-27 20:47:29 +01:00
|
|
|
" Vim-table-mode. Set the table separator
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:table_mode_corner='|'
|
2017-07-13 10:44:10 +02:00
|
|
|
|
2020-10-27 20:47:29 +01:00
|
|
|
" NERDTree. By default, NERDTree is open when no file is provided when launching vim/neovim
|
2019-08-08 07:22:53 +02:00
|
|
|
autocmd StdinReadPre * let s:std_in=1
|
|
|
|
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
2019-08-22 07:37:46 +02:00
|
|
|
let g:NERDTreeWinSize=40
|
2019-08-08 07:22:53 +02:00
|
|
|
|
2017-07-20 11:39:04 +02:00
|
|
|
" vim-json, don't conceal
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:vim_json_syntax_conceal=0
|
2017-12-10 10:48:12 +01:00
|
|
|
|
2017-12-11 06:27:23 +01:00
|
|
|
" ctrlP
|
2020-10-27 20:47:29 +01:00
|
|
|
" Match window position, number of results
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:ctrlp_match_window='top,order:ttb,min:1,max:10,results:10'
|
2019-04-15 06:53:23 +02:00
|
|
|
"set the working directory
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:ctrlp_working_path_mode='ra'
|
2017-12-11 06:27:23 +01:00
|
|
|
" enable caching
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:ctrlp_use_caching=1
|
|
|
|
let g:ctrlp_clear_cache_on_exit=0
|
2017-12-11 06:27:23 +01:00
|
|
|
|
2020-04-29 06:33:36 +02:00
|
|
|
" Pandoc
|
2020-10-14 16:18:43 +02:00
|
|
|
" Autoformatting with hardwrap
|
|
|
|
let g:pandoc#formatting#mode="hA"
|
|
|
|
" ctrl+s switch to softwrap
|
2020-04-29 06:33:36 +02:00
|
|
|
nnoremap <C-s> :call pandoc#formatting#UseSoftWraps()
|
2020-10-14 16:18:43 +02:00
|
|
|
" ctrl+h switch to hardwrap
|
2020-04-29 06:33:36 +02:00
|
|
|
nnoremap <C-h> :call pandoc#formatting#UseHardWraps()
|
2020-10-14 16:18:43 +02:00
|
|
|
" ctrl+t toggle autoformat (mainly to deactivate it when necessary)
|
2020-04-29 06:33:36 +02:00
|
|
|
nnoremap <C-t> :call pandoc#formatting#ToggleAutoformat()
|
2020-12-13 13:50:31 +01:00
|
|
|
let g:mkdp_filetypes = ['markdown', 'pandoc', 'pandoc.markdown']
|
2019-08-26 07:34:45 +02:00
|
|
|
|
2021-02-21 17:32:32 +01:00
|
|
|
" #########################################
|
|
|
|
" #########################################
|
2020-10-27 20:47:29 +01:00
|
|
|
" Linters (syntastic configuration)
|
2021-02-21 17:32:32 +01:00
|
|
|
"
|
2020-10-27 20:47:29 +01:00
|
|
|
" SCSS linter
|
|
|
|
let g:syntastic_scss_checkers = ['scss_lint']
|
2021-02-21 17:32:32 +01:00
|
|
|
|
2020-10-27 20:47:29 +01:00
|
|
|
" Python linters. I define this list mainly to avoid pylint which I can't
|
|
|
|
" manage to use correctly and is required on my main OS.
|
|
|
|
let g:syntastic_python_checkers=['flake8', 'pep8', 'pycodestyle', 'pyflakes']
|
2021-02-21 17:32:32 +01:00
|
|
|
|
2020-10-27 20:47:29 +01:00
|
|
|
" Copy pasting of the basic configuration recommended by syntastic
|
|
|
|
" https://github.com/vim-syntastic/syntastic#settings
|
|
|
|
" but without the statusline settings to improve comptability with airline.
|
|
|
|
let g:syntastic_always_populate_loc_list = 1
|
|
|
|
let g:syntastic_auto_loc_list = 1
|
|
|
|
let g:syntastic_check_on_open = 1
|
2020-10-27 20:47:29 +01:00
|
|
|
|
2021-02-12 20:34:11 +01:00
|
|
|
" #########################################
|
|
|
|
" #########################################
|
|
|
|
" autocompletion, mainly coc configuration
|
|
|
|
" as inspired from the project README
|
|
|
|
|
|
|
|
" Give more space for displaying messages
|
|
|
|
set cmdheight=2
|
|
|
|
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
|
|
|
" delays and poor user experience
|
|
|
|
set updatetime=300
|
|
|
|
|
|
|
|
" Always show the signcolumn, otherwise it would shift the text each time
|
|
|
|
" diagnostics appear/become resolved.
|
|
|
|
if has("patch-8.1.1564")
|
|
|
|
" Recently vim can merge signcolumn and number column into one
|
|
|
|
set signcolumn=number
|
|
|
|
else
|
|
|
|
set signcolumn=yes
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Use tab for trigger completion with characters ahead and navigate
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
|
|
\ coc#refresh()
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
|
|
|
|
|
|
|
function! s:check_back_space() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
endfunction
|
|
|
|
" Use <c-space> to trigger completion.
|
|
|
|
if has('nvim')
|
|
|
|
inoremap <silent><expr> <c-space> coc#refresh()
|
|
|
|
else
|
|
|
|
inoremap <silent><expr> <c-@> coc#refresh()
|
|
|
|
endif
|
2019-08-27 18:56:52 +02:00
|
|
|
|
2021-02-12 20:34:11 +01:00
|
|
|
" Make <CR> auto-select the first completion item and notify coc.nvim to
|
|
|
|
" format on enter, <cr> could be remapped by other vim plugin
|
|
|
|
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
|
|
|
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
|
|
|
|
|
|
|
" Use `[g` and `]g` to navigate diagnostics
|
|
|
|
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
|
|
|
|
|
|
" GoTo code navigation.
|
|
|
|
nmap <silent> gd <Plug>(coc-definition)
|
|
|
|
nmap <silent> gy <Plug>(coc-type-definition)
|
|
|
|
nmap <silent> gi <Plug>(coc-implementation)
|
|
|
|
nmap <silent> gr <Plug>(coc-references)
|
|
|
|
|
|
|
|
" Use K to show documentation in preview window.
|
|
|
|
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
|
|
|
|
|
|
|
function! s:show_documentation()
|
|
|
|
if (index(['vim','help'], &filetype) >= 0)
|
|
|
|
execute 'h '.expand('<cword>')
|
|
|
|
elseif (coc#rpc#ready())
|
|
|
|
call CocActionAsync('doHover')
|
|
|
|
else
|
|
|
|
execute '!' . &keywordprg . " " . expand('<cword>')
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Install missing coc extensions
|
2021-04-15 15:20:09 +02:00
|
|
|
let g:coc_global_extensions = ['coc-html', 'coc-json', 'coc-css', 'coc-markdownlint', 'coc-git', 'coc-vimtex', 'coc-yaml']
|
2021-02-12 20:34:11 +01:00
|
|
|
autocmd FileType scss setl iskeyword+=@-@ " Add @ to iskeyword option
|
|
|
|
let g:coc_filetype_map = { 'pandoc': 'markdown' } " Allow markdownlint to recognized pandoc filetype
|
|
|
|
|
|
|
|
" #########################################
|
|
|
|
" #########################################
|
2020-05-20 20:45:57 +02:00
|
|
|
" Python provider in a pyenv
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:python3_host_prog='/home/igor/.pyenv/versions/neovim3/bin/python'
|
2020-05-20 20:45:57 +02:00
|
|
|
|
2019-09-05 17:41:10 +02:00
|
|
|
" Imports sorting
|
2020-10-14 16:18:43 +02:00
|
|
|
let g:isort_command='isort'
|
2019-09-05 17:41:10 +02:00
|
|
|
|
2021-06-27 07:50:33 +02:00
|
|
|
" #########################################
|
|
|
|
" #########################################
|
|
|
|
let g:vimtex_compiler_latexmk = {
|
|
|
|
\ 'executable' : 'latexmk',
|
|
|
|
\ 'options' : [
|
|
|
|
\ '-xelatex',
|
|
|
|
\ '-file-line-error',
|
|
|
|
\ '-synctex=1',
|
|
|
|
\ '-interaction=nonstopmode',
|
|
|
|
\ ],
|
|
|
|
\}
|
|
|
|
|
2020-05-13 21:20:53 +02:00
|
|
|
" Syntax coloration and color theme
|
|
|
|
syntax enable
|
|
|
|
colorscheme nord
|