Skip to content

Fix: Exit insert mode and cleanup buffers when closing picker#10

Merged
dmtrKovalenko merged 1 commit into
dmtrKovalenko:mainfrom
0xDAEF0F:main
Aug 2, 2025
Merged

Fix: Exit insert mode and cleanup buffers when closing picker#10
dmtrKovalenko merged 1 commit into
dmtrKovalenko:mainfrom
0xDAEF0F:main

Conversation

@0xDAEF0F
Copy link
Copy Markdown
Contributor

@0xDAEF0F 0xDAEF0F commented Aug 2, 2025

Summary

This PR fixes three related issues with the file picker:

  • Files opening in insert mode instead of normal mode when selected
  • User remaining in insert mode when closing picker without selecting a file
  • E37 error when quitting Vim after using the picker

Changes

  1. Added vim.cmd('stopinsert') in the select function before closing the picker
  2. Added vim.cmd('stopinsert') at the beginning of the close function
  3. Added proper buffer cleanup in the close function to delete all created buffers

Testing

  • Open the picker with <C-p>
  • Select a file - it now opens in normal mode ✓
  • Open the picker again and press <Esc> - you return to normal mode ✓
  • Open the picker and close it, then try :q\! - no E37 error ✓

Fixes #8

@dmtrKovalenko
Copy link
Copy Markdown
Owner

Thank you so much for a contribution. Changes make a lot of sense!

@dmtrKovalenko
Copy link
Copy Markdown
Owner

Could you quickly run stylua? I’d love to merge it just not near the computer rn

@dmtrKovalenko
Copy link
Copy Markdown
Owner

It’s hard for me rn because I know that this unlocks certain flows but I really need to test the solution. I’m just thinking won’t it cause much more significant load time?

probably I’ll merge it rn even with CI failures to unfuck the current state of things and will revisit it tonight.

Same for ci

@dmtrKovalenko dmtrKovalenko merged commit 76628e7 into dmtrKovalenko:main Aug 2, 2025
1 of 2 checks passed
@0xDAEF0F
Copy link
Copy Markdown
Contributor Author

0xDAEF0F commented Aug 2, 2025

anytime bro thank you for creating this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Files open in insert mode instead of normal mode when selected from picker

2 participants