Closed gal064 closed 1 year ago
So, if I understand it correctly the idea is to open the entire file in an external editor at the position of the current task?
Gotta say, I like the idea. But I would probably generalize it a bit more. Is that something you would consider? Like adding it as a new function (similar to edit-external
) so it could be bound to a key? In case of a generalization it would also make sense to have a configuration option that allows the communication of file and line number to the external program, e.g. external-file-editor = code -r -g %(filename)s:%(line)s:99999
and if the filename
and line
placeholders are not in place they are added by default in the filename:line
notion?
What do you think?
Oh, and I understand why you don’t use the regular edit-external
functionality: it does not allow for editors that would require additional parameters, like code -r -w
.
I’m fixing that now. That’s now fixed (version 3.3.2)
Great! 3.3.2 solves my problem!
Re
open the entire file in an external editor at the position of the current task
That was mainly to allow me to edit files in vscode. My suggestion is to decide the preferred behaviour (i.e. open just the specific task in a temp file, or open the todo.txt at the relevant line) and use it for the "Open in external editor" command. I don't think this is important enough to have two separate commands.
Just my thoughts. But as I mentioned 3.3.2 solves my problem as well so on my side I think that's great.
Happy to hear that the root of your issue with pter could be solved like this!
But I’d like to leave this issue open because I like the idea to open the respective todo.txt file as a separate functionality. I can see that being super useful when adding tasks in bulk. Just not going to implement it right now :)
I like the idea to open the respective todo.txt file as a separate functionality Up to you of course, but I don't see the value in having both. I agree opening the respective todo.txt is great, but if you implement that, why would someone want to open a task in a temp file?
In other words if any action you can accomplish with the temp file, you can accomplish with the full todo.txt, consider just switching the behavior and not create a separate function
The use-case for the separate temp file to edit one task in is to prevent merge conflicts while editing the task file in the external editor.
In this scenario edit-external
will happily do the merge, because it only replaces the line that contains the task that you edit.
Finally, there’s the edit-file-external
function in pter 3.8.0. It’s not bound to any key by default, as it’s a bit of an obscure function.
Hi,
I added support for VS Code as an external editor. See https://github.com/gal064/pter
I'd create a pull request but I don't have a codeberg account. Do you want to clone and merge?
Here's the specific commit: https://github.com/gal064/pter/commit/eb6efad03a76f123439fc90477d89ac9700e5217