aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/man.lua
Commit message (Collapse)AuthorAge
* fix(man.lua): skip `Attrs.None` highlights #32262Johannes Larsen2025-02-02
| | | | | | | | | | | | | | | Before the 7121983c45d92349a6532f32dcde9f425e30781e refactoring this loop added highlights from a `buf_hls` list that had filtered out elements with `Attrs.None`. After the refactoring this added highlights from `hls` directly, and those elements would fail with e.g.: $ nvim 'man://math.h(0)' Error detected while processing command line: Error executing Lua callback: /usr/share/nvim/runtime/lua/man.lua:205: Invalid 'hl_group': Expected Lua string stack traceback: [C]: in function 'nvim_buf_add_highlight' /usr/share/nvim/runtime/lua/man.lua:205: in function 'highlight_man_page' /usr/share/nvim/runtime/lua/man.lua:632: in function 'init_pager' /usr/share/nvim/runtime/plugin/man.lua:9: in function </usr/share/nvim/runtime/plugin/man.lua:6>
* fix: resolve all remaining LuaLS diagnosticsLewis Russell2025-01-27
|
* refactor(man.lua): various changesLewis Russell2024-12-18
| | | | | | | | | | | | | | | | | | | - Replace all uses of vim.regex with simpler Lua patterns. - Replace all uses of vim.fn.substitute with string.gsub. - Rework error handling so expected errors are passed back via a return. - These get routed up an passed to `vim.notify()` - Any other errors will cause a stack trace. - Reworked the module initialization of `localfile_arg` - Updated all type annotations. - Refactored CLI completion by introduction a parse_cmdline() function. - Simplified `show_toc()` - Refactor highlighting - Inline some functions - Fix completion on MacOS 13 and earlier. - Prefer `manpath -q` over `man -w` - Make completion more efficient by avoiding vim.fn.sort and vim.fn.uniq - Reimplement using a single loop
* fix(Man): completion on MacLewis Russell2024-12-16
| | | | | | | | Problem: `man -w` does not work on recent versions of MacOs. Solution: Make it so an empty result is interpreted as an error unless silent=true
* Revert "fix(Man.lua): trigger completion even without arguments" #31572Justin M. Keyes2024-12-13
| | | This reverts commit 7940ec69136fa992c98aa7b37265fbc2e619232e.
* fix(man.lua): `:Man <tab>` does not complete #31569Luca Saccarola2024-12-13
| | | closes: #31512
* refactor(lsp): drop str_byteindex/str_utfindex wrappers #30915Tristan Knight2024-10-26
| | | | | * deprecate old signatures * move to new str_byteindex/str_utfindex signature * use single-underscore name (double-underscore is reserved for Lua itself)
* feat(man.vim): "q" always closes window #30819xudyang12024-10-15
|
* fix(man): check if buffer is valid before restoring 'tagfunc' (#30180)zeertzjq2024-08-29
|
* fix(man): avoid setting v:errmsg (#30052)zeertzjq2024-08-15
|
* fix(man): filter OSC 8 hyperlink markup #29171Lennard Hofmann2024-06-07
| | | | | Problem: `man cmake` shows "8;;https://cmake.orghttps://cmake.org8;;" Solution: Remove noise so that it shows as "https://cmake.org". See also: https://en.wikipedia.org/wiki/ANSI_escape_code#OSC
* fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495)Brian Cao2024-04-26
|
* fix(man): pass modifiers also to :tag (#27878)zeertzjq2024-03-16
| | | | There aren't really many modifiers that take an effect on :tag (except maybe :confirm, :unsilent, :verbose), but pass them for consistency.
* feat(man): allow opening pages in current window (#27861)Tomasz N2024-03-16
| | | With :hide modifier, open page in current window.
* docs: small fixesdundargoc2024-01-02
| | | | | | Co-authored-by: Christian Clason <c.clason@uni-graz.at> Co-authored-by: HiPhish <hiphish@posteo.de> Co-authored-by: JD Rudie <rudiejd@miamioh.edu>
* fix(man.lua): hardwrapped manpage is not resized #25646James Barford-Evans2023-10-16
| | | | | | | | | | | Problem: If a manpage is opened, its hardwrapped dimensions are not recalculated after closing then revisiting the same manpage. Solution: Unload the manpage when it is hidden. This forces it to be reloaded, which forces the hard-wrapping to be recalculated when it is revisited. Fixes: #25457
* feat(man): respect 'wrapmargin' when wrapping man pages (#24091)Gregory Anders2023-06-21
|
* feat(lua): add `vim.system()`Lewis Russell2023-06-07
| | | | | | | | | | | | | | | feat(lua): add vim.system() Problem: Handling system commands in Lua is tedious and error-prone: - vim.fn.jobstart() is vimscript and comes with all limitations attached to typval. - vim.loop.spawn is too low level Solution: Add vim.system(). Partly inspired by Python's subprocess module Does not expose any libuv objects.
* feat(lua): rename vim.loop -> vim.uv (#22846)Lewis Russell2023-06-03
|
* fix(man.lua): return support of all sectionsVadim A. Misbakh-Soloviov2023-05-07
| | | | | | | | | | | | Current behaviour of `:Man` is to only work with "number" sections. This is caused by wrong assumptions about man sections naming. Also, there was similar assumption about length of section dirs in `paths` variable. fixes #23485 Signed-off-by: Vadim Misbakh-Soloviov <git@mva.name>
* fix(man.lua): don't continue on command error (#23009)zeertzjq2023-04-11
| | | Fix #21169
* fix(man.lua): tests, namingJustin M. Keyes2023-03-07
|
* feat(man.lua): support spaces in manpage namesEriks Muhins2023-03-07
| | | | | | | | | | Problem: :Man command errors if given more than two arguments. Thus, it is impossible to open man pages that contain spaces in their names. Solution: Adjust :Man so that it tries variants with spaces and underscores, and uses the first found.
* refactor(man): add type annotationsLewis Russell2023-02-21
|
* fix(man): use italics for `<bs>_` (#22086)Lewis Russell2023-02-01
| | | | | | | | | | | | fix(man): use italics for <bs>_ Even though underline is strictly what this should be. <bs>_ was used by nroff to indicate italics which wasn't possible on old typewriters so underline was used. Modern terminals now support italics so lets use that now. See: - https://unix.stackexchange.com/questions/274658/purpose-of-ascii-text-with-overstriking-file-format/274795#274795 - https://cmd.inp.nsk.su/old/cmd2/manuals/unix/UNIX_Unleashed/ch08.htm
* fix(man.lua): open in current window if it's already a man page (#21987)0xAdk2023-01-25
| | | This matters when there are multiple man page windows open.
* fix(man.lua): use `env` command (#21007)euclidianAce2022-11-09
| | | | | | | Previously man.lua would use the `env` field in the parameters of `vim.loop.spawn` to override things like MANPAGER. This caused issues on NixOS since `spawn` will _override_ the environment rather than _append_ to it (and NixOS relies on a heavily modified environment). Using the `env` command to append to the environment solves this issue.
* fix(man.lua): set modifiable before writing page (#20914)Kevin Hwang2022-11-03
|
* fix(man): handle absolute paths as `:Man` targets (#20624)Mahmoud Al-Qudsi2022-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix(man): handle absolute paths as :Man targets Previously, attempting to provide `:Man` with an absolute path as the name would cause neovim to return the following error: ``` Error detected while processing command line: /usr/local/share/nvim/runtime/lua/man.lua:690: /usr/local/share/nvim/runtime/lua/man.lua:683: Vim:E426: tag not found: nil(nil) Press ENTER or type command to continue ``` ..because it would try to validate the existence of a man page for the provided name by executing `man -w /some/path` which (on at least some Linux machines [0]) returns `/some/path` instead of the path to the nroff files that would be formatted to satisfy the man(1) lookup. While man pages are not normally named after absolute paths, users shouldn't be blamed for trying. Given such a name/path, neovim would **not** complain that the path didn't have a corresponding man file but would error out when trying to call the tag function for the null-propagated name-and-section `nil(nil)`. (The same underlying error existed before this function was ported to lua, but did not exhibit the lua-specific `nil(nil)` name; instead a tag lookup for `()` would fail and error out.) With this patch, we detect the case where `man -w ...` returns the same value as the provided name to not only prevent invoking the tag function for a non-existent/malformed name+sect but also to properly report the non-existence of a man page for the provided lookup (the absolute path). While man(1) can be used to directly read an nroff-formatted document via `man /path/to/nroff.doc`, `:Man /path/to/nroff.doc` never supported this behavior so no functionality is lost in case the provided path _was_ an nroff file. [0]: `man -w /absolute/path` returning `/absolute/path` observed on an Ubuntu 18.04 installation. * test: add regression test for #20624 Add a functional test to `man_spec.lua` to check for a regression for #20624 by first obtaining an absolute path to a random file and materializing it to disk, then attempting to query `:Man` for an entry by that same name/path. The test passes if nvim correctly reports that there is no man page correspending to the provided name/path and fails if any other error (or no error) is shown.
* feat(cscope)!: removeLewis Russell2022-10-13
|
* fix(man): support MacOS 13Lewis Russell2022-10-11
| | | | | | | | MacOS 13 has changed its version of `man` to an version that doesn't properly support `man -w` (without arguments). In order to workaround this we simply fallback to $MANPATH. Fixes #20579
* refactor(man): pass env directly to spawn() (#20591)Lewis Russell2022-10-11
|
* fix(tests): indicate in test logs when nvim exit times outbfredl2022-09-22
| | | | | | When it happens it wastes 2 seconds which is NOT included in the normal busted timing info. It is hard to correct this, but we can at least print a warning when this happens.
* feat(lua): move compat module from runtime to test (#20257)Lewis Russell2022-09-20
|
* fix(api)!: correctly deal with number before :tabzeertzjq2022-09-02
| | | | | | Now nvim_parse_cmd and nvim_create_user_command use a "tab" value which is the same as the number passed before :tab modifier instead of the number plus 1, and "tab" value is -1 if :tab modifier is not used.
* feat(Man): port to Lua (#19912)Lewis Russell2022-09-02
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* chore: format runtime with styluaChristian Clason2022-05-09
|
* man.vim: Handle ANSI escape sequences with ":" #10267Kovas Palunas2019-06-30
| | | | closes #10267
* lintJustin M. Keyes2018-12-20
|
* runtime/lua/vim/compat.luaJustin M. Keyes2018-12-20
| | | | | | | | | | | | | | | | | | | | | ref #9280 Introduce the `vim.compat` module, to help environments with system Lua 5.2+ run the build/tests. Include the module implicitly in all tests. ref #8677 legacy `vim` module: beep buffer command dict eval firstline lastline line list open type window
* test: Lua 5.2/5.3 compat #9280Matěj Cepl2018-12-20
| | | | | Make the code run both on Lua 5.1 (which is the default for Neovim, and is what LuaJIT provides) and Lua 5.2+.
* man.lua: avoid float conversion on lua 5.3 (#7851)Filip Szymański2018-01-15
| | | | | Error detected while processing function man#open_page[58]..<SNR>54_put_page: line 8: E5105: Error while calling lua chunk: /usr/share/nvim/runtime/lua/man.lua:165: Vim(let):E805: Using a Float as a Number
* Address PR commentsGabriel Holodak2017-12-27
|
* Add support for escape sequencesGabriel Holodak2017-12-27
|
* Switch to processing in LuaGabriel Holodak2017-12-27