Update init.vim

This commit is contained in:
tforgione 2023-10-11 10:01:55 +02:00
parent f1ee5b1aff
commit 7bbf9b8c9b
1 changed files with 162 additions and 187 deletions

349
init.vim
View File

@ -1,187 +1,162 @@
" Pas de compatibilité a VI ! " Pas de compatibilité a VI !
set nocompatible set nocompatible
" PLUGNIS ###########################################################{{{ " PLUGNIS ###########################################################{{{
call plug#begin() call plug#begin()
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " General plugins
else Plug 'vim-airline/vim-airline'
Plug 'Shougo/deoplete.nvim' Plug 'vim-airline/vim-airline-themes'
Plug 'roxma/nvim-yarp' Plug 'https://gitea.tforgione.fr/tforgione/peach.git'
Plug 'roxma/vim-hug-neovim-rpc' Plug 'scrooloose/nerdtree'
endif Plug 'tpope/vim-abolish'
" General plugins " Language specific plugins
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'https://gitea.tforgione.fr/tforgione/peach.git' " Rust
Plug 'scrooloose/nerdtree' Plug 'rust-lang/rust.vim'
Plug 'w0rp/ale'
Plug 'tpope/vim-abolish' " Elm
Plug 'ElmCast/elm-vim'
" Language specific plugins
" Toml
" C++ Plug 'cespare/vim-toml'
Plug 'Shougo/deoplete-clangx'
" Pug
" Rust Plug 'digitaltoad/vim-pug'
Plug 'rust-lang/rust.vim'
Plug 'racer-rust/vim-racer' call plug#end()
Plug 'sebastianmarkow/deoplete-rust'
" Line numbers and syntaxic coloration
" Elm " set nu
Plug 'ElmCast/elm-vim' " syntax on
Plug 'antew/vim-elm-language-server'
" Highlight bad spaces (not working...)
" Toml " }}}
Plug 'cespare/vim-toml'
" INDENTATION #######################################################{{{
" Pug set expandtab
Plug 'digitaltoad/vim-pug' set tabstop=4
set shiftwidth=4
" Spandex set autoindent
Plug 'rust-spandex/spandex.vim' " }}}
call plug#end() " UI CONFIG #########################################################{{{
set number
" Line numbers and syntaxic coloration if $NVIM_LINE_NUMBER == 'rnu'
" set nu set rnu
" syntax on endif
set showcmd
" Highlight bad spaces (not working...) set wildmenu
" }}} set lazyredraw
set encoding=utf8
" INDENTATION #######################################################{{{ set clipboard=unnamedplus
set expandtab set updatecount=50
set tabstop=4 set mouse=a
set shiftwidth=4 set guicursor=
set autoindent " set ttymouse=sgr
" }}} " Espaces insécables grrrr
set list
" UI CONFIG #########################################################{{{ set listchars=tab:,trail,extends:>,precedes:<,nbsp
set number " Remove trailing spaces
if $NVIM_LINE_NUMBER == 'rnu' autocmd BufWritePre * :%s/\s\+$//e
set rnu
endif " Compile on F12
set showcmd if executable('mars')
set wildmenu nnoremap <silent><F12> :wa \| !mars -p %:p<CR>
set lazyredraw inoremap <silent><F12> <C-O>:wa \|!mars -p %:p<CR>
set encoding=utf8 vnoremap <silent><F12> :wa \|!mars -p %:p<CR>
set clipboard=unnamedplus elseif executable('make')
set updatecount=50 nnoremap <silent><F12> :wa \| !make -p %:p<CR>
set mouse=a inoremap <silent><F12> <C-O>:wa \|!make -p %:p<CR>
set guicursor= vnoremap <silent><F12> :wa \|!make -p %:p<CR>
" set ttymouse=sgr endif
" Espaces insécables grrrr
set list " Escape on F1
set listchars=tab:,trail,extends:>,precedes:<,nbsp map <F1> <Esc>
" Remove trailing spaces imap <F1> <Esc>
autocmd BufWritePre * :%s/\s\+$//e " vim airline config
set laststatus=2
" Compile on F12 let g:airline_powerline_fonts = 1
if executable('mars') let g:airline#extensions#branch#format = 1
nnoremap <silent><F12> :wa \| !mars -p %:p<CR> let g:airline_theme='dark'
inoremap <silent><F12> <C-O>:wa \|!mars -p %:p<CR> set t_Co=256
vnoremap <silent><F12> :wa \|!mars -p %:p<CR> " Set textwidth for latex
elseif executable('make') " autocmd FileType tex set textwidth=79
nnoremap <silent><F12> :wa \| !make -p %:p<CR> " }}}
inoremap <silent><F12> <C-O>:wa \|!make -p %:p<CR>
vnoremap <silent><F12> :wa \|!make -p %:p<CR> " COLOR #############################################################{{{
endif set background=dark
syntax enable
" Escape on F1 try
map <F1> <Esc> colorscheme peach
imap <F1> <Esc> catch
" vim airline config endtry
set laststatus=2 highlight BadWhitespace ctermbg=red guibg=red
let g:airline_powerline_fonts = 1 match BadWhitespace / \| \+\t/
let g:airline#extensions#branch#format = 1 " }}}
let g:airline_theme='dark'
set t_Co=256 " SEARCHING #########################################################{{{
" Set textwidth for latex set title
" autocmd FileType tex set textwidth=79 set showmatch
" }}} set hlsearch
set noincsearch
" COLOR #############################################################{{{ " }}}
set background=dark
syntax enable " NERDTREE ##########################################################{{{
try let NERDTreeIgnore = ['\.pyc$','__pycache__']
colorscheme peach set shell=zsh
catch let g:NERDTreeIndicatorMapCustom = {
endtry \ "Modified" : "✹",
highlight BadWhitespace ctermbg=red guibg=red \ "Staged" : "✚",
match BadWhitespace / \| \+\t/ \ "Untracked" : "✭",
" }}} \ "Renamed" : "➜",
\ "Unmerged" : "═",
" SEARCHING #########################################################{{{ \ "Deleted" : "✖",
set title \ "Dirty" : "✗",
set showmatch \ "Clean" : "✔︎",
set hlsearch \ "Unknown" : "?"
set noincsearch \ }
" }}} let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
" }}}
" NERDTREE ##########################################################{{{
let NERDTreeIgnore = ['\.pyc$','__pycache__'] " BACKUPS ###########################################################{{{
set shell=zsh set dir=$HOME/.nvim/swp//
let g:NERDTreeIndicatorMapCustom = { autocmd BufWritePost * :silent execute ':w! ' ."$HOME/.nvim/backups/" . substitute(escape(substitute(expand('%:p'), "/", "%", "g"), "%"), ' ', '\\ ', 'g')
\ "Modified" : "✹",
\ "Staged" : "✚", if exists('+undofile')
\ "Untracked" : "✭", set undofile
\ "Renamed" : "➜", set undolevels=1000
\ "Unmerged" : "═", set undoreload=10000
\ "Deleted" : "✖", if exists('+undodir')
\ "Dirty" : "✗", set undodir=$HOME/.nvim/undo
\ "Clean" : "✔︎", endif
\ "Unknown" : "?" endif
\ } " }}}
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
" }}}
" MARKDOWN PREVIEW ##################################################{{{
" BACKUPS ###########################################################{{{ let g:markdown_composer_browser = 'firefox'
set dir=$HOME/.nvim/swp// let g:instant_markdown_autostart = 0
autocmd BufWritePost * :silent execute ':w! ' ."$HOME/.nvim/backups/" . substitute(escape(substitute(expand('%:p'), "/", "%", "g"), "%"), ' ', '\\ ', 'g') " }}}
if exists('+undofile') function! s:check_back_space() abort
set undofile let col = col('.') - 1
set undolevels=1000 return !col || getline('.')[col - 1] =~ '\s'
set undoreload=10000 endfunction
if exists('+undodir')
set undodir=$HOME/.nvim/undo
endif " CUSTOM THINGS DEPENDING ON ENV ####################################{{{
endif let g:rustfmt_autosave = 1
" }}} let g:ale_linters = {}
let g:ale_c_parse_compile_commands=1
let g:ale_elm_ls_use_global = 1
" MARKDOWN PREVIEW ##################################################{{{ let g:ale_linters_ignore = { 'elm': ['make'] }
let g:markdown_composer_browser = 'firefox' let g:ale_lint_on_text_changed = 0
let g:instant_markdown_autostart = 0 if $NVIM_DISABLE_PYTHON_LINTER == '1'
" }}} let g:ale_linters.python = []
endif
" CODE COMPLETION ###################################################{{{ if $NVIM_DISABLE_JAVA_LINTER == '1'
let g:ale_linters.java = []
" Use deoplete endif
let g:deoplete#enable_at_startup = 1
autocmd FileType elm call deoplete#custom#buffer_option('auto_complete', v:false)
" Autoclose preview
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Complete on tab
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" }}}
" CUSTOM THINGS DEPENDING ON ENV ####################################{{{
let g:rustfmt_autosave = 1
let g:ale_linters = {}
let g:ale_c_parse_compile_commands=1
let g:ale_elm_ls_use_global = 1
let g:ale_linters_ignore = { 'elm': ['make'] }
let g:ale_lint_on_text_changed = 0
if $NVIM_DISABLE_PYTHON_LINTER == '1'
let g:ale_linters.python = []
endif
if $NVIM_DISABLE_JAVA_LINTER == '1'
let g:ale_linters.java = []
endif