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

nnn fullscreen always errors when closing #101

Open
FabioAntunes opened this issue Jul 31, 2024 · 0 comments
Open

nnn fullscreen always errors when closing #101

FabioAntunes opened this issue Jul 31, 2024 · 0 comments

Comments

@FabioAntunes
Copy link

FabioAntunes commented Jul 31, 2024

This change 62b0153

Introduced some bug when starting nvim . and nnn is in explorer mode.

I have modified the nnn.lua to print the existing variables hopefully this will help understanding the issue:

The original code:

-- Close and re-open explorer when it was fullscreen
  if mode == "explorer" and state[mode][tab].fs then
    a.nvim_win_close(state[mode][tab].win, {force = true})
    M.toggle("explorer", false, false)
    c("vert resize +1 | vert resize -1 | wincmd p")
  end

What I added:

  if mode == "explorer" and state[mode][tab].fs then
+    vim.print(state[mode][tab].win)
+    vim.print(state[mode][tab])
+    vim.print(state[mode])
+    vim.print(a.nvim_list_wins())
+    vim.print(a.nvim_tabpage_list_wins(0))
    a.nvim_win_close(state[mode][tab].win, {force = true})
    M.toggle("explorer", false, false)
    c("vert resize +1 | vert resize -1 | wincmd p")
  end

And this is the output of the :messages

nil
{
  buf = 1,
  fs = true,
  id = 3
}
{ {
    buf = 1,
    fs = true,
    id = 3
  } }
{ 1000 }
{ 1000 }
Error executing vim.schedule lua callback: ...l/share/nvim/site/pack/packer/start/nnn.nvim/lua/nnn.lua:132: Invalid 'window': Expected Lua nu
mber
stack traceback:
        [C]: in function 'nvim_win_close'
        ...l/share/nvim/site/pack/packer/start/nnn.nvim/lua/nnn.lua:132: in function 'handle_files'
        ...l/share/nvim/site/pack/packer/start/nnn.nvim/lua/nnn.lua:164: in function <...l/share/nvim/site/pack/packer/start/nnn.nvim/lua/nnn
.lua:163>

As you can see there's no win property in the state[mode][tab]

As for the configs for nnn I'm using packer and requiring a file with the configs:

-- packer/lua
use({
    "luukvbaal/nnn.nvim",
    config = function()
      require("fantunes.plugins.nnn-nvim")
    end,
  })
  
-- ------------------------------------------
-- fantunes.plugins.nnn-nvim.lua
vim.cmd([[packadd nvim-web-devicons]])
local map = vim.api.nvim_set_keymap
local mapOpts = { noremap = true }

map("n", "<leader>nn", ":NnnExplorer<CR>", mapOpts)

require("nnn").setup({
  explorer = {
    cmd = "nnn -H",
  },
  replace_netrw = "explorer",
  auto_close = true,
  windownav = {
    left = "<C-h>",
    right = "<C-l>",
  },
})

There are a few more issues with these changes, but I can raise them in separate issues if you prefer?

For now I have reverted to a previous commit:

use({
    "luukvbaal/nnn.nvim",
    commit = "62b01532a9dcb0111459b308668aebdb0088bfd8",
    config = function()
      require("fantunes.plugins.nnn-nvim")
    end,
  })

Let me know if you need any more info.

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

No branches or pull requests

1 participant