commit 9e3fd1ec8791467eb118dbd0a9d3738ddd4208af Author: valvin Date: Thu Nov 17 20:47:15 2022 +0000 chore: init repo diff --git a/README.md b/README.md new file mode 100644 index 0000000..74bc503 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Valvin's dotfile + +## Vim + +run `./install-vimrc.sh` to : + +* enable vimrc +* install vim-plug +* launch vim and PlugInstall command diff --git a/install-vimrc.sh b/install-vimrc.sh new file mode 100755 index 0000000..018a87d --- /dev/null +++ b/install-vimrc.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# to be in script folder +cd $(dirname $0) +CURRENT_DIR=$(pwd) +echo "installing vimrc" + +if [ -f ~/.vimrc ] +then + echo "backuping existing ~/.vimrc" + cp ~/.vimrc ~/.vimrc.bkp + rm ~/.vimrc + echo "Linking ${CURRENT_DIR}/vim/.vimrc" + ln -s ${CURRENT_DIR}/vim/.vimrc ~/.vimrc +fi + +if [ ! -f ~/.vim/autoload/plug.vim ] +then + echo "installing vim-plug" + curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + vim -c PlugInstall +else + echo "vim-plug already installed" +fi + + diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000..9304d10 --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,199 @@ +" VIM Configuration - Vincent Jousse +" Annule la compatibilite avec l'ancetre Vi : totalement indispensable +set nocompatible +filetype off " required + +call plug#begin('~/.vim/plugged') +" let Vundle manage Vundle, required +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'w0rp/ale' +Plug 'Raimondi/delimitMate' +Plug 'sclo/haproxy.vim' +Plug 'airblade/vim-gitgutter' +Plug 'dracula/vim' +Plug 'ctrlpvim/ctrlp.vim' +Plug 'lepture/vim-jinja' +Plug 'RobbieClarken/vim-haproxy' +"Plug 'preservim/nerdtree' +Plug 'scrooloose/nerdtree' +Plug 'Xuyuanp/nerdtree-git-plugin' +Plug 'pearofducks/ansible-vim' +Plug 'ekalinin/Dockerfile.vim' +Plug 'tpope/vim-fugitive' +Plug 'junegunn/gv.vim' +Plug 'hashivim/vim-terraform' +Plug 'dpelle/vim-Grammalecte' + +"Plugin 'solarized' +"Plugin 'todotxt.vim' +"Plugin 'LustyExplorer' +call plug#end() +filetype plugin indent on " required + +" Plugin settings +"let g:airline_powerline_fonts = 1 +"let g:airline#extensions#tabline#enabled = 1 +"let g:airline#extensions#ale#enabled = 1 +" Enable the list of buffers +let g:airline#extensions#tabline#enabled = 1 +" Show just the filename +let g:airline#extensions#tabline#fnamemod = ':t' + +let g:grammalecte_cli_py='~/grammalecte/grammalecte-cli.py' +" -- Affichage +set title " Met a jour le titre de votre fenetre ou de + " votre terminal +set number " Affiche le numero des lignes +set ruler " Affiche la position actuelle du curseur +set wrap " Affiche les lignes trop longues sur plusieurs + " lignes + +set scrolloff=3 " Affiche un minimum de 3 lignes autour du curseur + " (pour le scroll) + +" -- Recherche +set ignorecase " Ignore la casse lors d'une recherche +set smartcase " Si une recherche contient une majuscule, + " re-active la sensibilite a la casse +set incsearch " Surligne les resultats de recherche pendant la + " saisie +set hlsearch " Surligne les resultats de recherche + +" -- Beep +set visualbell " Empeche Vim de beeper +set noerrorbells " Empeche Vim de beeper + +" Active le comportement 'habituel' de la touche retour en arriere +set backspace=indent,eol,start + +" Cache les fichiers lors de l'ouverture d'autres fichiers +set hidden +" Active la coloration syntaxique +syntax enable +" Active les comportements specifiques aux types de fichiers comme +" la syntaxe et l'indentation +filetype on +filetype plugin on +filetype indent on +" Utilise la version sombre de Solarized +"set background=dark +"colorscheme solarized +color dracula +"set guifont=Source\ Code\ Pro\ Regular\ 12 +set antialias +set t_Co=16 +"Enable clipboard with external apps +set clipboard=unnamedplus +" +" Désactiver les touches directionnelles +map +map +map +map +imap +imap +imap +imap +" Les ; sont rarement utilisés l'un à la suite de l'autre +imap ;; +map ;; +let mapleader = "," +let maplocalleader = "," +set expandtab +set shiftwidth=2 +set softtabstop=2 + +" always enable Vim tabs +"set showtabline=2 +" set tab features just like browser +" open tab, close tab, next tab, previous tab (just like Chrome and Firefox keyboard shortcuts) +map :tabnew +"map :tabclose +map :tabnext +map :tabprev +map :CtrlP +map :NERDTreeToggle + +" map / :LustyBufferGrep + + +" set mouse=a +" source ~/.vimrc.bepo +" + +" To open a new empty buffer +" This replaces :tabnew which I used to bind to this mapping +nmap T :enew +" Move to the next buffer +nmap l :bnext +" Move to the previous buffer +nmap h :bprevious +" Close the current buffer and move to the previous one +" This replicates the idea of closing a tab +nmap bq :bp bd # +" Show all open buffers and their status +nmap bl :ls +" Setup some default ignores +let g:ctrlp_custom_ignore = { + \ 'dir': '\v[\/](\.(git|hg|svn)|\_site)$', + \ 'file': '\v\.(exe|so|dll|class|png|jpg|jpeg)$', +\} +" Use the nearest .git directory as the cwd +" This makes a lot of sense if you are working on a project that is in version +" control. It also supports works with .svn, .hg, .bzr. +let g:ctrlp_working_path_mode = 'r' +" Use a leader instead of the actual named binding +nmap p :CtrlP +" Easy bindings for its various modes +nmap bb :CtrlPBuffer +nmap bm :CtrlPMixed +nmap bs :CtrlPMRU +" map redo +nmap U +" recherche incrémentale +set hlsearch +set incsearch +" compléter avec en mode commande +set wildmenu +set wildmode=longest,full + +"Active le retour à la ligne automatique avec +"remappage des touches de navigation. +let s:wrapenabled = 0 +set wrap nolist +function! EnableWrap() + set linebreak + nnoremap j gj + nnoremap k gk + nnoremap 0 g0 + nnoremap ^ g^ + nnoremap $ g$ + vnoremap j gj + vnoremap k gk + vnoremap 0 g0 + vnoremap ^ g^ + vnoremap $ g$ + let s:wrapenabled = 1 +endfunction + +function! DisableWrap() + set nolinebreak + unmap j + unmap k + unmap 0 + unmap ^ + unmap $ + let s:wrapenabled = 0 +endfunction + +function! ToggleWrap() + if s:wrapenabled + call DisableWrap() + else + call EnableWrap() + endif +endfunction +map w :call ToggleWrap() +au BufRead,BufNewFile *.gmi call EnableWrap() +au BufRead,BufNewFile *.md call EnableWrap()