1
0
forked from aniani/vim

9 Commits

Author SHA1 Message Date
David Mandelberg
c2623824a7
runtime(man): improve :Man completion for man-db
On man-db systems, complete with actual man sections and pages, instead
of shell commands.

I tried to come up with a portable solution for multiple man
implementations in https://github.com/vim/vim/discussions/16794 but I
think the differences between implementations were too large to do that
without overly complicated code. So instead, I implemented it for man-db
(which I think is common on Linux) and hopefully left it easier for
other people to implement it on other systems in the future if they want
to.

closes: #16843

Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-03-10 21:26:50 +01:00
David Mandelberg
b34ce3e205
runtime(man): don't add jumps when loading a manpage
Without this change, pressing K while in one manpage to load another
one, then pressing CTRL-O to go back, results in going to the bottom of
the current (second) manpage. With this change, it goes back to the
previous manpage.

closes: #16791

Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-03-05 20:38:20 +01:00
Ivan Shapovalov
84ca1388d8
runtime(man): honor cmd modifiers before g:ft_man_open_mode
Give priority to (placement) command modifiers, specifically
`:vertical`, `:horizontal` and `:tab`, ahead of `g:ft_man_open_mode`,
so that if the user says e.g. `:vert Man`, Vim does the expected thing.

closes: #15117

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-06 16:57:18 +02:00
Christian Brabandt
f942db2557
runtime(man): man on AIX does not understand -l
fixes: #13847

Co-authored-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-17 21:55:41 +01:00
Yee Cheng Chin
249a208803
runtime(man): Man plugin does not respect 'gdefault'
Fix the issue introduced by #12557. `:substitute` commands in plugins
need to take into account whether `gdefault` is set or not because
that depends on the user.

closes: #13097

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-09-16 18:12:14 +02:00
lifecrisis
17befac581
runtime(man): remove backslashes in man pages using Vim script (#12557)
Closes: vim/vim#12301

Co-authored-by: Jason Franklin <jason@oneway.dev>
2023-08-20 20:41:25 +02:00
goweol
8cfe52e6fb
man.vim: Recognise hyphenated-at-eol cross-references (#12609)
Manual pages requested for output may undergo formatting
arranged by some roff-descendant program. Lines longer
than MANWIDTH or COLUMNS or real-estate width of a device
(with support for horizontal scrolling considered) can be
divided at either blank characters and/or at groups of word
characters (syllables) according to supported hyphenation
rules (although page authors are free to disable hyphenation
or prevent particular words from being hyphenated).

Groff‘s manual describes it as follows:

    5.1.2 Hyphenation

    Since the odds are not great for finding a set of words, for
    every output line, which fit nicely on a line without
    inserting excessive amounts of space between words, gtroff
    hyphenates words so that it can justify lines without
    inserting too much space between words. It uses an internal
    hyphenation algorithm (a simplified version of the algorithm
    used within TeX) to indicate which words can be hyphenated
    and how to do so. When a word is hyphenated, the first part
    of the word is added to the current filled line being output
    (with an attached hyphen), and the other portion is added to
    the next line to be filled.

It would be expedient for autoload/dist/man.vim (along with
syntax/man.vim‘s highlighting and ftplugin/man.vim‘s Ctrl-],
\K mappings) to allow for hyphenation of cross-references
to manual pages.

For example,

  # Launch Vim [v9.0; patched: 1-1378, 1499] as follows:
  MANWIDTH=80 vim --not-a-term +MANPAGER '+Man man' '+/conv(1)' '+norm B'

  # Press Ctrl-] with cursor on _m_: "... use man‐
  # conv(1) directly."_______________________[^]
  #
  # (Man v2.11.2)

  # Launch Vim as follows:
  MANWIDTH=80 vim --not-a-term +MANPAGER '+Man git' '+/config(1)' '+norm B'

  # Press Ctrl-] with cursor on _g_: "... in git-
  # config(1) for a more ..."_______________[^]
  #
  # (Git v2.39.2)

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2023-08-17 23:13:29 +02:00
goweol
6e5ab2b994
man.vim: Uniformly place cursor at the same column with Ctrl-t (#12608)
Functions col and cursor count each tab (0x9) as a byte, and
are complementary. On the other hand, the | command motion
takes into consideration how many screen columns a tab does
occupy and may move cursor to a column closer to the start
of line than col would report at that position.

The provided changes prefer the cursor function to the | command.

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2023-08-17 23:12:42 +02:00
Bram Moolenaar
d799daa660 Update runtime files 2022-06-20 11:17:32 +01:00