-
Notifications
You must be signed in to change notification settings - Fork 716
Tips and Tricks
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.
You can set the default action by setting “TODOTXT_DEFAULT_ACTION”.
You can combine the above alias with the default action so that typing t
lists your outstanding items.
Allow t
to list outstanding tasks Add the following to your ~/.bashrc
file (~/.bash_profile
for Mac and Cygwin users):
export TODOTXT_DEFAULT_ACTION=ls
alias t='todo.sh -d /path/to/your/todo.cfg'
You can still type t add laundry
from anywhere to add a task, but now you can just type t
to list your current tasks.
Sort your output by priority, then by number: Find export TODOTXT_SORT_COMMAND
in your configuration file, and set it as follows:
export TODOTXT_SORT_COMMAND='env LC_COLLATE=C sort -k 2,2 -k 1,1n'
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 username
remote.server.com@ to them. Something like:
ssh -qt [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 lsprj 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 [ "${cur:0:1}" == "+" ]; then completions="$(todo.sh listproj)" elif [ "${cur:0:1}" == "@" ]; then completions="$(todo.sh listcon)" elif [ $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 complete -F _todo todo
Now you can type $ todo ad
<Tab> and Bash will autocomplete to $ todo add
. Any words that begin with + or @ will be completed using projects or contexts, respectively.
Note: The Bash completion is currently being integrated into the main todo.txt distribution.
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