ttodo_vim icon indicating copy to clipboard operation
ttodo_vim copied to clipboard

set to "wrap" mode when setting filetype in nvim

Open nnako opened this issue 2 years ago • 4 comments

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?

nnako avatar Feb 17 '23 15:02 nnako

I think the right location for a customisation would be after/ftplugin/ttodo.vim somewhere in &runtimepath.

What would you like to achieve. ttodo sets textwidth=0 to avoid hard line wraps. It can only deal with single-line tasks.

tomtom avatar Feb 18 '23 14:02 tomtom

Doesn't ftdetect/ttodo.vim get loaded? It should take care of setting the filetype.

tomtom avatar Feb 18 '23 14:02 tomtom

I think the right location for a customisation would be after/ftplugin/ttodo.vim somewhere in &runtimepath.

True. Thanks, there I added a setlocal wrap to realize "soft" line breaks and it does exactly what I wanted, now.

What would you like to achieve. ttodo sets textwidth=0 to avoid hard line wraps. It can only deal with single-line tasks.

True. People generally seem to use the todotxt format to store very short tasks which fit into one single line of text, each. I use my own extended version of this format in order to be able to encode further features into one line (without breaking the todotxt format itself), like:

  • line breaks (to be able to encode some kind of basic text structure)
  • author information (who created this task)
  • responsible information (who will be the one solving the task)
  • tracker information (who would be interested to get notified at a certain score)
  • remarks (comments on the progression of the task, like done in TaskWarrior)
  • dependencies (on which tasks would a task depend on)
  • ...

would you mind if I sent you a PR containing this setting? It would just enable the line to have the capacity to break virtually/visually (thus still not creating a physical new line). In case other users end up with lines longer than expected, they wouldn't need to scroll their view sideways.

What do you think?

nnako avatar Feb 24 '23 18:02 nnako

would you mind if I sent you a PR containing this setting?

wrt wrap, I don't think wrap should be set by a plugin. Users have already configured vim to their liking (vim provides plenty of possibilities for that). I'd rather consider it bad practice if a plugin messes with that (i.e., changes non-essential options).

You can add notes to a task for comments.

Dependencies should already be implemented (see :h ttodo-tags) and the note about indented tasks.

Line breaks would interfere with how todo.txt works - and would make the file unreadable for other todo.txt clients.

Author, assigned-to, tracker etc.: this could be done (by convention) using custom tags or lists. I'm not sure, something has to be added to the plugin as such.

tomtom avatar Feb 26 '23 10:02 tomtom