From e4342f718f06a58c844716e0a88b8088bcbd31ac Mon Sep 17 00:00:00 2001 From: motius Date: Fri, 12 May 2017 05:15:39 +0200 Subject: [PATCH] essenials vim bash --- shell/bashrc | 230 +++++++++++++++++++++++++++++++++++++++++++++++++++ shell/vimrc | 101 ++++++++++++++++++++++ 2 files changed, 331 insertions(+) create mode 100644 shell/bashrc create mode 100644 shell/vimrc diff --git a/shell/bashrc b/shell/bashrc new file mode 100644 index 0000000..46a02d8 --- /dev/null +++ b/shell/bashrc @@ -0,0 +1,230 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +#IGNOREEOF=10 +# If not running interactively, don't do anything +case $- in +*i*) ;; +*) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend +shopt -s autocd + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=4096 +HISTFILESIZE=8192 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then +debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in +xterm-color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then +if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then +# We have color support; assume it's compliant with Ecma-48 +# (ISO/IEC-6429). (Lack of such support is extremely rare, and such +# a case would tend to support setf rather than setaf.) +color_prompt=yes +else +color_prompt= +fi +fi + +hg_ps1() +{ +:;#hg prompt "{({branch})}{({bookmark})}{status}" 2> /dev/null +wmctrl -r :ACTIVE: -N "$(whoami) — $PWD" 2> /dev/null; +} + +hgd() +{ +:;#hg diff -r "$1" -r "$2"; +} + +ly() +{ +. ~/.build/go_lynx; +} + + +if [ "$color_prompt" = yes ]; then +#PS1="${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[00m\]\[\033[01;34m\]@\[\033[00m\]\[\033[01;31m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;33m\]\$(__git_ps1 '(%s)')\[\033[01;00m\]\$ " +PS1="${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[00m\]\[\033[01;34m\]@\[\033[00m\]\[\033[01;31m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;33m\]\$(__git_ps1 '(%s)')\$(hg_ps1)\[\033[01;00m\]\$ " +else +PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) +PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" +;; +*) +;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then +test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" +alias ls='ls --color=auto' +#alias dir='dir --color=auto' +#alias vdir='vdir --color=auto' + +#alias grep='grep --color=auto' +#alias fgrep='fgrep --color=auto' +#alias egrep='egrep --color=auto' +fi + +# some more ls aliases +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + +umask 022 + +alias l='ls -lhp --color=always --time-style=long-iso' +alias ll='ls -lrthp --color=always --time-style=long-iso' +alias lll='ls -lArthp --color=always --time-style=long-iso' +alias rm='rm -iv' +alias du='du -h --si' +alias df='df -h --si' +alias cp='cp -iv' +alias scp='scp -v' +alias dd='xset dpms force off' +alias less='less -R' +alias v='vim -R' +alias Q='qemu -m 768 -ctrl-grab' +alias p='python3' +alias pi='ipython3' +alias mv='mv -iv' +alias ..='cd ..' +alias ...='cd ../..' +alias c='cc -Wall -g -O0 -std=c11' +alias g='g++ -Wall -g -O0 -std=c++1y -Werror=conversion -Werror=uninitialized' +alias date='date +%Y-%m-%d" "%H:%M:%S," "%A' +alias j='jobs' +alias vi='vim -u /etc/vim/vimrc' +alias json='python3 -m json.tool' +alias vim='/home/xpv/.vim/vim/install/bin/vim' +alias vb='virtualbox' +alias ta='tmux a' +alias xi='xclip -i' +alias xo='xclip -o' +alias hgst='hg st | grep -v "?"' +alias log='/bin/date +%H:%M:%S ; tail -c 0 -f' +alias vom='/usr/bin/vim' +alias tm='tmux' +alias gr="grep -r -n --color" + +proc() +{ + ps aux | grep "$1" | grep -v grep; +} + +dash() +{ + cd ~/projects/lynx_dashboard/stable/sources; +} +ddate() +{ +hms() +{ +/bin/date +%H:%M:%S +} +export PS1="${debian_chroot:+($debian_chroot)}(\$(hms))\[\033[01;31m\]\u\[\033[00m\]\[\033[01;34m\]@\[\033[00m\]\[\033[01;31m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;33m\]\$(__git_ps1 '(%s)')\$(hg_ps1)\[\033[01;00m\]\$ " +} + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then +. ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then +if [ -f /usr/share/bash-completion/bash_completion ]; then +. /usr/share/bash-completion/bash_completion +elif [ -f /etc/bash_completion ]; then +. /etc/bash_completion +fi +fi + +TTY=$(tty | grep -o tty) +if [ -z $TTY ]; then +man() { +MANWIDTH=30 +MANWIDTH=$(($MANWIDTH>$COLUMNS?$MANWIDTH:$COLUMNS)) +MANWIDTH=$(($MANWIDTH<80?$MANWIDTH:80)) +env LESS_TERMCAP_mb=$'\E[01;31m' \ +LESS_TERMCAP_md=$'\E[01;38;5;74m' \ +LESS_TERMCAP_me=$'\E[0m' \ +LESS_TERMCAP_se=$'\E[0m' \ +LESS_TERMCAP_so=$'\E[38;5;246m' \ +LESS_TERMCAP_ue=$'\E[0m' \ +LESS_TERMCAP_us=$'\E[04;38;5;146m' \ +man "$@" +} +sf() +{ +DATE=$(/bin/date +%Y-%m-%d_%H:%M:%S.%N) +local TMPFILE=tmp.${DATE}.sw +mv "$1" $TMPFILE && mv "$2" "$1" && mv $TMPFILE $2 +} +fi + +#date() { +# /bin/date --rfc-3339='seconds' | cut -d'+' -f1 | tr ' ' '_' | tr ':' '-' +#} + +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' +export DEVKITPRO='/home/administrateur/devkitPro' +export DEVKITARM='/home/administrateur/devkitPro/devkitARM' +#noir 30 40 +#rouge 31 41 +#vert 32 42 +#jaune 33 43 +#bleu 34 44 +#violet 35 45 +#bleu clair 36 46 +#blanc 37 47 + +#bind 'set show-all-if-ambiguous on' +#bind 'TAB:menu-complete' +#bind 'set completion-ignore-case on' +bind '"\eh": "\C-a\eb\ed\C-y\e#man \C-y\C-m\C-p\C-p\C-a\C-d\C-e"' +export LANG=en_US.UTF-8 + diff --git a/shell/vimrc b/shell/vimrc new file mode 100644 index 0000000..211756c --- /dev/null +++ b/shell/vimrc @@ -0,0 +1,101 @@ +set nocompatible " be iMproved, required +filetype off " required + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() +" alternatively, pass a path where Vundle should install plugins +"call vundle#begin('~/some/path/here') + +" let Vundle manage Vundle, required +Plugin 'VundleVim/Vundle.vim' + +" The following are examples of different formats supported. +" Keep Plugin commands between vundle#begin/end. +" plugin on GitHub repo +"##Plugin 'tpope/vim-fugitive' +" plugin from http://vim-scripts.org/vim/scripts.html +"##Plugin 'L9' +" Git plugin not hosted on GitHub +"##Plugin 'git://git.wincent.com/command-t.git' +" git repos on your local machine (i.e. when working on your own plugin) +""Plugin 'file:///home/gmarik/path/to/plugin' +" The sparkup vim script is in a subdirectory of this repo called vim. +" Pass the path to set the runtimepath properly. +"##Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} +" Install L9 and avoid a Naming conflict if you've already installed a +" different version somewhere else. +""Plugin 'ascenator/L9', {'name': 'newL9'} + +" ça va pas, il casse tout +"Plugin 'leafgarland/typescript-vim' + +" All of your Plugins must be added before the following line +call vundle#end() " required +filetype plugin indent on " required +" To ignore plugin indent changes, instead use: +"filetype plugin on +" +" Brief help +" :PluginList - lists configured plugins +" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate +" :PluginSearch foo - searches for foo; append `!` to refresh local cache +" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal +" +" see :h vundle for more details or wiki for FAQ +" Put your non-Plugin stuff after this line + + +set nocompatible +set showcmd +set wildmenu +set backspace=eol,start,indent +syntax on +filetype plugin indent on +set mouse=v +set number +colorscheme zellner +highlight LineNr ctermfg=yellow +"set autoindent +set smartindent +set cindent +set expandtab +set tabstop=4 +retab +set shiftwidth=4 +set ruler +set softtabstop=4 + +" warn > 79 +highlight OverLength ctermbg=black ctermfg=gray guibg=#592929 +match OverLength /\%80v.\+/ + +""highlight ColorColumn ctermbg=gray +""set colorcolumn=80 + +" language +""set spell spelllang=en_us +set spell spelllang=fr +set complete+=k +" save +inoremap :up +" remove trailing spaces +nnoremap :let _s=@/ :%s/\s\+$//e :let @/=_s :nohl :unlet _s +" hit by mistake +inoremap "_dda +" j but create newline +inoremap o +set nospell +" quick diff buffer vs save +command D :w !diff -u % - +" force unix mode on write +""set ff=unix +" copy-paste using X buffers +map :w !xclip +vmap "*y +map :r!xclip -o +" line numbers in netrw file explorer +let g:netrw_bufsettings = 'noma nomod nu nobl nowrap ro' +" status line +set laststatus=2 +