From d52d1434d8260a7884f02a7f63e52864ffa8b077 Mon Sep 17 00:00:00 2001 From: Jeenu V Date: Wed, 20 Jan 2010 22:50:42 +0530 Subject: [PATCH] Updating from SVN --- work/home/.bashrc | 40 +++++++-------------------------------- work/home/.lessfilter | 6 ++++++ work/home/.mybashutils | 46 +++++++++++++++++++++++++++++---------------- work/home/.mygitutils | 20 +++++++++++--------- work/home/.mysvnutils | 20 +++++++++++--------- work/home/.tigrc | 21 ++++++++++++++++++++- work/home/.vimrc | 24 +++++++++++------------ work/scripts/irctc_pnr | 14 ++++++++++++++ work/vim/syntax/arm_asm.vim | 5 ++--- work/vim/syntax/mmp.vim | 3 ++- 10 files changed, 115 insertions(+), 84 deletions(-) create mode 100755 work/home/.lessfilter create mode 100755 work/scripts/irctc_pnr mode change 100644 => 100755 work/vim/syntax/arm_asm.vim mode change 100644 => 100755 work/vim/syntax/mmp.vim diff --git a/work/home/.bashrc b/work/home/.bashrc index 0cbb728..2925413 100644 --- a/work/home/.bashrc +++ b/work/home/.bashrc @@ -54,22 +54,14 @@ HISTSIZE=1000 # Histroy control HISTCONTROL=ignorespace:ignoredups:erasedups -HISTIGNORE='mplayer*' # Processing for setting up less if [ -z "$LESSOPEN" ]; then - less_proc_path="$(which lesspipe.sh 2>/dev/null)" - if [ -n "$less_proc_path" ]; then - # This is probably for Cygwin - LESSOPEN="| $less_proc_path %s" - else - less_proc_path="$(which lesspipe 2>/dev/null)" - if [ -n "$less_proc_path" ]; then - eval $(lesspipe) - fi - fi + # Cygwin might have lesspipe.sh + less_proc_path="$(which lesspipe 2>/dev/null)" || less_proc_path="$(which lesspipe.sh 2>/dev/null)" + eval "$less_proc_path" + unset less_proc_path fi -unset less_proc_path # Create a tmp directory if [ ! -d ~/tmp ]; then @@ -99,23 +91,6 @@ function launch() eval "$ARG_LIST &>/dev/null &" } -# Funtion to ask y/n questions -function confirm() -{ - if [ -z "$*" ]; then - return 1 - fi - - echo -n "${PROGNAME+$PROGNAME: }$1 (y/n) " - read - if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then - return 0 - else - return 1 - fi -} -export -f confirm - # Function to go up in the directory; level is specified as argument function up() { @@ -291,10 +266,9 @@ fi # Bookmarking features [ -f "$HOME/.mybashutils" ] && source "$HOME/.mybashutils" -# Get SVN completion -if [ -f /etc/bash_completion.d/svn ]; then - source /etc/bash_completion.d/svn - svn_sourced=yes +# Get all available BASH completion +if [ -f /etc/bash_completion ]; then + source /etc/bash_completion fi # My own SVN utilities diff --git a/work/home/.lessfilter b/work/home/.lessfilter new file mode 100755 index 0000000..f45acb9 --- /dev/null +++ b/work/home/.lessfilter @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ -d "$1" ]; then + ls -hAFl "$1" + exit 0 +fi diff --git a/work/home/.mybashutils b/work/home/.mybashutils index a686032..8d89e45 100644 --- a/work/home/.mybashutils +++ b/work/home/.mybashutils @@ -6,23 +6,35 @@ CHANGED_BM=0 # Default bookmark profile PROFILE_BM="$HOME/.book" -# Funtion to ask y/n questions. We need to define this if only not already defined -if ! type confirm &>/dev/null; then - function confirm() - { - if [ -z "$*" ]; then - return 1 - fi +# Funtion to ask y/n questions +function confirm() +{ + CONFIRMED= + REPLY= + + if [ -z "$*" ]; then + return 1 + fi - echo -n "${PROGNAME+$PROGNAME: }$1 (y/n) " + echo -ne "\r\e[2K${PROGNAME:+$PROGNAME: }$1 (y/n/q) " + if [ -z "$2" ]; then read - if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then - return 0 - else - return 1 - fi - } -fi + else + read -n "$2" + fi + + if [ "$REPLY" = "n" -o "$REPLY" = "N" ]; then + CONFIRMED="no" + return 1 + elif [ "$REPLY" = "q" -o "$REPLY" = "Q" ]; then + CONFIRMED="quit" + return 1 + else + CONFIRMED="yes" + return 0 + fi +} +export -f confirm # Read the bookmarks function bmread() @@ -268,5 +280,7 @@ complete -F _bm_complete go complete -F _bm_complete bm complete -o dirnames bmtemplate -touch "$HOME/.book" +if [ ! -f "$HOME/.book" ]; then + echo "#BOOKMARK" > "$HOME/.book" +fi bmprofile "$HOME/.book" diff --git a/work/home/.mygitutils b/work/home/.mygitutils index cdc81db..8878c6b 100644 --- a/work/home/.mygitutils +++ b/work/home/.mygitutils @@ -18,23 +18,25 @@ function gitshowdiffs() cd "$git_dir/.." for i in $(gitmodified "$@"); do # prompt for continue - read -n1 -p "$i: continue (n/q)? " - if [ "$REPLY" = "n" -o "$REPLY" = "N" ]; then - echo - continue - elif [ "$REPLY" = "q" -o "$REPLY" = "Q" ]; then - echo - return + if ! confirm "$i: continue" 1; then + if [ "$CONFIRMED" = "no" ]; then + echo + continue + elif [ "$CONFIRMED" = "quit" ]; then + echo + return + fi fi - echo " getting diff..." + # With control character to clear the entire line + echo -e "\r\e[2Kgetting diff..." git diff --no-prefix --no-ext-diff "$i" > "$git_patch_file" || return if [ "$(stat -c %s "$git_patch_file")" -eq 0 ]; then echo "gitshowdiffs: $i: no diff found" continue else - vim -n '+set patchexpr=MyPatch()' \ + DISPLAY= vi -n '+set patchexpr=MyPatch()' \ "+leftabove vertical diffpatch $git_patch_file |cmap q qa|nmap ]c|nmap [c|windo set fdm=diff nolist|normal gg" \ "$i" fi diff --git a/work/home/.mysvnutils b/work/home/.mysvnutils index 8b6bddf..1d36b08 100644 --- a/work/home/.mysvnutils +++ b/work/home/.mysvnutils @@ -14,23 +14,25 @@ function svnshowdiffs() for i in $(svnmodified $@); do # prompt for continue - REPLY= read -n1 -p "$i: continue (n/q)? " - if [ "$REPLY" = "n" -o "$REPLY" = "N" ]; then - echo - continue - elif [ "$REPLY" = "q" -o "$REPLY" = "Q" ]; then - echo - return + if ! confirm "$i: continue" 1; then + if [ "$CONFIRMED" = "no" ]; then + echo + continue + elif [ "$CONFIRMED" = "quit" ]; then + echo + return + fi fi - echo " getting diff..." + # With control character to clear the entire line + echo -e "\r\e[2Kgetting diff..." svn diff "$i" > "$svn_patch_file" || continue if [ "$(stat -c %s "$svn_patch_file")" -eq 0 ]; then echo "svnshowdiffs: $i: no diff found" continue else - vim -n '+set patchexpr=MyPatch()' \ + DISPLAY= vi -n '+set patchexpr=MyPatch()' \ "+leftabove vertical diffpatch $svn_patch_file |cmap q qa|nmap ]c|nmap [c|windo set fdm=diff|normal gg" \ "$i" fi diff --git a/work/home/.tigrc b/work/home/.tigrc index 14ec6c9..eb42fe0 100644 --- a/work/home/.tigrc +++ b/work/home/.tigrc @@ -1,2 +1,21 @@ bind generic g move-first-line -bind generic G move-last-line + +bind main G move-last-line +bind diff G move-last-line +bind log G move-last-line +bind help G move-last-line +bind pager G move-last-line +bind status G move-last-line +bind stage G move-last-line + +bind main v toggle-rev-graph + +bind generic e scroll-line-down +bind generic y scroll-line-up + +set line-graphics = no +set show-rev-graph = yes + +color cursor black white +color diff-header white white bold +color diff-index default default dim diff --git a/work/home/.vimrc b/work/home/.vimrc index 677427b..8a28ef5 100644 --- a/work/home/.vimrc +++ b/work/home/.vimrc @@ -384,22 +384,22 @@ function! GetNPNavigatonChoiceFromUser(...) let choice = a:1 endif - if choice ==? "p" || choice == 1 + if choice ==? "p" nmap nmap silent! nunmap g silent! nunmap g - elseif choice ==? "t" || choice == 2 + elseif choice ==? "t" if v:version >= 700 " Tab's were added after 700 " tabnext does't accept a count, I've to work this around nmap : - \let g:J_count = v:count1 - \while g:J_count > 0 - \ tabnext - \ let g:J_count -= 1 - \endwhile + \ let g:J_count = v:count1 + \ while g:J_count > 0 + \ tabnext + \ let g:J_count -= 1 + \ endwhile nmap :execute "tabprevious " . v:count1 else silent! nunmap @@ -408,35 +408,35 @@ function! GetNPNavigatonChoiceFromUser(...) silent! nunmap g silent! nunmap g - elseif choice ==? "c" || choice == 3 + elseif choice ==? "c" " Navigate error list nmap :execute "keepju " . v:count . "cnext" nmap :execute "keepju " . v:count . "cprevious" nmap g :execute v:count . "cnewer" nmap g :execute v:count . "colder" - elseif choice ==? "l" || choice == 4 + elseif choice ==? "l" " Navigate location list nmap :execute "keepju " . v:count . "lnext" nmap :execute "keepju " . v:count . "lprevious" nmap g :execute v:count . "lnewer" nmap g :execute v:count . "lolder" - elseif choice ==? "d" || choice == 5 + elseif choice ==? "d" " Navigate diffs in file nmap ]c nmap [c silent! nunmap g silent! nunmap g - elseif choice ==? "a" || choice == 6 + elseif choice ==? "a" " Navigate arguments nmap :next nmap :previous silent! nunmap g silent! nunmap g - elseif choice ==? "g" || choice == 7 + elseif choice ==? "g" " Navigate tags nmap :tn nmap :tp diff --git a/work/scripts/irctc_pnr b/work/scripts/irctc_pnr new file mode 100755 index 0000000..a8ef866 --- /dev/null +++ b/work/scripts/irctc_pnr @@ -0,0 +1,14 @@ +#!/bin/bash + +until [ -z "$*" ]; do + if [ -z "$1" -o "${#1}" -ne 10 ]; then + echo "Usage: irctc_pnr PNR_NUMBER" + exit 1 + fi + + pnr_number=$(echo "$1" | sed 's/^\([0-9]\{3\}\)\([0-9]\{7\}\)$/lccp_pnrno1=\1\&lccp_pnrno2=\2/') + echo "$1: " + wget -q -O - --post-data="$pnr_number" http://www.indianrail.gov.in/cgi_bin/inet_pnrstat_cgi.cgi | + sed -n '/Passenger\s\+[1-6]/{N;N;s/<[^>]\+>//g;s/\n/ \t| /g;s/^/\t/p}' + shift +done diff --git a/work/vim/syntax/arm_asm.vim b/work/vim/syntax/arm_asm.vim old mode 100644 new mode 100755 index c4225cd..a4ac320 --- a/work/vim/syntax/arm_asm.vim +++ b/work/vim/syntax/arm_asm.vim @@ -82,9 +82,8 @@ syn match armStoreMKeyword "\" contains=armConditional syn keyword armInstruction HALT SWI MCR MRC ASL ASR ROR RRX SETCPSR SETSPSR GETCPSR -syn keyword armAssembler IF ELIF ELSE ENDIF MACRO MEND EXPORT IMPORT GBLL INCLUDE CODE READONLY ALIGN AREA END DCB DCD DCDU DCW DCWU DCDO SPACE FILL SETL SETA DWORD -syn match armAssembler "[a-zA-Z_][a-zA-Z0-9_]\+\s\+rout" -syn match armAssembler "^[a-zA-Z0-9_]\+\s*$" +syn keyword armAssembler IF ELIF ELSE ENDIF MACRO MEND EXPORT IMPORT GBLL INCLUDE CODE READONLY ALIGN AREA END DCB DCD DCDU DCW DCWU DCDO SPACE FILL SETL SETA DWORD ROUT +syn match armAssembler "^[a-zA-Z0-9_]\+" contains=armComment syn match armAssembler "%[FB][AT][0-9]\([a-zA-Z0-9]\+\)\?" syn match armAssembler ":\(L\?OR\|L\?AND\|DEF\|LNOT\):" syn match armAssembler "{\(TRUE\|FALSE\)}" diff --git a/work/vim/syntax/mmp.vim b/work/vim/syntax/mmp.vim old mode 100644 new mode 100755 index 63cf53a..f70aaba --- a/work/vim/syntax/mmp.vim +++ b/work/vim/syntax/mmp.vim @@ -18,7 +18,8 @@ syn keyword mmpStorage lang library linkas nostrictdef option option_replace syn keyword mmpStorage resource source sourcepath srcdbg startbitmap syn keyword mmpStorage start end staticlibrary strictdepend systeminclude syn keyword mmpStorage systemresource target targettype targetpath uid -syn keyword mmpStorage userinclude win32_library +syn keyword mmpStorage userinclude win32_library capability epocallowdlldata exportlibrary +syn keyword mmpStorage smpsafe firstlib syn match mmpIfdef "^\s*#\(include\|ifdef\|ifndef\|if\|endif\|else\|elif\|define\).*$" contains=mmpComment syn match mmpMacro "^\s*macro.*$" contains=mmpComment -- 2.11.4.GIT