Vim plugin written in python for flat-file todo list time sheets
Vim must be compiled with python support
Requires vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Add timetracker to ~/.vimrc
call plug#begin()
Plug 'mozey/vim-timetracker'
call plug#end()
And install with plug
:PlugInstall
TODO :PlugUpdate doesn't seem to work? To update:
rm -rf ~/.vim/plugged/vim-timetracker && vim
:PlugInstall
As per the official docs
Use :pyfile myscript.py
TODO test.py
Manual testing
cp ./plugin/bindings.vim ~/.vim/plugged/vim-timetracker/plugin/bindings.vim
cp ./plugin/timetracker.vim ~/.vim/plugged/vim-timetracker/plugin/timetracker.vim
For many years I kept a todo.txt
on my computer. I would prefix these with the
year and month, for example, 2016-01 todo.txt
. At some point I switched to
using markdown so the files became 2016-02 todo.md
. Usually I would edit them
with whatever text editor was available on the OS I was currently using, for a
while now that text editor has been vim.
Many many times I've pondered using an actual database for this, and maybe I will at some point. I've also used various other text file based todo scripts and programs, but I find I keep coming back to using just a simple editable file, even though it's somewhat clunky.
A couple of years ago I wrote two vim plugins in python that helps me maintain the todo text files, this repos is a combination of these two plugins:
Make two different kinds of headers
# First kind
## Second kind
Insert current date
2016-02-02
Insert current time rounded to nearest 5 minutes
09:25
Calculate time difference in hh:mm
09:00 - 09:25 -> 00:25
Sum time diffs for a block
=> 01:30
Sum time diffs for the entire day
==> 07:00
Export todo.md
to json
The content of 2016-02 todo.md
might look like this
# 2016-02-01
## My Project
= Task 1
= Sub task of task 1
= Random note
09:00 - 09:25 -> 00:25
10:00 - 10:15 -> 00:15
11:10 - 12:00 -> 00:50
=> 01:30
= Task 2
== Skip this task, don't export
09:25 - 10:00 -> 00:35
=> 00:35
= Task 3
= Sub task of task 3
10:15 - 11:10 -> 00:55
12:00 - 13:00 -> 01:00
=> 01:55
## My Other Project
= Fixed amount expense
$123
= Task 1
14:00 - 17:00 -> 03:00
=> 03:00
==> 07:00
Some good tips for improvement here, Writing Vim Plugins in Python especially the bit about failing silently when vim doesn't have Python support.
More documentation here Scripting Vim with Python
The contents of the test
folder has to be revised