Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Improve <ESC> Behavior in Comment Windows #239

Closed
petRUShka opened this issue Apr 4, 2024 · 3 comments
Closed

Feature Request: Improve <ESC> Behavior in Comment Windows #239

petRUShka opened this issue Apr 4, 2024 · 3 comments

Comments

@petRUShka
Copy link

Feature Request: Improve <ESC> Behavior in Comment Windows

Issue Description

I've been exploring gitlab.nvim, and it's been a fantastic tool. However, I've encountered a significant issue that hinders my workflow: inadvertently losing comment text by pressing <ESC>. In Vim (or Neovim), <ESC> is habitually used to ensure one is in Normal mode, often pressed multiple times just to be certain. Unfortunately, in gitlab.nvim, an extra press of <ESC> results in losing all the written comments — erasing thoughts and efforts instantaneously.

This behavior is contrary to the Vim philosophy, where it's challenging to lose work unintentionally. Vim safeguards against potential loss, allowing for undo actions, reopening closed buffers, and warning users about unsafe actions like quitting without saving. The current <ESC> functionality in comment windows breaks from this safety net, forcing users to adopt new habits that may detract from their experience.

Proposed Solution

  1. Save Unfinished Comments: Similar to how the GitLab web interface retains comments even if the tab is closed, gitlab.nvim could automatically save drafts of unfinished comments. This feature would prevent data loss and align with the expected Vim behavior of safeguarding user input.

  2. Redefine <ESC> Keybinding: Removing <ESC> as the default method for closing comment windows would adhere more closely to Vim traditions. Instead, adopting commands like :q! for closing without saving and :wq for saving and submitting comments could offer a more Vim-centric approach. This method is reminiscent of Fugitive's handling of commit messages, providing a familiar workflow for Vim users.

Conclusion

Adjusting the <ESC> key's functionality to protect user input and align with Vim's user-protection philosophy would greatly enhance the usability of gitlab.nvim for the Vim community. These changes would mitigate the risk of losing valuable input and help maintain the muscle memory and habits formed by long-time Vim users.

@petRUShka
Copy link
Author

#177

@harrisoncramer
Copy link
Owner

Fair enough, I'll remove the <Esc> keybinding. You may also be interested in this MR, which was filed recently and I intend to review this weekend:

#238

harrisoncramer added a commit that referenced this issue Apr 4, 2024
This MR removes the `<esc>` keybinding from the application for popups to avoid accidentally nuking existing changes. Addresses #239.
@harrisoncramer
Copy link
Owner

I've merged the <esc> keybinding removal into develop, you're welcome to use that branch, but just be aware it's not always stable. Once I've had time to use develop for a while I'll ship it into main. I'm going to close this ticket and track your second request (saving buffer edits) in the other MR.

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

No branches or pull requests

2 participants