aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/man.vim
Commit message (Collapse)AuthorAge
* feat(Man): port to Lua (#19912)Lewis Russell2022-09-02
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* feat(man.vim): list command flags in "gO" outline #17558Joshua Cao2022-05-16
|
* fix(man.vim): q in "$MANPAGER mode" does not quit #18443Arsham Shirvani2022-05-13
| | | | | | | | | | | | | | | | | Problem: q in "$MANPAGER mode" does not quit Nvim. This is because ftplugin/man.vim creates its own mapping: nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c which overrides the one set by the autoload file when using :Man! ("$MANPAGER mode") Solution: Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the mapping correctly. Fixes #18281 Ref #17791 Helped-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
* revert: "man.vim: Ensure 'modifiable' in man#init_pager" #17791dundargoc2022-04-25
| | | | | | | | | | | | | This reverts commit 526798a941b4cf80fd1f128b40e51fb47c77b654. This will make man filetype not modifiable by default, as it is the superior behavior in my opinion. More importantly, also make it possible for a user to modify man filetypes by adding `set modifiable` in `~/.config/nvim/ftplugin/man.vim` or its equivalent. ref #11450 closes #17595 Co-authored-by: Javier López <graulopezjavier@gmail.com>
* fix(man.vim): support calling :Man without a section again (#17119)zeertzjq2022-01-17
| | | | | When `man -w` is called with an empty string as section name, it may fail with an error code, which causes :Man to no longer work without a section. Just remove that argument when no section is specified.
* fix(man.vim): fix search function on some systems (#13709)Will Eccles2022-01-10
| | | | | Fixes man.vim's searching on some systems (namely mandoc) where previously it would not respect the value of b:man_default_sects. It now properly parses man pages on these systems.
* feat(man.vim): convert spaces to underscores #16068William Chargin2021-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | PostgreSQL ships with man pages for SQL statements like `CREATE TABLE`, which are provided with underscores as `man 7 CREATE_TABLE`. This patch updates `man#open_page` (as used by `:Man`) such that visually selecting the words `CREATE TABLE` in SQL code and pressing `K` properly opens the desired man page. Writing `:Man CREATE TABLE` still does not work, since `CREATE` is interpreted as a section name. (Similarly, `:Man CREATE TABLE AS` fails because there are too many arguments to `:Man`.) But this is okay, because if you're typing it anyway then you can just enter underscores and also tab-completion properly suggests `:Man CREATE_TABLE(7)`. This is a bit bespoke, but my box has over 9000 man pages (as reported by `man -k '' | wc -l`), and not one of them has a space in the man page name, whereas the Postgres manuals do exist and are actually useful. Test Plan: On a machine with Postgres manual pages, running nvim -u NORC +'exe "norm iCREATE TABLE foo(x int);" | norm 0veeK' should open the appropriate man page. wchargin-branch: man-spaces-to-underscores
* fix(man.vim): ensure buftype=nofile after :tag or :stag #15675zeertzjq2021-09-16
| | | | | | | | | | | | | | | | | | | | | | Problem: `buftype=help` occasionally propagates from help to man buffer. As a result the next time you open help it opens in the man window, replacing the manpage. Test case: nvim -u NORC :Man man :set bt? " should print `buftype=nofile` :help <C-W><C-W><C-W>c " go back to :Man window and close it :help " focus help window :Man man " open window with manpage again :set bt? " prints `buftype=help` Solution: - call s:set_options() - man#read_page() (called by autocmd BufReadCmd man://*) should already do this. But BufReadCmd doesn't fire for already-existing man:// buffers. Fix #15650
* fix(man.vim): filetype=man is too eager #15488Justin M. Keyes2021-08-26
| | | | | | | | | | | | | | | Problem: "set filetype=man" assumes the user wants :Man features, this does extra stuff like renaming the buffer as "man://". Solution: - old entrypoint was ":set filetype=man", but this is too presumptuous #15487 - make the entrypoints more explicit: 1. when the ":Man" command is run 2. when a "man://" buffer is opened - remove the tricky b:man_sect checks in ftplugin/man.vim and syntax/man.vim - MANPAGER is supported via ":Man!", as documented. fixes #15487
* fixup! man.vim: Refactor verify_exists to unset $MANSECT as neededJan Edmund Lazo2021-04-27
| | | | | ":unset" is not a valid Ex command. Use setenv() to set/unset environment variables.
* man.vim: `:Man` should not change global value of 'tagfunc' option (#13926)最上川2021-02-13
|
* Merge pull request #13439 from shade-of-noon/man-iskeywordJames McCoy2021-01-11
|\ | | | | [RDY] man.vim: Set iskeyword explicitly.
| * man.vim: Set iskeyword explicitly.Edwin Pujols2020-12-04
| | | | | | | | | | This also fixes `:Man!`, which wasn't setting 'iskeyword' to contain parentheses, etc.
* | runtime: Fix man.vim count handling.Edwin Pujols2020-11-29
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here I use a negative number to decide whether the count has been explicitly set. I think it unlikely that negative sections will ever be created given that negative numbers complicate argument handling: ``` $ man -1 foo man: invalid option -- '1' ``` and given that there's already precedence for alphanumeric sections like `3p`, `3x`, `n`, etc. --- This does work, though: ``` $ man -S -3 baz ``` With `man baz.-3` and `man 'baz(-3)'`, (GNU) man *might* consider `-3` internally as a section, but in the end reports as if the whole argument was the name of a topic: ``` $ man 'baz(-3)' No manual entry for baz(-3) ``` --- Closes #13411.
* man.vim: Use page title instead of full path. (#13353)shade-of-noon2020-11-24
| | | | | | | | | In commit 63f0ca326322376271, `tagfunc` was introduced to `runtime/autoload/man.vim`. Nonetheless the tag function instead of using a short buffer name (e.g. `man://foo(3)`) uses the full path to the man page (e.g. `man:///usr/share/.../foo.3.gz`). This behaviour is inconsistent with `:Man!`, thus this commit. Closes #13334
* runtime: Remove error handling for E145.Edwin Pujols2020-11-22
| | | | | | Restricted mode (-Z) has been removed per #11996. Some runtime files had lingering error handling (error identifier `E145`) so I cleaned them up.
* man.vim: Simplify man#init to reduce load time (#12482)Anmol Sethi2020-07-21
| | | | | | | | | | | | | I removed the SunOS stuff since no one uses SunOS and I've never tested it on there. I removed the section_flag init as we can just use -S instead of -s and -S is used by every implementation as far as I know. This brings man#init's time from 50-70ms to 15-20ms for me. Closes #12318 Related #6766 Related #6815
* man.vim: Fix tagfunc to respect b:man_default_sectsAnmol Sethi2020-06-13
| | | | | | | | | | | Also, kudos to @zsugabubus for fixing a related issue in #12417 This also prevents any sorting of the paths from man. We need to respect the order we get from it otherwise you end up loading /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man/man1/ls.1 on MacOS instead of /usr/share/man/man1/ls.1
* man.vim: Refactor verify_exists to unset $MANSECT as neededAnmol Sethi2020-06-12
| | | | | | | | | | | | | | Also cleaned it up a little and made it faster. Closes #9159 and #9271 Also changes man#extract_sect_and_name_ref to only return a single section at a time. This fixes a bug in its usage in man#goto_tag where get_paths would be called with multiple sections and it does not support that. I noticed that our tagfunc doesn't obey b:man_default_sects and I'll fix that next.
* man.vim: Handle `man` errors when looking for man-pathsRob Pilling2020-02-29
| | | | | | | | Fallback to simply globbing the tag we're given. This matches the original behaviour of `man.vim`, prior to c6afad78d39aa. fixes #11794 closes #11918
* man.vim: workaround for 'cscopetag' #11679Rob Pilling2020-01-06
| | | | | | | | | | | | | The old `:Man` implementation would take either the word under the cursor, or the argument passed in, and load that as a man page. Since we now use 'tagfunc' and look for all relevant man-pages, if your system has several (i.e. same name, different sections), we return several, giving the user an option. This works for most tag commands except `:tjump`, which will fail if there's multiple tags to choose from. This just happens to be what the cscope code uses (it actually attempts to prompt the user, but this fails).
* man.vim: Improve ft=man 'iskeyword' #11457Rob Pilling2019-11-27
| | | | | | | | | | | | | | | | | This addresses a minor quality problem with the recent `'tagfunc'` changes for `man.vim` (see [link]). Currently, with the cursor on a parenthese, hitting `K` will jump us to the man page of the next mentioned entry, instead of the one to which the parenthese (or section number) belongs. ``` pcrepattern(3), terminfo(5), glob(7), regex(7). e.g. ^ e.g. ^ ``` Adding the parentheses to `'iskeyword'` means we correctly handle these cases too. [link]: https://github.com/neovim/neovim/pull/11280#discussion_r348342357
* Merge #11451 'man.vim: Fixes'Justin M. Keyes2019-11-24
|\
| * man.vim: Hard wrap by defaultAnmol Sethi2019-11-24
| | | | | | | | Closes #11436
* | man.vim: Ensure 'modifiable' in man#init_pager #11450Anmol Sethi2019-11-24
|/
* Merge #11280 "man.vim: implement 'tagfunc'"Justin M. Keyes2019-11-20
|\
| * Sort man pages by relevance during goto_tag()Rob Pilling2019-11-13
| |
| * Don't attempt swapfiles for man pagesRob Pilling2019-11-13
| | | | | | | | | | This is because we now use :tag to open a man page, which attempts to open a swap file for a path under man://...
| * Remove eventignore - :Man now uses :tag to populate the pageRob Pilling2019-11-13
| |
| * man.vim: remove push_tag and simplify man#open_pageRob Pilling2019-10-29
| |
| * man.vim: parse the section from the tagRob Pilling2019-10-24
| |
| * man.vim: `:Man` preserves the tag stackRob Pilling2019-10-24
| |
| * man.vim: use 'tagfunc' instead of remappingRob Pilling2019-10-24
| | | | | | | | man#pop_tag() is also no longer used
| * man.vim: pull out s:get_paths()Rob Pilling2019-10-24
| |
* | man.vim: never switch to non-man window #11286Joshua Rubin2019-10-25
|/ | | | | | | | | | | In order to find if there was already an open man page, the :Man command would cycle through each window to see if &ft=='man'. This triggers autocmds, e.g. BufEnter, unnecessarily and can have unexpected side-effects. Change the logic to check each window's ft without switching to it unless it is actually a man window. Signed-off-by: Joshua Rubin <me@jawa.dev>
* man.vim: g:man_hardwrap #9633Curtis McEnroe2019-02-21
| | | | | | This option allows restoring the behaviour prior to #9023. Fixes #9583 Closes #9633
* man.vim: lowercase title when invoked as $MANPAGERJustin M. Keyes2018-10-26
| | | | | | | | man#init_pager() guesses the ref by the heading, which is usually uppercase, so we don't know the correct casing. But lowercase is more common, so use that for the buffer name instead of uppercase. ref #9156
* man.vim: avoid duplicate buffers, E95Justin M. Keyes2018-10-25
| | | | | | | | | | | | | | | | | | | | Before this commit, man#init_pager() always tries to scrape the manpage name and set the buffer name. That's much less important than avoiding duplicate buffers and E95. And it doesn't seem to be necessary, usually. Steps to reproduce: $ export MANPAGER="nvim -c 'set ft=man' -" $ man sleep :Man sleep Error detected while processing function man#init_pager: line 15: E95: Buffer with this name already exists :ls! 1 h- "man://SLEEP(1)" line 4 2 %a- "man://sleep(1)" line 1
* man.vim: set $MANWIDTH=999Justin M. Keyes2018-09-30
| | | | | | | | On some systems, mandoc disallows $MANWIDTH greater than 1000. E.g. FreeBSD: https://github.com/freebsd/freebsd/blob/b7d613ae8a2fc1530d33aff53a1a678d284bfeec/contrib/mandoc/manpath.c#L312 closes #9065
* man.vim: Start at the top #9023Justin M. Keyes2018-09-27
| | | | fixes #9057
* man.vim: Fix very long justified lines #9023Justin M. Keyes2018-09-21
| | | | | | | | | | | When nroff justifies a line, it fills the line with whitespace to meet $MANWIDTH. With $MANWIDTH=9999, that of course results in nonsense (and behaves poorly with 'cursorline' option). To work around that, instead of trying to hard-justify the lines, just replace the mega-whitespace with a fixed size of 10 spaces. Perhaps N/Vim needs a "soft justify" feature?
* man.vim: Ignore $MANWIDTH, use soft wrap #9023Doron Behar2018-09-21
| | | | | fix #9017 close #9023
* man.vim: guard against reload (#8940)dm1try2018-09-01
| | | | | | Some plugins attempt to reload autoloaded scripts. Use a guard to prevent this. fix #8939
* man.vim: fix for mandoc (#8698)Brayden Banks2018-07-08
| | | | | When giving a section, the first candidate selection was not performed. followup/fixup #8341
* man.vim: s:get_path(): trim newline in all casesJustin M. Keyes2018-05-10
| | | | ref #8372
* man.vim: get() first item if -w returns multiple paths #8372Jon Bernard2018-05-10
| | | | | | | | | OpenBSD's man returns all candidates when searching with -w instead of the first one it finds. So this patch takes the first one if multiple entries are found. closes #8372 closes #8341
* man.vim: use correct offset in presence of modifier commandsMarco Hinz2018-01-22
| | | | | | | | | | | The argument expansion for :Man depends on the number of arguments given to it starting at the command itself. But user completion functions always provide the entire command-line which can include modifier commands like :tab, :vert, etc. leading to a wrong number of arguments. Prune all arguments up to :Man. Fixes #7872.
* Merge #7623 'man.vim: highlight bold, underlined text'Justin M. Keyes2018-01-09
|\
| * Address PR commentsGabriel Holodak2017-12-27
| |
| * Add support for escape sequencesGabriel Holodak2017-12-27
| |