-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
ftplugin/man.vim: Hide signcolumn to avoid "embarrassing line wrap" #28775
base: master
Are you sure you want to change the base?
Conversation
Also, change placement of `setlocal` commands to improve logical structure: - move 'colorcolumn' and 'nolist' to the group of other uncommented visual-representation-related options at the beginning - move 'nofoldenable' inside if-else construction to keep relevant instructions together
This is to address situation when user has set 'signcolumn=yes' (always show) in global configuration, so they see a rudimentary empty column, which breaks the text flow in man pages. In default configuration there is no |signs| in man pages anyway, so 'signcolumn=auto' should behave like 'signcolumn=no' (hiding the empty column). It still allows to detect an "unusual" situation, just in case some advanced users do set some |signs| in man pages.
setlocal foldcolumn=0 colorcolumn=0 nolist nofoldenable | ||
" man page content is likely preformatted for the terminal width, so | ||
" narrowing display by any additional columns leads to Embarrassing Line Wrap | ||
setlocal nonumber norelativenumber foldcolumn=0 signcolumn=auto |
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
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.
I don't think MANWIDTH
is controlled by plugin when calling man
from CLI. Personally, I have MANPAGER
set in my environment as described in :help man
, and just call man echo
in bash (see steps to reproduce).
Note, that this PR only adds signcolumn=auto
(may be easier to see when viewing separate commits). Other "random things" (visual columns occupied by editor's UI, to be precise) are already disabled. Suggested changes follow the existing approach and improve it (I believe), not aiming to seek for ideal.
If someone decide to spend time finding an "ideal" solution, they could still benefit from these changes by using them as a reference. E. g. just like they will see "nonumber", "norelativenumber", "foldcolumn" and include the width of these columns into their calculations of MANWIDTH (or whatever is relevant), they will also see the "signcolumn" and remember to take it into account as well.
Also, IMHO, benefits of what you call an "ideal" approach are questionable. ftplugins are specifically intended to improve user experience with specific filetype
s by taking into account the meaning of the file type. Disabling/enabling specific things for specific filetypes feels totally reasonable for me. Do you think that other setlocal
options are not ideal should be avoided in this ftplugin (e. g. nolist
)?
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
This is how man page looks like when using neovim as a man pager and having
signcolumn=yes
:Note: I did not resize the window after running the command.
Steps to reproduce:
set signcolumn=yes
in your~/.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 by default, not taking pager's UI into account.ftplugin/man.vim
already contains similar options, e.g.set nonumber