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

Support quitting with exit code #1082

Closed
cole-h opened this issue Nov 12, 2021 · 2 comments · Fixed by #1096
Closed

Support quitting with exit code #1082

cole-h opened this issue Nov 12, 2021 · 2 comments · Fixed by #1096
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@cole-h
Copy link
Contributor

cole-h commented Nov 12, 2021

Describe your feature request

In kakoune, you can return any error code you want when quitting via :quit [exit code]. One example of where I use this functionality a lot is when I write a git commit message, save the buffer, but then realize there's something else I need to do (rather than accepting and then git reset --soft HEAD^).

One implementation detail would be what we want to do when there's more than 1 view (since :q really just closes views). Likely just return an error.

@cole-h cole-h added the C-enhancement Category: Improvements label Nov 12, 2021
@sudormrfbin
Copy link
Member

Vim has a separate :cquit command which I use with git commit regularly:

:cq[uit][!]
:{N}cq[uit][!]
:cq[uit][!] {N}     Quit Vim with error code {N}.  {N} defaults to one.
                    Useful when Vim is called from another program:
                    e.g., a compiler will not compile the same file again,
                    `git commit` will abort the committing process, `fc`
                    (built-in for shells like bash and zsh) will not
                    execute the command, etc.
                    {N} can also be zero, in which case Vim exits
                    normally.
                    WARNING: All changes in files are lost.  It works like
                    ":qall!" |:qall|, except that Nvim exits non-zero or
                    [count].

@cole-h
Copy link
Contributor Author

cole-h commented Nov 14, 2021

I actually like that better. I was originally going to augment the existing :qa commands, but a dedicated command seems just right. Implemented in #1096.

@kirawi kirawi added the A-helix-term Area: Helix term improvements label Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants