vifm.vim icon indicating copy to clipboard operation
vifm.vim copied to clipboard

Is it possible to select a directory to be neovim cwd within vifm?

Open satishskamath opened this issue 3 years ago • 3 comments

satishskamath avatar Feb 21 '23 21:02 satishskamath

No, but it probably won't be hard to add.

xaizek avatar Feb 25 '23 21:02 xaizek

Sorry for the really late reply @xaizek . I was wondering how this can be approached? I thought of 2 functions and I am not sure if this can already be achieved in some way other than vifm or default netrw has something built in for this:

  • Function 1: Setting directory of the currently opened buffer as the cwd.
  • Function 2: Choosing the last opened directory in the file tree as the cwd. (https://wiki.vifm.info/index.php/How_to_set_shell_working_directory_after_leaving_Vifm may be using this option --choose-dir and passing this on to the editor?)

satishskamath avatar Feb 09 '24 17:02 satishskamath

Yes, need to use result of --choose-dir, specifically feed it into :cd or :lcd. The catch though is that plugin's code is a mess. Code-wise:

  1. In s:StartVifm and s:HandleRunResults.
  2. Need to check cd for editcmd parameter and upon detection, pass --choose-dir instead of --choose-files.
  3. s:HandleRunResults should do exec cd <path> after checking that there is only one path.

xaizek avatar Feb 09 '24 18:02 xaizek