mrjones2014 / smart-splits.nvim

🧠 Smart, seamless, directional navigation and resizing of Neovim + terminal multiplexer splits. Supports tmux, Wezterm, and Kitty. Think about splits in terms of "up/down/left/right".
MIT License
904 stars 38 forks source link

[Bug]: Moving between multiplexer windows with separate nvim instances #74

Closed rahulaggarwal965 closed 1 year ago

rahulaggarwal965 commented 1 year ago

Similar Issues

Neovim Version

NVIM v0.9.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Expected Behavior

If I open a multiplexer like TMUX and create two panes, with a separate neovim instance in each pane, the I expect the directional movement commands require('smart-splits).move_cursor_{left, up} to move across the panes. However, only the "right" and "down" directions work.

Actual Behavior

The"left" and "up" smart movement commands do not move across the two panes.

Minimal Configuration to Reproduce

local root = vim.fn.fnamemodify('./.repro', ':p')

-- set stdpaths to use .repro
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
  vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end

-- bootstrap lazy
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    '--single-branch',
    'https://github.com/folke/lazy.nvim.git',
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  -- do not remove the colorscheme! it makes testing nicer
  'folke/tokyonight.nvim',
  'mrjones2014/smart-splits.nvim',
  -- add any other pugins here
}

require('lazy').setup(plugins, {
  root = root .. '/plugins',
})

require('smart-splits').setup({
  wrap_at_edge = false
})

-- recommended mappings
-- resizing splits
-- these keymaps will also accept a range,
-- for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
vim.keymap.set('n', '<A-h>', require('smart-splits').resize_left)
vim.keymap.set('n', '<A-j>', require('smart-splits').resize_down)
vim.keymap.set('n', '<A-k>', require('smart-splits').resize_up)
vim.keymap.set('n', '<A-l>', require('smart-splits').resize_right)
-- moving between splits
vim.keymap.set('n', '<C-h>', require('smart-splits').move_cursor_left)
vim.keymap.set('n', '<C-j>', require('smart-splits').move_cursor_down)
vim.keymap.set('n', '<C-k>', require('smart-splits').move_cursor_up)
vim.keymap.set('n', '<C-l>', require('smart-splits').move_cursor_right)
-- swapping buffers between windows
vim.keymap.set('n', '<leader><leader>h', require('smart-splits').swap_buf_left)
vim.keymap.set('n', '<leader><leader>j', require('smart-splits').swap_buf_down)
vim.keymap.set('n', '<leader><leader>k', require('smart-splits').swap_buf_up)
vim.keymap.set('n', '<leader><leader>l', require('smart-splits').swap_buf_right)

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme! it makes testing nicer
vim.cmd([[colorscheme tokyonight]])

Additional Details and/or Screenshots

Here is a screen recording of the issue (pay attention to bottom right)

https://user-images.githubusercontent.com/18104107/231343963-17adf68c-0399-49a4-a8eb-c6ff2e33a9fb.mp4

mrjones2014 commented 1 year ago

I can't reproduce. Can you please provide:

I cannot reproduce using Wezterm or Kitty, using tmux or Wezterm or Kitty multiplexers.

rahulaggarwal965 commented 1 year ago

Sorry about that, I failed to include the key wrap_at_edge = false option that causes this behavior. I am using st 0.9 but alacritty 0.13.0-dev experiences this behavior as well.

I am using tmux 3.3a as my multiplexer, but have not reproduced in other multiplexers.

mrjones2014 commented 1 year ago

Okay, I am able to reproduce now with wrap_at_edge = false, thanks. Will investigate further 👍