akiyosi / goneovim

A GUI frontend for neovim.
MIT License
2.41k stars 63 forks source link

cwd of gonvim #43

Open epheien opened 5 years ago

epheien commented 5 years ago

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

jerrywang1981 commented 5 years ago

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

tssm commented 4 years ago

@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 /

onsails commented 4 years ago

@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 ~.

akiyosi commented 4 years ago

@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 commented 2 years ago

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.

dominikmayer commented 1 year ago

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.

akiyosi commented 1 year ago

@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.

dominikmayer commented 1 year ago

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
techloghub commented 1 year ago

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