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

Remove the q map #1221

Closed
odnoletkov opened this issue Mar 1, 2019 · 11 comments
Closed

Remove the q map #1221

odnoletkov opened this issue Mar 1, 2019 · 11 comments

Comments

@odnoletkov
Copy link
Sponsor Contributor

It is very intrusive. I keep accidentally closing :Gstatus (and often Vim since I often $ vim .git/index these days) when trying to q:? for reverse commands search – which I do very often in this context to recall long :Git commands.
For :Gblame I don't care so much but it provides no value over CTRL-W q. I see the usefulness of :bdelete over CTRL-W q when :Gstatus is the last window, but that seems like a general not fugitive's problem. Am I missing something else? Alternatively it can be remapped to gq.

tpope added a commit that referenced this issue Mar 1, 2019
@tpope
Copy link
Owner

tpope commented Mar 1, 2019

The status window comes and goes enough that I think shaving a couple of keystrokes off of closing it is not a ridiculous endeavor, but as the status window gets more functionality I increasingly agree it's a poor trade-off. For now, I will add a gq map. I think q probably has enough usage that it needs a deprecation cycle. After 3.0, feel free to send a PR that adds <Bar>echohl WarningMsg<Bar>echo "q is deprecated in favor of gq"<Bar>echohl NONE to the q map.

@tpope tpope closed this as completed Mar 1, 2019
@SolaWing
Copy link

SolaWing commented Mar 2, 2019

@tpope q is a commonly hot key to close window. And I rarely saw someone use gq to quit.
if q conflict with someone's habit, I suggest that allow user map or unmap it.
if have to use two-key-combo, I suggest use one of vim default key: ZQ, CTRL-W q, CTRL-W CTRL-q.

@sodapopcan
Copy link
Contributor

TL;DR: I advocate for keeping q... mostly.

This is interesting as the command line window is something I avoid at all costs, especially with Vim's, uh, completion-based-on-what's-already-been-typed (I either forget or never know what this was called... but :Git <Up> lets you cycle through only history starting with :Git ). While I don't exactly pour through github issues in plugins I use on a regular basis, I do from time-to-time and this is the first I've seen of someone who actually uses the command line window... and, of course, that is totally legit.

That said, q for quit in unmodifiable output buffers is used by several respected plugin authors and I feel it's become a ubiquitous mapping for a whole slue of folk who use Vim a certain way. Of course, this is hardly based on any real data, just my perception in small sample of plugins I use.

If you do decide to change, I do agree with @SolaWing that overriding a Vim default would be best. The whole thing about using g-prefixed mappings is that g has become somewhat of my leader key, which I learned from Drew Neil who I believe learned it from you winky-nudgey-stick-out-tongue emoji

I actually don't hate gq, but I think consistency for muscle memory is important here and maybe wait for more complaints before committing to this change.

@tpope
Copy link
Owner

tpope commented Apr 28, 2019

It is indeed common for read-only plugin buffers (which is why I did it), but overrides a built-in that has valid uses in read-only plugin buffers (which is I why I will ultimately remove it). gq is slightly easier to type than <C-W>q so it does offer a tiny bit of value on that front. I don't understand g as leader key, 20 of the 26 lowercase g followups (including q) are taken. It's low value enough that I'd be fine to check for another gq map and defer to it, if that's really a concern.

@justinmk
Copy link
Contributor

gq is a good choice IMO, and I'm considering it for https://github.com/justinmk/vim-dirvish/ as well. q-to-quit never felt right to me, it often gets in the way when I want to end macro-recording.

brendeschuijmert pushed a commit to brendeschuijmert/vim-fugitive that referenced this issue Aug 6, 2019
@d3jn
Copy link

d3jn commented Oct 10, 2019

@tpope, since q map is deprecated as of now and later (as far as I understand) will be removed, can we have an option that enables this map and keeps its previous behavior for this plugin?

I am so used to q for popular plugins (such as NerdTree, VimMerginal and so on) that I include it for my own plugins as well.

@tpope
Copy link
Owner

tpope commented Oct 10, 2019

See conversation at a510b3a#commitcomment-35424504.

brendeschuijmert added a commit to brendeschuijmert/vim-fugitive that referenced this issue Apr 13, 2020
midchildan added a commit to midchildan/dotfiles that referenced this issue Mar 27, 2021
It's already deprecated[1], but I want to disable it earlier than the
official schedule because it interferes with macro recording. This
should be reverted after fugitive removes the mapping completely.

[1]: tpope/vim-fugitive#1221.
@dyng
Copy link

dyng commented May 22, 2021

For those who misses the old fashion q, add below line in your .vimrc

autocmd FileType fugitiveblame nmap <buffer> q gq

@bangedorrunt
Copy link

For those who misses the old fashion q, add below line in your .vimrc

autocmd FileType fugitiveblame nmap <buffer> q gq

Sadly not working for me with Neovim Nightly. Press q gave me this error.
Screen Shot 2022-09-02 at 6 26 23 pm

@alexventuraio
Copy link

alexventuraio commented Feb 24, 2024

I added this file in my Lua config with the following content but I got the same error:

-- ftplugin/fugitiveblame.lua
vim.keymap.set('n', 'q', [[gq]], { buffer = 0, nowait = true, noremap=true })
image

Did you happen to got that fixed? @bangedorrunt

@kdowolski
Copy link

@bangedorrunt @alexventuraio
The problem is gq is already a mapping, so your mapping should be recursive (delete noremap)

My version:

vim.api.nvim_create_autocmd("FileType", {
    pattern = {"fugitiveblame", "fugitive"},
    callback = function()
        vim.api.nvim_buf_set_keymap(0, 'n', 'q', 'gq', { silent = true })
    end
})

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

10 participants