1
0
Fork 0

bash and zsh tweaks, vimrc fix and getting rid of a vim plugin

This commit is contained in:
Von Random 2014-10-15 01:19:50 +04:00
parent 6804f0e295
commit 3b3f30505d
9 changed files with 602 additions and 483 deletions

31
bashrc
View file

@ -4,7 +4,8 @@
[[ $- != *i* ]] && return
# Export some useful variables
[[ -r $HOME/.local/bin && $PATH != *$HOME/.local/bin* ]] && PATH=$PATH:$HOME/.local/bin
local_bin="${HOME}/.local/bin"
[[ -r ${local_bin} && ${PATH} != *${local_bin}* ]] && PATH=${PATH}:${local_bin}
# Some history tweaks
HISTCONTROL=ignoredups:ignorespace
@ -12,12 +13,12 @@ HISTSIZE=1000
HISTFILESIZE=2000
# Enable completion
COMP_ENABLE=true
comp_enable=true
# Other useful vars
#export LC_CTYPE= <- for system messages locale
export LC_ALL='en_GB.UTF-8'
export LANG=$LC_ALL
export LANG=${LC_ALL}
export PAGER='less -R'
export EDITOR='vim'
export LS_COLORS='no=00:fi=00:di=34:ow=34;40:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;32:*~=01;32:*#=01;32:*.bak=01;33:*.BAK=01;33:*.old=01;33:*.OLD=01;33:*.org_archive=01;33:*.off=01;33:*.OFF=01;33:*.dist=01;33:*.DIST=01;33:*.orig=01;33:*.ORIG=01;33:*.swp=01;33:*.swo=01;33:*,v=01;33:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:'
@ -30,7 +31,7 @@ shopt -s histappend
shopt -s checkwinsize
# autocd works only with bash versions 4+.
if [[ $BASH_VERSINFO -ge 4 ]]; then
if [[ ${BASH_VERSINFO} -ge 4 ]]; then
shopt -s autocd
fi
@ -44,7 +45,7 @@ fi
# 0 - Black, 1 - Red, 2 - Green, 3 - Yellow
# 4 - Blue, 5 - Magenta, 6 - Cyan, 7 - White
if [[ $UID -eq 1000 || $UID -eq 1205 || $UID -eq 0 || $USER == 'Von Random' ]]; then
if [[ ${UID} -eq 1000 || ${UID} -eq 1205 || ${UID} -eq 0 || ${USER} == 'Von Random' ]]; then
user_ps=""
else
user_ps="\[\e[1;31m\]\u\[\e[0m\]@"
@ -77,7 +78,7 @@ alias iconvuk='command iconv -c -f utf-8 -t koi8-r'
alias iconvku='command iconv -c -f koi8-r -t utf-8'
alias iconvwu='command iconv -c -f cp1251 -t utf-8'
# grc:
if [[ -x /usr/bin/grc ]]; then
if [[ -x $(type -P grc) ]]; then
alias ping='command grc --colour=auto ping'
alias ping6='command grc --colour=auto ping'
alias traceroute='command grc --colour=auto traceroute'
@ -88,15 +89,15 @@ if [[ -x /usr/bin/grc ]]; then
alias netstat='command grc --colour=auto netstat'
fi
# ls:
if [[ $OSTYPE == freebsd* ]]; then
if [[ ${OSTYPE} == freebsd* ]]; then
alias ls='command ls -G '
elif [[ $OSTYPE == linux-gnu ]] && [[ $HOSTNAME != *pvc* ]]; then
elif [[ ${OSTYPE} == 'linux-gnu' ]] && [[ ${HOSTNAME} != *pvc* ]]; then
alias ls='command ls --color=auto --group-directories-first '
fi
alias la='ls -FA'
alias ll='ls -lha'
alias ld='ls -lhda'
if [[ -x /usr/bin/colordiff || -x $HOME/.local/bin/colordiff ]]; then
if [[ -x $(type -P colordiff) ]]; then
alias diff='command colordiff'
fi
# mount:
@ -114,17 +115,19 @@ alias sdf='command svn diff'
alias sci='command svn commit'
alias sup='command svn up'
# we want to see exit code on error
trap 'echo -e "\e[0mbash: exit \e[1;37m$?\e[0m"' ERR
# bash completion in case we have it
completion_path='/usr/share/bash-completion/bash_completion'
[[ COMP_ENABLE == true && -r $completion_path ]] && source $completion_path
if [[ ${comp_enable} == true && -r ${completion_path} ]]; then
source ${completion_path}
fi
# load additional functions and overrides
extras=( "$HOME/.bashrc.work" )
extras=( "${HOME}/.bashrc.extras" )
for i in ${extras[@]}; do
if [[ -r $i ]]; then
source $i
fi
done
# we want to see exit code on error (it also has to be the last entry here)
trap 'echo -e "\e[0mbash: exit \e[1;37m$?\e[0m"' ERR

551
vim-colors/jellybeans.vim Normal file
View file

