2023-05-03 12:16:54 +02:00
|
|
|
set nocompatible " be iMproved, required
|
|
|
|
filetype off " required
|
|
|
|
|
|
|
|
set rtp+=~/.vim/bundle/Vundle.vim
|
|
|
|
call vundle#begin()
|
|
|
|
Plugin 'VundleVim/Vundle.vim'
|
|
|
|
|
2024-04-06 23:33:41 +02:00
|
|
|
"Plugins installés depuis Vim Awesome avec le gestionnaire Vundle
|
2023-05-03 12:16:54 +02:00
|
|
|
Plugin 'preservim/nerdtree'
|
2024-04-06 23:33:41 +02:00
|
|
|
Plugin 'mbbill/undotree'
|
2023-05-03 12:16:54 +02:00
|
|
|
Plugin 'jeffkreeftmeijer/vim-numbertoggle'
|
|
|
|
Plugin 'jodosha/vim-devnotes'
|
|
|
|
Plugin 'joshdick/onedark.vim'
|
|
|
|
Plugin 'flazz/vim-colorschemes'
|
|
|
|
Plugin 'ervandew/supertab'
|
2024-04-06 23:33:41 +02:00
|
|
|
Plugin 'tpope/vim-fugitive'
|
|
|
|
Plugin 'jiangmiao/auto-pairs'
|
|
|
|
Plugin 'tpope/vim-commentary'
|
|
|
|
Plugin 'vim-airline/vim-airline'
|
|
|
|
Plugin 'vim-airline/vim-airline-themes'
|
|
|
|
Plugin 'liuchengxu/vim-which-key'
|
|
|
|
Plugin 'mhinz/vim-startify'
|
2023-05-03 12:16:54 +02:00
|
|
|
|
|
|
|
call vundle#end() " required
|
|
|
|
filetype plugin indent on " required
|
|
|
|
|
|
|
|
"Parametre de vim
|
|
|
|
syntax on
|
|
|
|
set smartindent
|
|
|
|
set shiftround
|
|
|
|
set wildmenu
|
|
|
|
set cursorline
|
2023-06-20 17:36:32 +02:00
|
|
|
set ignorecase
|
2023-05-03 12:16:54 +02:00
|
|
|
set hlsearch
|
2024-04-06 23:33:41 +02:00
|
|
|
set autowrite
|
2023-05-03 12:16:54 +02:00
|
|
|
set mouse=a
|
2024-04-06 23:33:41 +02:00
|
|
|
|
|
|
|
" Configuration du terminal extensible
|
|
|
|
function! OpenResizableTerminals(size)
|
|
|
|
let size_arg = a:size != '' ? '++rows=' . a:size : ''
|
|
|
|
execute 'bot term ' . size_arg
|
|
|
|
endfunction
|
|
|
|
nnoremap <F5> :call OpenResizableTerminals(input('Taille du terminal : ', '10'))<CR>
|
|
|
|
|
|
|
|
" Configurer Airline
|
|
|
|
set laststatus=2
|
|
|
|
let g:airline_powerline_fonts = 1
|
|
|
|
let g:airline_theme='onedark'
|
|
|
|
|
|
|
|
" Stocker le nom d'utilisateur dans une variable
|
|
|
|
let g:username = substitute(system('whoami'), '\n', '', '')
|
|
|
|
|
|
|
|
" Fonction pour mapper les modes
|
|
|
|
function! Mode()
|
|
|
|
let mode = mode()
|
|
|
|
if mode ==# 'n'
|
|
|
|
return 'NORMAL'
|
|
|
|
elseif mode ==# 'i'
|
|
|
|
return 'INSERT'
|
|
|
|
elseif mode ==# 'v'
|
|
|
|
return 'VISUAL'
|
|
|
|
elseif mode ==# "\<C-V>"
|
|
|
|
return 'VISUAL BLOCK'
|
|
|
|
elseif mode ==# 'V'
|
|
|
|
return 'VISUAL LINE'
|
|
|
|
elseif mode ==# 'R'
|
|
|
|
return 'REPLACE'
|
|
|
|
else
|
|
|
|
return mode()
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Configurer les sections personnalisées dans la barre d'état
|
|
|
|
let g:airline_section_a = '%<%{Mode()}'
|
|
|
|
let g:airline_section_b = '%#StatusLine#' . g:username . ' | %f'
|
|
|
|
let g:airline_section_c = '%#StatusLineNC#%{strftime("%H:%M")}'
|
|
|
|
|
|
|
|
" Configurer les symboles de séparation
|
|
|
|
let g:airline_left_sep = ''
|
|
|
|
let g:airline_right_sep = ''
|
|
|
|
let g:airline_left_alt_sep = ''
|
|
|
|
let g:airline_right_alt_sep = ''
|
|
|
|
|
|
|
|
" Configurer les couleurs
|
|
|
|
hi StatusLine guifg=#ebdbb2 guibg=#3c3836 gui=NONE ctermfg=180 ctermbg=237 cterm=NONE
|
|
|
|
hi StatusLineNC guifg=#928374 guibg=#3c3836 gui=NONE ctermfg=146 ctermbg=237 cterm=NONE
|
|
|
|
hi User1 guifg=#282828 guibg=#98971a gui=NONE ctermfg=234 ctermbg=142 cterm=NONE
|
|
|
|
hi User2 guifg=#928374 guibg=NONE gui=NONE ctermfg=146 ctermbg=NONE cterm=NONE
|
|
|
|
hi User3 guifg=#d5c4a1 guibg=#3c3836 gui=NONE ctermfg=223 ctermbg=237 cterm=NONE
|
|
|
|
hi User4 guifg=#1d2021 guibg=NONE gui=NONE ctermfg=234 ctermbg=NONE cterm=NONE
|
|
|
|
hi User5 guifg=#689d6a guibg=NONE gui=NONE ctermfg=108 ctermbg=NONE cterm=NONE
|
|
|
|
hi User6 guifg=#fabd2f guibg=NONE gui=NONE ctermfg=214 ctermbg=NONE cterm=NONE
|
|
|
|
|
|
|
|
" Activer auto-pairs
|
|
|
|
let g:AutoPairsFlyMode = 1
|
|
|
|
let g:AutoPairsShortcutBackInsert = '<M-b>'
|
|
|
|
au FileType * let b:AutoPairs = AutoPairsDefine({'(':')', '[':']', '{':'}', '"':'"', "'":"'", '`':'`'})
|
2023-06-14 12:52:27 +02:00
|
|
|
|
2023-05-03 12:16:54 +02:00
|
|
|
"Numérotation avec numbertoggle
|
|
|
|
set number relativenumber
|
|
|
|
|
|
|
|
"Theme vim
|
|
|
|
colorscheme space-vim-dark
|
|
|
|
|
2024-04-06 23:33:41 +02:00
|
|
|
"Permet la sauvegarde automatique de l'historique...
|
|
|
|
set undofile
|
|
|
|
set undodir=~/.vim/
|
2023-05-03 12:16:54 +02:00
|
|
|
|
2023-06-20 17:36:32 +02:00
|
|
|
"Raccourci vertical split
|
2024-04-06 23:33:41 +02:00
|
|
|
nnoremap <c-a> :vsp<CR>
|
2023-05-03 12:16:54 +02:00
|
|
|
|
2023-06-20 17:36:32 +02:00
|
|
|
"Raccourci Note
|
2024-04-06 23:33:41 +02:00
|
|
|
nmap <F2> :call DevNotes()<CR>
|
2023-05-03 12:16:54 +02:00
|
|
|
|
2023-06-20 17:36:32 +02:00
|
|
|
"Raccourci NerdTree
|
2024-04-06 23:33:41 +02:00
|
|
|
nnoremap <F3> :NERDTreeToggle<CR>
|
2023-05-03 12:16:54 +02:00
|
|
|
|
2023-06-20 17:36:32 +02:00
|
|
|
"Raccourci historique
|
2024-04-06 23:33:41 +02:00
|
|
|
nnoremap <F4> :UndotreeToggle<CR>:wincmd p<CR>
|
2023-06-20 17:36:32 +02:00
|
|
|
|
|
|
|
"Raccourci terminal
|
2023-06-14 10:03:06 +02:00
|
|
|
tnoremap <F6> <c-w>N
|
2023-05-03 12:16:54 +02:00
|
|
|
|
|
|
|
"Raccourci vers une recherche duckduckgo
|
2024-04-06 23:33:41 +02:00
|
|
|
vmap g :<C-U> !firefox "https://duckduckgo.com/?q=<cword>&t=newext&atb=v372-6&ia=web" >& /dev/null <CR><CR>
|
2023-05-03 12:16:54 +02:00
|
|
|
|
|
|
|
"Raccourci vers aide vim
|
2024-04-06 23:33:41 +02:00
|
|
|
nmap <F7> :!elinks https://agreugr.eu<CR>
|
2023-05-03 12:16:54 +02:00
|
|
|
|
|
|
|
"Raccourci onglet
|
2024-04-06 23:33:41 +02:00
|
|
|
nnoremap <F8> :call OpenFileInNewTab()<CR>
|
|
|
|
nmap <F9> :tabnext<CR>
|
2023-05-03 12:16:54 +02:00
|
|
|
|
2024-04-06 23:33:41 +02:00
|
|
|
" Sauvegarde et Fermeture de vimscode
|
|
|
|
function! SaveAndQuit()
|
|
|
|
wa
|
|
|
|
qall!
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
nnoremap <F10> :call SaveAndQuit()<CR>
|
2023-05-23 17:28:58 +02:00
|
|
|
|
2023-05-03 12:16:54 +02:00
|
|
|
"Raccourci plugin installer
|
2024-04-06 23:33:41 +02:00
|
|
|
nmap ² :PluginList<CR>
|
2023-05-03 12:16:54 +02:00
|
|
|
|
|
|
|
"Raccourci au lancement de vim
|
2024-04-06 23:33:41 +02:00
|
|
|
au VimEnter *.cpp :NERDTreeFocus
|
|
|
|
au VimEnter *.cpp :call OpenResizableTerminals(input('Taille du terminal : ', '10'))<CR>
|
|
|
|
|
|
|
|
au VimEnter *.ino :NERDTreeFocus
|
|
|
|
au VimEnter *.ino :call OpenResizableTerminals(input('Taille du terminal : ', '10'))<CR>
|
|
|
|
|
|
|
|
" Fonction pour la création d'un nouvel onglet
|
|
|
|
function! OpenFileInNewTab()
|
|
|
|
let user_choice = input("Voulez-vous ouvrir un fichier existant ? (o/n): ")
|
|
|
|
if user_choice == 'o'
|
|
|
|
let file_name = input("Choisir un fichier à ouvrir : ", '', 'file')
|
|
|
|
if filereadable(file_name)
|
|
|
|
execute "tabnew " . fnameescape(file_name)
|
|
|
|
else
|
|
|
|
echo "Le fichier spécifié n'existe pas : " . file_name
|
|
|
|
endif
|
|
|
|
elseif user_choice == 't'
|
|
|
|
execute "tabnew "
|
|
|
|
elseif user_choice == 'n'
|
|
|
|
let new_file = input("Nouveau nom de fichier : ")
|
|
|
|
execute "tabnew " . new_file
|
|
|
|
else
|
|
|
|
echo "\nChoix invalide. Veuillez saisir 'o' pour ouvrir un fichier existant, ou 'n' pour créer un fichier."
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Configuration de la page d'accueil vim
|
|
|
|
let g:startify_lists = [
|
|
|
|
\ {'type': 'files', 'header': ['Fichiers récents']},
|
|
|
|
\ ]
|
|
|
|
let g:startify_custom_header =
|
|
|
|
\ startify#center(split(system('figlet -w 100 VIMSCODE'), '\n'))
|
|
|
|
|
|
|
|
" Configuration WhichKey
|
|
|
|
call which_key#register('<Space>', "g:which_key_map")
|
|
|
|
nnoremap <silent> <c-l> :<c-u>WhichKey '<Space>'<CR>
|
|
|
|
set timeoutlen=20
|
|
|
|
let g:which_key_map = {
|
|
|
|
\ 'name' : 'Raccourcis VimsCode' ,
|
|
|
|
\ '<F2>' : ['<C-W>w' , 'fait apparaitre une note'] ,
|
|
|
|
\ '<F3>' : ['<C-W>c' , 'fait apparaitre l arborescence'] ,
|
|
|
|
\ '<F4>' : ['<C-W>s' , 'historique de modification'] ,
|
|
|
|
\ '<F5>' : ['<C-W>v' , 'fait apparaitre un terminal'] ,
|
|
|
|
\ '<F6>' : ['<C-W>v' , 'scroll dans le terminal'] ,
|
|
|
|
\ '<F7>' : ['<C-W>h' , 'fait apparaitre un site aide'] ,
|
|
|
|
\ '<F8>' : ['<C-W>j' , 'créer une nouvel fenetre'] ,
|
|
|
|
\ '<F9>' : ['<C-W>l' , 'change de fenetre'] ,
|
|
|
|
\ '<F10>' : ['<C-W>5<' , 'ferme VimsCode'] ,
|
|
|
|
\ 'Ctrl-s' : [':resize +5' , 'divise en deux vim'] ,
|
|
|
|
\ '²' : ['<C-W>5>' , 'affiche les greffons'] ,
|
|
|
|
\ }
|
|
|
|
let g:which_key_map.o = {
|
|
|
|
\ 'name' : 'Raccourcis Vim' ,
|
|
|
|
\ 'Ctrl-w-w' : ['<C-W>w' , 'other-window'] ,
|
|
|
|
\ 'Ctrl-w-c' : ['<C-W>c' , 'delete-window'] ,
|
|
|
|
\ 'Ctrl-w-s' : ['<C-W>s' , 'split-window-below'] ,
|
|
|
|
\ 'Ctrl-w-v' : ['<C-W>v' , 'split-window-right'] ,
|
|
|
|
\ 'Ctrl-w-h' : ['<C-W>h' , 'window-left'] ,
|
|
|
|
\ 'Ctrl-w-j' : ['<C-W>j' , 'window-below'] ,
|
|
|
|
\ 'Ctrl-w-l' : ['<C-W>l' , 'window-right'] ,
|
|
|
|
\ 'Ctrl-w-k' : ['<C-W>k' , 'window-up'] ,
|
|
|
|
\ ':resize +5' : [':resize +5' , 'expand-window-below'] ,
|
|
|
|
\ ':resize -5' : [':resize -5' , 'expand-window-up'] ,
|
|
|
|
\ 'Ctrl-w-=' : ['<C-W>=' , 'balance-window'] ,
|
|
|
|
\ }
|