Ben Bass avatar Ben Bass committed 56e4eba

updates

Comments (0)

Files changed (2)

 alias webserve="python -m SimpleHTTPServer"
 alias sf="find . ! \( -name .svn -prune \) -a -type f -print0 | xargs -0 grep -Hn --color"
 alias sn="find . ! \( -name .svn -prune \) -a -type f -name"
+alias sfn="find . ! \( -name .svn -prune \) -a -type f -print0 | xargs -0 grep -l"
 alias http_head="curl -I"
 alias cdtemp='td=$(mktemp -d); pushd $td; bash; popd;'  # TODO: add a trap to remove on exit
 alias pp="egrep '^\s*(def|class) '"
 
 en () {
-  MY_EDITOR=$VISUAL
-  if [[ -z $MY_EDITOR ]] ; then
-    MY_EDITOR=$EDITOR
+  MY_EDITOR="$VISUAL"
+  if [[ -z "$MY_EDITOR" ]] ; then
+    MY_EDITOR="$EDITOR"
   fi
-  if [[ -z $MY_EDITOR ]] ; then
+  if [[ -z "$MY_EDITOR" ]] ; then
     MY_EDITOR=/usr/bin/vim
   fi
-  find . ! \( -name .svn -prune \) -a -type f -name $1 | xargs $EDITOR
+  # see http://stackoverflow.com/questions/3852616/xargs-with-command-that-open-editor-leaves-shell-in-weird-state
+  export MY_EDITOR
+  find . ! \( -name .svn -prune \) -a -type f -name $1 | xargs sh -c '${MY_EDITOR} "$@" < /dev/tty' "${MY_EDITOR}"
 }
 
-map () { prog=$1; shift; for arg in $@; do eval $prog $arg; done }
+map () { prog="$1"; shift; for arg in $@; do eval "$prog" "$arg"; done }
 
 # mcd is part of mtools by default (change MSDOS directory)
 mcd () {
 set nobackup
 set nowritebackup
 set noswapfile
-set lines=40
-set columns=80
+"set lines=40
+"set columns=80
 :nnoremap <F5> :buffers<CR>:buffer<Space>
 
 set expandtab
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.