@ -0,0 +1,551 @@
" Vim color file
"
" " __ _ _ _ "
" " \ \ ___| | |_ _| |__ ___ __ _ _ __ ___ "
" " \ \/ _ \ | | | | | _ \ / _ \/ _ | _ \/ __| "
" " /\_/ / __/ | | |_| | |_| | __/ |_| | | | \__ \ "
" " \___/ \___|_|_|\__ |____/ \___|\____|_| |_|___/ "
" " \___/ "
"
" "A colorful, dark color scheme for Vim."
"
" File: jellybeans.vim
" URL: github.com/nanotech/jellybeans.vim
" Scripts URL: vim.org/scripts/script.php?script_id=2555
" Maintainer: NanoTech (nanotech.nanotechcorp.net)
" Version: 1.6~git
" Last Change: January 15th, 2012
" License: MIT
" Contributors: Daniel Herbert (pocketninja)
" Henry So, Jr. <henryso@panix.com>
" David Liang <bmdavll at gmail dot com>
" Rich Healey (richo)
" Andrew Wong (w0ng)
"
" Copyright (c) 2009-2012 NanoTech
"
" Permission is hereby granted, free of charge, to any per‐
" son obtaining a copy of this software and associated doc‐
" umentation files (the “Software”), to deal in the Soft‐
" ware without restriction, including without limitation
" the rights to use, copy, modify, merge, publish, distrib‐
" ute, sublicense, and/or sell copies of the Software, and
" to permit persons to whom the Software is furnished to do
" so, subject to the following conditions:
"
" The above copyright notice and this permission notice
" shall be included in all copies or substantial portions
" of the Software.
"
" THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
" KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
" THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU‐
" LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON‐
" TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐
" NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
" THE SOFTWARE.
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "jellybeans"
if has("gui_running") || &t_Co == 88 || &t_Co == 256
let s:low_color = 0
else
let s:low_color = 1
endif
" Color approximation functions by Henry So, Jr. and David Liang {{{
" Added to jellybeans.vim by Daniel Herbert
" returns an approximate grey index for the given grey level
fun! s:grey_number(x)
if &t_Co == 88
if a:x < 23
return 0
elseif a:x < 69
return 1
elseif a:x < 103
return 2
elseif a:x < 127
return 3
elseif a:x < 150
return 4
elseif a:x < 173
return 5
elseif a:x < 196
return 6
elseif a:x < 219
return 7
elseif a:x < 243
return 8
else
return 9
endif
else
if a:x < 14
return 0
else
let l:n = (a:x - 8) / 10
let l:m = (a:x - 8) % 10
if l:m < 5
return l:n
else
return l:n + 1
endif
endif
endif
endfun
" returns the actual grey level represented by the grey index
fun! s:grey_level(n)
if &t_Co == 88
if a:n == 0
return 0
elseif a:n == 1
return 46
elseif a:n == 2
return 92
elseif a:n == 3
return 115
elseif a:n == 4
return 139
elseif a:n == 5
return 162
elseif a:n == 6
return 185
elseif a:n == 7
return 208
elseif a:n == 8
return 231
else
return 255
endif
else
if a:n == 0
return 0
else
return 8 + (a:n * 10)
endif
endif
endfun
" returns the palette index for the given grey index
fun! s:grey_color(n)
if &t_Co == 88
if a:n == 0
return 16
elseif a:n == 9
return 79
else
return 79 + a:n
endif
else
if a:n == 0
return 16
elseif a:n == 25
return 231
else
return 231 + a:n
endif
endif
endfun
" returns an approximate color index for the given color level
fun! s:rgb_number(x)
if &t_Co == 88
if a:x < 69
return 0
elseif a:x < 172
return 1
elseif a:x < 230
return 2
else
return 3
endif
else
if a:x < 75
return 0
else
let l:n = (a:x - 55) / 40
let l:m = (a:x - 55) % 40
if l:m < 20
return l:n
else
return l:n + 1
endif
endif
endif
endfun
" returns the actual color level for the given color index
fun! s:rgb_level(n)
if &t_Co == 88
if a:n == 0
return 0
elseif a:n == 1
return 139
elseif a:n == 2
return 205
else
return 255
endif
else
if a:n == 0
return 0
else
return 55 + (a:n * 40)
endif
endif
endfun
" returns the palette index for the given R/G/B color indices
fun! s:rgb_color(x, y, z)
if &t_Co == 88
return 16 + (a:x * 16) + (a:y * 4) + a:z
else
return 16 + (a:x * 36) + (a:y * 6) + a:z
endif
endfun
" returns the palette index to approximate the given R/G/B color levels
fun! s:color(r, g, b)
" get the closest grey
let l:gx = s:grey_number(a:r)
let l:gy = s:grey_number(a:g)
let l:gz = s:grey_number(a:b)
" get the closest color
let l:x = s:rgb_number(a:r)
let l:y = s:rgb_number(a:g)
let l:z = s:rgb_number(a:b)
if l:gx == l:gy && l:gy == l:gz
" there are two possibilities
let l:dgr = s:grey_level(l:gx) - a:r
let l:dgg = s:grey_level(l:gy) - a:g
let l:dgb = s:grey_level(l:gz) - a:b
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
let l:dr = s:rgb_level(l:gx) - a:r
let l:dg = s:rgb_level(l:gy) - a:g
let l:db = s:rgb_level(l:gz) - a:b
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
if l:dgrey < l:drgb
" use the grey
return s:grey_color(l:gx)
else
" use the color
return s:rgb_color(l:x, l:y, l:z)
endif
else
" only one possibility
return s:rgb_color(l:x, l:y, l:z)
endif
endfun
" returns the palette index to approximate the 'rrggbb' hex string
fun! s:rgb(rgb)
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
return s:color(l:r, l:g, l:b)
endfun
" sets the highlighting for the given group
fun! s:X(group, fg, bg, attr, lcfg, lcbg)
if s:low_color
let l:fge = empty(a:lcfg)
let l:bge = empty(a:lcbg)
if !l:fge && !l:bge
exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=".a:lcbg
elseif !l:fge && l:bge
exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=NONE"
elseif l:fge && !l:bge
exec "hi ".a:group." ctermfg=NONE ctermbg=".a:lcbg
endif
else
let l:fge = empty(a:fg)
let l:bge = empty(a:bg)
if !l:fge && !l:bge
exec "hi ".a:group." guifg=#".a:fg." guibg=#".a:bg." ctermfg=".s:rgb(a:fg)." ctermbg=".s:rgb(a:bg)
elseif !l:fge && l:bge
exec "hi ".a:group." guifg=#".a:fg." guibg=NONE ctermfg=".s:rgb(a:fg)." ctermbg=NONE"
elseif l:fge && !l:bge
exec "hi ".a:group." guifg=NONE guibg=#".a:bg." ctermfg=NONE ctermbg=".s:rgb(a:bg)
endif
endif
if a:attr == ""
exec "hi ".a:group." gui=none cterm=none"
else
let l:noitalic = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",")
if empty(l:noitalic)
let l:noitalic = "none"
endif
exec "hi ".a:group." gui=".a:attr." cterm=".l:noitalic
endif
endfun
" }}}
if !exists("g:jellybeans_background_color")
let g:jellybeans_background_color = "151515"
end
call s:X("Normal","e8e8d3",g:jellybeans_background_color,"","White","")
set background=dark
if !exists("g:jellybeans_use_lowcolor_black") || g:jellybeans_use_lowcolor_black
let s:termBlack = "Black"
else
let s:termBlack = "Grey"
endif
if version >= 700
call s:X("CursorLine","","1c1c1c","","",s:termBlack)
call s:X("CursorColumn","","1c1c1c","","",s:termBlack)
call s:X("MatchParen","ffffff","556779","bold","","DarkCyan")
call s:X("TabLine","000000","b0b8c0","italic","",s:termBlack)
call s:X("TabLineFill","9098a0","","","",s:termBlack)
call s:X("TabLineSel","000000","f0f0f0","italic,bold",s:termBlack,"White")
" Auto-completion
call s:X("Pmenu","ffffff","606060","","White",s:termBlack)
call s:X("PmenuSel","101010","eeeeee","",s:termBlack,"White")
endif
call s:X("Visual","","404040","","",s:termBlack)
call s:X("Cursor",g:jellybeans_background_color,"b0d0f0","","","")
call s:X("LineNr","605958",g:jellybeans_background_color,"none",s:termBlack,"")
call s:X("CursorLineNr","ccc5c4","","none","White","")
call s:X("Comment","888888","","italic","Grey","")
call s:X("Todo","c7c7c7","","bold","White",s:termBlack)
call s:X("StatusLine","000000","dddddd","italic","","White")
call s:X("StatusLineNC","ffffff","403c41","italic","White","Black")
call s:X("VertSplit","777777","403c41","",s:termBlack,s:termBlack)
call s:X("WildMenu","f0a0c0","302028","","Magenta","")
call s:X("Folded","a0a8b0","384048","italic",s:termBlack,"")
call s:X("FoldColumn","535D66","1f1f1f","","",s:termBlack)
call s:X("SignColumn","777777","333333","","",s:termBlack)
call s:X("ColorColumn","","000000","","",s:termBlack)
call s:X("Title","70b950","","bold","Green","")
call s:X("Constant","cf6a4c","","","Red","")
call s:X("Special","799d6a","","","Green","")
call s:X("Delimiter","668799","","","Grey","")
call s:X("String","99ad6a","","","Green","")
call s:X("StringDelimiter","556633","","","DarkGreen","")
call s:X("Identifier","c6b6ee","","","LightCyan","")
call s:X("Structure","8fbfdc","","","LightCyan","")
call s:X("Function","fad07a","","","Yellow","")
call s:X("Statement","8197bf","","","DarkBlue","")
call s:X("PreProc","8fbfdc","","","LightBlue","")
hi! link Operator Structure
call s:X("Type","ffb964","","","Yellow","")
call s:X("NonText","606060",g:jellybeans_background_color,"",s:termBlack,"")
call s:X("SpecialKey","444444","1c1c1c","",s:termBlack,"")
call s:X("Search","f0a0c0","302028","underline","Magenta","")
call s:X("Directory","dad085","","","Yellow","")
call s:X("ErrorMsg","","902020","","","DarkRed")
hi! link Error ErrorMsg
hi! link MoreMsg Special
call s:X("Question","65C254","","","Green","")
" Spell Checking
call s:X("SpellBad","","902020","underline","","DarkRed")
call s:X("SpellCap","","0000df","underline","","Blue")
call s:X("SpellRare","","540063","underline","","DarkMagenta")
call s:X("SpellLocal","","2D7067","underline","","Green")
" Diff
hi! link diffRemoved Constant
hi! link diffAdded String
" VimDiff
call s:X("DiffAdd","D2EBBE","437019","","White","DarkGreen")
call s:X("DiffDelete","40000A","700009","","DarkRed","DarkRed")
call s:X("DiffChange","","2B5B77","","White","DarkBlue")
call s:X("DiffText","8fbfdc","000000","reverse","Yellow","")
" PHP
hi! link phpFunctions Function
call s:X("StorageClass","c59f6f","","","Red","")
hi! link phpSuperglobal Identifier
hi! link phpQuoteSingle StringDelimiter
hi! link phpQuoteDouble StringDelimiter
hi! link phpBoolean Constant
hi! link phpNull Constant
hi! link phpArrayPair Operator
hi! link phpOperator Normal
hi! link phpRelation Normal
hi! link phpVarSelector Identifier
" Python
hi! link pythonOperator Statement
" Ruby
hi! link rubySharpBang Comment
call s:X("rubyClass","447799","","","DarkBlue","")
call s:X("rubyIdentifier","c6b6fe","","","Cyan","")
hi! link rubyConstant Type
hi! link rubyFunction Function
call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","")
call s:X("rubySymbol","7697d6","","","Blue","")
hi! link rubyGlobalVariable rubyInstanceVariable
hi! link rubyModule rubyClass
call s:X("rubyControl","7597c6","","","Blue","")
hi! link rubyString String
hi! link rubyStringDelimiter StringDelimiter
hi! link rubyInterpolationDelimiter Identifier
call s:X("rubyRegexpDelimiter","540063","","","Magenta","")
call s:X("rubyRegexp","dd0093","","","DarkMagenta","")
call s:X("rubyRegexpSpecial","a40073","","","Magenta","")
call s:X("rubyPredefinedIdentifier","de5577","","","Red","")
" Erlang
hi! link erlangAtom rubySymbol
hi! link erlangBIF rubyPredefinedIdentifier
hi! link erlangFunction rubyPredefinedIdentifier
hi! link erlangDirective Statement
hi! link erlangNode Identifier
" JavaScript
hi! link javaScriptValue Constant
hi! link javaScriptRegexpString rubyRegexp
" CoffeeScript
hi! link coffeeRegExp javaScriptRegexpString
" Lua
hi! link luaOperator Conditional
" C
hi! link cFormat Identifier
hi! link cOperator Constant
" Objective-C/Cocoa
hi! link objcClass Type
hi! link cocoaClass objcClass
hi! link objcSubclass objcClass
hi! link objcSuperclass objcClass
hi! link objcDirective rubyClass
hi! link objcStatement Constant
hi! link cocoaFunction Function
hi! link objcMethodName Identifier
hi! link objcMethodArg Normal
hi! link objcMessageName Identifier
" Vimscript
hi! link vimOper Normal
" Debugger.vim
call s:X("DbgCurrent","DEEBFE","345FA8","","White","DarkBlue")
call s:X("DbgBreakPt","","4F0037","","","DarkMagenta")
" vim-indent-guides
if !exists("g:indent_guides_auto_colors")
let g:indent_guides_auto_colors = 0
endif
call s:X("IndentGuidesOdd","","232323","","","")
call s:X("IndentGuidesEven","","1b1b1b","","","")
" Plugins, etc.
hi! link TagListFileName Directory
call s:X("PreciseJumpTarget","B9ED67","405026","","White","Green")
if !exists("g:jellybeans_background_color_256")
let g:jellybeans_background_color_256=233
end
" Manual overrides for 256-color terminals. Dark colors auto-map badly.
if !s:low_color
hi StatusLineNC ctermbg=235
hi Folded ctermbg=236
hi FoldColumn ctermbg=234
hi SignColumn ctermbg=236
hi CursorColumn ctermbg=234
hi CursorLine ctermbg=234
hi SpecialKey ctermbg=234
exec "hi NonText ctermbg=".g:jellybeans_background_color_256
exec "hi LineNr ctermbg=".g:jellybeans_background_color_256
hi DiffText ctermfg=81
exec "hi Normal ctermbg=".g:jellybeans_background_color_256
hi DbgBreakPt ctermbg=53
hi IndentGuidesOdd ctermbg=235
hi IndentGuidesEven ctermbg=234
endif
if exists("g:jellybeans_overrides")
fun! s:load_colors(defs)
for [l:group, l:v] in items(a:defs)
call s:X(l:group, get(l:v, 'guifg', ''), get(l:v, 'guibg', ''),
\ get(l:v, 'attr', ''),
\ get(l:v, 'ctermfg', ''), get(l:v, 'ctermbg', ''))
if !s:low_color
for l:prop in ['ctermfg', 'ctermbg']
let l:override_key = '256'.l:prop
if has_key(l:v, l:override_key)
exec "hi ".l:group." ".l:prop."=".l:v[l:override_key]
endif
endfor
endif
unlet l:group
unlet l:v
endfor
endfun
call s:load_colors(g:jellybeans_overrides)
delf s:load_colors
endif
" delete functions {{{
delf s:X
delf s:rgb
delf s:color
delf s:rgb_color
delf s:rgb_level
delf s:rgb_number
delf s:grey_color
delf s:grey_level
delf s:grey_number
" }}}

