summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/ftplugin/man.vim
AgeCommit message (Collapse)AuthorFiles
2024-10-15feat(man.vim): "q" always closes window #30819xudyang11
2024-06-11fix(ftplugin/man.vim): hide signcolumn (auto)belkka1
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).
2024-06-11refactor(ftplugin/man.vim): rearrange `setlocal` commandsbelkka1
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
2024-04-26fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495)Brian Cao1
2022-09-02feat(Man): port to Lua (#19912)Lewis Russell1
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-05-13fix(man.vim): q in "$MANPAGER mode" does not quit #18443Arsham Shirvani1
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>
2021-08-26fix(man.vim): filetype=man is too eager #15488Justin M. Keyes1
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
2020-12-09man.vim: Add double click mapping.Edwin Pujols1
2020-12-04man.vim: Set iskeyword explicitly.Edwin Pujols1
This also fixes `:Man!`, which wasn't setting 'iskeyword' to contain parentheses, etc.
2020-08-08man.vim: Add - to 'iskeyword' (#12598)Anmol Sethi1
Pressing K on manpages with - in their name will now work. I noticed this the manpages of https://github.com/cli/cli
2020-06-13man.vim: Remove unnecessary codeAnmol Sethi1
Not sure why this was added in https://github.com/neovim/neovim/commit/94f4469638590ca5cc724ab6459f2cfc78c621a4 It doesn't seem to do anything and I can't reproduce the linked issue with this patch so I think it's all working now. cc @justinmk
2019-11-28man.vim: remove K mapping #11472Rob Pilling1
Since #11457 this mapping is no longer necessary. 'keywordprg' defaults to :Man in options.lua
2019-11-24man.vim: Update maintainer emailAnmol Sethi1
2019-10-24man.vim: use 'tagfunc' instead of remappingRob Pilling1
man#pop_tag() is also no longer used
2019-02-06man.vim: set 'linebreak'Justin M. Keyes1
closes #9583
2018-09-21man.vim: Ignore $MANWIDTH, use soft wrap #9023Doron Behar1
fix #9017 close #9023
2018-01-19man.vim: infer $MANPAGER invocation in more casesJustin M. Keyes1
This should handle most cases where Nvim was invoked as $MANPAGER. Ultimately the stakes are low: :quit will prompt if there are unsaved changes. fix #7873
2017-10-21help, man.vim: change "outline" map to gO (#7405)Justin M. Keyes1
2017-05-01help, man.vim: "outline" (TOC) feature #5169Tommy Allen1
2016-12-15Man: use non-recursive mappings for :Man (#5777)Marco Hinz1
This is a regression introduced by: https://github.com/neovim/neovim/pull/5290/files#diff-8691c83194ea5f1342ecc9f17b4c51d8R46 When the <plug> mappings were changed to using :Man, they should have changed to use `nnoremap` as well. Fixes #5776.
2016-12-03ftplugin/man: Finish early if &filetype is not manJames McCoy1
Many people have `runtime ftplugin/man.vim` in their init file, as was required in Vim to have the `:Man` command generally available. 7a4d069b removed the &filetype check, which caused these setups to always create a blank `man://` buffer.
2016-11-19man.vim: do not assume ftplugin is sourced before syntaxAnmol Sethi1
Fixes #5574
2016-11-18man.vim: no guarantee that the first line contains anything usefulAnmol Sethi1
Fixes #5628
2016-10-20man.vim: silence `file` call (#5509)Colin Caine1
When a file is opened by nvim with ft=man already set, and "has('vim_starting')", ftplugin/man.vim calls 'execute 'file man://'.ref', this causes nvim to display something like this: ```` "<name of original file>" 977, 41017C "man://foo(1)" [Not edited] 977 lines --0%-- Press ENTER or type command to continue ```` This is annoying, because nothing of note has actually happened. Use cases why you might want to read a man page from a file: `MANPAGER='bash -c "nvim -c \"set ft=man\" </dev/tty <(col -bx)"' man git` `nvim -c 'set ft=man' <(man -P cat git)`
2016-09-04[RFC] man.vim: remove <Plug> mappings (#5290)Anmol Sethi1
- :Man with no arguments opens the manapage for the <cWORD> (man buffers) or <cword> (non-man buffers). - remove now irrelevent comment about -P flag
2016-09-03man.vim #5249Anmol Sethi1
- fix synopsis highlighting in other locales. Cannot always rely on the first line for the section in some locales; instead, use the file path and explicitly set b:man_sect to the actual section. - eliminate separate s:man_args function - simplify logic: do not reuse buffer content - introduce b:man_default_sects Fixes #5233 - introduce <Plug>(man_vsplit), <Plug>(man_tab) - simplify regexps
2016-08-24man.vim: set window local options when reusing bufferAnmol Sethi1
This is necessary incase the buffer was previously opened in a different tab, in which the window options there do not carry over. It is not explicitly documented in ':help local-options' but that is how it works.
2016-08-19man.vim: Avoid error in legacy vimrcs.Justin M. Keyes1
The old man.vim ftplugin advises users to add this to vimrc: runtime ftplugin/man.vim Make this a no-op to avoid sending users on a debugging quest.
2016-08-13man.vim: doc fixes #5171Anmol Sethi1
- Weird tab+space combination used for alignment. All spaces now - Added back <C-T> mapping (somehow we missed that completely) - Fixed mistake that <Plug>(Man) opens in a new tab. Also added note at top on how the window is chosen/opened. - Clarified q local mapping - Removed section that shows an example autocmd to add desired folding style. - Removed random line in `usr_12.txt` about `<Leader>` and backslash. - :Man supports completion, not auto-completion. Closes #5171
2016-08-07man.vim: handle 'gdefault' (#5182)Anmol Sethi1
Fixes #5181
2016-08-07man.vim: buffers are now listedAnmol Sethi1
- Since the names are set and ':vsplit printf(3)' work, there is no need to unlist them.
2016-08-06man.vim: default K mappingAnmol Sethi1
- Also some small improvements in other parts.
2016-08-04man.vim: rewriteAnmol Sethi1
- Smart autocomplete. It's automatically sorted, filtered for duplicates and even formats the candidates based on what is needed. For example, `:Man 1 printf<TAB>` will show the pages that are in section 1m as 'page(sect)' to let you know they are in a more specific section. - Instead of trying to unset $MANPAGER we use the -P flag to set the pager to cat - Always use the section arg '-s', it makes the code much simpler (see comment in s:man-args). - A manpage name starting with '-' is invalid. It's fine for sections because of the use of '-s'. - The tagstack is an actual stack now, makes it much simpler. - By using v:count and v:count1, the plugin can explicitly check whether the user set a count, instead of relying on a default value (0) that is actually a real manpage section. - Extraction of a manpage reference is much more simple. No giant long complicated regexes. Now, the plugin lets `man` handle the actual validation. We merely extract the section and page. Syntax regexes are a bit more specific though to prevent highlighting everything. - Multilingual support in the syntax file. Removed the cruft that was only relevent to vim. Also simplified and improved many of the regexes. - Using shellescape when sending the page and sect as arguments - In general, the code flow is much more obvious. - man#get_page has been split up into smaller functions with explicit responsibilties - ':help' behavior in opening splits and manpages - Comments explaining anything that needs explaining and isn't immediately obvious. - If a manpage has already been loaded but if it were to reloaded at the current width which is the same as the width at which it was loaded at previously, it is not reloaded. - Use substitute to remove the backspaced instead of `col -b`, as the latter doesn't work with other languages. - Open paths to manpages - It uses cWORD instead of cword to get the manpage under the cursor, this helps with files that do not have (,) in iskeyword. It also means the plugin does not set iskeyword locally anymore. - <Plug>(Man) mapping for easy remapping - Switched to single quotes wherever possible. - Updated docs in $VIMRUNTIME/doc/filetype.txt (still need to update user-manual) - Always call tolower on section name. See comment in s:extract_page_and_sect_fpage - Formatting/consistency cleanup - Automatically map q to ':q<CR>' when invoked as $MANPAGER - It also fully supports being used as $MANPAGER. Setting the name and stuff automatically. - Split up the setlocals into multiple lines for easier readability - Better detection of errors by redirecting stderr to /dev/null. If an error occured, stdout will be empty. - Functions return [sect, page] not [page, sect]. Makes more sense with how man takes the arguments as sect and then page. - Pretty prints errors on a single line. - If no section is given, automatically finds the correct section for the buffer name. It also gets the correct page. See the comment in s:get_page - If $MANWIDTH is not set, do not assign directly to $MANWIDTH because then $MANWIDTH will always stay set to the same value as we only use winwidth(0) when the global $MANWIDTH is empty. Instead we set it locally for the command. - Maintainer notes on all files.
2016-05-03vim-patch:d042dc8KillTheMule1
Update runtime files. https://github.com/vim/vim/commit/d042dc825c9b97dacd84d4728f88300da4d5b6b9 Missing in runtime/doc: hangulin.txt, tags, todo.txt. The changes to options.txt do not apply for nvim. man.vim is very different in nvim, some changes applied manually, others discarded.
2016-03-05man.vim: fixes to argument handling and parsingNoah Frederick1
- Define a collection of legal characters when parsing page and section in `s:parse_page_and_section()` instead of relying on 'iskeyword', which is unreliable. - Allow non-numeric section names (e.g., `3c`). - Simplify argument handling in `man#get_page()` to accommodate non-numeric section names. Fixes #4165.
2015-09-25man.vim: Prevent sourcing in startup.Justin M. Keyes1
It is common practice for Vim users to :runtime! ftplugin/man.vim in order to get the :Man command. That will cause weird settings for non-man files.
2015-09-23man.vim: window-local optionsJustin M. Keyes1
Set window-local options only on a newly-created "man" tab or if we're already in one.
2015-09-23man.vim: man#get_page(): parse page and section.Justin M. Keyes1
- Eliminate man#pre_get_page(). - Temporarily remove () from 'iskeyword' to avoid spurious \k match.
2015-09-23man.vim: convert ftplugin to actual plugin.Justin M. Keyes1
- do not create leader maps - :norm! instead of :norm - :keepjumps during layout - use blackhole reg to avoid polluting unnamed reg - format buffer name as "man://foo(2)" - simulate behavior of `man` - buffer-local mapping of q to quit - open in new tab instead of new window - set 'nolist' - set tabstop=8
2015-09-23'keywordprg': support ex commandsJustin M. Keyes1
- new feature: if the first character of 'keywordprg' is ":", the command is invoked as a Vim ex-command prefixed with [count]. - change default 'keywordprg' to :Man
2015-05-19vim-patch:c5d53d4 #2695Florian Walch1
Update runtime files. https://code.google.com/p/vim/source/detail?r=c5d53d4c3e2e24e23fc4272bf91be3c031ccb598
2014-07-29re-integrate runtime/ vim-patch:0 #938Justin M. Keyes1
Vim runtime files based on 7.4.384 / hg changeset 7090d7f160f7 Excluding: Amiga icons (*.info, icons/) doc/hangulin.txt tutor/ spell/ lang/ (only used for menu translations) macros/maze/, macros/hanoi/, macros/life/, macros/urm/ These were used to test vi compatibility. termcap "Demonstration of a termcap file (for the Amiga and Archimedes)" Helped-by: Rich Wareham <rjw57@cam.ac.uk> Helped-by: John <john.schmidt.h@gmail.com> Helped-by: Yann <yann@yann-salaun.com> Helped-by: Christophe Badoit <c.badoit@lesiteimmo.com> Helped-by: drasill <github@tof2k.com> Helped-by: Tae Sandoval Murgan <taecilla@gmail.com> Helped-by: Lowe Thiderman <lowe.thiderman@gmail.com>