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
Why was default-path removed? Is there another way to achieve it? #2991
Comments
If you want tmux to use the current working directory from an already-running pane you can use
If you want to set the working directory explicitly with an option you can use a user option and set that to where you want the path to be:
|
You could also use |
Thanks @nicm, I did devise a system like that which works: if #vim.fn.system('printenv TMUX') > 0 then
vim.fn.system('tmux set-option @default-path "' .. vim.fn.getcwd() .. '"')
end # @default-path gets set in git-worktree.nvim switch callback
if-shell -b '[ -n `tmux show-option -v @default-path` ]' " \
bind-key c new-window -c '#{@default-path}'; \
bind-key c new-window -c '#{pane_current_path}'" This workaround is working okay, although I don't love it. Thanks @bew, that is actually the hack that is used in the script I linked. |
That script seems to do a lot for this.. For your vim config, you should be able to simply do: if vim.env.TMUX then
vim.fn.system('tmux attach-session -c "' .. vim.fn.getcwd() .. '"')
end no? |
You could do |
That worked perfectly @bew, thank you! I think I had created my custom binding before trying this the first time so it was using |
Thank you, I actually wondered about doing that, but I'm just learning how to use the format strings. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
First, thank you for this wonderful tool!
I created a plugin for neovim that manages processes based on my current git worktree, which changes my working directory. This is a perfect use case for
default-path
, but it seems that was removed. Is there another way to do it? If found this, but that looks like a terrible way to have to solve this!Please tell me there is a better way to tell tmux I want the
new-window
command to use a specific path without having to pass the-c
flag.For further information, I would like to change the "working directory" of the pane where neovim is running while neovim is still running. Then if I execute
new-window
, I need the new window to also be in the new working directory.The "not so fun" solution I have come up is to set a session variable from my neovim plugin which can then be used in a tmux binding with the -c flag on
neww
... but I am hoping there is a better way.Thanks again.
The text was updated successfully, but these errors were encountered: