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

feature request: Please support nyngwang/NeoZoom.lua #64

Closed
1 task done
nyngwang opened this issue Mar 3, 2023 · 7 comments
Closed
1 task done

feature request: Please support nyngwang/NeoZoom.lua #64

nyngwang opened this issue Mar 3, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@nyngwang
Copy link
Contributor

nyngwang commented Mar 3, 2023

Did you check existing requests?

  • I have searched the existing issues

Describe the feature

Currently, oil.nvim always close the floating window created by nyngwang/NeoZoom.lua when it shouldn't.

<C-c> doesn't work as expected:

  1. Run :NeoZoomToggle on a buffer A to create a floating window holding A.
  2. Rnd :Oil to replace A with the filetree.
  3. Press <C-c> to switch back to A.

Step 3. will fail and close the floating window.

<CR> doesn't work as expected:

  1. Run :NeoZoomToggle on a buffer A to create a floating window.
  2. Rnd :Oil to replace A with the filetree.
  3. Press <CR> on buffer B to switch the current buffer to B.

Again, step 3. will close the floating window and stay in the oil buffer.

Provide background

I expect that I oil.nvim should not close any floating window created by other plugins.

Additional details

No response

@nyngwang nyngwang added the enhancement New feature or request label Mar 3, 2023
@stevearc
Copy link
Owner

stevearc commented Mar 5, 2023

Should be fixed now

@stevearc stevearc closed this as completed Mar 5, 2023
@nyngwang
Copy link
Contributor Author

nyngwang commented Mar 5, 2023

Confirmed. Thank you a lot!

@nyngwang
Copy link
Contributor Author

nyngwang commented Mar 5, 2023

@stevearc I just found a problem. I'm using a keymap like the following, and:

  • calling require('oil').close() doesn't always jump back to the buffer where require('oil').open() is called.
  • calling require('oil').close() sometimes closes the window on enter if it's located at the rightmost position, i.e. window moved to <C-w>L.
vim.keymap.set('n', ';', function ()
  if vim.bo.buftype == 'terminal' then return end
  if vim.bo.filetype ~= 'oil'
    then require('oil').open()
    else require('oil').close() end
end)

Update: I just found a client-side workaround that might be helpful as an impl. reference:

vim.keymap.set('n', ';', function ()
  if vim.bo.buftype == 'terminal' then return end
  if vim.bo.filetype ~= 'oil' then
      vim.w.oil_win_enter = vim.api.nvim_get_current_buf()
      vim.w.oil_view_win_enter = vim.fn.winsaveview()
      require('oil').open()
  else
    if vim.api.nvim_buf_is_valid(vim.w.oil_win_enter or -1) then
      vim.api.nvim_set_current_buf(vim.w.oil_win_enter)
      vim.fn.winrestview(vim.w.oil_view_win_enter)
    end
  end
end)

@stevearc
Copy link
Owner

Did the fix for #65 resolve this as well?

@nyngwang
Copy link
Contributor Author

nyngwang commented Mar 13, 2023

@stevearc Sorry for my late reply. the first point has been resolved and the second point is not valid after #65 as it's not related to the rightmost window anymore. The current problem is shown by the DEMO below:

Explanation for the DEMO:

  • At some point in the demo, there are four splits of the same buffer. I pressed the keymap ; as provided in my last comment to call require('oil').open() at one of the splits.
  • I pressed the keymap ; again to trigger require('oil').close(). I expect that the buffer of that split should be switched back to the buffer on enter, but the split got closed.

According to the demo, this is the new problem to be solved:

  • calling require('oil').close() sometimes closes the window on enter, but this does not necessarily happen at the rightmost window. As in the DEMO, the split in the middle got closed.
demo_oil_should_not_close_win_on_oil_close.mov

@stevearc
Copy link
Owner

That was an interesting autocmd edge case. Should be fixed now!

@nyngwang
Copy link
Contributor Author

nyngwang commented Mar 16, 2023

@stevearc Thank you! I just confirmed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants