Git Product home page Git Product logo

ttodo_vim's Introduction

This plugin provides the |:Ttodo| command that allow easy editing,
viewing, and filtering of todo.txt files (see http://todotxt.com) via
|tlib#input#List()|. The plugin supports:

    - syntax highlighting for todo.txt files
    - search across multiple todo.txt files (see |:Ttodo|)
    - filter tasks with specific tags, lists etc. (see |:Ttodo|)
    - subtasks (outlines of complex tasks)
    - hide tasks until a threshold date
    - recurring tasks.

Examples: >

    " Show all tasks; default map (|g:ttodo_nmap|): <Leader>1
    :Ttodo

    " Show important tasks; default map (|g:ttodo_nmap_important|): <Leader>!
    :Ttodo!

    " Show tasks that are due in the next two weeks
    :Ttodo --due=2w

    " Show tasks with priorities A to C
    :Ttodo --pri=A-C

    " Show tasks matching @Test
    :Ttodo @Test

    " By default, |:Ttodo| scans the todo.txt files in |g:ttodo#dirs|. Users 
    " can also scan loaded buffers.
    " Show tasks in the current buffer
    :Ttodo --bufname=%

    " Command-line options can be collected in preference sets (see 
    " |g:ttodo#prefs|)
    :Ttodo --pref=work

Global maps:

    <Leader>1 ............ Show tasks (:Ttodo)
    <Leader>! ............ Show important tasks (:Ttodo --pref=important)

If filetype is ttodo, the following buffer-local keymaps are enabled:

    <cr> ................. Add a new task;
                           if |g:ttodo#ftplugin#add_at_eof| is true, add the 
                           task at the end of file
    <c-cr> ............... Add a new task; copy any list, tags, and notes from 
                           the current task;
                           if |g:ttodo#ftplugin#add_at_eof| is true, add the 
                           task at the end of file
    <s-cr> ............... Add a new subtask
    <LocalLeader>tx ...... Mark the current task as "done"
    <LocalLeader>td ...... Mark the current task as due in N days
    <LocalLeader>tw ...... Mark the current task as due in N weeks
    <LocalLeader>tm ...... Mark the current task as due in N months
    <LocalLeader>ty ...... Set the current task's priority
    <LocalLeader>ta ...... Archive completed tasks
    <LocalLeader>tb ...... View, filter tasks in the current buffer
    <LocalLeader>t* ...... View tasks in the current buffer that match the word 
                           under the cursor
    <LocalLeader>tn ...... Add a note (the filename uses the first @list tag)
    <LocalLeader>ti ...... Add a hopefully unique ID (an Adler32 hash)
    <LocalLeader>tD ...... Add a dependency

If filetype is ttodo, the following buffer-local commands are enabled:

    |:Ttodoarchive| ...... Archive completed tasks in the current buffer
    |:Ttodobuffer| ....... Show tasks in the current buffer only
    |:Ttodonote| ......... Add a new note to the task at the cursor
    |:Ttodosort| ......... Sort the tasks in the current buffer

As a ftplugin, ttodo supports the following syntax/extensions to todo.txt (see 
also https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format):

    (A) DATE TASK ........ A priority as upper case letter (at the beginning of the 
                           line)
    DATE TASK ............ An open task
    x DATE DATE TASK ..... A completed task (with completion date)
      indented tasks ..... A indented task is a subtask of the parent task; unless 
                           `has_subtasks` is true, |:Ttodo| will only show tasks 
                           with no open subtasks; this is similar to how the 
                           outline addon handles subtasks (see also 
                           https://github.com/samuelsnyder/outline-todo.txt)

                                                    *ttodo-tags*
A TASK may contain the following tags:
                                                    *ttodo-@next*
    @list ............ a "list" tag
                       NOTE: The is a special list `@next` that marks important 
                       task that should really be tackled next.
    +keyword ......... a "keyword" tag
    h:1 .............. hidden task
    due:YYYY-MM-DD ... due dates
                       NOTE: If a task is member of the `@next` list, filters 
                       by due dates will be ignored
    rec:+Nx .......... When marking a task a "done", add a new task with a due 
                       date in N d(ays), w(eeks), m(onths), y(ears); with the 
                       leading '+' use the original due date; else use the 
                       completion date; this is similar to how the Simpletask 
                       Android app handles `rec` tags
    t:YYYY-MM-DD ..... Hide the tasks until the given date
    t:-Nd ............ Hide the tasks until N days before the due date
    id:ID ............ Define a tasks ID string (an ID should consist 
                       of alphanumeric characters only)
    dep:IDs .......... Depends on task with ID (if the other task is not 
                       completed yet, mark the current task as pending);
                       IDs is a comma-separated list of IDs
    parent:ID ........ In outlines: the current task is the child of 
                       task with ID
                                                    *ttodo-file-options*
    $TTODO$ OPTION:VALUE .. If a line matches `$TTODO$` it is assumed to 
                       contain a file-local option. Search the help file for 
                       `OPTION:` to see which options are available. Users will 
                       typically want to hide such lines using `h:1`

If you set |g:ttodo_enable_ftdetect| to 0, you can use the |:Ttodo| command in 
conjunction with other syntax files/ftplugins such as:

    - https://github.com/freitass/todo.txt-vim
        - todo-txt.vim : Vim plugin for Todo.txt 
          https://github.com/dbeniamine/todo.txt-vim or
          http://www.vim.org/scripts/script.php?script_id=5134
    - https://github.com/mivok/vimtodo or
      http://www.vim.org/scripts/script.php?script_id=3264
    - https://github.com/davidoc/todo.txt-vim
        - My fork: https://github.com/tomtom/todo.txt-vim-1
    - https://github.com/dsiroky/vim-todotxt
    - ...

Related work:
    - https://github.com/elentok/todo.vim


-----------------------------------------------------------------------
Install~

To install the vimball, edit the vba file and type: >

    :so %

See :help vimball for details.

To install from github, please use
    1. git + a plugin loader like enable_vim, pathogen, vim-unbundle etc.
    2. a plugin manager like VAM, Vundle, NeoBundle, vim-plug etc.

The tlib_vim plugin is required:
https://github.com/tomtom/tlib_vim

Optional enhancement:
- https://github.com/tomtom/autolinker_vim for hyperlinking

Also available via git: http://github.com/tomtom/ttodo_vim


Setup~

Please set |g:ttodo#dirs| in |vimrc| before using |:Ttodo|.




Dependencies:
  tlib (>= 1.26) :: http://github.com/tomtom/tlib_vim

License: GPLv3 or later


ttodo_vim's People

Contributors

tomtom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

j86s gamaut

ttodo_vim's Issues

doc/ttodo.txt contains multiple defined tags

i_<expr> and n_<expr> are defined 3 times each. The help text is for the three ways of creating a new entry, <cr>, <s-cr> and <c-cr>, the tags should reflect this maybe, but I assume they are created automatically?

archiving should remove indention

the archiving function is nice to clean up files, would it be possible to remove indention? This is because the indention (of done subtasks) will not make any sense within the done.txt-file and the connection between parent and child is automatically added by the ids when a subtask is marked as done.

Document difference between Ttodo and Todo.txt for completed tasks

There's a difference in the way Ttodo handles completed tasks and the Todo.txt standard, I was just wondering why?

It's a bit confusing looking at the spec, but either the the priority should be discarded and moved to a key:value metadata; or it should be left between the x and the Completion date (2nd field).

I personally prefer moving it to a metadata.

I'm trying to understand your code - and learn Vim Script at the same time - to hopefully offer a patch for this.

Thanks

Ttodo (priority left between dates):

x 2023-06-30 (C) 2023-06-21 Send invites for week of June 26 to team workshops @Context +Project

But according to Todo.txt it should either be (priority moved to metadata):

x 2023-06-30 2023-06-21 Send invites for week of June 26 to team workshops @Context +Project pri:C

or (priority stays in 2nd field):

x (C) 2023-06-30 2023-06-21 Send invites for week of June 26 to team workshops @Context +Project

See https://github.com/todotxt/todo.txt#rule-2-the-date-of-completion-appears-directly-after-the-x-separated-by-a-space and also https://github.com/todotxt/todo.txt#todotxt-format-rules

concept for calculation of a task's id

ttodo provides a feature to create an "id string" for any task listed within the current task file. When in NORMAL mode, such a task's id can be created by pressing <localleader>ti or issuing a :call ttodo#ftplugin#AddId( <count> ).

In order to evaluate the "stability" and "universalit" of a task's id, I would be interested in knowing how exactly such a task id is calculated internally. As there are many possibilities to grab aspects of real life in order to set such an id, which ones did you pick and how did you combine them to generate the id string?:

  • did you use the position of the task line within the task file?
  • did you use the absolute number of tasks within the task file?
  • did you use the textual content of the task?
  • did you use a MAC address of the network interface of the local computer?
  • did you use part of a current global time stamp?
  • did you use a representation of "where" the local computer is located on earth?
  • did you use the current computer's user name?
  • ...

combining a subset of these options (or completely other aspects) could ensure a good and stable task id which is not found anywhere else within that scope.

could you describe the implemented concept?

:Ttodo --due= fails

I tried to use the due-date filter and got this:

Error detected while processing function ttodo#Show..ttodo#GetOpts..tlib#arg#GetOpts..<SNR>100_SetO
pt..<SNR>100_Validate:
line    6:
E605: Exception not caught: tlib#arg: 'due' has invalid value: '1w'
Error detected while processing function ttodo#Show..ttodo#GetOpts..tlib#arg#GetOpts..<SNR>100_SetO
pt:
line   80:
E171: Missing :endif
Error detected while processing function ttodo#Show..ttodo#GetOpts..tlib#arg#GetOpts:
line   12:
E170: Missing :endfor

Do you need any more information?

Logic error in Code

let refdate = rec =~ '^+' && !empty(due) ? due : donedate
let ndue = empty(due) ? donedate : due

the obove lines test empty(due) within a if-block that already tests empty(due) the code can be cleaned up.

I just realised this as I had changes in that part (can't remember what I tried there ;) ) and got merge conflicts during rebase.

set to "wrap" mode when setting filetype in nvim

Hey,

great plugin! runs even under neovim.

One question, though.

When loading a file e.g. called tasks.txt, the filetype has to be set manually, after the file has been loaded. For this, the command set filetype=ttodo works perfectly. In my current configuration under nvim, the general set nowrap seems to dominate the scene, so a set filetype=todo doesn't change this setting to wrap.

Where would I find the location in your ttodo plugin files to add a set wrap right where a set filetype=ttodo would target your code?

filetype detection inconvenience

my vim setup uses vam to include addons, therefore the plugins path is added to runtimepath after ~/.vim
somehow, when the ttodo-file type detection is called on a todo.txt-file those files are already detected as text and there for the setf command does not change that. Any reason why setf is prefered at this position over set filetye?

ttodo seems to generate the same id regardless of content

Hi,

I recently encountered that ttodo seems to generate identical "id" tags, regardless of what the todo item contains. I have two todo items:

2024-01-30 TEST +project sc:10
2024-01-30 TEST2345 +project2 sc:50

after pressing <localleader> + <T> + <I> on each line separately, I get this:

2024-01-30 TEST +project sc:10 id:AzL8n0Y58W0
2024-01-30 TEST2345 +project2 sc:50 id:AzL8n0Y58W0

The id value does not change. It seems that this is the case since about start of 2023. From there, all my tasks within different projects received AzL8n0Y58W0 as their generated id.

Could someone test this on his installation? What could be the problem, here?

Warning on start

tcomment: tcomment#DefineType() is deprecated; please use tcomment#type#Define() instead

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.