-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION]: cd into root when creating notes #7
Comments
Thanks for opening up the issue. I wanted to understand what problem are you facing for this feature not being present. Can you share some more details on that please. |
It is not a problem as such, but if I crate a note, at which point neovim is opened (as it is my editor), then neo-tree or nvimtree for example, will not show the right directory and therefore it is difficult to locate the newly created note. Also, if I want to fuzzy find something (e.g., with Telescope) then it would not be possible or difficult. This is because, most of the time after creating a note, I want to interact with the rest of my notes dir or vault (also, I am using |
Ahh right, I am aware of this and it was intentional since neovim uses the tdo script in non interactive mode. I personally use a keybinding that let's me quickly change the root to the parent of the current file: https://github.com/2KAbhishek/nvim2k/blob/13cb15d51e9ccc5ffa02e08b925d4642a3221722/lua/plugins/tools/which-key.lua#L126 You can also write a lua function that can do the same but change to git root instead of file root. |
Just pushed out a neovim command to handle git root / parent dir You can check it out here: 2KAbhishek/nvim2k@a96091e If this addresses your concern, feel free to close the issue as well |
Thanks for elaborating on that. Not sure what you mean by "neovim uses the tdo script in non interactive mode" though. I do have a similar command for changing the current directory in neovim (which I never use actually), but in my case, since whenever I interact with a note I want the notes directory to be set as the cwd, changing the cwd manually would add another step in my workflow. At the moment I am happy by adding Thanks again! |
I was referring to the https://github.com/2kabhishek/tdo.nvim plugin. This executes the script non interactively. |
Hey @idr4n I was going through the code and found a way to handle the case you mentioned without breaking compatibility with the neovim extension, I have pushed out a fix :) |
Thank @2KAbhishek. However I was referring to the functions that create notes, such as |
yes, they have been updated to cd into the root dir beofre opening neovim. check the |
Oh yes, I missed that. Thanks a lot @2KAbhishek, it is working as desired! |
Description
Hi there,
When I find a note with
tdo f
the functionfind_note
cd into root. I was wondering if there is a particular reason why this behavior is not added when creating notes, e.g. withtdo e
ortdo t
.Particularly, I would like to automatically cd into root whenever creating notes from any other path or directory outside of root. That is, to add
cd "$root" || return
to functions such asnew_todo
andnew_entry
.Let me know if you would like to consider a PR for this.
Thanks in advance!
Additional Information
No response
The text was updated successfully, but these errors were encountered: