Skip to content
inkarkat edited this page Nov 18, 2010 · 37 revisions

Access todo.sh from anywhere in the file tree. Add the following to your ~/.bashrc file (~/.bash_profile for Mac and Cygwin users):

          PATH=$PATH:"/path/to/your/todo/scripts"

Avoid typing todo.sh every time. Add the following to your ~/.bashrc file (~/.bash_profile for Mac and Cygwin users):

          alias t='todo.sh -d /path/to/your/todo.cfg'

Then you simply type t add laundry from anywhere in your file tree to add a task.

Hide the configuration file by renaming it .todo.cfg.

Access your remote server’s todo.txt via ssh. If you have a shell account on remote.server.com, alias your todo.sh commands to do the same thing as usual but prepend ssh usernameremote.server.com@ to them. Something like:

      ssh [email protected] todo.sh list

Displays the remote todo list.

If you often have an open ssh session to remote.server.com consider appending the following to your ~/.ssh/config file:

Host *
ControlPath ~/.ssh/master-%r@%h:%p
ControlMaster auto

This causes ssh to use the existing connection rather than opening new ones. The speed up for additional connections is amazing.

Integrate your todo.txt onto your desktop

Bash completion

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:

_todo() 
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    COMMANDS="add a addto addm append app archive command del  \
              rm depri dp do help list ls listall lsa listcon  \
              lsc listfile lf listpri lsp listproj lsproj move \
              mv prepend prep pri p replace report"

    # Add custom commands from add-ons, if installed. 
    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"

    if [ $COMP_CWORD -eq 1 ]; then
	completions="$COMMANDS $OPTS"
    else
	case "${prev}" in
	    -*) completions="$COMMANDS $OPTS";;
	    *)  return 0;;
	esac
    fi

    COMPREPLY=( $( compgen -W "$completions" -- $cur ))
    return 0
}

complete -F _todo todo.sh
# If you define an alias (e.g. "t") to todo.sh, you need to explicitly enable
# completion for it, too: 
#complete -F _todo t

Now you can type $ todo ad<Tab> and Bash will autocomplete to $ todo add

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.

### === HIGH-COLOR === compatible with most terms including putty
### for windows... use colors that don't make your eyes bleed :)
export PINK='\\033[38;5;211m'
export ORANGE='\\033[38;5;203m'
export SKYBLUE='\\033[38;5;111m'
export MEDIUMGREY='\\033[38;5;246m'
export LAVENDER='\\033[38;5;183m'
export TAN='\\033[38;5;179m'
export FOREST='\\033[38;5;22m'
export MAROON='\\033[38;5;52m'
export HOTPINK='\\033[38;5;198m'
export MINTGREEN='\\033[38;5;121m'
export LIGHTORANGE='\\033[38;5;215m'
export LIGHTRED='\\033[38;5;203m'
export JADE='\\033[38;5;35m'
export LIME='\\033[38;5;154m'
### background colors
export PINK_BG='\\033[48;5;211m'
export ORANGE_BG='\\033[48;5;203m'
export SKYBLUE_BG='\\033[48;5;111m'
export MEDIUMGREY_BG='\\033[48;5;246m'
export LAVENDER_BG='\\033[48;5;183m'
export TAN_BG='\\033[48;5;179m'
export FOREST_BG='\\033[48;5;22m'
export MAROON_BG='\\033[48;5;52m'
export HOTPINK_BG='\\033[48;5;198m'
export MINTGREEN_BG='\\033[48;5;121m'
export LIGHTORANGE_BG='\\033[48;5;215m'
export LIGHTRED_BG='\\033[48;5;203m'
export JADE_BG='\\033[48;5;35m'
export LIME_BG='\\033[48;5;154m'
### extra attributes
export UNDERLINE='\\033[4m'

### sample of combining foreground and background
# export PRI_A=$HOTPINK$MEDIUMGREY_BG$UNDERLINE

Clone this wiki locally