shortcuts / no-neck-pain.nvim

☕ Dead simple yet super extensible plugin to center the currently focused buffer to the middle of the screen.
MIT License
552 stars 13 forks source link

The neo-tree integration seems to be broken on small window width #331

Closed Demianeen closed 6 months ago

Demianeen commented 6 months ago

Description

The neo-tree integration seems to be broken on small window width

https://github.com/shortcuts/no-neck-pain.nvim/assets/51330172/15c27e56-2ae9-46d6-a278-db52d2f5e693

Steps to reproduce

  1. Set small window width (80 for example)
  2. Toggle neotree
  3. See that your code opened in wrong buffer

Expected behavior

Neotree integration will work with any width

Environment

shortcuts commented 6 months ago

Hey @Demianeen thanks for using the plugin!!

I've tried to reproduce myself but I'm not able to see any issue with the plugin, neither to see the bug on your video. Could you point to a timestamp where it happens?

Thanks!

Demianeen commented 6 months ago

Sure @shortcuts, on 9th second you will see that instead of focusing on buffer with a file, it focuses on left pane buffer that centers the main file buffer. In my case, setting width to 80. Config that reproduces it for me:

{
    'shortcuts/no-neck-pain.nvim',
    event = 'BufEnter',
    opts = {
      width = 80,
      -- --- @type table
      -- mappings = {
      --   -- When `true`, creates all the mappings that are not set to `false`.
      --   --- @type boolean
      --   enabled = true,
      --   -- Sets a global mapping to Neovim, which allows you to toggle the plugin.
      --   --- @type string
      --   toggle = '<Leader>unp',
      --   -- Sets a global mapping to Neovim, which allows you to toggle the left side buffer.
      --   --- @type string
      --   toggleLeftSide = '<Leader>unql',
      --   -- Sets a global mapping to Neovim, which allows you to toggle the right side buffer.
      --   --- @type string
      --   toggleRightSide = '<Leader>unqr',
      --   --- @type string | { mapping: string, value: number }
      --   widthUp = { mapping = '<Leader>un=', value = 20 },
      --   --- @type string | { mapping: string, value: number }
      --   widthDown = { mapping = '<Leader>un-', value = 20 },
      --   -- Sets a global mapping to Neovim, which allows you to toggle the scratchpad feature.
      --   --- @type string
      --   scratchPad = '<Leader>uns',
      -- },
      autocmds = {
        enableOnVimEnter = true,
      },
      -- buffers = {
      --   scratchPad = {
      --     enabled = false,
      --     fileName = 'NeovimNotes',
      --     -- set to `nil` to default
      --     -- to current working directory
      --     location = '~/Documents/',
      --   },
      --   bo = {
      --     filetype = 'markdown',
      --   },
      -- },
    },
  }

P.S. Already love your plugin. I was actually trying to do setup similar to this with zen mode before with autocmds, but your is so much better for this purpose)

shortcuts commented 6 months ago

Thanks for the details, and I'm glad you like the plugin ❤️ I try to make it as extensible as possible :)

I'm sorry but I've tried to reproduce your issue with many screen sizes etc. but I can't make it focus the wrong buffer, my guess is that you have an other plugin that conflicts with all of that 🤔

Alternatively, you can set autocmds.skipEnteringNoNeckPainBuffer to true which aims at re-routing focus on side buffers to the main one, which should fix your issue

I'm closing this issue unless you have more details, feel free to reopen!