From 47940878376fe1a0451ccde68f169bb83023b537 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 17 Apr 2016 20:05:21 +0200 Subject: [PATCH] Pop --- .gitignore | 1 + configurations/.Xdefaults | 72 ++++++++++++++ configurations/.vimrc | 176 ++++++++++++++++++++++++++++++++++ configurations/.zsh_functions | 73 ++++++++++++++ configurations/.zshrc | 82 ++++++++++++++++ configurations/.zshrc_perso | 28 ++++++ unixconf.sh | 20 ++++ 7 files changed, 452 insertions(+) create mode 100644 .gitignore create mode 100644 configurations/.Xdefaults create mode 100644 configurations/.vimrc create mode 100644 configurations/.zsh_functions create mode 100644 configurations/.zshrc create mode 100644 configurations/.zshrc_perso create mode 100755 unixconf.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..90c73a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +copyconfigurations.sh diff --git a/configurations/.Xdefaults b/configurations/.Xdefaults new file mode 100644 index 0000000..07387fa --- /dev/null +++ b/configurations/.Xdefaults @@ -0,0 +1,72 @@ +xscreensaver.Dialog.headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1 + +/* URxvt */ +URxvt*termName: rxvt +URxvt*allow_bold: true +URxvt*depth: 32 +URxvt*foreground: white +URxvt*background: black +URxvt.background: [95]#000000 +URxvt*shading: 10 +URxvt*tint: black +URxvt.cursorColor: #008C00 +URxvt*scrollBar: false +URxvt*saveLines: 10000 +URxvt*perl-ext-common: default,matcher,tabbed,clipboard,font-size +URxvt*url-launcher: firefox +URxvt*colorUL: #3465A4 +URxvt*matcher.button: 3 +URxvt*tabbed.tabbar-fg: 10 +URxvt*tabbed.tabbar-bg: 8 +URxvt*tabbed.tab-fg: 14 +URxvt*tabbed.tab-bg: 8 +URxvt.geometry: 90x25 +URxvt.font: xft:Monospace:size=11 + + +! do not scroll with output +URxvt*scrollTtyOutput: false + +! scroll in relation to buffer (with mouse scroll or Shift+Page Up) +URxvt*scrollWithBuffer: true + +! scroll back to the bottom on keypress +URxvt*scrollTtyKeypress: true + +URxvt.keysym.Control-Right: \033[1;5C +URxvt.keysym.Control-Left: \033[1;5D + +URxvt.keysym.Shift-PageUp: command:\033]720;1\007 +URxvt.keysym.Shift-PageDown: command:\033]721;1\007 + +URxvt.keysym.C-Up: perl:clipboard:copy +URxvt.keysym.C-Down: perl:clipboard:paste + +URxvt.keysym.C-0x2b: perl:font-size:increase +URxvt.keysym.C-0x2d: perl:font-size:decrease + +! black +! URxvt*color0 : #424242 +! URxvt*color8 : #000000 +! ! red +! URxvt*color1 : #CC0000 +! URxvt*color9 : #EF2929 +! ! green +! URxvt*color2 : #4E9A06 +! URxvt*color10 : #1CB500 +! ! yellow +! URxvt*color3 : #C4A000 +! URxvt*color11 : #FCE94F +! ! blue +! URxvt*color4 : #3465A4 +! URxvt*color12 : #729FCF +! ! magenta +! URxvt*color5 : #75507B +! URxvt*color13 : #AD7FA8 +! ! cyan +! URxvt*color6 : #06989A +! URxvt*color14 : #00F3FF +! ! white +! URxvt*color7 : #D3D7CF +! URxvt*color15 : #EEEEEC + diff --git a/configurations/.vimrc b/configurations/.vimrc new file mode 100644 index 0000000..6f245ff --- /dev/null +++ b/configurations/.vimrc @@ -0,0 +1,176 @@ +" za pour les folds +" ctrl + n pour le multi curseur +" crtl + ] pour aller à la définition de fonction +" ctrl + t pour revenir à avant ctrl + ] +" gf pour suivre le fichier sous le curseur + +set nocompatible " be iMproved, required +filetype off " required + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/vundle/ +call vundle#rc() + +" let Vundle manage Vundle, required +Plugin 'gmarik/vundle' +Plugin 'tpope/vim-fugitive' +Plugin 'vim-scripts/a.vim' +" Plugin 'Rip-Rip/clang_complete' +Plugin 'vim-scripts/DoxygenToolkit.vim' +Plugin 'ervandew/supertab' +Plugin 'emezeske/manpageview' +Plugin 'terryma/vim-multiple-cursors' +Plugin 'scrooloose/nerdcommenter' +Plugin 'scrooloose/nerdtree' +Plugin 'vim-perl/vim-perl' +Plugin 'c9s/perlomni.vim' +Plugin 'scrooloose/syntastic' +Plugin 'wincent/command-t' +Plugin 'vim-scripts/taglist.vim' +" Plugin 'Raimondi/delimitMate' +" Plugin 'WolfgangMehner/vim-plugins' +Plugin 'SirVer/ultisnips' +Plugin 'honza/vim-snippets' +Plugin 'chrisbra/Replay' +" Plugin 'fatih/vim-go' +Plugin 'terryma/vim-expand-region' + +filetype plugin indent on + +syntax enable " Coloration syntaxique +set t_Co=256 " Nombre de couleurs différentes +highlight NbSp ctermbg=5 +match NbSp /\%xa0/ + +set ai " Activer l'indentation automatique +set si " Activer l'indentation intelligente +set showcmd " Affiche (partiellement) la commande dans la barre de statut +set showmatch " Afficher les brackets qui correspondent +set ignorecase " Recherche insensible à la casse +set incsearch " Recherche insensible à la casse +set mouse=a " Activer la souris pour tous les modes +set number " Afficher les numéros de ligne +set shiftwidth=2 " Une tabulation = 4 espaces +set tabstop=2 +set expandtab " Transformer les tabulations en espaces +set ruler " Afficher la position courante +set smarttab " Être intelligent dans l'utilisation des tabluations +set fileencoding=utf-8 " Encoder en UTF-8 +set shell=zsh " Votre shell +set wildmenu " Completion dans l'interface +set wildmode=list:longest " Comportement de la complétion semblable à celui d'un shell +set wildignore=*.o,*~ "Ignorer les fichiers temporaires et objets +set foldmethod=indent " Méthode pour cacher du code (donc selon l'indentation) +set nofoldenable " Ne rien cacher par défaut + +set background=dark + +" Autocomplétion intelligente +set omnifunc=syntaxcomplete#Complete + +" Désactiver les commentaires auto +autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o + +" Touche bonus que l'on peut utiliser pour mapper certaines commandes +let mapleader = "," + +" Afficher arborescence +map :NERDTreeToggle:NERDTreeMirror +" Afficher la liste des fonctions +map :TlistToggle +" Switcher .h/.c +map :A +" Correction orthographique +map :setlocal spell! spelllang=fr +" Générer les blocs de commentaires Doxygen pour la ligne d'en dessous +map :Dox +" Exécuter PerlTidy sur l'actuel buffer +map :%!perltidy -i 2 +" Splitter horizontalement +map - :sp +" Splitter verticalement +map \| :vsp +" Aller à l'onglet suivant +nnoremap :tabprevious +" Aller à l'onglet précédent +nnoremap :tabnext +" Fermer l'onglet courant +nnoremap :tabclose +" Ouvrir un nouvel onglet +nnoremap :tabnew +" Exécuter CommandT (ouvrir un fichier rapidement en écrivant son nom) +noremap o :CommandT +" Commencer l'enregistrement en GIF de Vim +nnoremap s :ScreenRecord!: +" Arrêter l'enregistrement +nnoremap r :ScreenRecord: +" Save +nnoremap w :w +" Copy/Paste +vmap y "+y +vmap d "+d +nnoremap y "+yy +nnoremap p "+p +nnoremap P "+P +vnoremap p "+p +vnoremap P "+P +" Expand region +vmap v (expand_region_expand) +vmap (expand_region_shrink) + +" Action automatique pour les fichier de type C +autocmd FileType c call CodeC() +" Action automatique pour les fichier de type Perl +autocmd FileType perl call CodePerl() + +" Fonction à appeler pour initialiser Vim pour un script Perl +function CodePerl() + " Utiliser l'omnicompletion pour la tabulation + let g:SuperTabDefaultCompletionType = "" +endfunction + +" Fonction à appeler pour initialiser Vim pour un code C +function CodeC() + " Pour forcer ClangComplete à la tabulation + let g:SuperTabDefaultCompletionType = "" +endfunction + + +" Correction orthographique +setlocal spell spelllang=fr " Correcteur orthographique français +set nospell " Par défaut, pas de correction orthographique +autocmd BufEnter,BufNewFile,BufRead *.txt set spell " Activation pour les .txt +autocmd BufEnter,BufNewFile,BufRead *.txt let g:spellactive=1 " Ajustement pour la fonction d’activation/desactivation de la correction orthographique + +" UltiSnip - Lister les snippets disponible +let g:UltiSnipsListSnippets="" + +" Complétion +set pumheight=10 " Taille du menu d'autocomplétion +set completeopt=menu,longest +let g:clang_complete_auto=0 +let g:clang_snippets=1 " Utiliser un moteur de snippets pour les placeolders +let g:clang_snippets_engine='ultisnips' " Spécification du moteur de snippets que l'on utilise +let g:clang_auto_select=1 " Sélectionner la complétion vide par défaut + +" Vérification syntaxique (du code, pas du français :p ) +let g:syntastic_enable_signs=1 " Activer les signes dans la barre d'erreur à gauche +let g:syntastic_enable_perl_checker=1 " Réactiver l'analyse pour le Perl (désactivé car risque de sécurité sur les scripts Perl étrangers) +let g:syntastic_perl_checkers=['perl'] +let g:syntastic_check_on_open=1 " Analyser le fichier à l'ouverture +let g:syntastic_c_include_dirs = [ '../include', 'include', '../INC', 'INC', '../inc', 'inc' ] " Spécifications des dossier d'inclusion perso + +" Afficher la syntaxe et les couleurs pour les commentaires doxygen +let g:load_doxygen_syntax=1 +let g:doxygen_enhanced_colour=1 + +" Sauvegarder et restaurer les folds (fold = cacher le code entre accolades) +" Par défaut lorsque vous cachez un bloc de code, celui-ci n'est pas sauvegardé +autocmd BufWinLeave *.* mkview +autocmd BufWinEnter *.* silent loadview + +" Pour changer entre le .c/.h, on spécifie nos dossiers d'inclusions persos +let g:alternateSearchPath = 'sfr:../source,sfr:../src,sfr:../SRC,sfr:../include,sfr:../inc,sfr:../INC' + +" Enregistrer les actions faites dans Vim dans une vidéo ou GIF +let g:replay_record=1 diff --git a/configurations/.zsh_functions b/configurations/.zsh_functions new file mode 100644 index 0000000..7968040 --- /dev/null +++ b/configurations/.zsh_functions @@ -0,0 +1,73 @@ +#!/usr/bin/bash + +assignProxy(){ + PROXY_ENV=("http_proxy" "ftp_proxy" "https_proxy" "all_proxy" "no_proxy" "HTTP_PROXY" "HTTPS_PROXY" "FTP_PROXY" "NO_PROXY" "ALL_PROXY") + for envar in $PROXY_ENV + do + export $envar=$1 + done + + git config --global http.proxy "$1" +} + +proxyclear(){ + assignProxy "" # This is what 'unset' does. + echo "Proxy desactivé." +} + +proxyfac(){ + proxy_value="http://www-cache.ujf-grenoble.fr:3128" + assignProxy $proxy_value + echo "Proxy activé." +} + + +function cdfind() { + goto=$@; + IFS=' + ' + lall=( $(find . -iname "$goto*" -type d -readable 2>/dev/null) ) + + if [[ ${#lall[*]} == 0 ]]; then + echo "Aucune valeur trouvée"; + elif [[ ${#lall[*]} == 1 ]]; then + cd "${lall[0]}"; + else + for i in $(seq 1 $((${#lall[*]})) ); do + echo "[$i] - ${lall[$(( $i - 1 ))]}"; + done + read -p "#?" i + cd "${lall[ $(( $i - 1 )) ]}" + fi + IFS=' ' +} + +function up() { + LIMIT=$1 + P="$PWD" + for ((i=1; i <= LIMIT; i++));do + P=$P/.. + done + cd "$P" +} + + +function ssh_tmux() { + ssh -t "$1" tmux a || ssh -t "$1" tmux; +} + +function translate() { + if [[ "$1" = -r ]]; then + /usr/bin/translate fr en "$2" + else + /usr/bin/translate en fr "$1" + fi +} + +function rmcontainer() { + sudo docker ps -a | awk ' $1 != "CONTAINER" { print "sudo docker stop " $1 " && sudo docker rm " $1 }' | bash +} + +function vpn() { + sudo systemctl $1 openvpn@client +} diff --git a/configurations/.zshrc b/configurations/.zshrc new file mode 100644 index 0000000..4c573b9 --- /dev/null +++ b/configurations/.zshrc @@ -0,0 +1,82 @@ +# Path to your oh-my-zsh installation. + export ZSH=/home/florian/.oh-my-zsh + +# Set name of the theme to load. +# Look in ~/.oh-my-zsh/themes/ +# Optionally, if you set this to "random", it'll load a random theme each +# time that oh-my-zsh is loaded. +# candy, pygmalion, smt +ZSH_THEME="candy" + +# Uncomment the following line to use case-sensitive completion. +CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. Case +# sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(copydir copyfile cp docker codeclimate encode64 extract fancy-ctrl-z git-flow git-remote-branch history nmap scw zsh_reload) + +# User configuration + + export PATH="/home/florian/.vim/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" +# export MANPATH="/usr/local/man:$MANPATH" + +source $ZSH/oh-my-zsh.sh + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +export EDITOR='vim' + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# ssh +# export SSH_KEY_PATH="~/.ssh/dsa_id" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +source ~/.zshrc_perso diff --git a/configurations/.zshrc_perso b/configurations/.zshrc_perso new file mode 100644 index 0000000..f59e36c --- /dev/null +++ b/configurations/.zshrc_perso @@ -0,0 +1,28 @@ +unset SSH_ASKPASS # Dialog + +bindkey "^H" backward-delete-word # Ctrl + back + +export HISTSIZE=10000 +export SAVEHIST=10000 +export HISTFILE="$HOME/.history" +export XDG_CONFIG_HOME="$HOME/.config" +# export WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' +export WORDCHARS='' +export TERM=xterm-256color + +if [ -f ~/.zsh_functions ]; then + . ~/.zsh_functions +fi + +if [ -f ~/.zsh_aliases ]; then + . ~/.zsh_aliases +fi + +if ! pgrep -u $USER ssh-agent > /dev/null; then + ssh-agent > ~/.ssh-agent-thing +fi + +if [[ "$SSH_AGENT_PID" == "" ]]; then + eval $(<~/.ssh-agent-thing) > /dev/null +fi + diff --git a/unixconf.sh b/unixconf.sh new file mode 100755 index 0000000..df7fcca --- /dev/null +++ b/unixconf.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +gitlink="https://gitlab.cpy.re/florian/unixconf" + +if (! test -d "$HOME/.vim" ); then + mkdir "$HOME/.vim" +fi + + +musthaves="git vim ssh-agent urxvt" + +for musthave in $musthaves; do + which "$musthave" >/dev/null 2>&1 + if [ "$?" -ne 0 ]; then + echo "You should install ${musthave}." + exit + fi +done + +sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"