[vim/vim] Use `gq` instead of `q` in `man.vim` (#8210)

72 views
Skip to first unread message

Andrey Starodubtsev

unread,
May 15, 2021, 8:13:16 AM5/15/21
to vim/vim, Subscribed

Using q in man.vim prevents q/, q? from working.
It would be convenient to use gq as a shortcut to close man window - the same way as vim-fugitive does.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/8210

Commit Summary

  • Use `gq` instead of `q` in `man.vim`

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Andrey Starodubtsev

unread,
May 15, 2021, 8:15:14 AM5/15/21
to vim/vim, Push

@andrey-starodubtsev pushed 1 commit.

  • 6c5cad2 Use `gq` instead of `q` in `man.vim`


You are receiving this because you are subscribed to this thread.

View it on GitHub or unsubscribe.

codecov[bot]

unread,
May 15, 2021, 8:39:54 AM5/15/21
to vim/vim, Subscribed

Codecov Report

Merging #8210 (6c5cad2) into master (847fe7d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@

##           master    #8210   +/-   ##

=======================================

  Coverage    2.46%    2.46%           

=======================================

  Files         146      146           

  Lines      161675   161675           

=======================================

  Hits         3990     3990           

  Misses     157685   157685           
Flag Coverage Δ
huge-gcc-unittests 2.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 847fe7d...6c5cad2. Read the comment docs.

Bram Moolenaar

unread,
May 16, 2021, 6:25:32 AM5/16/21
to vim/vim, Subscribed


Andrey Starodubtsev wrote:

> Using `q` in `man.vim` prevents `q/`, `q?` from working.

> It would be convenient to use `gq` as a shortcut to close `man` window
> - the same way as `vim-fugitive` does.

Hmm, but "gq" is also a valid command. And it's not shorter than just
typing ":q", which everybody knows.

Since this uses a window, typing :q to close it is the most obvious. It
doesn't behave like "less" or "more" that scrolls through the text top
to bottom. I associate "q" with that.

How about just dropping the "q" mapping?

--
Facepalm reply #3: "I had a great time in Manhattan" "I thought you were
going to New York?"

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Andrey Starodubtsev

unread,
May 16, 2021, 7:50:23 AM5/16/21
to vim/vim, Push

@andrey-starodubtsev pushed 1 commit.

  • 55f3ac1 Drop `q` shortcut from `man.vim`


You are receiving this because you are subscribed to this thread.

Andrey Starodubtsev

unread,
May 16, 2021, 7:52:30 AM5/16/21
to vim/vim, Subscribed

Hmm, but "gq" is also a valid command. And it's not shorter than just typing ":q", which everybody knows.

Well, on the other hand gq isn't applicable to buffers which are marked as nomodifiable.

How about just dropping the "q" mapping?

I'm all for it; force-pushed removal of q in 55f3ac1.

Bram Moolenaar

unread,
May 22, 2021, 3:59:48 PM5/22/21
to vim/vim, Subscribed

lacygoill

unread,
Dec 4, 2021, 4:41:49 PM12/4/21
to vim/vim, Subscribed

Hmm, but "gq" is also a valid command.

But gq would not be used in a manpage because the latter is meant to be read, not edited.

And it's not shorter than just typing ":q", which everybody knows.

We still have to press Enter to execute :q, so that's 3 keypresses against 2 for gq.

How about just dropping the "q" mapping?

Or we could double the q in the lhs.

diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 8cb2e118a..411c45333 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -607,7 +607,7 @@ Global mapping:
 Local mappings:
 CTRL-]		Jump to the manual page for the word under the cursor.
 CTRL-T		Jump back to the previous manual page.
-q		Same as the |:quit| command.
+qq		Same as the |:quit| command.
 
 To use a vertical split instead of horizontal: >
 	let g:ft_man_open_mode = 'vert'
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index fbe6c5a12..7b425b809 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -36,14 +36,14 @@ if &filetype == "man"
 
     nnoremap <buffer> <silent> <c-]> :call <SID>PreGetPage(v:count)<CR>
     nnoremap <buffer> <silent> <c-t> :call <SID>PopPage()<CR>
-    nnoremap <buffer> <silent> q :q<CR>
+    nnoremap <buffer> <silent> qq :q<CR>
 
     " Add undo commands for the maps
     let b:undo_ftplugin = b:undo_ftplugin
 	  \ . '|silent! nunmap <buffer> <Plug>ManBS'
 	  \ . '|silent! nunmap <buffer> <c-]>'
 	  \ . '|silent! nunmap <buffer> <c-t>'
-	  \ . '|silent! nunmap <buffer> q'
+	  \ . '|silent! nunmap <buffer> qq'
   endif
 
   if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1)

The only command which would be shadowed is the one starting a recording in the q register. But it's already broken in the current version of the man plugin. In fact, all recordings are currently broken. With this patch, only the q recording would remain broken.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

lacygoill

unread,
Dec 4, 2021, 4:44:38 PM12/4/21
to vim/vim, Subscribed

Or we could double the q in the lhs.

Never mind, that's a bad idea. If the user has started a recording in a different window, the mapping would interfere if they try to end the recording in the man window.


You are receiving this because you are subscribed to this thread.

Enno

unread,
Jun 6, 2024, 8:53:48 AM6/6/24
to vim/vim, Subscribed

How about Q instead? Maybe most users, like @ andrey-starodubtsev, while reading man pages in Vim rather record a macro or open a command-line window than "Ex" mode.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/8210/c2152351331@github.com>

Christian Brabandt

unread,
Jun 6, 2024, 1:29:00 PM6/6/24
to vim/vim, Subscribed

Closed #8210 via 6dcd7f1.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/8210/issue_event/13070107747@github.com>

D. Ben Knoble

unread,
Jun 7, 2024, 11:46:56 AM6/7/24
to vim/vim, Subscribed

Ah, bummer. This makes man <prog> slightly less ergonomic for me. But I think I can re-add the mapping myself with a filetype plugin or similar.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/8210/c2155097947@github.com>

Reply all
Reply to author
Forward
0 new messages