merged
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 04 Dec 2011 18:45:24 +0200
changeset 270 19082e26bea6
parent 269 48b3cbdac750 (current diff)
parent 268 445d013283e6 (diff)
child 273 34e34bd191bf
merged
LICENSE
README
--- a/.bashrc	Sun Dec 04 18:43:51 2011 +0200
+++ b/.bashrc	Sun Dec 04 18:45:24 2011 +0200
@@ -1,8 +1,9 @@
+
+# set -x
+# set -u
 
 # XXX
-# [ -f /etc/bashrc ] && . /etc/bashrc
-
-[ -d ~/usr/bin ] && export PATH="$PATH":~/usr/bin || :
+# [[ -f /etc/bashrc ]] && . /etc/bashrc
 
 # XXX for mc, cvs, svn, ...
 export EDITOR=vim
@@ -14,11 +15,13 @@
 PS1='bash# '
 # Set magenta bold font.
 case "$TERM" in
-  xterm*) PS1='\[\033[31m\033[1m\]\h\033[35m\]+bash# \[\033[0m\]'
+  xterm*)
+    PS1='\[\033[31m\033[1m\]\h\[\033[35m\]+bash# \[\033[0m\]'
+    PS2='\[\033[32m\]> \[\033[0m\]'
   ;;
 esac
 
-# if [ -f ~/.dircolors ]; then
+# if [[ -f ~/.dircolors ]]; then
 #   eval `dircolors -b ~/.dircolors`
 # fi
 
@@ -84,6 +87,10 @@
 alias l.='ls -d .*'     #list hidden files
 alias ll='ls -lhrt'     #extra info compared to "l"
 alias lld='ls -lUd */'  #list directories
+# I prefer EN man pages.
+alias man='LANG=C man'
+
+alias j='jobs '
 
 # make and change to a directory
 md () { mkdir -p "$1" && cd "$1"; }
@@ -116,44 +123,30 @@
 # canonicalize path (including resolving symlinks)
 # alias realpath='readlink -f'
 
-# Use bash-completion, if available.
-if [ -f /etc/bash_completion ]; then
-  # Under Cygwin bash completition start a long time.
-  if [ ! "$OSTYPE" = cygwin ]; then
-    . /etc/bash_completion
-  else
-    # But load local completion anyway.
-    if [ -f ~/.bash_completion ]; then
-      . ~/.bash_completion
-    fi
-  fi
-fi
-if [ -f $HOME/usr/etc/bash_completion ]; then
-  . $HOME/usr/etc/bash_completion
-fi
-
 # Special case for CYGWIN to properly display russian letters in rxvt.
 # Don't forget set in Windows SHELL=/bin/bash. If default SHELL is sh then .bashrc will not be read.
-if [ -n "$COMSPEC" ]; then
-  if [ x$OSTYPE = xcygwin ]; then
-    export LANG=ru_RU.CP1251
-  fi
+if [[ x$OSTYPE = xcygwin ]]; then
+  export LANG=ru_RU.CP1251
+  # Avoid permission problem in Cygwin.
+  umask 0000
 fi
 
 export PATH=$PATH:~/usr/bin
 
-if [ -z "$MANPATH" ]; then
+if [[ -z "$MANPATH" ]]; then
   export MANPATH=~/usr/share/man:
 else
   export MANPATH=$MANPATH:~/usr/share/man:
 fi
 
-if [ -z "$INFOPATH" ]; then
+if [[ -z "$INFOPATH" ]]; then
   export INFOPATH=~/usr/share/info:
 else
   export INFOPATH=$INFOPATH:~/usr/share/info:
 fi
 
+export PYTHONSTARTUP=~/.pystartup
+
 ################################################################
 # Key binding.
 
@@ -198,3 +191,140 @@
 # builtin completes on builtins
 complete -b builtin
 
