From 39684faac1835a65ea2a17c80a727f04f2c9ee85 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 5 Sep 2019 19:27:39 +0200 Subject: [PATCH] Add vimrc --- README.md | 6 ++- install.sh | 19 +++++++++ vim/vimrc | 71 +++++++++++++++++++++++++++++++ vim/vimrc.bepo | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 install.sh create mode 100644 vim/vimrc create mode 100644 vim/vimrc.bepo diff --git a/README.md b/README.md index f4e576e..2e933db 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # tp -config pour les tp linux \ No newline at end of file +Config pour les tp linux : + +Commande à lancer en tant qu’`etu`: + +`curl --proto '=https' --tlsv1.2 -sSf https://git.flavien.ovh/louis_royer/tp | sh` diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..7317968 --- /dev/null +++ b/install.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env + +echo "Setting keyboard to bepo (shift-left+shift-right to go back to azerty" +echo 'setxkbmap -layout "fr,fr" -variant bepo, -option "grp:shifts_toggle"' >> /home/etu/.bashrc +. /home/etu/.bashrc + +echo "Installing some usefull softwares" +sudo apt install ripgrep exa git vim byobu -y + +echo "Cloning git repository" +git clone https://git.flavien.ovh/louis_royer/tp --depth 1 + +echo "Installing .vimrc for root" +sudo cp tp/vim/vimrc /root/.vimrc +sudo cp tp/vim/vimrc.bepo /root/.vimrc.bepo +sudo chown root:root /root/.vimrc* + +echo "End for installation, lets begin your work!" + diff --git a/vim/vimrc b/vim/vimrc new file mode 100644 index 0000000..92e74f1 --- /dev/null +++ b/vim/vimrc @@ -0,0 +1,71 @@ +" Activation de vim-pathogen pour l’installation de plugins +execute pathogen#infect() + +"Plugin pour rust +"rustfmt à chaque sauvegarde +let g:rustfmt_autosave = 1 + +" Appliquer automatiquement les modifications de ~/.vimrc +if has("autocmd") + autocmd! bufwritepost .vimrc source ~/.vimrc +endif + +if !empty(system("setxkbmap -print|grep bepo")) + source ~/.vimrc.bepo +endif + +" Visualise les tabs +set list +set listchars=tab:▸  + +" [Esc] sur Tab +"" Tab fait un Esc, Maj+Tab fait un Tab +inoremap +inoremap <S-Tab> + +"" Même chose, mais en mode visuel +vnoremap +vnoremap <S-Tab> + +" encodage et coloration syntaxique +set encoding=utf-8 +set fileencoding=utf-8 +syntax on +set number "affiche les numéros de ligne +set relativenumber "affiche les numéros de ligne (relatif) + +" python ident +filetype indent plugin on +set autoindent +set modeline + +" Maintain undo history between sessions +set undofile +if ($XDG_DATA_HOME != '') + silent !mkdir $XDG_DATA_HOME/vim/undodir -p > /dev/null 2>&1 + set undodir=$XDG_DATA_HOME/vim/undodir +else + if ($HOME != '') + silent !mkdir $HOME/.local/share/vim/undodir -p > /dev/null 2>&1 + set undodir=$HOME/.local/share/vim/undodir + else + echo "Error: environment variable $HOME not set" + endif +endif +if &term =~ "xterm\\|rxvt" + " use an orange cursor in insert mode + let &t_SI = "\]12;orange\x7" + " use a red cursor otherwise + let &t_EI = "\]12;red\x7" + silent !echo -ne "\033]12;red\007" + " reset cursor when vim exits + autocmd VimLeave * silent !echo -ne "\033]112\007" + " use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21 +endif + +" Colorise les nbsp +colorscheme koehler +highlight NbSp ctermbg=lightgray guibg=lightred +match NbSp /\%xa0/ + + diff --git a/vim/vimrc.bepo b/vim/vimrc.bepo new file mode 100644 index 0000000..e4da87b --- /dev/null +++ b/vim/vimrc.bepo @@ -0,0 +1,110 @@ +" {W} -> [É] +" —————————— +" On remappe W sur É : +noremap é w +noremap É W +" Corollaire: on remplace les text objects aw, aW, iw et iW +" pour effacer/remplacer un mot quand on n’est pas au début (daé / laé). +onoremap aé aw +onoremap aÉ aW +onoremap ié iw +onoremap iÉ iW +" Pour faciliter les manipulations de fenêtres, on utilise {W} comme un Ctrl+W : +noremap w +noremap W + +" [HJKL] -> {CTSR} +" ———————————————— +" {cr} = « gauche / droite » +noremap c h +noremap r l +" {ts} = « haut / bas » +noremap t j +noremap s k +" {CR} = « haut / bas de l'écran » +noremap C H +noremap R L +" {TS} = « joindre / aide » +noremap T J +noremap S K +" Corollaire : repli suivant / précédent +noremap zs zj +noremap zt zk + +" {HJKL} <- [CTSR] +" ———————————————— +" {J} = « Jusqu'à » (j = suivant, J = précédant) +noremap j t +noremap J T +" {L} = « Change » (l = attend un mvt, L = jusqu'à la fin de ligne) +noremap l c +noremap L C +" {H} = « Remplace » (h = un caractère slt, H = reste en « Remplace ») +noremap h r +noremap H R +" {K} = « Substitue » (k = caractère, K = ligne) +noremap k s +noremap K S +" Corollaire : correction orthographique +noremap ]k ]s +noremap [k [s + +" Désambiguation de {g} +" ————————————————————— +" ligne écran précédente / suivante (à l'intérieur d'une phrase) +noremap gs gk +noremap gt gj +" onglet précédant / suivant +noremap gb gT +noremap gé gt +" optionnel : {gB} / {gÉ} pour aller au premier / dernier onglet +noremap gB :exe "silent! tabfirst" +noremap gÉ :exe "silent! tablast" +" optionnel : {g"} pour aller au début de la ligne écran +noremap g" g0 + +" Chiffres en accès direct +" ———————————————————————— +noremap " 1 +noremap 1 " +noremap « 2 +noremap 2 < +noremap » 3 +noremap 3 > +noremap ( 4 +noremap 4 ( +noremap ) 5 +noremap 5 ) +noremap @ 6 +noremap 6 @ +noremap + 7 +noremap 7 + +noremap - 8 +noremap 8 - +noremap / 9 +noremap 9 / +noremap * 0 +noremap 0 * + +" Remaper la gestion des fenêtres +" ——————————————————————————————— +noremap wt j +noremap ws k +noremap wc h +noremap wr l +noremap wd c +noremap wo s +noremap wp o +noremap w :split +noremap w :vsplit + +" [PgUp] / [PgDn] plus accessibles +" ________________________________ +noremap +noremap +noremap zz + +" Fixer l’encodage des fichiers en utf-8 +" ______________________________________ +set encoding=utf-8 +set fileencoding=utf-8