View file

@ -1,438 +0,0 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" svndiff (C) 2007 Ico Doornekamp
"
" This program is free software; you can redistribute it and/or modify it
" under the terms of the GNU General Public License as published by the Free
" Software Foundation; either version 2 of the License, or (at your option)
" any later version.
"
" This program is distributed in the hope that it will be useful, but WITHOUT
" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
" more details.
"
" Introduction
" ------------
"
" NOTE: This plugin is unix-only!
"
" An small vim 7.0 plugin for showing RCS diff information in a file while
" editing. This plugin runs a diff between the current buffer and the original
" file from the version control system, and shows coloured signs indicating
" where the buffer differs from the original file from the repository. The
" original text is not shown, only signs are used to indicate where changes were
" made. With proper key bindings configured, fast navigation between changed
" blocks is also provided.
"
" Despite the name 'svndiff' this plugin supports the following RCS systems:
"
" - CVS
" - Fossil
" - Git
" - Mercurial
" - Perforce / p4
" - Subversion
"
" The type of RCS will be detected when first issuing a svndiff command on
" the file.
"
" The following symbols and syntax highlight groups are used for the signs:
"
" > DiffAdd: Newly added lines. (default=blue)
"
" ! DiffChange: Lines which are changed from the original. (default=cyan)
"
" < DiffDel: Applied to the lines directly above and below a deleted block
" (default=magenta)
"
" Usage
" -----
"
" The plugin defines one function: Svndiff(). This function figures out the
" difference between the current buffer and it's RCS original, and adds the
" signs at the places where the buffer differs from the original file from svn
" or git. You'll need to call this function after making changes to update the
" highlighting.
"
" The function takes one argument specifying an additional action to perform:
"
" "prev" : jump to the previous different block
" "next" : jump to the next different block
" "clear" : clean up all signs
"
" You might want to map some keys to run the Svndiff function. For
" example, add to your .vimrc:
"
" noremap <F3> :call Svndiff("prev")<CR>
" noremap <F4> :call Svndiff("next")<CR>
" noremap <F5> :call Svndiff("clear")<CR>
"
"
" Configuration
" -------------
"
" The following configuration variables are availabe:
"
" * g:svndiff_autoupdate
"
" If this variable is defined, svndiff will automatically update the signs
" when the user stops typing for a short while, and when leaving insert
" mode. This might slow things down on large files, so use with caution.
" The vim variable 'updatetime' can be used to set the auto-update interval,
" but note that changing this variable other effects as well. (refer to the
" vim docs for more info)
" To use, add to your .vimrc:
"
" let g:svndiff_autoupdate = 1
"
" * g:svndiff_one_sign_delete
"
" Normally, two 'delete' signs are placed around the location where
" text was deleted. When this variable is defined, only one sign is
" placed, above the location of the deleted text.
" To use, add to your .vimrc:
"
" let g:svndiff_one_sign_delete = 1
"
" Colors
" ------
"
" Personally, I find the following colours more intuitive for diff colours:
" red=deleted, green=added, yellow=changed. If you want to use these colours,
" try adding the following lines to your .vimrc
"
" hi DiffAdd ctermfg=0 ctermbg=2 guibg='green'
" hi DiffDelete ctermfg=0 ctermbg=1 guibg='red'
" hi DiffChange ctermfg=0 ctermbg=3 guibg='yellow'
"
" Changelog
" ---------
"
" 1.0 2007-04-02 Initial version
"
" 1.1 2007-04-02 Added goto prev/next diffblock commands
"
" 1.2 2007-06-14 Updated diff arguments from -u0 (obsolete) to -U0
"
" 2.0 2007-08-16 Changed from syntax highlighting to using signs, thanks
" to Noah Spurrier for the idea. NOTE: the name of the
" function changed from Svndiff_show() to Svndiff(), so
" you might need to update your .vimrc mappings!
"
" 3.0 2008-02-02 Redesign with some ideas from Jan Bezdekovsky. The
" diff is only updated when the buffer actually changes,
" cleanup of signs is now done properly and some info
" about each diff block is printed in the status line.
"
" 3.1 2008-02-04 Fixed bug that broke plugin in non-english locales, thanks
" to Bernhard Walle for the patch
"
" 3.2 2008-02-27 The latest rewrite broke vim 6 compatiblity. The plugin
" is now simply disabled for older vim versions to avoid
" a lot of warnings when loading.
"
" 4.0 2008-11-24 Added GIT support. The RCS type is now detected (svn/git)
"
" 4.1 2008-11-25 Added CVS support.
"
" 4.2 2009-07-31 Added support for proper handling of non-unix file formats
" which use different newline conventions (dos, mac)
"
" 4.3 2010-05-08 Added support for Mercurial, fixed git support (thanks
" Frankovskyi Bogdan)
"
" 4.4 2011-03-30 Added support for perforce/p4 (thanks, Timandahaf)
"
" 4.5 2011-10-09 Bugfix when trying to use svndiff in a new fileless buffer
" (Frankovskyi Bogdan)
"
" 4.6 2012-06-02 Added support for the Fossil SCM (Andrea Federico
" Grisotto)
"
" 4.7 2013-04-25 Fixed git diff when not in top git directory
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if v:version < 700
finish
endif
" Globals for this plugin
let s:sign_base = 200000 " Base for our sign id's, hoping to avoid colisions
let s:is_active = {} " dictionary with buffer names that have svndiff active
let s:rcs_type = {} " RCS type, will be autodetected to one of svn/git/hg/cvs/p4
let s:rcs_cmd = {} " Shell command to execute to get contents of clean file from RCS
let s:diff_signs = {} " dict with list of ids of all signs, per file
let s:diff_blocks = {} " dict with list of ids of first line of each diff block, per file
let s:changedtick = {} " dict with changedticks of each buffer since last invocation
let s:newline = {} " dict with newline character of each buffer
" Commands to execute to get current file contents in various rcs systems
let s:rcs_cmd_svn = "svn cat '%s'"
let s:rcs_cmd_git = "git cat-file -p HEAD:$(git ls-files --full-name '%s')"
let s:rcs_cmd_hg = "hg cat '%s'"
let s:rcs_cmd_cvs = "cvs -q update -p '%s'"
let s:rcs_cmd_p4 = "p4 print '%s'"
let s:rcs_cmd_fossil = "fossil finfo -p '%s'"
"
" Do the diff and update signs.
"
function s:Svndiff_update(...)
let fname = bufname("%")
if ! exists("s:is_active[fname]")
return 0
end
" Guess RCS type for this file
if ! has_key(s:rcs_type, fname)
" skip new files created in vim buffer
if ! filereadable(fname)
return 0
end
let info = system("LANG=C svn info " . fname)
if match(info, "Path") != -1
let s:rcs_type[fname] = "svn"
let s:rcs_cmd[fname] = s:rcs_cmd_svn
end
let info = system("git status " . fname)
if v:shell_error == 0
let s:rcs_type[fname] = "git"
let s:rcs_cmd[fname] = s:rcs_cmd_git
end
let info = system("fossil status " . fname)
if v:shell_error == 0
let s:rcs_type[fname] = "fossil"
let s:rcs_cmd[fname] = s:rcs_cmd_fossil
end
let info = system("cvs st " . fname)
if v:shell_error == 0
let s:rcs_type[fname] = "cvs"
let s:rcs_cmd[fname] = s:rcs_cmd_cvs
end
let info = system("hg status " . fname)
if v:shell_error == 0
let s:rcs_type[fname] = "hg"
let s:rcs_cmd[fname] = s:rcs_cmd_hg
end
let info = system("p4 fstat " . fname)
if match(info, "depotFile") != -1
let s:rcs_type[fname] = "p4"
let s:rcs_cmd[fname] = s:rcs_cmd_p4
end
end
" Could not detect RCS type, print message and exit
if ! has_key(s:rcs_type, fname)
echom "Svndiff: Warning, file " . fname . " is not managed by a supported versioning system!"
unlet s:is_active[fname]
return
end
" Find newline characters for the current file
if ! has_key(s:newline, fname)
let l:ff_to_newline = { "dos": "\r\n", "unix": "\n", "mac": "\r" }
let s:newline[fname] = l:ff_to_newline[&l:fileformat]
echom s:newline[fname]
end
" Check if the changedticks changed since the last invocation of this
" function. If nothing changed, there's no need to update the signs.
if exists("s:changedtick[fname]") && s:changedtick[fname] == b:changedtick
return 1
end
let s:changedtick[fname] = b:changedtick
" The diff has changed since the last time, so we need to update the signs.
" This is where the magic happens: pipe the current buffer contents to a
" shell command calculating the diff in a friendly parsable format.
let contents = join(getbufline("%", 1, "$"), s:newline[fname])
let diff = system("diff -U0 <(" . substitute(s:rcs_cmd[fname], "%s", fname, "") . ") <(cat;echo)", contents)
" clear the old signs
call s:Svndiff_clear()
" Parse the output of the diff command and put signs at changed, added and
" removed lines
for line in split(diff, '\n')
let part = matchlist(line, '@@ -\([0-9]*\),*\([0-9]*\) +\([0-9]*\),*\([0-9]*\) @@')
if ! empty(part)
let old_from = part[1]
let old_count = part[2] == '' ? 1 : part[2]
let new_from = part[3]
let new_count = part[4] == '' ? 1 : part[4]
" Figure out if text was added, removed or changed.
if old_count == 0
let from = new_from
let to = new_from + new_count - 1
let name = 'svndiff_add'
let info = new_count . " lines added"
elseif new_count == 0
let from = new_from
let to = new_from
let name = 'svndiff_delete'
let info = old_count . " lines deleted"
if ! exists("g:svndiff_one_sign_delete")
let to += 1
endif
else
let from = new_from
let to = new_from + new_count - 1
let name = 'svndiff_change'
let info = new_count . " lines changed"
endif
let id = from + s:sign_base
let s:diff_blocks[fname] += [{ 'id': id, 'info': info }]
" Add signs to mark the changed lines
let line = from
while line <= to
let id = line + s:sign_base
exec 'sign place ' . id . ' line=' . line . ' name=' . name . ' file=' . fname
let s:diff_signs[fname] += [id]
let line = line + 1
endwhile
endif
endfor
endfunction
"
" Remove all signs we placed earlier
"
function s:Svndiff_clear(...)
let fname = bufname("%")
if exists("s:diff_signs[fname]")
for id in s:diff_signs[fname]
exec 'sign unplace ' . id . ' file=' . fname
endfor
end
let s:diff_blocks[fname] = []
let s:diff_signs[fname] = []
endfunction
"
" Jump to previous diff block sign above the current line
"
function s:Svndiff_prev(...)
let fname = bufname("%")
let diff_blocks_reversed = reverse(copy(s:diff_blocks[fname]))
for block in diff_blocks_reversed
let line = block.id - s:sign_base
if line < line(".")
call setpos(".", [ 0, line, 1, 0 ])
echom 'svndiff: ' . block.info
return
endif
endfor
echom 'svndiff: no more diff blocks above cursor'
endfunction
"
" Jump to next diff block sign below the current line
"
function s:Svndiff_next(...)
let fname = bufname("%")
for block in s:diff_blocks[fname]
let line = block.id - s:sign_base
if line > line(".")
call setpos(".", [ 0, line, 1, 0 ])
echom 'svndiff: ' . block.info
return
endif
endfor
echom 'svndiff: no more diff blocks below cursor'
endfunction
"
" Wrapper function: Takes one argument, which is the action to perform:
" {next|prev|clear}
"
function Svndiff(...)
let cmd = exists("a:1") ? a:1 : ''
let fname = bufname("%")
if fname == ""
echom "Buffer has no file name, can not do a diff"
return
endif
if cmd == 'clear'
let s:changedtick[fname] = 0
if exists("s:is_active[fname]")
unlet s:is_active[fname]
endif
call s:Svndiff_clear()
end
if cmd == 'prev'
let s:is_active[fname] = 1
let ok = s:Svndiff_update()
if ok
call s:Svndiff_prev()
endif
endif
if cmd == 'next'
let s:is_active[fname] = 1
let ok = s:Svndiff_update()
if ok
call s:Svndiff_next()
endif
endif
endfunction
" Define sign characters and colors
sign define svndiff_add text=+ texthl=diffAdd
sign define svndiff_delete text=- texthl=diffDelete
sign define svndiff_change text=~ texthl=diffChange
" Define autocmds if autoupdate is enabled
if exists("g:svndiff_autoupdate")
autocmd CursorHold,CursorHoldI * call s:Svndiff_update()
autocmd InsertLeave * call s:Svndiff_update()
endif
" vi: ts=2 sw=2

