2KAbhishek / termim.nvim

Neovim Terminal, Improved 🦾💻
GNU General Public License v3.0
54 stars 1 forks source link

fix: prevent 'startinsert' if terminal buffer hasn't been entered #4

Closed sleeptightAnsiC closed 1 month ago

sleeptightAnsiC commented 1 month ago

Hey again @2KAbhishek,

There is a problem with binding startinsert to TermOpen: If a terminal gets opened in the background, it will always start Insert mode, even if you're not using said Terminal directly, which in this case is undesired and annoying. For example, I spotted mentioned issue while starting debug session in nvim-dap.

I fixed this by adding a branch that checks whether the currently open buffer is the event.buf. I couldn't solve it from lua and had to use vimscript, probably because vim.cmd() adds a delay to the call.

This fixes the issue on my side but have in mind that I don't use termim.nvim directly, just few functions from your plugin that makes my config behave in similar way. So probably it would be nice if you could test it on your side.

Cheers

sleeptightAnsiC commented 1 month ago

ahh, I see I also removed ! from startinsert! but this doesn't make any difference in case of Terminals. Feel free to revert it. PR is open for edits.

2KAbhishek commented 1 month ago

Thanks for opening the PR, I tested it out, this doesn't seem to be affecting the default commands.

I am skipping this for now to not break compatibility, will refer if need in future.