Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.
/ vim-timetracker Public archive

Vim plugin written in python for flat-file todo list time sheets

License

Notifications You must be signed in to change notification settings

mozey/vim-timetracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

timetracker

Vim plugin written in python for flat-file todo list time sheets

Installation

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

Debugging

As per the official docs

Use :pyfile myscript.py

Testing

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

Why?

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:

timetracker.vim

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_json.py

Export todo.md to json

Example

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

TODO

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

About

Vim plugin written in python for flat-file todo list time sheets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published