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
895 stars 37 forks source link

[Bug]: System exit > 0 after upgrade to v1.3.1 (v1.3.0 works fine) #158

Closed chardskarth closed 6 months ago

chardskarth commented 6 months ago

Similar Issues

Neovim Version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info

Multiplexer Integration

tmux

Multiplexer Version

tmux 3.3a

Steps to Reproduce

  1. Start tmux session
  2. Open neovim
  3. Exit

Expected Behavior

System should exit without any error status code

Actual Behavior

Exits with more than 0 status code

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',
})

-- 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

No response

mrjones2014 commented 6 months ago

Try updating tmux. I cannot reproduce on tmux 3.4

tlindsay commented 6 months ago

I'm getting the same issue on tmux v3.4. Neovim exits with a 134 with smart-splits v1.3.1, 0 on smart-splits v1.3.0.

I started investigating this in the first place because this seems to also be responsible for breaking things that open the $EDITOR in the middle of the command like git commit --amend. Again, that all works on v1.3.0, but on v1.3.1 I get something like this:

$ git commit --amend
hint: Waiting for your editor to close the file... error: There was a problem with the editor 'nvim'.
Please supply the message using either -m or -F option.
tlindsay commented 6 months ago

I've also confirmed that commenting out the body of the on_exit method fixes both of my problems. I'm not sure why, as the logs don't indicate that these tmux commands are failing and running them manually seems to work as expected.

I haven't updated my tmux config to use the new @pane-is-vim stuff yet. Not sure if that's important or not.

mrjones2014 commented 6 months ago

Ah, I probably need to check if the vim loop has exited already before checking the error

mrjones2014 commented 6 months ago

Thanks for investigating!

mrjones2014 commented 6 months ago

@tlindsay could you please test #159 and let me know if that fixes the issue?

mrjones2014 commented 6 months ago

If that doesn't fix it we can try the workaround here: https://github.com/neovim/neovim/issues/21856#issuecomment-1514723887

tlindsay commented 6 months ago

@mrjones2014 Nope, still getting the error...

$ tmux -V
tmux 3.4
$ git commit --amend
hint: Waiting for your editor to close the file... error: There was a problem with the editor 'nvim'.
Please supply the message using either -m or -F option.

Screen Shot 2024-02-28 at 17 10 28

tlindsay commented 6 months ago

Oh! But the exit code is now 1 instead of 134....

mrjones2014 commented 6 months ago

Okay, I've added the workaround I linked, can you test again?

tlindsay commented 6 months ago

@mrjones2014 Yep, that did the trick! Thanks!