Compare commits

...

2 Commits
main ... terry

Author SHA1 Message Date
tforgione 7bbf9b8c9b Update init.vim 2023-10-11 10:01:55 +02:00
Thomas Forgione f1ee5b1aff Restore old init.vim 2022-12-07 12:45:51 +01:00
1 changed files with 162 additions and 203 deletions

365
init.vim
View File

@ -1,203 +1,162 @@
" Pas de compatibilité a VI ! " Pas de compatibilité a VI !
set nocompatible set nocompatible
" PLUGNIS ###########################################################{{{ " PLUGNIS ###########################################################{{{
call plug#begin() call plug#begin()
" Conquer of Completion " General plugins
Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" General plugins Plug 'https://gitea.tforgione.fr/tforgione/peach.git'
Plug 'vim-airline/vim-airline' Plug 'scrooloose/nerdtree'
Plug 'vim-airline/vim-airline-themes' Plug 'tpope/vim-abolish'
Plug 'https://gitea.tforgione.fr/tforgione/peach.git'
Plug 'scrooloose/nerdtree' " Language specific plugins
Plug 'tpope/vim-abolish'
" Language specific plugins " Rust
Plug 'rust-lang/rust.vim'
" Rust
Plug 'rust-lang/rust.vim' " Elm
Plug 'ElmCast/elm-vim'
" Elm
Plug 'ElmCast/elm-vim' " Toml
Plug 'cespare/vim-toml'
" Toml
Plug 'cespare/vim-toml' " Pug
Plug 'digitaltoad/vim-pug'
" Pug
Plug 'digitaltoad/vim-pug' call plug#end()
" Spandex " Line numbers and syntaxic coloration
Plug 'rust-spandex/spandex.vim' " set nu
" syntax on
call plug#end()
" Highlight bad spaces (not working...)
" Line numbers and syntaxic coloration " }}}
" set nu
" syntax on " INDENTATION #######################################################{{{
set expandtab
" Highlight bad spaces (not working...) set tabstop=4
" }}} set shiftwidth=4
set autoindent
" INDENTATION #######################################################{{{ " }}}
set expandtab
set tabstop=4 " UI CONFIG #########################################################{{{
set shiftwidth=4 set number
set autoindent if $NVIM_LINE_NUMBER == 'rnu'
set tw=120 set rnu
" }}} endif
set showcmd
" UI CONFIG #########################################################{{{ set wildmenu
set number set lazyredraw
if $NVIM_LINE_NUMBER == 'rnu' set encoding=utf8
set rnu set clipboard=unnamedplus
endif set updatecount=50
set showcmd set mouse=a
set wildmenu set guicursor=
set lazyredraw " set ttymouse=sgr
set encoding=utf8 " Espaces insécables grrrr
set clipboard=unnamedplus set list
set updatecount=50 set listchars=tab:,trail,extends:>,precedes:<,nbsp
set mouse=a " Remove trailing spaces
set guicursor= autocmd BufWritePre * :%s/\s\+$//e
" set ttymouse=sgr
" Espaces insécables grrrr " Compile on F12
set list if executable('mars')
set listchars=tab:,trail,extends:>,precedes:<,nbsp nnoremap <silent><F12> :wa \| !mars -p %:p<CR>
" Remove trailing spaces inoremap <silent><F12> <C-O>:wa \|!mars -p %:p<CR>
autocmd BufWritePre * :%s/\s\+$//e vnoremap <silent><F12> :wa \|!mars -p %:p<CR>
elseif executable('make')
" Compile on F12 nnoremap <silent><F12> :wa \| !make -p %:p<CR>
if executable('mars') inoremap <silent><F12> <C-O>:wa \|!make -p %:p<CR>
nnoremap <silent><F12> :wa \| !mars -p %:p<CR> vnoremap <silent><F12> :wa \|!make -p %:p<CR>
inoremap <silent><F12> <C-O>:wa \|!mars -p %:p<CR> endif
vnoremap <silent><F12> :wa \|!mars -p %:p<CR>
elseif executable('make') " Escape on F1
nnoremap <silent><F12> :wa \| !make -p %:p<CR> map <F1> <Esc>
inoremap <silent><F12> <C-O>:wa \|!make -p %:p<CR> imap <F1> <Esc>
vnoremap <silent><F12> :wa \|!make -p %:p<CR> " vim airline config
endif set laststatus=2
let g:airline_powerline_fonts = 1
" Escape on F1 let g:airline#extensions#branch#format = 1
map <F1> <Esc> let g:airline_theme='dark'
imap <F1> <Esc> set t_Co=256
" vim airline config " Set textwidth for latex
set laststatus=2 " autocmd FileType tex set textwidth=79
let g:airline_powerline_fonts = 1 " }}}
let g:airline#extensions#branch#format = 1
let g:airline_theme='dark' " COLOR #############################################################{{{
set t_Co=256 set background=dark
" Set textwidth for latex syntax enable
" autocmd FileType tex set textwidth=79 try
" }}} colorscheme peach
catch
" COLOR #############################################################{{{ endtry
set background=dark highlight BadWhitespace ctermbg=red guibg=red
syntax enable match BadWhitespace / \| \+\t/
try " }}}
colorscheme peach
catch " SEARCHING #########################################################{{{
endtry set title
highlight BadWhitespace ctermbg=red guibg=red set showmatch
match BadWhitespace / \| \+\t/ set hlsearch
" }}} set noincsearch
" }}}
" SEARCHING #########################################################{{{
set title " NERDTREE ##########################################################{{{
set showmatch let NERDTreeIgnore = ['\.pyc$','__pycache__']
set hlsearch set shell=zsh
set noincsearch let g:NERDTreeIndicatorMapCustom = {
" }}} \ "Modified" : "✹",
\ "Staged" : "✚",
" NERDTREE ##########################################################{{{ \ "Untracked" : "✭",
let NERDTreeIgnore = ['\.pyc$','__pycache__'] \ "Renamed" : "➜",
set shell=zsh \ "Unmerged" : "═",
let g:NERDTreeIndicatorMapCustom = { \ "Deleted" : "✖",
\ "Modified" : "✹", \ "Dirty" : "✗",
\ "Staged" : "✚", \ "Clean" : "✔︎",
\ "Untracked" : "✭", \ "Unknown" : "?"
\ "Renamed" : "➜", \ }
\ "Unmerged" : "═", let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
\ "Deleted" : "✖", " }}}
\ "Dirty" : "✗",
\ "Clean" : "✔︎", " BACKUPS ###########################################################{{{
\ "Unknown" : "?" set dir=$HOME/.nvim/swp//
\ } autocmd BufWritePost * :silent execute ':w! ' ."$HOME/.nvim/backups/" . substitute(escape(substitute(expand('%:p'), "/", "%", "g"), "%"), ' ', '\\ ', 'g')
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
" }}} if exists('+undofile')
set undofile
" BACKUPS ###########################################################{{{ set undolevels=1000
set dir=$HOME/.nvim/swp// set undoreload=10000
autocmd BufWritePost * :silent execute ':w! ' ."$HOME/.nvim/backups/" . substitute(escape(substitute(expand('%:p'), "/", "%", "g"), "%"), ' ', '\\ ', 'g') if exists('+undodir')
set undodir=$HOME/.nvim/undo
if exists('+undofile') endif
set undofile endif
set undolevels=1000 " }}}
set undoreload=10000
if exists('+undodir')
set undodir=$HOME/.nvim/undo " MARKDOWN PREVIEW ##################################################{{{
endif let g:markdown_composer_browser = 'firefox'
endif let g:instant_markdown_autostart = 0
" }}} " }}}
function! s:check_back_space() abort
" MARKDOWN PREVIEW ##################################################{{{ let col = col('.') - 1
let g:markdown_composer_browser = 'firefox' return !col || getline('.')[col - 1] =~ '\s'
let g:instant_markdown_autostart = 0 endfunction
" }}}
" COC CONFIG ########################################################{{{ " CUSTOM THINGS DEPENDING ON ENV ####################################{{{
let g:rustfmt_autosave = 1
" Use `[g` and `]g` to navigate diagnostics let g:ale_linters = {}
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. let g:ale_c_parse_compile_commands=1
nmap <silent> gp <Plug>(coc-diagnostic-prev) let g:ale_elm_ls_use_global = 1
nmap <silent> gn <Plug>(coc-diagnostic-next) let g:ale_linters_ignore = { 'elm': ['make'] }
let g:ale_lint_on_text_changed = 0
" GoTo code navigation. if $NVIM_DISABLE_PYTHON_LINTER == '1'
nmap <silent> gd <Plug>(coc-definition) let g:ale_linters.python = []
nmap <silent> gy <Plug>(coc-type-definition) endif
nmap <silent> gi <Plug>(coc-implementation) if $NVIM_DISABLE_JAVA_LINTER == '1'
nmap <silent> gr <Plug>(coc-references) let g:ale_linters.java = []
endif
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" 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
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" 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