tomtom / ttodo_vim

Edit, view, filter, and sort todo.txt files
http://www.vim.org/scripts/script.php?script_id=5262
GNU General Public License v3.0
14 stars 1 forks source link

set to "wrap" mode when setting filetype in nvim #8

Open nnako opened 1 year ago

nnako commented 1 year ago

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?

tomtom commented 1 year ago

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 commented 1 year ago

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

nnako commented 1 year ago

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:

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?

tomtom commented 1 year ago

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.