Skip to content

Instantly share code, notes, and snippets.

@hogelog
Created March 11, 2012 12:08
Show Gist options
  • Save hogelog/2016212 to your computer and use it in GitHub Desktop.
Save hogelog/2016212 to your computer and use it in GitHub Desktop.
dotfiles
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
if [ $TTY ] ; then
stty stop 'undef'
fi
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# 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
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
window=`echo $WINDOW`
if [ -z $window ]; then
wps=""
else
wps="[$window]"
fi
PS1='$wps\[\033[01;34m\]\w\[\033[00m\] \$ '
PS1="\[\e]0;\h $wps \w\a\]$PS1"
# 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
alias cp='cp -f'
alias mv='mv -f'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ls='ls -F --color=auto'
alias ll='ls -lF --color=auto'
alias la='ls -aF --color=auto'
alias rr='screen -U -RR'
alias ..='cd ..'
alias lv='lv -c'
alias gcc='colorgcc'
alias make='colormake'
alias diff='colordiff'
function gomi (){
for file in $*
do
__rm_single_file $file
done
}
function __rm_single_file(){
if ! [ -d ~/trash/ ]
then
command /bin/mkdir ~/trash
fi
if ! [ $# -eq 1 ]
then
echo "__rm_single_file: 1 argument required but $# passed."
exit
fi
if [ -e $1 ]
then
BASENAME=`basename $1`
NAME=$BASENAME
COUNT=0
while [ -e ~/trash/$NAME ]
do
COUNT=$(($COUNT+1))
NAME="$BASENAME.$COUNT"
done
command /bin/mv $1 ~/trash/$NAME
else
echo "No such file or directory: $file"
fi
}
alias gomi-look='ls -a ~/trash/ 2> /dev/null'
alias gomi-clean='\rm -rf ~/trash/*;\rm -rf ~/trash/.??*'
. /etc/bash_completion
. $HOME/.cdd/cdd
export ANDROID_SDK=/opt/android-sdk-linux_x86/
export PATH=\
$HOME/local/bin:\
$ANDROID_SDK/tools:\
$ANDROID_SDK/platform-tools:\
/opt/bin:\
$HOME/.rbenv/bin:\
$PATH
#export JAVA_HOME=/usr/lib/jvm/java-6-sun
#export JRE_HOME=$JAVA_HOME/jre
export JAVA_HOME=/opt/jre1.6.0_30
export JRE_HOME=$JAVA_HOME
export ANT_HOME=/opt/ant
export M2_HOME=/opt/maven
export CATALINA_HOME=/opt/tomcat
export EDITOR=vim
export PAGER='lv -c'
export LD_LIBRARY_PATH=/opt/opencv/lib:\
$LD_LIBRARY_PATH
export PYTHON_LIBRARY_PATH=/opt/opencv/lib
eval "$(rbenv init -)"
# vim: set ft=sh sw=4 ts=4 et:
; global settings
(global-set-key "\C-h" 'delete-backward-char)
(global-set-key "\C-x\C-b" 'anything-buffers+)
(setq inhibit-startup-message t)
(setq make-backup-files nil)
(setq auto-save-default nil)
; for emacs client
;(server-start)
(require 'gnuserv)
(gnuserv-start)
(setq gnuserv-frame (selected-frame))
; auto-install
(require 'auto-install)
(setq auto-install-directory "~/.emacs.d/auto-install/")
(auto-install-update-emacswiki-package-name t)
;(auto-install-compatibility-setup)
(setq auto-install-add-load-path-flag t)
(add-to-list 'load-path auto-install-directory)
; anything
(require 'anything-startup)
; anything everywhere
(ac-mode 1)
; scala-mode
(require 'scala-mode-auto)
(setq scala-interpreter "c:/hoge/prg/scala-2.9.1.final/bin/scala")
;(auto-install-from-url "http://svn.coderepos.org/share/lang/elisp/auto-save-buffers-enhanced/trunk/auto-save-buffers-enhanced.el")
; auto-save-buffers-enhanced
;; If you're using CVS or Subversion or git
(require 'auto-save-buffers-enhanced)
;(auto-save-buffers-enhanced-include-only-checkout-path t)
(auto-save-buffers-enhanced t)
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
escape ^Oo
nethack on
defencoding utf-8
encoding utf-8 utf-8
cjkwidth on
" Use this group for any autocmd defined in this file.
augroup MyAutoCmd
autocmd!
augroup END
filetype plugin indent on
syntax enable
"colorscheme default
let mapleader = ","
let $PATH="c:\\cygwin\\bin;".$PATH
set noswapfile
set nobackup
set number
set smartindent
" completion
set wildmode=list:longest
" no bell
set visualbell
set t_vb=
" for UTF-8
set ambiwidth=double
" show statusline always
set laststatus=2
" show fenc, ff on statusline
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P
set showmatch
set modeline
set tabstop=2
set shiftwidth=2
set softtabstop=0
set expandtab
set encoding=utf-8
set termencoding=utf-8
set fileencodings=iso-2022-jp,euc-jp,utf-8,cp932
set fileformats=unix,dos,mac
" search
set ignorecase
set smartcase
set hlsearch
set history=500
command Q qa
let g:is_gauche = 1
" auto save
set updatetime=50
autocmd MyAutoCmd CursorHold * call AutoUp()
function! AutoUp()
if expand('<afile>') != '' && !&readonly && &buftype == '' && &filetype != 'tex'
silent update
endif
endfunction
let s:CMapABC_Entries = []
function! s:CMapABC_Add(original_pattern, alternate_name)
call add(s:CMapABC_Entries, [a:original_pattern, a:alternate_name])
endfunction
" tabpage
nnoremap <silent> <C-t>c :tabnew \| tabmove<Return>
nnoremap <silent> <C-t>k :tabclose<Return>
nnoremap <silent> <C-t>p :tabprev<Return>
nnoremap <silent> <C-t>n :tabnext<Return>
nmap <C-t><C-c> <C-t>c
nmap <C-t><C-k> <C-t>k
nmap <C-t><C-p> <C-t>p
nmap <C-t><C-n> <C-t>n
command! -complete=customlist,<SID>CommandComplete_cdpath -nargs=1 CD
\ TabCD <args>
function! s:CommandComplete_cdpath(arglead, cmdline, cursorpos)
return split(globpath(&cdpath, a:arglead . '*/'), "\n")
endfunction
call s:CMapABC_Add('^cd', 'CD')
command! -nargs=1 TabCD
\ execute 'cd' <q-args>
\ | let t:cwd = getcwd()
autocmd MyAutoCmd TabEnter *
\ if !exists('t:cwd')
\ | let t:cwd = getcwd()
\ | endif
\ | execute 'cd' t:cwd
#!/bin/sh
cdddir=$HOME/.cdd
cddfile=$cdddir/cddfile
cddtmp=$cdddir/cddtmp
cddmax=20
function cdd_init() {
if [ ! -d $cdddir ]; then
mkdir $cdddir
fi
if [ ! -f $cddfile ]; then
for i in `seq $cddmax`
do
echo >> $cddfile
done
fi
touch $cddfile
touch $cddtmp
}
function cdd_cd() {
dir=`head -\`perl -e"print \"$1\"+1"\` $cddfile |tail -1`
builtin cd $dir
}
function cdd_ls() {
perl -nle 'print "\t", $n++, " $_"' $cddfile
}
function cdd_rec() {
perl -nle "\$c=\$i++;if(\$c==$1){print'$2'}else{print}" $cddfile > $cddtmp
cp $cddtmp $cddfile
}
function cdd() {
cdd_init
if [ $1 ]; then
cdd_cd $1
if [ $WINDOW ]; then
cdd_rec $WINDOW `pwd`
fi
else
cdd_ls
fi
}
function cd() {
cdd_init
builtin cd $@
if [ $WINDOW ]; then
cdd_rec $WINDOW `pwd`
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment