smart-splits.nvim icon indicating copy to clipboard operation
smart-splits.nvim copied to clipboard

[Bug]: In vertical split, if accidentally smartsplits.resize_up, the layout becomes stuck in shorter height

Open DeepReef11 opened this issue 6 months ago • 4 comments

Similar Issues

  • [x] Before filing, I have searched for similar issues.

Neovim Version

nvim v0.11.1

Multiplexer Integration

tmux

Multiplexer Version

Using Ghostty terminal. There are no conflicting binding. When I remove the resize_up binding, the problem goes away.

Ghostty 1.1.2-r285.gee8ae19-1-arch

Version

  • version: 1.1.2-r285.gee8ae19-1-arch
  • channel: tip Build Config
  • Zig version: 0.13.0
  • build mode : builtin.OptimizeMode.ReleaseFast
  • app runtime: apprt.Runtime.gtk
  • font engine: font.main.Backend.fontconfig_freetype
  • renderer : renderer.OpenGL
  • libxev : io_uring
  • desktop env: other
  • GTK version: build : 4.16.12 runtime : 4.18.5
  • libadwaita : enabled build : 1.6.4 runtime : 1.7.2
  • libX11 : enabled
  • libwayland : enabled

Steps to Reproduce

Step to reproduce:

  • Split vertical
  • smartsplits.resize_up

Expected Behavior

Don't resize up when there are no horizintal split or resize down on resize_down

Actual Behavior

Stuck in resized up

Minimal Configuration to Reproduce

Here's my config:

return {
  {
    "mrjones2014/smart-splits.nvim",
    lazy = false,
    config = function()
      require("smart-splits").setup({

      default_amount = 7,
        swap = {
          -- this will create the mapping like
          -- <leader><C-h>
          -- <leader><C-j>
          -- <leader><C-k>
          -- <leader><C-l>
          mod = '<C>',
          prefix = '<leader>',
        },
      })
      -- resizing splits
      -- these keymaps will also accept a range,
      -- for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
      local smartsplits = require('smart-splits')
      
      vim.keymap.set('n', '<M-S-Left>', smartsplits.resize_left, {desc = "Resize pane <-left"})
      vim.keymap.set('n', '<M-S-Right>', smartsplits.resize_right, {desc = "Resize pane ->right"})
      vim.keymap.set('n', '<M-S-Up>', smartsplits.resize_up, {desc = "Resize pane to up"})
      vim.keymap.set('n', '<M-S-Down>', smartsplits.resize_down, {desc = "Resize pane down"})
      -- moving between splits
      vim.keymap.set('n', '<C-w><left>', smartsplits.move_cursor_left) -- These can more from left to right even when outbound
      vim.keymap.set('n', '<C-w><down>', smartsplits.move_cursor_down)
      vim.keymap.set('n', '<C-w><up>', smartsplits.move_cursor_up)
      vim.keymap.set('n', '<C-w><right>', smartsplits.move_cursor_right)
      vim.keymap.set('n', '<C-\\>', smartsplits.move_cursor_previous)
      -- swapping buffers between windows
      vim.keymap.set('n', '<leader><C-h>', require('smart-splits').swap_buf_left)
      vim.keymap.set('n', '<leader><C-j>', require('smart-splits').swap_buf_down)
      vim.keymap.set('n', '<leader><C-k>', require('smart-splits').swap_buf_up)
      vim.keymap.set('n', '<leader><C-l>', require('smart-splits').swap_buf_right)
    end
  },
}

Additional Details and/or Screenshots

No response

DeepReef11 avatar May 30 '25 12:05 DeepReef11

Can't reproduce in Zellij, must be a tmux specific issue.

mrjones2014 avatar May 30 '25 13:05 mrjones2014

Is it your terminal or neovim that gets resized in this situation?

mrjones2014 avatar May 30 '25 13:05 mrjones2014

No, only nvim. I don't use tmux

Image

DeepReef11 avatar May 31 '25 01:05 DeepReef11

Ah, well in the issue you wrote that you're using tmux.

Seems this is only reproducible when not using any multiplexer.

mrjones2014 avatar Jun 02 '25 13:06 mrjones2014

can you test if #373 fixes the issue

mrjones2014 avatar Sep 22 '25 17:09 mrjones2014