freitass / todo.txt-vim Goto Github PK
View Code? Open in Web Editor NEWVim plugin for Todo.txt
Vim plugin for Todo.txt
I've had a file like this
(I) русский текст в строке
(L) ещё одна строка
(I) ещё больше строка даже с английскими буквами немножко foo:foo
- и много строк с минусами в начале
- ещё ....
- и ещё ...
- 20 more lines with minuses
and all the lines starting with '-' were truncated on first save event in effitask
(btw I have a backup copy of the file so I lost nothing)
Hi,
with this function in your .vimrc
:
autocmd FileType todo call s:todo_settings()
function! s:todo_settings()
setl includeexpr=substitute(v:fname,'+','','g')
setl suffixesadd+=.md
setl path+=~/Cloud/wiki/
endfunction
Pressing gf
with the crusor on the project tag, will open a corresponding project file.
For example:
(C) add todo.txt to conky +ConkyAndTodo.txt
Pressing gf
on the project tag will open the file: ~/Cloud/wiki/ConkyAndTodo.txt.md
Cheers
Gordian
First off, gotta say I love this plugin. Thanks for it! It's definitely been a great addition to my arsenal!
However, after the last update, mappings no longer seem to be working. Is there something I can test to make sure that it's not just me? It's happening on more than one of my machines.
Thanks,
Andy
It would be nice to rather than delete completed tasks, to concatenate them into done.txt in the same directory. The iOS app can do this, and it is nice to keep the todo file cleaner.
When there is already a date on the current line using <localleader>d
add a new one (becoming the new creation date). Adding a new date should replace the old one (or do nothing, with an option selecting the desired behaviour).
The same happens with the priority so adding a priority should replace the old one. e.g.: when the priority is (D)
, using <localleader>a
on the line should replace the priority by (A)
edit: PS: thanks for this awesome plugin!
What about the ability to filter arbitrarily, kind of like the todo.sh ls
works?
Perhaps a command you run:
:todo.txt-filter @mytag +myProject
Would then re-order the file with all of the tasks matching the query on top, and the rest in a fold below?
I have little insight into how to accomplish this with vim+python and how the folding API works. Any thoughts?
Just installed todo.txt-vim using the quick install instructions. Code Highlighting looks great Mappings aren't being found. What am I missing?
This is my .vimrc:
set number
map ""
map ""
map ""
map ""
syntax on
set ignorecase smartcase
set history=200
set incsearch
set ww=b,s,<,>,[,]
set spell
com! Pdf !open %:r.pdf
autocmd FileType .ml source ~/.vim/ml.vim
autocmd FileType plaintex source ~/.vim/latex.vim
autocmd FileType tex setlocal makeprg=pdflatex\ --shell-escape\ '%'
autocmd Syntax ocaml set commentstring=(%s*)
set viminfo+=n~/.viminfo
set spell
hi clear SpellBad
hi SpellBad cterm=underlinelet mapleader=","
let maplocalleader=""
set whichwrap+=<,>,h,l,[,]
set showcmdfiletype on
au BufNewFile, BufRead *.csv set filetype=nextActions
autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
set relativenumber
I have several functions that I created for my own convenience that may fit into this plugin. If any or all of these fit into the spirit of this plugin and I can create a PR.
According to the Todo.txt format creation dates are saved in completed tasks. Currently instead of the completion date being appended to the task, they are replaced.
https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format
at least in my vim, lists or contexts (the ones starting with @) have the same color as tags or projects (+fields)...
any ideas?
For example, I have this setting in my vimrc.
let mapleader = ' '
let maplocalleader = ' '
nnoremap <Leader>b :CtrlPBuffer<cr>
nnoremap <Leader>k :bprevious\|bdelete \#<cr>
However, hasmapto function is not checking my setting correctly.
:echo hasmapto("<leader>k",'n') " => 0
:echo hasmapto("<localleader>k",'n') " => 0
:echo hasmapto("<leader>b",'n') " => 1
:echo hasmapto("<localleader>b",'n') " => 1
It leads to the whole mapping checking behaves in a strange way. Is there anyway I can globally disable the mapping instead of checking mapping respectively?
How do I get todo.txt vim plugin to respect the colours I have defined within my todo.cfg file?
I have custom color settings in todo.cfg for when doing various sorting/filtering on the command line but all my priority colours are changed when I open my todo.txt file with vim and this wonderful plugin.
Lazy config:
return {
'MunifTanjim/nui.nvim',
{
'arnarg/todotxt.nvim',
dependencies = {'MunifTanjim/nui.nvim'},
config = function()
local todo = require("todotxt-nvim")
todo.setup({
todo_file = "~/Documents/todo.txt",
sidebar = {
width = 40,
position = "right", -- default: "right"
},
capture = {
prompt = "> ",
-- Percentage is percentage of width of the whole editor
-- Integer is number of columns
width = "50%",
position = "50%",
-- Styled after https://swiftodoapp.com/todotxt-syntax/priority/
-- With this, if you include any of the below keywords it will
-- automatically use the associated priority and remove that
-- keyword from the final task.
alternative_priority = {
A = "now",
B = "next",
C = "today",
D = "this week",
E = "next week",
},
},
-- Highlights used in both capture prompt and tasks sidebar
-- Each highlight type can be a table with 'fg', 'bg' and 'style'
-- options or a string referencing an existing highlight group.
-- highlights = {
-- project = "Identifier",
-- }
highlights = {
project = {
fg = "magenta",
bg = "NONE",
style = "NONE",
},
context = {
fg = "cyan",
bg = "NONE",
style = "NONE",
},
date = {
fg = "NONE",
bg = "NONE",
style = "underline",
},
done_task = {
fg = "gray",
bg = "NONE",
style = "NONE",
},
priorities = {
A = {
fg = "red",
bg = "NONE",
style = "bold",
},
B = {
fg = "magenta",
bg = "NONE",
style = "bold",
},
C = {
fg = "yellow",
bg = "NONE",
style = "bold",
},
D = {
fg = "cyan",
bg = "NONE",
style = "bold",
},
},
},
-- Keymap used in sidebar split
keymap = {
quit = "q",
toggle_metadata = "m",
delete_task = "dd",
complete_task = "n",
edit_task = "cc",
},
})
vim.keymap.set("n", "<leader>t", ":ToDoTxtTasksToggle<CR>")
vim.keymap.set("n", "<leader>a", ":ToDoTxtCapture<CR>")
end,
},
}
Error message:
E5108: Error executing lua ...n/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:214: Invalid buffer id: 13
stack traceback:
[C]: in function 'create'
...n/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:214: in function 'mount'
...n/.local/share/nvim/lazy/nui.nvim/lua/nui/input/init.lua:80: in function 'mount'
...l/share/nvim/lazy/todotxt.nvim/lua/todotxt-nvim/init.lua:211: in function 'capture'
[string ":lua"]:1: in main chunk
Reproducable steps:
Hello,
I have been using the great simpletask android app. The app has a nice feature that allows for recurring tasks by adding to the task line the following:
"rec:7d" will automatically create the same task due 7 days after the completion date, "rec:2w" will create the same task due 2 weeks from the completion date, etc...
I was playing around with the txt.vim file and added an if statement to the todo#txt#mark_as_done() function which mimics this behavior:
function! todo#txt#mark_as_done()
let current_line = getline('.')
if (current_line =~ 'rec\:\d\{1,4\}[d,w,y]')
let recurrence_time = split(split(current_line,"rec:")[1]," ")[0][:-2]
let recurrence_unit = split(split(current_line,"rec:")[1]," ")[0][-1:]
if (recurrence_unit == 'd')
let no_of_days = recurrence_time
endif
if (recurrence_unit == 'w')
let no_of_days = 7*recurrence_time
endif
normal! yy P j
execute 's/\d\{2,4\}-\d\{2\}-\d\{2\}/' . strftime('%Y-%m-%d',localtime()+24*3600*no_of_days)
normal! k
endif
call s:remove_priority()
call todo#txt#prepend_date()
normal! Ix
endfunction
Right now, it only works for days and weeks. Let me know if this works for you and if you have any ideas on how to add month/year recurrence.
It would be really nice to have a vim integration of the 'note' plugin, which lets define one file of notes for each task.
For example a shortcut to automatically open the note file of the task below the cursor, and some marker to show that the task has a related note in the todo.txt.
<leader>-d
and <leader>-D
must insert dates in the beginning of the line, not right under cursor
Hi! I love this plugin, and use it to keep track of my todo-list on my pc and laptop alongside the FOSS Markdown & todo.txt editor Markor on my Android. I sync a folder between all my devices, and this setup works great for me, but there's a minor issue. todo.txt-vim archives completed to-do's to done.txt
, but Markor archives completed todo items to todo.done.txt
! I thought it'd be a quick fix and checked :h, but alas; and neither does Markor support changing the archive file-name at this time.
Hi,
to begin with, thanks for the great work!
I am not using a standard keyboard layout, and remapping is kind of a hassle. What would you think of defining the mappings as options instead?
So that in my vimrc I can also change the values of these options?
Thank you.
Issue is with before.py, Line 47.
last_month_day = str((date(int(year), (int(month) + 1) % 12, 1) + - date.resolution).day)
This would never work in November, as you would get a '0' instead of a '12', and there is no 0 month.
If this is adjusted to (int(month) % 12) + 1, then it corrects the issue with November, and matches all other month cases.
Hello @freitass
There's a new organization (@todotxt) managing the todo.txt
format, todo.txt-cli
, and other apps. It'd be great to move this repo there and get more group maintenance. Would you be willing to move this project over and join the team to manage your repo, with the help of others?
It's better to move it than fork it since the issues, wiki, and history will all move along with it.
Hello,
My vim has been built with python3 but not with python. Here are the relevant output of vim --version
: -python +python3
.
However I get a error message at start-up and the feature regarding overdue dates does not work.
I think it should work with python 3 and the line 53 in todo.vim should be replaced by if has('python') || has('python3')
.
Best.
I love this project but I messed around in my .vimrc and somehow
filetype plugin on
wasn't set. This caused this plugin not to work anymore. Maybe you could just mention that for the vim newbies like me. ;)
I'm new to the vim customization/plugin ecosystem and couldn't figure out how to use todo.txt-vim with vim-gnupg for encrypted todo files. When decrypting a todo.txt.gpg
file, the result wouldn't have the correct syntax highlighting.
I'm sharing this here because it seems the wiki isn't set up. Adding the following to .vimrc
will turn on todo.txt syntax highlighting for decrypted todo.txt.gpg
and *.todo.txt.gpg
files:
autocmd BufRead,BufNewFile *todo.txt.gpg set filetype=todo
Maybe there's a better way to do this, but it works.
Is it possible to include autocompletion for projects and contexts, such that typing
@ho
would complete to @home, or give a choice such as
@home
@homebase
@homebargains
Cheers
Pete
Hi,
The git clone call in README.md says
git clone git://github.com/freitass/todo.txt-vim.git
instead of
git clone git://github.com/freitass:todo.txt-vim.git
Best,
iago
Currently all dates are highlight using regexp, but it would be cool to highlight overdue dates as Error, for example. Preferably, only dates with "due:" prefix.
I propose to move all keybindings to localleader mapping as it is filetype-specific plugin. It will eliminate possible overrides of user keybindings.
At the current moment is as easy as typing :g/^x /d
. Should there be a shortcut?
What do you think about appending the characters +
(plus sign) and @
(at sign) to the iskeyword
(isk
) option?
:set iskeyword+=+,@-@
This way pressing *
(star) on +project
and @tag
will include +
and @
to the word search. Citing from :h iskeyword
:
Keywords are used in searching and recognizing with many commands: "w", "*", "[i", etc. It is also used for "\k" in a pattern.
Do you think this is a good idea?
As mentioned at http://lifehacker.com/166299/geek-to-live--list-your-life-in-txt, it's useful to have multiple todo.txt style lists, for example, a shopping.txt. Obviously it doesn't make sense to match all *.txt files, but it would be great if this plugin matched *.todo.txt.
Of course, I can do that manually, with
au BufNewFile,BufReadPost *.todo.txt set filetype=todo
but <leader>D
doesn't work then, it just adds the done things to done.txt
. Would it be possible for <leader>D
to match the filename, and move done items to, for example, shopping.done.txt
?
It would be great to have the option to put a blank line between groups (+projects
, @tags
), to make them more visually distinct.
I have installed the plugin and can see it with :scriptnames. The highlighting works as well. When I go to sort the file with -s the file is not sorted and I find myself in insert mode and the char before the cursor is deleted.
--Jan Carlin
First of all: thank you very much for this vim customization!
I like the idea of shortcuts a lot, but I am not sure how to use them. For instance I tried the option <leader>-k : Increase the priority of the current line
. My leader
is usually :
. For instance, when I want to save a file and then exit, I type :wq
. So I opened my todo.txt and typed :k
, also tried :-k
, but it returns E471: Argument required
.
I also tried marking the whole line before applying this, but no luck.
Any help is greatly appreciated - thanks.
Update:
My key was not defined, so I added let mapleader=","
to my .vimrc. Then I tried ,k
and ,-k
in command mode, but still no success for me.
Update 2:
I tried date<tab>
now in insert mode, and it results in exactly that verbatim, without inserting the date. So maybe something is not set up correctly - like permissions. But I do get the highlighting, so the add-on is in the right folder ~/.vim
.
Update 3:
Some of my other mappings from long ago were conflicting these mappings. So I temporarily moved my .vimrc
, and then typed -- using the default map leader \
-- \k
in command mode. Still no luck.
If a project or context begins the line (which helps to sort the list on the iOS app), that project or context remains the default color. I tried several colorschemes, but it remains the same.
Marking a task as done with the <localleader>x
key binding, removes the task's priority, which is unnecessary and may affect some users negatively.
(B) Linear regression Rnet=Qh+Qle. +cons_emp_model
(A) Review key questions. +benchmarking
(B) simple model first +cons_emp_model
This is the sorted result with <leader>s+
. the +Qle is not a project, and so it shouldn't be included in the sorting. A project needs to have a space before it, according to the spec, and in this case it doesn't. Bad regex?
Hey:
This is a really useful tool. Thank you!
My question is this: the documentation says:
date (Insert mode) Insert the current date
Does that mean:
Enter Insert mode.
Type 'date' followed by a tab.
Thanks,
Greg
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.