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