3
vimrc
View file

@ -26,6 +26,7 @@ set clipboard=exclude:.*
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set list
set listchars=tab:→\ ,trail:•,nbsp
" set indentation options for specific file types
autocmd FileType ruby setlocal sts=2 sw=2 expandtab
@ -47,11 +48,9 @@ endif
" set color scheme depending on the terminal capabilities
if &t_Co > 88 || has("gui_running")
set listchars=tab:→\ ,trail:•,nbsp
colorscheme solarized
let g:solarized_italic=0
else
set listchars=tab:|\ ,trail:*,nbsp:x
colorscheme elflord
endif

60
zshrc
View file

@ -26,16 +26,19 @@ zstyle ':completion:*:processes-names' command 'ps axho command'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# variables
[[ -n ${(M)path:#~/.local/bin} ]] || path+=($HOME/.local/bin(N))
HISTFILE="$HOME/.histfile"
local_bin="${HOME}/.local/bin"
[[ -z ${(M)path:#${local_bin}} && -d ${local_bin} ]] && path+=(${local_bin})
HISTFILE="${HOME}/.histfile"
HISTSIZE=1000
SAVEHIST=1000
export LS_COLORS='no=00:fi=00:di=34:ow=34;40:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;32:*~=01;32:*#=01;32:*.bak=01;33:*.BAK=01;33:*.old=01;33:*.OLD=01;33:*.org_archive=01;33:*.off=01;33:*.OFF=01;33:*.dist=01;33:*.DIST=01;33:*.orig=01;33:*.ORIG=01;33:*.swp=01;33:*.swo=01;33:*,v=01;33:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:'
export LC_ALL='en_GB.UTF-8'
export LANG="$LC_ALL"
export LANG=${LC_ALL}
export PAGER='less'
export EDITOR='vim'
player='mpv'
viewer='eog'
# ---> prompt
PROMPT="%B%(!..%(1000#..%F{red}%n%f@))%F{blue}%m%f %F{white}%~%f %(1j.+%F{red}%j%f.)%(!.%F{red}.%F{green})%#%f%b "
@ -82,7 +85,7 @@ alias iconvuk='command iconv -c -f utf-8 -t koi8-r'
alias iconvku='command iconv -c -f koi8-r -t utf-8'
alias iconvwu='command iconv -c -f cp1251 -t utf-8'
# grc - colorize some command outputs
if [[ -x /usr/bin/grc ]]; then
if [[ -x $(whence 'grc') ]]; then
alias ping='command grc --colour=auto ping'
alias ping6='command grc --colour=auto ping'
alias traceroute='command grc --colour=auto traceroute'
@ -93,16 +96,16 @@ if [[ -x /usr/bin/grc ]]; then
alias netstat='command grc --colour=auto netstat'
fi
# ls
if [[ $OSTYPE == freebsd* ]]; then
if [[ ${OSTYPE} == freebsd* ]]; then
alias ls='command ls -G'
elif [[ $OSTYPE == linux-gnu || $OSTYPE == cygwin ]] && [[ $HOST != *pvc* ]]; then
elif [[ ${OSTYPE} == 'linux-gnu' || ${OSTYPE} == 'cygwin' ]] && [[ ${HOST} != *pvc* ]]; then
alias ls='command ls --color=auto --group-directories-first'
fi
alias la='ls -FA'
alias ll='ls -lha'
alias ld='ls -lhda'
# colordiff
if [[ -x /usr/bin/colordiff || -x $HOME/.local/bin/colordiff ]]; then
if [[ -x $(whence 'colordiff') ]]; then
alias diff='command colordiff'
fi
# mount
@ -112,8 +115,9 @@ alias mountnrg='sudo mount -o loop,offset=307200'
# git
alias gss='command git status -s'
alias gdf='command git diff'
alias gci='command git commit'
alias gci='command git commit -a'
alias gup='command git pull'
alias gpush='command git push'
# svn
alias sss='command svn status'
alias sdf='command svn diff'
@ -139,23 +143,23 @@ alias -g UK='| iconv -f utf-8 -t koi8-r'
alias -g KU='| iconv -f koi8-r -t utf-8'
# ---> suffix aliases
text=( txt xml cfg cnf conf ini erb pp )
for i in $text[@]; do
alias -s $i=$EDITOR
text=( 'txt' 'xml' 'cfg' 'cnf' 'conf' 'ini' 'erb' 'pp' )
for i in ${text[@]}; do
alias -s ${i}=${EDITOR}
done
media=( mkv mp4 avi mpg mp3 ogg mpeg mov webm flv )
for i in $media[@]; do
alias -s $i=mpv
media=( 'mkv' 'mp4' 'avi' 'mpg' 'mp3' 'ogg' 'mpeg' 'mov' 'webm' 'flv' )
for i in ${media[@]}; do
alias -s ${i}=${player}
done
image=( jpg png gif bmp jpeg )
for i in $image[@]; do
alias -s $i=eog
image=( 'jpg' 'png' 'gif' 'bmp' 'jpeg' )
for i in ${image[@]}; do
alias -s ${i}=${viewer}
done
# wine:
if [[ $OSTYPE != cygwin ]]; then
if [[ ${OSTYPE} != 'cygwin' ]]; then
alias -s exe=wine
fi
@ -171,31 +175,31 @@ function screenoffenable {
xset s on
}
function zshrc {
vim "$HOME/.zshrc"
vim "${HOME}/.zshrc"
}
autoload screenoffdisable screenoffenable
# command line syntax highlight from https://github.com/zsh-users/zsh-syntax-highlighting
#hl_script="$HOME/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
hl_script="/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
if [[ -r $hl_script ]]; then
source $hl_script
if [[ -r ${hl_script} ]]; then
source ${hl_script}
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[path]='fg=white,bold'
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=white,bold'
fi
# history substring search à la fish from https://github.com/zsh-users/zsh-history-substring-search
hs_script="$HOME/.zsh-history-substring-search/zsh-history-substring-search.zsh"
if [[ -r $hs_script ]]; then
source $hs_script
hs_script="${HOME}/.zsh-history-substring-search/zsh-history-substring-search.zsh"
if [[ -r ${hs_script} ]]; then
source ${hs_script}
bindkey "^[[A" history-substring-search-up
bindkey "^[[B" history-substring-search-down
fi
extras=( "$HOME/.zshrc.work" )
for i in $extras[@]; do
if [[ -r $i ]]; then
source $i
extras=( "${HOME}/.zshrc.extras" )
for i in ${extras[@]}; do
if [[ -r ${i} ]]; then
source ${i}
fi
done