Updated Tips and Tricks (textile)

jagipson
2011-06-21 06:29:13 -07:00
parent 98254e9335
commit 563227d839

@@ -67,44 +67,41 @@ This causes ssh to use the existing connection rather than opening new ones. The
Put this into @/etc/bash_completion.d/todo@ (system-wide, for all users), or put it somewhere in your home directory and source it from your @.bashrc@: Put this into @/etc/bash_completion.d/todo@ (system-wide, for all users), or put it somewhere in your home directory and source it from your @.bashrc@:
<pre> pre.. _todo()
_todo()
{ {
local cur prev opts local cur prev opts
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
COMMANDS="add a addto addm append app archive command del \ COMMANDS="add a addto addm append app archive command del \
rm depri dp do help list ls listall lsa listcon \ rm depri dp do help list ls listall lsa listcon \
lsc listfile lf listpri lsp listproj lsprj move \ lsc listfile lf listpri lsp listproj lsprj move \
mv prepend prep pri p replace report" mv prepend prep pri p replace report"
# Add custom commands from add-ons, if installed. # Add custom commands from add-ons, if installed.
COMMANDS="$COMMANDS $('ls' ${TODO_ACTIONS_DIR:-$HOME/.todo.actions.d}/ 2>/dev/null)" COMMANDS="$COMMANDS $('ls' ${TODO_ACTIONS_DIR:-$HOME/.todo.actions.d}/ 2>/dev/null)"
OPTS="-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x" OPTS="-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x"
if [ "${cur:0:1}" == "+" ]; then
if [ $COMP_CWORD -eq 1 ]; then completions="$(t listproj)"
completions="$COMMANDS $OPTS" elif [ "${cur:0:1}" == "@" ]; then
completions="$(t listcon)"
elif [ $COMP_CWORD -eq 1 ]; then
completions="$COMMANDS $OPTS"
else else
case "${prev}" in case "${prev}" in
-*) completions="$COMMANDS $OPTS";; -*) completions="$COMMANDS $OPTS";;
*) return 0;; *) return 0;;
esac esac
fi fi
COMPREPLY=( $( compgen -W "$completions" -- $cur )) COMPREPLY=( $( compgen -W "$completions" -- $cur ))
return 0 return 0
} }
complete -F _todo todo.sh complete -F _todo todo.sh
# If you define an alias (e.g. "t") to todo.sh, you need to explicitly enable # If you define an alias (e.g. "t") to todo.sh, you need to explicitly enable
# completion for it, too: # completion for it, too:
#complete -F _todo t complete -F _todo t
</pre> complete -F _todo todo
Now you can type @$ todo ad@&lt;Tab&gt; and Bash will autocomplete to @$ todo add@ p. Now you can type @$ todo ad@&lt;Tab&gt; and Bash will autocomplete to @$ todo add@. Any words that begin with + or @ will be completed using projects or contexts, respectively.
*High Color Support* *High Color Support*
xterm-based terminals, including Putty for Windows, support 256 colors instead of just 16. Here are some sample colors (including backgrounds) that you can paste into your config file right before the PRIORITY COLORS section. Check http://www.frexx.de/xterm-256-notes/ for a hex-to-xterm converter to get exactly the color you want. xterm-based terminals, including Putty for Windows, support 256 colors instead of just 16. Here are some sample colors (including backgrounds) that you can paste into your config file right before the PRIORITY COLORS section. Check http://www.frexx.de/xterm-256-notes/ for a hex-to-xterm converter to get exactly the color you want.