Skip to content

fix(#2191): disregard floating windows when opening window on edit #2209

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

Conversation

alex-courtis
Copy link
Member

fixes #2191

@alex-courtis alex-courtis merged commit 89816ac into master May 14, 2023
@alex-courtis alex-courtis deleted the 2191-disregard-floating-windows-when-opening-window-on-edit branch May 14, 2023 01:30
@TendonT52
Copy link

TendonT52 commented May 14, 2023

I've noticed that the recent change has caused unexpected behavior in my settings. According to the documentation, CR should initiate nvim-tree-api.node.open.edit(). However, when I press CR, it appears to execute nvim-tree-api.node.open.vertical() instead.

Here is my current configuration for your reference:
I'm using lazy.nvim

return {
  "nvim-tree/nvim-tree.lua",
  keys = {
    { "<leader>e", ":NvimTreeToggle<CR>" }
  },
  commit = "498e8793bbe73ab5235b3ee8f0aee32f5d01649f",
  init = function()
    local theme = require("config.theme")
    theme.highlight("NvimTreeCursorLine", { bg = theme.color.bg.floating.bright })
  end,
  opts = {
    disable_netrw = true,
    hijack_netrw = true,
    view = {
      number = true,
      relativenumber = true,
      float = {
        enable = true,
        quit_on_focus_loss = true,
        open_win_config = function()
          local screen_w = vim.opt.columns:get()
          local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
          local window_w = screen_w * 0.5
          local window_h = screen_h * 0.8
          local window_w_int = math.floor(window_w)
          local window_h_int = math.floor(window_h)
          local center_x = (screen_w - window_w) / 2
          local center_y = ((vim.opt.lines:get() - window_h) / 2)
              - vim.opt.cmdheight:get()
          return {
            border = "",
            relative = "editor",
            style = "minimal",
            row = center_y,
            col = center_x,
            width = window_w_int,
            height = window_h_int,
          }
        end,
      }
    },
    renderer = {
      add_trailing = false,
      group_empty = false,
      highlight_git = false,
      full_name = false,
      highlight_opened_files = "none",
      highlight_modified = "none",
      root_folder_label = ":~:s?$?/..?",
      indent_width = 4,
      indent_markers = {
        enable = false,
        inline_arrows = true,
        icons = {
          corner = "└",
          edge = "│",
          item = "│",
          bottom = "─",
          none = " ",
        },
      },
      icons = {
        webdev_colors = true,
        git_placement = "before",
        modified_placement = "after",
        padding = " ",
        symlink_arrow = " ➛ ",
        show = {
          file = true,
          folder = true,
          folder_arrow = true,
          git = false,
          modified = true,
        },
      },
      special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
      symlink_destination = true,
    },
  },
  config = function(_, opts)
    require("nvim-tree").setup(opts)
  end
}

I hope this issue can be resolved soon. Thank you.

@alex-courtis
Copy link
Member Author

I've noticed that the recent change has caused unexpected behavior in my settings. According to the documentation, CR should initiate nvim-tree-api.node.open.edit(). However, when I press CR, it appears to execute nvim-tree-api.node.open.vertical() instead.

I did not test floating windows. I'll see if I can come up with a fix for you to test.

@alex-courtis
Copy link
Member Author

@TendonT52 please see #2212

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

Successfully merging this pull request may close these issues.

Vim:E444: Cannot close last window
2 participants