chore: init repo

This commit is contained in:
valvin 2022-11-17 20:47:15 +00:00
commit 9e3fd1ec87
3 changed files with 235 additions and 0 deletions

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# Valvin's dotfile
## Vim
run `./install-vimrc.sh` to :
* enable vimrc
* install vim-plug
* launch vim and PlugInstall command

27
install-vimrc.sh Executable file
View File

@ -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

199
vim/.vimrc Normal file
View File

@ -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 <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
" Les ; sont rarement utilisés l'un à la suite de l'autre
imap ;; <Esc>
map ;; <Esc>
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 <C-t> <Esc>:tabnew<CR>
"map <C-w> <Esc>:tabclose<CR>
map <C-Tab> <Esc>:tabnext<CR>
map <C-S-Tab> <Esc>:tabprev<CR>
map <C-P> <Esc>:CtrlP<CR>
map <C-n> :NERDTreeToggle<CR>
" map / <Esc>:LustyBufferGrep<CR>
" set mouse=a
" source ~/.vimrc.bepo
"
" To open a new empty buffer
" This replaces :tabnew which I used to bind to this mapping
nmap <leader>T :enew<cr>
" Move to the next buffer
nmap <leader>l :bnext<CR>
" Move to the previous buffer
nmap <leader>h :bprevious<CR>
" Close the current buffer and move to the previous one
" This replicates the idea of closing a tab
nmap <leader>bq :bp <BAR> bd #<CR>
" Show all open buffers and their status
nmap <leader>bl :ls<CR>
" 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 <leader>p :CtrlP<cr>
" Easy bindings for its various modes
nmap <leader>bb :CtrlPBuffer<cr>
nmap <leader>bm :CtrlPMixed<cr>
nmap <leader>bs :CtrlPMRU<cr>
" map redo
nmap U <C-R>
" recherche incrémentale
set hlsearch
set incsearch
" compléter avec <Tab> 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 <leader>w :call ToggleWrap()<CR>
au BufRead,BufNewFile *.gmi call EnableWrap()
au BufRead,BufNewFile *.md call EnableWrap()