161 lines
3.9 KiB
VimL
161 lines
3.9 KiB
VimL
" --- Compatibilité & encodage ---
|
|
set nocompatible
|
|
filetype off
|
|
syntax on
|
|
set encoding=utf-8
|
|
set fileencoding=utf-8
|
|
set termguicolors
|
|
set background=dark
|
|
set hidden
|
|
set clipboard=unnamedplus
|
|
|
|
" --- Interface ---
|
|
set number
|
|
set ruler
|
|
"set cursorline
|
|
set showmatch
|
|
set showcmd
|
|
set splitbelow splitright
|
|
set scrolloff=4
|
|
"set signcolumn=yes
|
|
|
|
" --- Indentation intelligente ---
|
|
set tabstop=4
|
|
set shiftwidth=4
|
|
set expandtab
|
|
set smartindent
|
|
set autoindent
|
|
|
|
" --- Recherche & navigation ---
|
|
set ignorecase
|
|
set smartcase
|
|
set incsearch
|
|
set hlsearch
|
|
set wildmenu
|
|
set wildmode=list:longest
|
|
set mouse=a
|
|
|
|
" --- Sauvegarde & confort ---
|
|
set undofile
|
|
set nobackup
|
|
set noswapfile
|
|
set confirm
|
|
|
|
" ==========================================================
|
|
" PLUGINS
|
|
" ==========================================================
|
|
call plug#begin('~/.vim/plugged')
|
|
|
|
" Navigateur de fichiers
|
|
Plug 'preservim/nerdtree'
|
|
|
|
" Barre d’état élégante (restera sobre)
|
|
Plug 'itchyny/lightline.vim'
|
|
|
|
" Git intégré
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
" Commentaires faciles
|
|
Plug 'tpope/vim-commentary'
|
|
|
|
" Autocomplétion et LSP
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
" Fuzzy finder (recherche rapide de fichiers)
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
|
Plug 'junegunn/fzf.vim'
|
|
|
|
" Multicurseurs
|
|
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
|
|
|
|
" Entourer facilement du texte (quotes, parenthèses…)
|
|
Plug 'tpope/vim-surround'
|
|
|
|
" Statistiques et perf
|
|
Plug 'tpope/vim-sensible'
|
|
|
|
call plug#end()
|
|
|
|
" ==========================================================
|
|
" RACCOURCIS UTILES
|
|
" ==========================================================
|
|
|
|
" --- NERDTree ---
|
|
nnoremap <C-n> :NERDTreeToggle<CR>
|
|
|
|
" --- Navigation entre fenêtres ---
|
|
nnoremap <C-h> <C-w>h
|
|
nnoremap <C-j> <C-w>j
|
|
nnoremap <C-k> <C-w>k
|
|
nnoremap <C-l> <C-w>l
|
|
|
|
" --- Sauvegarde rapide ---
|
|
nnoremap <C-s> :w<CR>
|
|
|
|
" --- FZF (recherche rapide de fichiers) ---
|
|
nnoremap <C-p> :Files<CR>
|
|
|
|
" --- Supprimer le surlignage après une recherche ---
|
|
nnoremap <silent> <Esc> :noh<CR><Esc>
|
|
|
|
" ==========================================================
|
|
" LIGHTLINE (barre d’état)
|
|
" ==========================================================
|
|
set laststatus=2
|
|
let g:lightline = {
|
|
\ 'colorscheme': 'default',
|
|
\ 'active': {
|
|
\ 'left': [ ['mode', 'paste'], ['readonly', 'filename', 'modified'] ]
|
|
\ },
|
|
\ 'component_function': {
|
|
\ 'readonly': 'LightlineReadonly',
|
|
\ }
|
|
\ }
|
|
function! LightlineReadonly()
|
|
return &readonly ? '' : ''
|
|
endfunction
|
|
|
|
" ==========================================================
|
|
" COC (AUTOCOMPLÉTION & LSP)
|
|
" ==========================================================
|
|
|
|
" --- Activer la complétion ---
|
|
inoremap <silent><expr> <C-Space> coc#refresh()
|
|
inoremap <expr> <CR> pumvisible() ? coc#_select_confirm() : "\<CR>"
|
|
|
|
" --- Navigation dans les erreurs ---
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
|
|
" --- Aller à la définition / référence ---
|
|
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)
|
|
|
|
" --- Renommer symbole ---
|
|
nmap <leader>rn <Plug>(coc-rename)
|
|
|
|
" --- Formater le code ---
|
|
command! -nargs=0 Format :call CocAction('format')
|
|
|
|
" ==========================================================
|
|
" APPARENCE SOBRE
|
|
" ==========================================================
|
|
colorscheme default
|
|
set background=dark
|
|
highlight Normal ctermbg=none
|
|
highlight NonText ctermbg=none
|
|
highlight LineNr ctermfg=DarkGrey
|
|
highlight CursorLineNr ctermfg=White
|
|
highlight CursorLine ctermbg=236
|
|
|
|
" ==========================================================
|
|
" OPTIMISATIONS DIVERS
|
|
" ==========================================================
|
|
set lazyredraw
|
|
set ttyfast
|
|
set updatetime=300
|
|
set shortmess+=c
|
|
set completeopt=menu,menuone,noselect
|