+_hgsyncew() {
+  local cur=${COMP_WORDS[COMP_CWORD]}
+  COMPREPLY=( $(compgen -W "--push" -- $cur) )
+  return 0
+}
+complete -F _hgsyncew -o nospace hgsyncew
+
+_pathsearch() {
+  local prev cur=${COMP_WORDS[COMP_CWORD]}
+  [[ $COMP_CWORD > 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
+  if [[ $prev = -d ]]; then
+    COMPREPLY=()
+    return 0
+  fi
+  case "$cur" in
+    -*) COMPREPLY=( $(compgen -W "-d --delimiter= -h --help" -- $cur ) ) ;;
+    *) COMPREPLY=() ;;
+  esac
+  return 0
+}
+complete -F _pathsearch -o nospace pathsearch
+
+_mycd() {
+  local cur
+  cur=${COMP_WORDS[COMP_CWORD]}
+  if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then
+    COMPREPLY=( $(compgen -d -- "$cur") )
+    return 0
+  fi
+  local i j k
+  for i in ${CDPATH//:/$'\n'}; do
+    k="${#COMPREPLY[@]}"
+    for j in $( compgen -d -- $i/$cur ); do
+      COMPREPLY[k++]=${j#$i/}
+    done
+  done
+  return 0
+}
+complete -F _mycd -o nospace cd
+
+_man() {
+  local p
+  local cur=${COMP_WORDS[COMP_CWORD]}
+  if [[ $cur = /* || $cur = ./* ]]; then
+    COMPREPLY=( $(compgen -f -- $cur) )
+  fi
+  local IFS=':
+'
+  for p in /usr/share/man $MANPATH; do
+    [[ -n $p ]] || continue
+    p=( $p/man*/* )
+    p=( ${p[@]##*/} )
+    p=( ${p[@]%.gz} )
+    p=( ${p[@]%.*} )
+    p=( $(compgen -W '${p[@]}' -- $cur ) )
+    COMPREPLY=( ${COMPREPLY[@]} ${p[@]} )
+  done
+}
+complete -F _man man
+
+_make() {
+  local i mk
+  local dir=.
+  local cur=${COMP_WORDS[COMP_CWORD]}
+  if [[ $cur = -* ]]; then
+    COMPREPLY=( $(compgen -W "-C -f" -- "$cur") )
+    return 0
+  fi
+  [[ $COMP_CWORD > 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
+  for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
+    case ${COMP_WORDS[i]} in
+      -f) mk=${COMP_WORDS[i+1]} ;;
+      -C) dir=${COMP_WORDS[i+1]} ;;
+    esac
+  done
+  if [[ $prev = -C ]]; then
+    COMPREPLY=( $(compgen -d -- "$cur") )
+    return 0
+  fi
+  if [[ $prev = -f ]]; then
+    COMPREPLY=( $(cd $dir >/dev/null 2>&1; compgen -f -- "$cur") )
+    return 0
+  fi
+  mk=$dir/$mk
+  [[ -f $mk ]] || mk=$(eval echo $dir/[Mm]akefile)
+  [[ -f $mk ]] || return 1
+  COMPREPLY=( $(compgen -W "$(sed -n -e '/^[[:alnum:]_-]*:/{s=^\([^:]*\):.*=\1=;p;}' $mk)" -- $cur) )
+  return 0
+}
+complete -F _make make gmake pmake
+
+_cygcheck() {
+  local opt
+  local cur=${COMP_WORDS[COMP_CWORD]}
+  case $COMP_CWORD in
+    1)
+      case $cur in
+        -*)
+          COMPREPLY=( $(compgen -W "-v --verbose -h --help -V --version -c --check-setup -s --sysinfo
+            -k --keycheck -f --find-package -l --list-package -p --package-query" -- "$cur") )
+          return 0 ;;
+        *)
+          COMPREPLY=( $(compgen -c -- "$cur") )
+          return 0 ;;
+      esac
+      ;;
+    2)
+      opt=${COMP_WORDS[1]}
+      case $opt in
+        -c|--check-setup|-l|--list-package)
+          pkgs=( /etc/setup/*.lst.gz )
+          pkgs=( ${pkgs[@]##*/} )
+          pkgs=( ${pkgs[@]%.lst.gz} )
+          COMPREPLY=( $(compgen -W '${pkgs[@]}' -- $cur ) )
+          return 0;;
+      esac
+      return 0;;
+  esac
+  return 0
+}
+complete -F _cygcheck cygcheck.exe cygcheck
+
+# Use bash-completion, if available.
+if [ -f /etc/bash_completion ]; then
+  # Under Cygwin bash completition start a long time.
+  if [ ! "$OSTYPE" = cygwin ]; then
+    . /etc/bash_completion
+  else
+    # But load local completion anyway.
+    if [ -f ~/.bash_completion ]; then
+      . ~/.bash_completion
+    fi
+  fi
+fi
+if [ -f $HOME/usr/etc/bash_completion ]; then
+  . $HOME/usr/etc/bash_completion
+fi
--- a/.hgrc	Sun Dec 04 18:43:51 2011 +0200
+++ b/.hgrc	Sun Dec 04 18:45:24 2011 +0200
@@ -8,6 +8,8 @@
 editor = emacs -q
 ignore = ~/.hgignore
 
+style = ~/.hgstyle
+
 [defaults]
 log = -v -f
 incoming = -v
@@ -33,3 +35,26 @@
 hgext.eol =
 ; Allow cherry-picking.
 transplant =
+; Show progress on operations.
+progress =
+; Delete untracked files from the working directory.
+hgext.purge=
+
+[progress]
+; Number of seconds (float) before showing the progress bar.
+delay = 2
+; Time in seconds between refreshes of the progress bar.
+refresh = 0.5
+; Format of the progress bar: topic bar number estimate.
+format = topic bar number estimate
+; Clear the progress bar after it's done.
+clear-complete = False
+; If true, don't show a progress bar.
+disable = False
+; If true, ALWAYS show a progress bar, unless disable is given.
+assume-tty = False
+
+[trusted]
+; http://mercurial.selenic.com/wiki/Trust
+; Do not include: nobody.
+groups = apache, daemon, www-data
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgstyle	Sun Dec 04 18:45:24 2011 +0200
@@ -0,0 +1,25 @@
+changeset = 'changeset:   {rev}:{node|short}\n{branches}{bookmarks}{tags}{parents}user:        {author}\ndate:        {date|isodate}\nsummary:     {desc|firstline}\n\n'
+changeset_quiet = '{rev}:{node|short}\n'
+changeset_verbose = 'changeset:   {rev}:{node|short}\n{branches}{bookmarks}{tags}{parents}user:        {author}\ndate:        {date|isodate}\n{files}{file_copies_switch}description:\n{desc|strip}\n\n\n'
+changeset_debug = 'changeset:   {rev}:{node}\n{branches}{bookmarks}{tags}{parents}{manifest}user:        {author}\ndate:        {date|isodate}\n{file_mods}{file_adds}{file_dels}{file_copies_switch}{extras}description:\n{desc|strip}\n\n\n'
+start_files = 'files:      '
+file = ' {file}'
+end_files = '\n'
+start_file_mods = 'files:      '
+file_mod = ' {file_mod}'
+end_file_mods = '\n'
+start_file_adds = 'files+:     '
+file_add = ' {file_add}'
+end_file_adds = '\n'
+start_file_dels = 'files-:     '
+file_del = ' {file_del}'
+end_file_dels = '\n'
+start_file_copies = 'copies:     '
+file_copy = ' {name} ({source})'
+end_file_copies = '\n'
+parent = 'parent:      {rev}:{node|formatnode}\n'
+manifest = 'manifest:    {rev}:{node}\n'
+branch = 'branch:      {branch}\n'
+tag = 'tag:         {tag}\n'
+bookmark = 'bookmark:    {bookmark}\n'
+extra = 'extra:       {key}={value|stringescape}\n'
--- a/.inputrc	Sun Dec 04 18:43:51 2011 +0200
+++ b/.inputrc	Sun Dec 04 18:45:24 2011 +0200
@@ -87,7 +87,12 @@
 "\e[B": history-search-forward
 "\C-n": history-search-forward
 
-# "	": menu-complete
+# Bind 'Shift+TAB' to complete as in Python TAB was need for another purpose.
+"\e[Z": complete
+$if Bash
+# Use 'Control+TAB' for cycling possible completion in bash.
+"\e[1;5I": menu-complete
+$endif
 
 # Local Variables:
 # mode: shell-script
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.pystartup	Sun Dec 04 18:45:24 2011 +0200
@@ -0,0 +1,35 @@
+# -*- mode: python -*-
+# Add auto-completion and a stored history file of commands to your Python
+# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
+# bound to the Esc key by default (you can change it - see readline docs).
+#
+# Store the file in ~/.pystartup, and set an environment variable to point
+# to it:  "export PYTHONSTARTUP=~/.pystartup" in bash.
+
+import os
+import sys
+import atexit
+import readline
+import rlcompleter
+
+historyPath = os.path.expanduser("~/.pyhistory")
+
+def save_history(historyPath=historyPath):
+    import readline
+    readline.write_history_file(historyPath)
+
+if os.path.exists(historyPath):
+    readline.read_history_file(historyPath)
+
+term_with_colors = ['xterm', 'xterm-color', 'xterm-256color', 'linux', 'screen', 'screen-256color', 'screen-bce']
+if os.environ.get('TERM') in term_with_colors:
+    green='\033[32m'
+    red='\033[31m'
+    reset='\033[0m'
+    sys.ps1 = red + '>>> ' + reset
+    sys.ps2 = green + '... ' + reset
+del term_with_colors
+
+atexit.register(save_history)
+del os, sys, atexit, readline, rlcompleter, save_history, historyPath
+
--- a/.vimrc	Sun Dec 04 18:43:51 2011 +0200
+++ b/.vimrc	Sun Dec 04 18:45:24 2011 +0200
@@ -11,7 +11,7 @@
 
 " A 256 color scheme.
 if &t_Co >= 256 || has("gui_running")
-  colorscheme inkpot
+  colorscheme delek
 endif
 
 set sessionoptions=curdir,buffers,tabpages
--- a/.zshrc	Sun Dec 04 18:43:51 2011 +0200
+++ b/.zshrc	Sun Dec 04 18:45:24 2011 +0200
@@ -28,3 +28,12 @@
 # Emacs like editing.
 bindkey -e
 
+bindkey "^[[A" history-search-backward
+bindkey "^[[B" history-search-forward
+
+autoload -U compinit
+compinit
+
+# autoload -U promptinit
+# promptinit
+# prompt walters
--- a/LICENSE	Sun Dec 04 18:43:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-All files from gavenkoa-skel project under public domain if this
-term applicable in your national low.
-
-In other cases I allow do anything you want with this files.
-
-NOTE: Some international/national lows preserve some inalienable
-rights for authors like:
-
- * XXX
-
-Be careful!
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE.rst	Sun Dec 04 18:45:24 2011 +0200
@@ -0,0 +1,21 @@
+
+==========================================
+ LICENSE for gavenkoa personal dot-files.
+==========================================
+.. contents::
+
+TERMS of use.
+=============
+
+All files from gavenkoa-skel project under public domain if this
+term applicable in your national low.
+
+In other cases I allow do anything you want with this files.
+
+NOTE: Some international/national lows preserve some inalienable
+rights for authors like:
+
+ * XXX
+
+Be careful!
+
--- a/Makefile	Sun Dec 04 18:43:51 2011 +0200
+++ b/Makefile	Sun Dec 04 18:45:24 2011 +0200
@@ -10,8 +10,8 @@
 # Default target.
 .DEFAULT_GOAL = help
 
-.PHONY: all
-all:
+################################################################
+# Platform definition.
 
 ifeq '' '$(HOME)'
   $(error HOME env var not set!)
@@ -19,7 +19,15 @@
 
 host_os = linux
 ifneq '' '$(COMSPEC)'
-  host_os = windows
+  host_os = cygwin
+endif
+
+################################################################
+# Build tool definition/switches.
+
+RST2HTML = rst2html
+ifeq '$(host_os)' 'cygwin'
+  RST2HTML = rst2html.py
 endif
 
 ################################################################
@@ -27,14 +35,23 @@
 
 OVERRIDDEN_ITEMS = \
     .inputrc .minttyrc .Xdefaults .xinitrc .xserverrc .screenrc .dircolors \
-    .bashrc .bash_completion .zshrc .vimrc .ssh \
-    .mailsign .muttrc .tidy \
+    .bashrc .bash_completion .zshrc .vimrc .ssh .pystartup \
+    .signature .muttrc .tidy \
     .dictrc \
-    .hgrc .hgignore .bazaar .gitconfig .gitignore .cvs \
+    .hgrc .hgignore .hgstyle .bazaar .gitconfig .gitignore .cvs \
     .gnupg
 MANUALINSTALL_ITEMS = .mc
 IFNONEXIST_ITEMS = .wgetrc .subversion
 
+RST_FILES = $(wildcard *.rst)
+HTML_FILES = $(RST_FILES:.rst=.html)
+
+################################################################
+# Build targets.
+
+.PHONY: all
+all:
+
 ################################################################
 # Install/uninstall targets.
 
@@ -72,7 +89,7 @@
 	done
 	mkdir -p $(HOME)/.mc
 	install -m 640 .mc/bashrc $(HOME)/.mc
-ifeq '$(host_os)' 'windows'
+ifeq '$(host_os)' 'cygwin'
 	install -m 640 .mc/bindings.cygwin $(HOME)/.mc/bindings
 else
 	install -m 640 .mc/bindings $(HOME)/.mc/bindings
@@ -98,10 +115,21 @@
 	rmdir $(HOME)/.mc || :
 
 ################################################################
+# Docs targets.
+
+.PHONY: html
+html: $(HTML_FILES)
+
+# --stylesheet=rst.css
+$(HTML_FILES): %.html: %.rst
+	$(RST2HTML) $*.rst $@
+
+################################################################
 # Clean targets.
 
 .PHONY: clean
 clean:
+	rm -f $(HTML_FILES)
 
 .PHONY: distclean
 distclean: clean
--- a/README	Sun Dec 04 18:43:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-.. -*- mode: rst; coding: utf-8 -*-
-.. rst2html.py README README.html
-
-==============================
- gavenkoa personal dot-files.
-==============================
-.. content::
-
-How install.
-============
-
-  $ make install
-
-Tidy.
------
-
-To enable Tidy config set HTML_TIDY env var:
-
-  $ cat ~/.bashrc
-...
-HTML_TIDY = ~/.tidy
-
-Structure.
-==========
-
-  .mailsign
-                signature for mail
-  .tidy
-                config for Tidy
-
-Tips.
-=====
-
-Cygwin ssh.
------------
-
-To point Cygwin ssh to your $HOME edit /etc/password for your user.
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.rst	Sun Dec 04 18:45:24 2011 +0200
@@ -0,0 +1,39 @@
+.. -*- coding: utf-8 -*-
+.. rst2html.py README README.html
+
+==============================
+ gavenkoa personal dot-files.
+==============================
+.. contents::
+
+How install.
+============
+::
+
+  $ make install
+
+Tidy.
+-----
+
+To enable Tidy config set HTML_TIDY env var::
+
+  $ cat ~/.bashrc
+  ...
+  HTML_TIDY = ~/.tidy
+
+Structure.
+==========
+
+  .mailsign
+                signature for mail
+  .tidy
+                config for Tidy
+
+Tips.
+=====
+
+Cygwin ssh.
+-----------
+
+To point Cygwin ssh to your $HOME edit /etc/password for your user.
+