-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix(ftplugin/man.vim): Hide signcolumn to avoid "embarrassing line wrap" #28775
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disabling random things is not ideal. instead, find where the width (MANWIDTH, iirc) is calculated in this plugin, and adjust it
Problem: 1. multiple `setlocal` commands are spread across the script. 2. several options, apparently, serve the same purpose (hide UI columns) which may not be immediately clear. more options may be required to fullfill the same purpose or they could be removed all together as a group if better solution is found later 3. `setlocal nofoldenable` may be overriden by conditional block later in the script. Solution: 1. move 'colorcolumn' and 'nolist' to the group of other options at the beginning 2. add an explanatory comment about options that disable UI columns 3. move 'nofoldenable' to the if-else block to keep relevant commands coupled
Problem: It's a common practice to set 'signcolumn=yes' (always show) instead of default 'signcolumn=auto' in order to prevent annoying horizontal shifting in editable buffers when using some popular plugins that add/remove signs on the fly. This makes signcolumn always visible and breaks the text flow of pre-formatted man pages, even when no signs are actually defined. Some other options are already tweaked in man.vim to address the issue (e.g. 'nonumber'), but not signcolumn. Solution: set 'signcolumn=auto' in ftplugin/man.vim. By default there is no |signs| in man pages anyway (and I am not aware of any plugins that could define them in man pages), so 'signcolumn=auto' should behave like 'signcolumn=no', i.e. hide the empty column in order to keep buffer width same as terminal width. In a (rare?) case when user does define some signs in man pages, signcolumn will appear (breaking the text flow).
5e93cf6
to
2c160f3
Compare
@justinmk how did you make your message appear in both "review comment" and PR conversation? Duplicating my response for clarity:
Marked that thread as resolved because suggested changes are both
I've finally updated commit messages to follow contribution guidelines (https://conventionalcommits.org), so removing "draft" status from this PR. |
This is how man page looks like when using neovim as a man pager and having
signcolumn=yes
. Note the line wraps in Description:Note: I did not resize the window after running the command.
Steps to reproduce:
set signcolumn=yes
in~/.config/nvim/init.vim
MANPAGER='nvim +Man!' man man
The suggested solution is to
set signcolumn=auto
inftplugin/man.vim
, because man pages are especially sensitive to terminal width.man
hard-wraps content (using terminal width as a default value for MANWIDTH), not taking pager's UI into account (the default MANPAGER isless
, which displays content at full width of the terminal)ftplugin/man.vim
already contains similar options (e.g.set nonumber
) to address the issue. The benefit of those tweaks is lost if ANY of UI columns appear.