Skip to content
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

GTD changes pwd #225

Closed
danymat opened this issue Dec 8, 2021 · 4 comments · Fixed by #275
Closed

GTD changes pwd #225

danymat opened this issue Dec 8, 2021 · 4 comments · Fixed by #275
Assignees
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@danymat
Copy link
Member

danymat commented Dec 8, 2021

Yeah I tried it out. This is actually a different question. NeorgStart silent=true do start Neorg. Said you can follow these steps:

  1. Open Nvim at ~/foo
  2. Run pwd in command mode => result should be ~/foo
  3. Start Neorg via NeorgStart silent=true
  4. Open GTD view by Neorg gtd views
  5. Check pwd again in command mode => expected to be ~/foo but now changed to GTD workspace instead

Originally posted by @vanhtuan0409 in #224 (reply in thread)

@danymat danymat self-assigned this Dec 8, 2021
@danymat danymat added bug Issues related to bugs. Please attach a severity, a priority and category with this label. Category::GTD labels Dec 8, 2021
@danymat
Copy link
Member Author

danymat commented Dec 8, 2021

It seems like adding a new task with :Neorg gtd capture does the same thing

@danymat
Copy link
Member Author

danymat commented Dec 8, 2021

@vhyrro It seems like

if event.type == "core.norg.dirman.events.workspace_changed" then
-- Grab the current working directory and the current workspace
local new_cwd = vim.fn.getcwd()
local current_workspace = module.public.get_current_workspace()
-- If the current working directory is not the same as the workspace root then set it
if current_workspace[2] ~= new_cwd then
vim.cmd("lcd! " .. current_workspace[2])
end
end
-- If the user has changed directories and the autochdir flag is set then
if event.type == "core.autocommands.events.dirchanged" then
-- Grab the current working directory and the current workspace
local new_cwd = vim.fn.getcwd()
local current_workspace = module.public.get_current_workspace()
-- If the current workspace is not the default and if the cwd is not the same as the workspace root then set it
if module.config.public.autochdir and current_workspace[1] ~= "default" and current_workspace[2] ~= new_cwd then
vim.cmd("lcd! " .. current_workspace[2])
return
end
-- Upon changing a directory attempt to perform a match
module.public.update_cwd()
end
is doing some work here because we "open" buffers to read GTD content

@danymat danymat modified the milestone: 0.1 Dec 8, 2021
@danymat danymat changed the title [bug] GTD changes pwd GTD changes pwd Dec 8, 2021
@danymat
Copy link
Member Author

danymat commented Dec 17, 2021

It seems to be a global feature built into core (dirman autocommands).

It seems that opening buffers with TS (in order to parse them) triggers the dirman autocommands, and I don't know how to mess it up to make this work.

@danymat
Copy link
Member Author

danymat commented Dec 28, 2021

Hello @vanhtuan0409, can you use the gtd-performance branch and test your requirements ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.
Projects
None yet
1 participant