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

257
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 runs ONLY on non-login subshells! (different from ksh)
@@ -7,109 +7,6 @@
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#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
@@ -141,103 +38,6 @@ fi
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.
@@ -249,6 +49,16 @@ kversion=`uname -v`
krelease=`uname -r`
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
#
@@ -259,8 +69,7 @@ elif [ $kernel == SunOS ]; then
fi
MYSCRIPTS=$HOME/devel/scripts
PATH=$MYLOCAL/bin:$PATH
PATH=$MYSCRIPTS/bash:$PATH
PATH=$MYSCRIPTS/bloomberg:$PATH
PATH=$MYSCRIPTS/bin:$PATH
#
# VIM
@@ -319,36 +128,28 @@ 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
#
alias ll='ls -la --color=tty'
alias cd='pushd >/dev/null'
alias bd='popd'
alias bb='pushd $HOME/devel/bb >/dev/null'
alias cgrep="grep --include \*.cpp --include \*.h --include \*.c --color=auto"
#complete -f --X '!*.mk' plink
if [ $kernel == AIX ]; then
alias l='ls -a'
alias ls='ls -a'
alias ll='ls -la'
alias pd='pushd >/dev/null'
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

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
[include]
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
bind C-a send-prefix
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
setw -g mode-keys vi
set -g status-position top
set -g default-terminal "screen-256color"
set-window-option -g xterm-keys on
set -g mode-mouse off
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of 'Enter' to also use copy-pipe
#unbind -t vi-copy Enter
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
#bind p paste-buffer
bind h select-pane -L
@@ -18,10 +35,16 @@ bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r C-h resize-pane -L
bind -r C-j resize-pane -D
bind -r C-k resize-pane -U
bind -r C-l resize-pane -R
#bind -r C-h resize-pane -L
#bind -r C-j resize-pane -D
#bind -r C-k resize-pane -U
#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 \
set -g mode-mouse on \;\
@@ -29,7 +52,8 @@ bind m \
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
bind m \
bind M \
set -g mode-mouse off \;\
set -g mouse-resize=pane off \;\
set -g mouse-select-pane 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

@@ -264,6 +264,11 @@ function! s:clearOutputWindow()
execute cwinnr . 'wincmd w'
endif
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Public interface.
""
"
" Load compile instructions and call window or linux compiler. {{{1
"
@@ -292,4 +297,16 @@ function! CF5Compile(run)
"
call s:Compile(a:run)
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
" Act when creating or loading a file
augroup LocalVimrc
au BufNewFile,BufRead * call s:LoadConfig()
au BufNewFile,BufRead * call s:LocalVimrcLoadForFile()
augroup END
" Function: LoadConfig()
"
" If the file .vimrc exists in the root of a git project - load it
function s:LoadConfig()
" If the file .vimrc exists in the path - load it
function s:LocalVimrcLoadForFile()
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)
return
endif

View File

@@ -18,7 +18,7 @@ set fileformat=unix
set nobackup
"set backupdir="~/tmp,." git commit doesn't work.
" Try to set up UTF-8 encoding.
if has("multi_byte")
if has('multi_byte')
if &termencoding == ""
let &termencoding = &encoding
endif
@@ -85,11 +85,20 @@ set cino+=(0
" enable omni completion
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
let g:netrw_preview = 1 " netrw open window to the right
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 timeoutlen=400
"set autoread "update file modified outside of vim
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
@@ -125,7 +132,7 @@ endif
"
" Configure color theme, fonts and other graphics.
"
if has("gui_running")
if has('gui_running')
" set color scheme
colorscheme darkblue
"set guioptions-=m
@@ -147,7 +154,7 @@ endif
" Switch syntax highlighting on, when the terminal has colors
" 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
set hlsearch
endif
@@ -168,16 +175,16 @@ set cmdheight=2
set laststatus=2
" Display the cursor position on the last line of the screen or in the status
" line of a window
if exists('&ruler')
if exists('+ruler')
set ruler
endif
" Instead of failing a command because of unsaved changes, raise a dialogue
" asking if you wish to save changed files.
if exists('&confirm')
if exists('+confirm')
set confirm
endif
" Use visual bell instead of beeping when doing something wrong
if exists('&visualbell')
if exists('+visualbell')
set visualbell
" 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
@@ -185,17 +192,17 @@ if exists('&visualbell')
set t_vb=
endif
" Display line numbers on the left
if exists('&number')
if exists('+number')
set number
endif
" Turn on spell check.
if exists("+spell") && &diff=="nodiff"
if exists('+spell') && !&diff
set spell
highlight clear SpellBad
highlight SpellBad cterm=underline ctermfg=red
endif
" Show 80th column.
if exists("+colorcolumn")
if exists('+colorcolumn')
set colorcolumn=+1 " color textwidth+1-th line
endif
@@ -227,14 +234,12 @@ endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vimdiff
"
" Turn on spell check.
if &diff=="diff"
if &diff
"turn off spelling
set nospell
@@ -245,6 +250,9 @@ if &diff=="diff"
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TODO: review
"
@@ -267,12 +275,6 @@ if exists('&hidden')
set hidden
endif
" Modelined are used to configure files.
if exists('&modeline')
set modeline
set modelines=10
endif
" Set fold method if supported
if has('folding')
set nofoldenable
@@ -290,7 +292,7 @@ if has('folding')
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
if has('autocmd')
" Enable file type detection.
" 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}
" 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>
"
" 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
@@ -365,8 +382,8 @@ map <C-F3> :execute "grep " . expand("<cword>") . " -r --include \*.h --include
if !exists('*CF5Compile')
runtime plugin/cf5-compiler.vim
endif
map <silent> <C-F5> :call CF5Compile(1)<CR>
map <silent> <F5> :call CF5Compile(0)<CR>
map <silent> a4 :call CF5CompileOnly()<CR>
map <silent> a5 :call CF5CompileAndRun()<CR>
"
" 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.
@@ -377,8 +394,8 @@ inoremap <C-U> <C-G>u<C-U>
"
noremap <Up> gk
noremap <Down> gj
imap <Up> <C-O>gk
imap <Down> <C-O>gj
"imap <Up> <C-O>gk
"imap <Down> <C-O>gj
"
" Working with tabs especially if using console version.
"
@@ -389,6 +406,14 @@ nnoremap tl :tablast<CR>
nnoremap tm :tabm<Space>
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
"
@@ -396,7 +421,7 @@ nnoremap td :tabclose<CR>
"
" Vundle experimental stuff here.
"
if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md'))
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
@@ -416,8 +441,8 @@ if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
Plugin 'vim-scripts/Buffergator'
let g:buffergator_suppress_keymaps = 1
let g:buffergator_viewport_split_policy = "L"
map <C-b> :BuffergatorToggle<CR>
map <C-B> :BuffergatorTabsToggle<CR>
map ab :BuffergatorToggle<CR>
"map at :BuffergatorTabsToggle<CR>
"
"
@@ -439,9 +464,11 @@ if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
Plugin 'scrooloose/nerdtree'
let g:NERDTreeQuitOnOpen = 1
let g:NERDTreeDirArrows = 1
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
let g:NERDTreeIgnore = ['\.o$', '\.so$', '\.tsk$']
map <C-n> :NERDTreeToggle<CR>
map <C-m> :NERDTreeFind<CR>
map at :NERDTreeToggle<CR>
"map am :NERDTreeFind<CR>
"
" :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_cpp = "h"
let g:alternateExtensions_c = "h"
map ah :A<CR>
"
" Comment code.