From a3579a36a0bd5f05aab9992d109158110f89c2eb Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Wed, 10 Feb 2016 12:50:57 -0500 Subject: [PATCH 1/8] .ctags added. --- config/.ctags | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 config/.ctags diff --git a/config/.ctags b/config/.ctags new file mode 100644 index 0000000..36b03aa --- /dev/null +++ b/config/.ctags @@ -0,0 +1,5 @@ +# Basic options +--recurse=yes +--tag-relative=yes +--exclude=.git + From 1ead0fd7c6127ef77a4dab7267a452c9e5a39377 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Wed, 10 Feb 2016 12:52:24 -0500 Subject: [PATCH 2/8] .tmux.conf revisited. --- config/.tmux.conf | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/config/.tmux.conf b/config/.tmux.conf index b4c8e45..65ad295 100644 --- a/config/.tmux.conf +++ b/config/.tmux.conf @@ -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 \;\ From 7b539d82a2004309a9e5a7659eb9762af328fa85 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Fri, 18 Mar 2016 05:30:16 -0400 Subject: [PATCH 3/8] Moving company specific files to local. --- {mg => local/mg}/.vimrc.local | 0 {mg => local/mg}/build_and_run.csh | 0 {mg => local/mg}/create_dwa.csh | 0 {mg => local/mg}/create_iwa.csh | 0 {mg => local/mg}/cshrc | 0 {mg => local/mg}/integrate.csh | 0 {mg => local/mg}/merge.csh | 0 {mg => local/mg}/merge.tcl | 0 {mg => local/mg}/sync_home | 0 bash/bashrc.synopsys => local/snps/.bashrc.local | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename {mg => local/mg}/.vimrc.local (100%) rename {mg => local/mg}/build_and_run.csh (100%) rename {mg => local/mg}/create_dwa.csh (100%) rename {mg => local/mg}/create_iwa.csh (100%) rename {mg => local/mg}/cshrc (100%) rename {mg => local/mg}/integrate.csh (100%) rename {mg => local/mg}/merge.csh (100%) rename {mg => local/mg}/merge.tcl (100%) rename {mg => local/mg}/sync_home (100%) rename bash/bashrc.synopsys => local/snps/.bashrc.local (100%) diff --git a/mg/.vimrc.local b/local/mg/.vimrc.local similarity index 100% rename from mg/.vimrc.local rename to local/mg/.vimrc.local diff --git a/mg/build_and_run.csh b/local/mg/build_and_run.csh similarity index 100% rename from mg/build_and_run.csh rename to local/mg/build_and_run.csh diff --git a/mg/create_dwa.csh b/local/mg/create_dwa.csh similarity index 100% rename from mg/create_dwa.csh rename to local/mg/create_dwa.csh diff --git a/mg/create_iwa.csh b/local/mg/create_iwa.csh similarity index 100% rename from mg/create_iwa.csh rename to local/mg/create_iwa.csh diff --git a/mg/cshrc b/local/mg/cshrc similarity index 100% rename from mg/cshrc rename to local/mg/cshrc diff --git a/mg/integrate.csh b/local/mg/integrate.csh similarity index 100% rename from mg/integrate.csh rename to local/mg/integrate.csh diff --git a/mg/merge.csh b/local/mg/merge.csh similarity index 100% rename from mg/merge.csh rename to local/mg/merge.csh diff --git a/mg/merge.tcl b/local/mg/merge.tcl similarity index 100% rename from mg/merge.tcl rename to local/mg/merge.tcl diff --git a/mg/sync_home b/local/mg/sync_home similarity index 100% rename from mg/sync_home rename to local/mg/sync_home diff --git a/bash/bashrc.synopsys b/local/snps/.bashrc.local similarity index 100% rename from bash/bashrc.synopsys rename to local/snps/.bashrc.local From e683f35674e102bf5641bd8407c8d0acee2595d7 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Fri, 8 Apr 2016 13:37:27 -0400 Subject: [PATCH 4/8] Git ignore global. --- config/.gitconfig | 2 ++ config/.gitignore.global | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 config/.gitignore.global diff --git a/config/.gitconfig b/config/.gitconfig index 58cb9a1..71f9342 100644 --- a/config/.gitconfig +++ b/config/.gitconfig @@ -21,3 +21,5 @@ prompt = false [include] path = ~/.gitconfig.local +[core] + excludesfile = ~/.gitignore.global diff --git a/config/.gitignore.global b/config/.gitignore.global new file mode 100644 index 0000000..6e4fa7e --- /dev/null +++ b/config/.gitignore.global @@ -0,0 +1,5 @@ +*.swp +*.o +*.d +plink.log +llcalc_* From 3a585a64125b205569e1e980bb8b247f8f090bc6 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Fri, 8 Apr 2016 13:40:41 -0400 Subject: [PATCH 5/8] Bashrc cleaned up. Local definitions are moved to a separate file. --- config/.bashrc | 324 ++++++++++--------------------------------------- 1 file changed, 62 insertions(+), 262 deletions(-) mode change 100644 => 100755 config/.bashrc diff --git a/config/.bashrc b/config/.bashrc old mode 100644 new mode 100755 index e0c2805..82f8e36 --- a/config/.bashrc +++ b/config/.bashrc @@ -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,240 +7,40 @@ # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #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 - . /etc/bashrc + . /etc/bashrc else - # are we an interactive shell? - if [ "$PS1" ]; then - PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"' - # Turn on checkwinsize - shopt -s checkwinsize - [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " - fi + # are we an interactive shell? + if [ "$PS1" ]; then + PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"' + # Turn on checkwinsize + shopt -s checkwinsize + [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " + fi - if ! shopt -q login_shell ; then # We're not a login shell - for i in /etc/profile.d/*.sh; do - if [ -r "$i" ]; then - if [ "$PS1" ]; then - . $i - else - . $i &>/dev/null - fi - fi - done - unset i - fi + if ! shopt -q login_shell ; then # We're not a login shell + for i in /etc/profile.d/*.sh; do + if [ -r "$i" ]; then + if [ "$PS1" ]; then + . $i + else + . $i &>/dev/null + fi + fi + done + unset i + fi 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 " -# 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 []" -# 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 cpu=`uname -p` #x86_64 powerpc sparc @@ -249,6 +49,15 @@ kversion=`uname -v` krelease=`uname -r` hostnm=`hostname` +# +# Tmux usually sets screen-256color which is unknown to most of systems I work +# with. +# +if [ "$TERM" == "screen-256color" ]; then + export TERM="xterm-256color" +fi + +# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # # User specific environment and startup programs # @@ -260,27 +69,26 @@ fi MYSCRIPTS=$HOME/devel/scripts PATH=$MYLOCAL/bin:$PATH PATH=$MYSCRIPTS/bash:$PATH -PATH=$MYSCRIPTS/bloomberg:$PATH # -# VIM +# VIM # #VIMDIR=/depot/vim-7.3/bin #VIM=${VIMDIR}/vim #if [ "$kernel" == "Linux" ]; then -# alias vi=$VIM -# alias vim=$VIM -# alias gvim=${VIMDIR}/gvim -# alias ctags="/depot/ctag-5.5.4/bin/ctags" +# alias vi=$VIM +# alias vim=$VIM +# alias gvim=${VIMDIR}/gvim +# alias ctags="/depot/ctag-5.5.4/bin/ctags" #fi # -# GIT +# GIT # [ -f $MYSCRIPTS/bash/git-completion.bash ] && . $MYSCRIPTSE/bash/git-completion.bash # -# GCC +# GCC # #if [ -e /depot/gcc-4.7.2/bin ]; then # PATH=/depot/gcc-4.7.2/bin:$PATH @@ -294,18 +102,18 @@ PATH=$MYSCRIPTS/bloomberg:$PATH #fi # -# GDB +# GDB # #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 #alias vtune=/depot/vtune_amplifier_xe_2013_update5/bin64/amplxe-gui # -# PURIFY and all. +# PURIFY and all. # #postpath /depot/coverity/swat/bin #export RSU_TEMPLATE2_INI=/depot/pure/templates2.ini @@ -319,42 +127,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 " - 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 +# Make sure to export PATH # export PATH #export LM_LICENSE_FILE -export HISTFILESIZE=5000 # Store 5000 commands in history -export HISTCONTROL=ignoredups # Don't put duplicate lines in the history. +export HISTFILESIZE=5000 # Store 5000 commands in history +export HISTCONTROL=ignoredups # Don't put duplicate lines in the history. From 2e69a93b14a7b169f0acb1716520565619e8f207 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Fri, 8 Apr 2016 13:43:07 -0400 Subject: [PATCH 6/8] Adds a function to local-vimrc plugin to load .vimrc.local at startup. --- vim/plugin/local-vimrc.vim | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/vim/plugin/local-vimrc.vim b/vim/plugin/local-vimrc.vim index b4a32f8..eafb3cf 100644 --- a/vim/plugin/local-vimrc.vim +++ b/vim/plugin/local-vimrc.vim @@ -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 From 8d90b9f83f4b0628c28ab811bd84b08017529c0a Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Fri, 8 Apr 2016 14:06:50 -0400 Subject: [PATCH 7/8] .vimrc review --- vim/plugin/cf5-compile.vim | 31 +++++++++--- vim/vimrc | 97 ++++++++++++++++++++++++-------------- 2 files changed, 86 insertions(+), 42 deletions(-) diff --git a/vim/plugin/cf5-compile.vim b/vim/plugin/cf5-compile.vim index 1c84d0a..cca8e4c 100755 --- a/vim/plugin/cf5-compile.vim +++ b/vim/plugin/cf5-compile.vim @@ -128,7 +128,7 @@ function! s:CompileMSVC(run) "{{{2 endif endfunction -" +" " GCC " 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 call s:appendOutput(ccline) let cout = system( ccline ) - if v:shell_error + if v:shell_error call s:appendOutput(cout) return endif @@ -228,7 +228,7 @@ function! s:getOutputWindow() if (winnr < 0) execute "below 10new ".obuff setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap - " setlocal nomodifiable + " setlocal nomodifiable let winnr = bufwinnr('^'.obuff.'$') endif @@ -241,10 +241,10 @@ function! s:appendOutput( text ) if exists("g:cf5output") && (g:cf5output==1) let cwinnr = winnr() let owinnr = s:getOutputWindow() -" setlocal modifiable +" setlocal modifiable execute owinnr . 'wincmd w' execute 'normal! Go'.a:text -" setlocal nomodifiable +" setlocal nomodifiable execute cwinnr.'wincmd w' else echo a:text @@ -257,13 +257,18 @@ function! s:clearOutputWindow() if exists("g:cf5output") && (g:cf5output==1) let cwinnr = winnr() let owinnr = s:getOutputWindow() -" setlocal modifiable +" setlocal modifiable execute owinnr . 'wincmd w' execute 'normal ggdG' -" setlocal nomodifiable +" setlocal nomodifiable 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 diff --git a/vim/vimrc b/vim/vimrc index fe9414c..7cccd08 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -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 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 :tab split:exec("tag ".expand("")) "map :tabnew " -" F4 grep the word under cursor. +" Grep the word under cursor. " -map :execute "grep " . expand("") . " -r --include \*.h --include \*.cpp --include \*.c --include \*.f ." cw +" 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("")." -r ." cw " " Loads CF5Compile @@ -365,8 +382,8 @@ map :execute "grep " . expand("") . " -r --include \*.h --include if !exists('*CF5Compile') runtime plugin/cf5-compiler.vim endif -map :call CF5Compile(1) -map :call CF5Compile(0) +map a4 :call CF5CompileOnly() +map a5 :call CF5CompileAndRun() " " 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 u " noremap gk noremap gj -imap gk -imap gj +"imap gk +"imap gj " " Working with tabs especially if using console version. " @@ -389,6 +406,14 @@ nnoremap tl :tablast nnoremap tm :tabm nnoremap td :tabclose +" +" 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 " " 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 :BuffergatorToggle - map :BuffergatorTabsToggle + map ab :BuffergatorToggle + "map at :BuffergatorTabsToggle " " @@ -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 :NERDTreeToggle - map :NERDTreeFind + map at :NERDTreeToggle + "map am :NERDTreeFind " " :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 " " Comment code. From cd33a61a87158c47fee706bcb84540ad2a24abe6 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Wed, 13 Apr 2016 12:31:12 -0400 Subject: [PATCH 8/8] Use local terminfo for the systems which don't have screen-256color. --- config/.bashrc | 11 ++++--- terminfo/README | 2 ++ terminfo/screen-256color.terminfo | 27 ++++++++++++++++ terminfo/xterm-256color.terminfo | 51 +++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 terminfo/README create mode 100644 terminfo/screen-256color.terminfo create mode 100644 terminfo/xterm-256color.terminfo diff --git a/config/.bashrc b/config/.bashrc index 82f8e36..3bd123e 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -50,11 +50,12 @@ krelease=`uname -r` hostnm=`hostname` # -# Tmux usually sets screen-256color which is unknown to most of systems I work -# with. +# If there is no terminal info in the system for current terminal but there is +# one in local terminfo then use it. # -if [ "$TERM" == "screen-256color" ]; then - export TERM="xterm-256color" +/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 # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -68,7 +69,7 @@ elif [ $kernel == SunOS ]; then fi MYSCRIPTS=$HOME/devel/scripts PATH=$MYLOCAL/bin:$PATH -PATH=$MYSCRIPTS/bash:$PATH +PATH=$MYSCRIPTS/bin:$PATH # # VIM diff --git a/terminfo/README b/terminfo/README new file mode 100644 index 0000000..d74551e --- /dev/null +++ b/terminfo/README @@ -0,0 +1,2 @@ +Hint: use 'tic' to compile terminfo files. + tic -o diff --git a/terminfo/screen-256color.terminfo b/terminfo/screen-256color.terminfo new file mode 100644 index 0000000..c852b5c --- /dev/null +++ b/terminfo/screen-256color.terminfo @@ -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, diff --git a/terminfo/xterm-256color.terminfo b/terminfo/xterm-256color.terminfo new file mode 100644 index 0000000..efc5ee9 --- /dev/null +++ b/terminfo/xterm-256color.terminfo @@ -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,