Merge branch 'master' of bitbucket.org:vishap/scripts

This commit is contained in:
2016-04-24 22:20:47 +00:00
21 changed files with 288 additions and 319 deletions

327
config/.bashrc Normal file → Executable file
View File

@@ -1,4 +1,4 @@
# ~/.bashrc: executed by bash(1) for non-login shells. #!/bin/bash
# ~/.bashrc skeleton # ~/.bashrc skeleton
# ~/.bashrc runs ONLY on non-login subshells! (different from ksh) # ~/.bashrc runs ONLY on non-login subshells! (different from ksh)
@@ -7,240 +7,40 @@
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#echo "BASHRC has run" #echo "BASHRC has run"
# 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
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# 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
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[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 grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll='ls -lAF'
# 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
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# #
# Source global definitions # Source global definitions
# #
if [ -f /etc/bashrc ]; then if [ -f /etc/bashrc ]; then
. /etc/bashrc . /etc/bashrc
else else
# are we an interactive shell? # are we an interactive shell?
if [ "$PS1" ]; then if [ "$PS1" ]; then
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"' PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
# Turn on checkwinsize # Turn on checkwinsize
shopt -s checkwinsize shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
fi fi
if ! shopt -q login_shell ; then # We're not a login shell if ! shopt -q login_shell ; then # We're not a login shell
for i in /etc/profile.d/*.sh; do for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then if [ -r "$i" ]; then
if [ "$PS1" ]; then if [ "$PS1" ]; then
. $i . $i
else else
. $i &>/dev/null . $i &>/dev/null
fi fi
fi fi
done done
unset i unset i
fi fi
fi fi
umask 002 umask 002
#
#alias dirs='dirs -v'
#alias ack='ack --ignore-file=ext:d,dd'
#
#alias dirtree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' "
#alias currgit='cd /bb/mbig/mbig1205/devgit/s_tktapi2/src; echo -e "I am here $(pwd)"'
#alias tktapi='cd /bb/mbig/mbig1205/devgit/tktapi/src; echo -e "I am here $(pwd) \n $(ls)"'
#alias bastest='/bbsrc/abin/basclient'
#alias bas_codegen='/bb/shared/bin/bas_codegen.pl'
#alias metasymfind="cat - | awk '{ print \$1 }' | xargs symfind | awk 'BEGIN{FS=\"[\"} { print \$1 }' | sort | uniq | tr '\n' ' ' | sed -e 's/\(\b\S\)/-l\1/g' && echo \"\""
#
#alias git-robo='ssh devgit svnsync $(git remote -v | grep "(fetch)" | cut -d ":" -f2 | cut -d "(" -f1); git fetch origin; git pull; git merge robo/trunk; read -p "!!!!! PUSH the merged version back !!!!! ? [Y] / Ctrl+C to stop"; git push'
#alias intuorcreate=/bbsrc/internal/isystest/uorcreate/intuorcreate
#
#
#export EDITOR=/opt/swt/bin/nedit
#export TERM=xterm
#
#export BIGHOME=/bb/mbig/mbig1205
#export PLINK_PARALLEL_BUILD=true
#export EDITOR=/opt/swt/bin/nedit
#export PAGER=less
#export GROUP=trading-systems-group
#export mysvn="svn+ssh://devsvn"
#export myrobosvn="svn+ssh://devsvn/robo/branches/trunk"
#export PATH=/opt/swt/bin:~/bin:/bb/util/common/studio12/SUNWspro/bin:${PATH}
#export DEVGIT=${BIGHOME}/devgit
#export VISUAL=/opt/swt/bin/nedit
#export MAIL=/usr/mail/${LOGNAME:?}
#
#codegrep() {
# if [[ $# -eq 0 ]]
# then
# echo "Usage: codegrep <pattern> "
# else
# grep -nT --colour \
# --exclude=tags \
# --exclude=*.o \
# --exclude=*.so \
# --exclude=*.tsk \
# --exclude=*.d \
# --exclude=*.dd \
# "$1" *
# fi
#}
#
##ssh() {
# #echo "wut"
# #[[ -n "$INSCREEN" ]] && TERM=screen-256color
# #env ssh -t $*
# #$SCREEN_TITLE_CMD
##}
#
#sshcd() {
# if [[ $# -lt 1 ]]
# then
# echo "Usage: sshcd <server> [<path>]"
# else
# ssh -t $LOGNAME@$1 "export SSHCDPATH=${path:-$(pwd)}; exec $BASH --login "
# fi
#}
#
#biggest() {
# dir=${1:-.}
# find $dir -type f -exec du -a {} \+ | sort -rn
#}
#
## Screen variables
#function last2dirs {
# pwd | awk -F\/ '{print $(NF-1),$(NF)}' | sed 's# #/#'
#}
#
##screen specific functionality
##if [[ -n ${STY} ]]
##then
# PROMPT_COMMAND='echo -ne "\033k${HOSTNAME} $(last2dirs)\033\\";
# history -a;'
##fi
#
#function dupscreen {
# screen bash -c "export SSHCDPATH=$PWD && exec $SHELL --login"
#}
#
#if [ -n "$BBENV" ] && [[ -f ~/bin/hijackEOD.sh ]]
#then
# source `which hijackEOD.sh`
#fi
#
#
#
# Don't source the rest twice.
#
#if [ "$BASHRC_VAHAGNK_DONT_SOURCE_THIS_FILE_TWICE" == "true" ]; then
# return
#fi
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# #
# Find out system details. # Find out system details.
# #
os=`uname -o` #GNU/Linux AIX Solaris os=`uname -o` #GNU/Linux AIX Solaris
cpu=`uname -p` #x86_64 powerpc sparc cpu=`uname -p` #x86_64 powerpc sparc
@@ -249,6 +49,16 @@ kversion=`uname -v`
krelease=`uname -r` krelease=`uname -r`
hostnm=`hostname` hostnm=`hostname`
#
# If there is no terminal info in the system for current terminal but there is
# one in local terminfo then use it.
#
/bin/tput -T $TERM longname 2>/dev/null >/dev/null
if [[ $? -ne 0 && -f $HOME/.terminfo/$kernel/${TERM:0:1}/$TERM ]]; then
export TERMINFO=$HOME/.terminfo/$kernel;
fi
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# #
# User specific environment and startup programs # User specific environment and startup programs
# #
@@ -259,28 +69,27 @@ elif [ $kernel == SunOS ]; then
fi fi
MYSCRIPTS=$HOME/devel/scripts MYSCRIPTS=$HOME/devel/scripts
PATH=$MYLOCAL/bin:$PATH PATH=$MYLOCAL/bin:$PATH
PATH=$MYSCRIPTS/bash:$PATH PATH=$MYSCRIPTS/bin:$PATH
PATH=$MYSCRIPTS/bloomberg:$PATH
# #
# VIM # VIM
# #
#VIMDIR=/depot/vim-7.3/bin #VIMDIR=/depot/vim-7.3/bin
#VIM=${VIMDIR}/vim #VIM=${VIMDIR}/vim
#if [ "$kernel" == "Linux" ]; then #if [ "$kernel" == "Linux" ]; then
# alias vi=$VIM # alias vi=$VIM
# alias vim=$VIM # alias vim=$VIM
# alias gvim=${VIMDIR}/gvim # alias gvim=${VIMDIR}/gvim
# alias ctags="/depot/ctag-5.5.4/bin/ctags" # alias ctags="/depot/ctag-5.5.4/bin/ctags"
#fi #fi
# #
# GIT # GIT
# #
[ -f $MYSCRIPTS/bash/git-completion.bash ] && . $MYSCRIPTSE/bash/git-completion.bash [ -f $MYSCRIPTS/bash/git-completion.bash ] && . $MYSCRIPTSE/bash/git-completion.bash
# #
# GCC # GCC
# #
#if [ -e /depot/gcc-4.7.2/bin ]; then #if [ -e /depot/gcc-4.7.2/bin ]; then
# PATH=/depot/gcc-4.7.2/bin:$PATH # PATH=/depot/gcc-4.7.2/bin:$PATH
@@ -294,18 +103,18 @@ PATH=$MYSCRIPTS/bloomberg:$PATH
#fi #fi
# #
# GDB # GDB
# #
#prepath /depot/gdb-7.5.1/bin #prepath /depot/gdb-7.5.1/bin
# #
# VTune Amplifier # VTune Amplifier
# #
#export INTEL_LICENSE_FILE=28518@us01-lic10:28518@us01-lic11:28518@us01-lic12:28518@tyndall #export INTEL_LICENSE_FILE=28518@us01-lic10:28518@us01-lic11:28518@us01-lic12:28518@tyndall
#alias vtune=/depot/vtune_amplifier_xe_2013_update5/bin64/amplxe-gui #alias vtune=/depot/vtune_amplifier_xe_2013_update5/bin64/amplxe-gui
# #
# PURIFY and all. # PURIFY and all.
# #
#postpath /depot/coverity/swat/bin #postpath /depot/coverity/swat/bin
#export RSU_TEMPLATE2_INI=/depot/pure/templates2.ini #export RSU_TEMPLATE2_INI=/depot/pure/templates2.ini
@@ -319,42 +128,34 @@ PATH=$MYSCRIPTS/bloomberg:$PATH
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# #
# BLOOMBERG and TOMS # Run local settings.
# #
[ -f $PWD/.bashrc.local ] && . $PWD/.bashrc.local
# if chimera generated aliases exist, pull them into the current ENV # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ -f ~/.bbalias ] && . ~/.bbalias
export BB=$HOME/devel/bb
export DEVGIT=$BB/devgit
PATH=$PATH:$BB/scripts
getpw() { # BOX
if [[ $# -ne 1 ]]; then
echo "Usage: getpw <machine>"
else
local BOX="$1"
local BIN="/bb/bin/getprdwin"
$BIN -u op1 -i -s $BOX -d "op1 for $USER on $BOX"
fi
}
alias create_tags='/opt/swt/bin/ctags -R --verbose --exclude=.git --exclude=.doxygen --exclude="*.o" --exclude="llcalc*"'
# #
# set alias # set alias
# #
alias ll='ls -la --color=tty' if [ $kernel == AIX ]; then
alias cd='pushd >/dev/null' alias l='ls -a'
alias bd='popd' alias ls='ls -a'
alias bb='pushd $HOME/devel/bb >/dev/null' alias ll='ls -la'
alias cgrep="grep --include \*.cpp --include \*.h --include \*.c --color=auto" alias pd='pushd >/dev/null'
#complete -f --X '!*.mk' plink alias bd='popd'
else
alias l='ls -a --color=tty'
alias ls='ls -a --color=tty'
alias ll='ls -la --color=tty'
alias pd='pushd >/dev/null'
alias bd='popd'
fi
alias cgrep="grep --include \*.cpp --include \*.h --include \*.c"
# #
# Make sure to export PATH # Make sure to export PATH
# #
export PATH export PATH
#export LM_LICENSE_FILE #export LM_LICENSE_FILE
export HISTFILESIZE=5000 # Store 5000 commands in history export HISTFILESIZE=5000 # Store 5000 commands in history
export HISTCONTROL=ignoredups # Don't put duplicate lines in the history. export HISTCONTROL=ignoredups # Don't put duplicate lines in the history.

5
config/.ctags Normal file
View File

@@ -0,0 +1,5 @@
# Basic options
--recurse=yes
--tag-relative=yes
--exclude=.git

View File

@@ -21,3 +21,5 @@
prompt = false prompt = false
[include] [include]
path = ~/.gitconfig.local path = ~/.gitconfig.local
[core]
excludesfile = ~/.gitignore.global

5
config/.gitignore.global Normal file
View File

@@ -0,0 +1,5 @@
*.swp
*.o
*.d
plink.log
llcalc_*

View File

@@ -1,16 +1,33 @@
#
# Ctrl-a is the prefix.
#
set -g prefix C-a set -g prefix C-a
bind C-a send-prefix bind C-a send-prefix
unbind C-b unbind C-b
set-option -g history-limit 10000 # Start windows from #1 (default #0)
set -g base-index 1
# Status bar is on top.
set -g status-position top
set -g status-utf8 on
# Keep this much of history per window.
set -g history-limit 100000
# 256color mode.
set -g default-terminal "screen-256color"
setw -g xterm-keys on
# VI mode
set -g status-keys vi set -g status-keys vi
setw -g mode-keys vi setw -g mode-keys vi
set -g status-position top # Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
set -g default-terminal "screen-256color" bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
set-window-option -g xterm-keys on # Update default binding of 'Enter' to also use copy-pipe
set -g mode-mouse off #unbind -t vi-copy Enter
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
#bind p paste-buffer #bind p paste-buffer
bind h select-pane -L bind h select-pane -L
@@ -18,10 +35,16 @@ bind j select-pane -D
bind k select-pane -U bind k select-pane -U
bind l select-pane -R bind l select-pane -R
bind -r C-h resize-pane -L #bind -r C-h resize-pane -L
bind -r C-j resize-pane -D #bind -r C-j resize-pane -D
bind -r C-k resize-pane -U #bind -r C-k resize-pane -U
bind -r C-l resize-pane -R #bind -r C-l resize-pane -R
#No mouse
set -g mode-mouse off
set -g mouse-select-pane off
set -g mouse-resize-pane off
set -g mouse-select-window off
bind m \ bind m \
set -g mode-mouse on \;\ set -g mode-mouse on \;\
@@ -29,7 +52,8 @@ bind m \
set -g mouse-select-pane on \;\ set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\ set -g mouse-select-window on \;\
display 'Mouse: ON' display 'Mouse: ON'
bind m \ bind M \
set -g mode-mouse off \;\
set -g mouse-resize=pane off \;\ set -g mouse-resize=pane off \;\
set -g mouse-select-pane off \;\ set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\ set -g mouse-select-window off \;\

2
terminfo/README Normal file
View File

@@ -0,0 +1,2 @@
Hint: use 'tic' to compile terminfo files.
tic -o <dir> <file.terminfo>

View File

@@ -0,0 +1,27 @@
# Reconstructed via infocmp from file: /opt/bb/share/terminfo/s/screen-256color
screen-256color|GNU Screen with 256 colors,
am, km, mir, msgr, xenl,
colors#256, cols#80, it#8, lines#24, pairs#32767,
acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0,
flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@,
il=\E[%p1%dL, il1=\E[L, ind=^J, initc@, is2=\E)0, kbs=^H,
kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O,
rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m,
rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h,
smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g,

View File

@@ -0,0 +1,51 @@
# Reconstructed via infocmp from file: /opt/bb/share/terminfo/x/xterm-256color
xterm-256color|xterm with 256 colors,
am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
colors#256, cols#80, it#8, lines#24, pairs#32767,
acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
ind=^J, indn=\E[%p1%dS,
initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~,
kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D,
kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H,
kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m,
rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

View File

@@ -128,7 +128,7 @@ function! s:CompileMSVC(run) "{{{2
endif endif
endfunction endfunction
" "
" GCC " GCC
" "
function! s:CompileGCC(run) "{{{2 function! s:CompileGCC(run) "{{{2
@@ -138,7 +138,7 @@ function! s:CompileGCC(run) "{{{2
let ccline="g++ ".g:cppflags." ".g:lcppflags." ".g:ldflags." ".srcname." -o".exename let ccline="g++ ".g:cppflags." ".g:lcppflags." ".g:ldflags." ".srcname." -o".exename
call s:appendOutput(ccline) call s:appendOutput(ccline)
let cout = system( ccline ) let cout = system( ccline )
if v:shell_error if v:shell_error
call s:appendOutput(cout) call s:appendOutput(cout)
return return
endif endif
@@ -228,7 +228,7 @@ function! s:getOutputWindow()
if (winnr < 0) if (winnr < 0)
execute "below 10new ".obuff execute "below 10new ".obuff
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
" setlocal nomodifiable " setlocal nomodifiable
let winnr = bufwinnr('^'.obuff.'$') let winnr = bufwinnr('^'.obuff.'$')
endif endif
@@ -241,10 +241,10 @@ function! s:appendOutput( text )
if exists("g:cf5output") && (g:cf5output==1) if exists("g:cf5output") && (g:cf5output==1)
let cwinnr = winnr() let cwinnr = winnr()
let owinnr = s:getOutputWindow() let owinnr = s:getOutputWindow()
" setlocal modifiable " setlocal modifiable
execute owinnr . 'wincmd w' execute owinnr . 'wincmd w'
execute 'normal! Go'.a:text execute 'normal! Go'.a:text
" setlocal nomodifiable " setlocal nomodifiable
execute cwinnr.'wincmd w' execute cwinnr.'wincmd w'
else else
echo a:text echo a:text
@@ -257,13 +257,18 @@ function! s:clearOutputWindow()
if exists("g:cf5output") && (g:cf5output==1) if exists("g:cf5output") && (g:cf5output==1)
let cwinnr = winnr() let cwinnr = winnr()
let owinnr = s:getOutputWindow() let owinnr = s:getOutputWindow()
" setlocal modifiable " setlocal modifiable
execute owinnr . 'wincmd w' execute owinnr . 'wincmd w'
execute 'normal ggdG' execute 'normal ggdG'
" setlocal nomodifiable " setlocal nomodifiable
execute cwinnr . 'wincmd w' execute cwinnr . 'wincmd w'
endif endif
endfunction endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Public interface.
""
" "
" Load compile instructions and call window or linux compiler. {{{1 " Load compile instructions and call window or linux compiler. {{{1
" "
@@ -292,4 +297,16 @@ function! CF5Compile(run)
" "
call s:Compile(a:run) call s:Compile(a:run)
endfunction endfunction
"
" Load compile instructions and call window or linux compiler.
"
function! CF5CompileAndRun()
call CF5Compile(1)
endfunction
"
" Load compile instructions and call window or linux compiler.
"
function! CF5CompileOnly()
call CF5Compile(0)
endfunction

View File

@@ -26,14 +26,22 @@ let g:loaded_local_vimrc=1
" Section: Event group setup " Section: Event group setup
" Act when creating or loading a file " Act when creating or loading a file
augroup LocalVimrc augroup LocalVimrc
au BufNewFile,BufRead * call s:LoadConfig() au BufNewFile,BufRead * call s:LocalVimrcLoadForFile()
augroup END augroup END
" Function: LoadConfig() " Function: LoadConfig()
" "
" If the file .vimrc exists in the root of a git project - load it " If the file .vimrc exists in the path - load it
function s:LoadConfig() function s:LocalVimrcLoadForFile()
let l:path = fnameescape(expand("%:p:h")) let l:path = fnameescape(expand("%:p:h"))
call g:LocalVimrcLoad( l:path )
endfunction
" Function: LocalVimrcLoad()
"
" If the file .vimrc exists in the path - load it
function! g:LocalVimrcLoad(path)
let l:path = a:path
if empty(l:path) if empty(l:path)
return return
endif endif

View File

@@ -18,7 +18,7 @@ set fileformat=unix
set nobackup set nobackup
"set backupdir="~/tmp,." git commit doesn't work. "set backupdir="~/tmp,." git commit doesn't work.
" Try to set up UTF-8 encoding. " Try to set up UTF-8 encoding.
if has("multi_byte") if has('multi_byte')
if &termencoding == "" if &termencoding == ""
let &termencoding = &encoding let &termencoding = &encoding
endif endif
@@ -85,11 +85,20 @@ set cino+=(0
" enable omni completion " enable omni completion
set omnifunc=syntaxcomplete#Complete set omnifunc=syntaxcomplete#Complete
" If modlines available then turn it on so each file could set its settings.
" ex. # vim: set expandtab:
if exists('+modeline')
set modeline
set modelines=5
endif
" read/write a .viminfo file, don't store more
if exists('+viminfo')
set viminfo='20,\"50
endif
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers " than 50 lines of registers
let g:netrw_preview = 1 " netrw open window to the right let g:netrw_preview = 1 " netrw open window to the right
let g:netrw_browse_split = 3 " open in a tab let g:netrw_browse_split = 3 " open in a tab
@@ -102,8 +111,6 @@ set ttyfast "tf "smooths redraw by using more bandwidth
" Set timeout for detecting command key sequence " Set timeout for detecting command key sequence
set timeoutlen=400 set timeoutlen=400
"set autoread "update file modified outside of vim
" Quickly time out on keycodes, but never time out on mappings " Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200 set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste' " Use <F11> to toggle between 'paste' and 'nopaste'
@@ -125,7 +132,7 @@ endif
" "
" Configure color theme, fonts and other graphics. " Configure color theme, fonts and other graphics.
" "
if has("gui_running") if has('gui_running')
" set color scheme " set color scheme
colorscheme darkblue colorscheme darkblue
"set guioptions-=m "set guioptions-=m
@@ -147,7 +154,7 @@ endif
" Switch syntax highlighting on, when the terminal has colors " Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern. " Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running") if &t_Co > 2 || has('gui_running')
syntax on syntax on
set hlsearch set hlsearch
endif endif
@@ -168,16 +175,16 @@ set cmdheight=2
set laststatus=2 set laststatus=2
" Display the cursor position on the last line of the screen or in the status " Display the cursor position on the last line of the screen or in the status
" line of a window " line of a window
if exists('&ruler') if exists('+ruler')
set ruler set ruler
endif endif
" Instead of failing a command because of unsaved changes, raise a dialogue " Instead of failing a command because of unsaved changes, raise a dialogue
" asking if you wish to save changed files. " asking if you wish to save changed files.
if exists('&confirm') if exists('+confirm')
set confirm set confirm
endif endif
" Use visual bell instead of beeping when doing something wrong " Use visual bell instead of beeping when doing something wrong
if exists('&visualbell') if exists('+visualbell')
set visualbell set visualbell
" And reset the terminal code for the visual bell. If visualbell is set, and " And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell " this line is also included, vim will neither flash nor beep. If visualbell
@@ -185,17 +192,17 @@ if exists('&visualbell')
set t_vb= set t_vb=
endif endif
" Display line numbers on the left " Display line numbers on the left
if exists('&number') if exists('+number')
set number set number
endif endif
" Turn on spell check. " Turn on spell check.
if exists("+spell") && &diff=="nodiff" if exists('+spell') && !&diff
set spell set spell
highlight clear SpellBad highlight clear SpellBad
highlight SpellBad cterm=underline ctermfg=red highlight SpellBad cterm=underline ctermfg=red
endif endif
" Show 80th column. " Show 80th column.
if exists("+colorcolumn") if exists('+colorcolumn')
set colorcolumn=+1 " color textwidth+1-th line set colorcolumn=+1 " color textwidth+1-th line
endif endif
@@ -227,14 +234,12 @@ endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vimdiff " vimdiff
" "
" Turn on spell check. " Turn on spell check.
if &diff=="diff" if &diff
"turn off spelling "turn off spelling
set nospell set nospell
@@ -245,6 +250,9 @@ if &diff=="diff"
endif endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TODO: review
"
@@ -267,12 +275,6 @@ if exists('&hidden')
set hidden set hidden
endif endif
" Modelined are used to configure files.
if exists('&modeline')
set modeline
set modelines=10
endif
" Set fold method if supported " Set fold method if supported
if has('folding') if has('folding')
set nofoldenable set nofoldenable
@@ -290,7 +292,7 @@ if has('folding')
endif endif
" Only do this part when compiled with support for autocommands. " Only do this part when compiled with support for autocommands.
if has("autocmd") if has('autocmd')
" Enable file type detection. " Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72, " Use the default filetype settings, so that mail gets 'tw' set to 72,
@@ -332,7 +334,7 @@ endif " has("autocmd")
" "
" "
if has("gui_running") if has('gui_running')
":tab drop {file} ":tab drop {file}
" Hide show menu and toolbar. " Hide show menu and toolbar.
@@ -354,9 +356,24 @@ map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
"map <silent> <C-F3> :tabnew<CR> "map <silent> <C-F3> :tabnew<CR>
" "
" F4 grep the word under cursor. " Grep the word under cursor.
" "
map <C-F3> :execute "grep " . expand("<cword>") . " -r --include \*.h --include \*.cpp --include \*.c --include \*.f ." <Bar> cw<CR> " Grep options affect GNU grep. The intend is that greps not supporting the
" options will continue working without options.
"
let $GREP_OPTIONS.=' --exclude-dir=.git --exclude-dir=.svn'
let $GREP_OPTIONS.=' --exclude=tags --exclude=*.o --exclude=*.log'
let $GREP_OPTIONS.=' --exclude=*.swp'
let $GREP_OPTIONS.=' --exclude-dir=llcalc* --exclude-dir=00*'
"let $GREP_OPTIONS.=' --include *.sh'
"let $GREP_OPTIONS.=' --include *.php'
"let $GREP_OPTIONS.=' --include *.h --include *.cpp --include *.c'
"let $GREP_OPTIONS.=' --include *.py'
"let $GREP_OPTIONS.=' --include *.java'
"let $GREP_OPTIONS.=' --include *.f'
"let $GREP_OPTIONS.=' --include *.xsd --include *.xml'
"let $GREP_OPTIONS.=' --include Makefile'
map af :execute "grep! ".expand("<cword>")." -r ." <Bar> cw<CR>
" "
" Loads CF5Compile " Loads CF5Compile
@@ -365,8 +382,8 @@ map <C-F3> :execute "grep " . expand("<cword>") . " -r --include \*.h --include
if !exists('*CF5Compile') if !exists('*CF5Compile')
runtime plugin/cf5-compiler.vim runtime plugin/cf5-compiler.vim
endif endif
map <silent> <C-F5> :call CF5Compile(1)<CR> map <silent> a4 :call CF5CompileOnly()<CR>
map <silent> <F5> :call CF5Compile(0)<CR> map <silent> a5 :call CF5CompileAndRun()<CR>
" "
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break. " so that you can undo CTRL-U after inserting a line break.
@@ -377,8 +394,8 @@ inoremap <C-U> <C-G>u<C-U>
" "
noremap <Up> gk noremap <Up> gk
noremap <Down> gj noremap <Down> gj
imap <Up> <C-O>gk "imap <Up> <C-O>gk
imap <Down> <C-O>gj "imap <Down> <C-O>gj
" "
" Working with tabs especially if using console version. " Working with tabs especially if using console version.
" "
@@ -389,6 +406,14 @@ nnoremap tl :tablast<CR>
nnoremap tm :tabm<Space> nnoremap tm :tabm<Space>
nnoremap td :tabclose<CR> nnoremap td :tabclose<CR>
"
" Locate and load .vimrc.local from curent directory.
"
if !exists('*LocalVimrcLoad')
runtime plugin/local-vimrc.vim
endif
call LocalVimrcLoad( getcwd() )
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins " Plugins
" "
@@ -396,7 +421,7 @@ nnoremap td :tabclose<CR>
" "
" Vundle experimental stuff here. " Vundle experimental stuff here.
" "
if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md")) if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md'))
filetype off filetype off
set rtp+=~/.vim/bundle/Vundle.vim set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin() call vundle#begin()
@@ -416,8 +441,8 @@ if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
Plugin 'vim-scripts/Buffergator' Plugin 'vim-scripts/Buffergator'
let g:buffergator_suppress_keymaps = 1 let g:buffergator_suppress_keymaps = 1
let g:buffergator_viewport_split_policy = "L" let g:buffergator_viewport_split_policy = "L"
map <C-b> :BuffergatorToggle<CR> map ab :BuffergatorToggle<CR>
map <C-B> :BuffergatorTabsToggle<CR> "map at :BuffergatorTabsToggle<CR>
" "
" "
@@ -439,9 +464,11 @@ if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
Plugin 'scrooloose/nerdtree' Plugin 'scrooloose/nerdtree'
let g:NERDTreeQuitOnOpen = 1 let g:NERDTreeQuitOnOpen = 1
let g:NERDTreeDirArrows = 1 let g:NERDTreeDirArrows = 1
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
let g:NERDTreeIgnore = ['\.o$', '\.so$', '\.tsk$'] let g:NERDTreeIgnore = ['\.o$', '\.so$', '\.tsk$']
map <C-n> :NERDTreeToggle<CR> map at :NERDTreeToggle<CR>
map <C-m> :NERDTreeFind<CR> "map am :NERDTreeFind<CR>
" "
" :A switches to the header file (or vise versa) " :A switches to the header file (or vise versa)
@@ -463,7 +490,7 @@ if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
let g:alternateExtensions_h = "cpp,c" let g:alternateExtensions_h = "cpp,c"
let g:alternateExtensions_cpp = "h" let g:alternateExtensions_cpp = "h"
let g:alternateExtensions_c = "h" let g:alternateExtensions_c = "h"
map ah :A<CR>
" "
" Comment code. " Comment code.