goneovim icon indicating copy to clipboard operation
goneovim copied to clipboard

cwd of gonvim

Open epheien opened this issue 5 years ago • 9 comments

On macOS High Sierra,when I start gonvim from dock icon,it's pwd is '/'. Default cwd is ~ is better.

epheien avatar Mar 23 '19 08:03 epheien

what do you mean? I'm trying to look for a way to start gonvim from command line, e.g. to open in VS code, just run

code .

but not sure how to do it with gonvim

jerrywang1981 avatar Apr 28 '19 00:04 jerrywang1981

@jerrywang1981 on macOS you can add /Applications/goneovim.app/Contents/MacOS to your $PATH and then you will able to execute goneovim .. Of course you can /Applications/goneovim.app/Contents/MacOS/goneovim ..

ephien refers to what happens when you open Goneovim as an app bundle either from the Dock, Spotlight, Launchpad or the Application directory. In those cases $PWD is set to /

tssm avatar Mar 12 '20 15:03 tssm

@jerrywang1981 on macOS you can add /Applications/goneovim.app/Contents/MacOS to your $PATH and then you will able to execute goneovim .. Of course you can /Applications/goneovim.app/Contents/MacOS/goneovim ..

ephien refers to what happens when you open Goneovim as an app bundle either from the Dock, Spotlight, Launchpad or the Application directory. In those cases $PWD is set to /

unfortunately /Applications/goneovim.app/Contents/MacOS/goneovim . does not set cwd to a current directory. It sets directory to ~.

onsails avatar Oct 01 '20 19:10 onsails

@onsails Hi This is probably a design change before and after the following commit. I'm trying to figure out how to fix it.

https://github.com/akiyosi/goneovim/commit/2307784a4605f5251967b61fc180e96fcf21d92c

akiyosi avatar Oct 02 '20 15:10 akiyosi

In relation to #325 and #337, I would like to change the current CWD setting specification to an approach where cwd is controlled by options.

akiyosi avatar Apr 19 '22 14:04 akiyosi

Is there any workaround to this? Goneovim seems not to save all buffers in the current session and auto-session doesn't work. Neither does mksession, which cannot write in the root directory.

I tried adding vim.cmd('cd ~') to init.lua. It works in the console but not in Goneovim.

dominikmayer avatar Jun 18 '23 05:06 dominikmayer

@dominikmayer Could you please tell me specifically the problem you are facing? (I understand that this issue itself is not an issue to the point that there is some kind of problem. However, I welcome you to report a related issue here.)

Tell me about the procedures and environmental conditions to reproduce or cause the problem you are facing.

akiyosi avatar Jul 03 '23 00:07 akiyosi

After writing the comment I realized that I had excluded root in the auto-session config.

All I want to achieve is to load the last session on startup. In the terminal, auto-session loads the last session in the current working directory. Doesn't work on goneovim, though. I assume it's because the working directory is never root.

After long trials I found a workaround by adding SessionRestore to my init.lua:

if vim.g.goneovim then
  -- Restoring the last session once Vim is idle
  autocmd("VimEnter", {
    pattern = "*",
    command = "lua vim.defer_fn(function() vim.cmd('SessionRestore') end, 0)",
  })
end

dominikmayer avatar Jul 03 '23 11:07 dominikmayer

I do such a configuration in my init.lua to implement this feature and it works well:

if vim.g.goneovim then
  vim.cmd('cd ~')
end

techloghub avatar Jul 20 '23 03:07 techloghub