summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/help.c
AgeCommit message (Collapse)AuthorFiles
2026-04-20refactor(excmd): migrate help.c to LuaJustin M. Keyes1
2026-04-05fix(help): show error when using :help! with nothing at cursor #38775zeertzjq1
It's possible to still show the old Easter egg, but then the user won't know about the new feature, so showing E349 is better.
2026-03-16fix(ux): drop "Sorry" from messages #38318Justin M. Keyes1
Problem: "Sorry" in a message (1) is noise, and (2) actually reduces the clarity of the message because the titlecasing of "Sorry" distracts from the actually important part of the message. Solution: Drop "Sorry" from messages.
2026-03-15feat(help): super K (":help!") guesses tag at cursor #36205Justin M. Keyes1
Problem: `K` in help files may fail in some noisy text. Example: (`fun(config: vim.lsp.ClientConfig): boolean`) ^cursor Solution: - `:help!` (bang, no args) activates DWIM behavior: tries `<cWORD>`, then trims punctuation until a valid tag is found. - Set `keywordprg=:help!` by default. - Does not affect `CTRL-]`, that is still fully "tags" based.
2026-02-14refactor(help): move local-additions to Lua #37831Yochem van Rosmalen1
Problem: - ~200 line function of hard-to-maintain C code. - Local Addition section looks messy because of the varying description formats. Solution: - Move code to Lua. - Have a best-effort approach where short descriptions are right aligned, giving a cleaner look. Long descriptions are untouched.
2026-02-10refactor(help): move escaping logic to Lua #37757Yochem van Rosmalen1
Problem: Escaping logic for {subject} in ex cmd `:help {subject}` is done in a messy 200+ lines C function which is hard to maintain and improve. Solution: Rewrite in Lua. Use `string.gsub()` instead of looping over characters to improve clarity and add many more tests to be able to confidently improve current code later on.
2025-09-12vim-patch:9.1.1754: :helptags doesn't skip examples with syntaxzeertzjq1
Problem: :helptags doesn't skip examples with syntax (Evgeni Chasnovski) Solution: Check for examples with syntax (zeertzjq). fixes: vim/vim#18273 closes: vim/vim#18277 https://github.com/vim/vim/commit/6f020cde569073622cc085251e47d82323d5c4bd
2025-08-14refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl1
These are not needed after #35129 but making uncrustify still play nice with them was a bit tricky. Unfortunately `uncrustify --update-config-with-doc` breaks strings with backslashes. This issue has been reported upstream, and in the meanwhile auto-update on every single run has been disabled.
2025-06-29fix(help): :help can focus unfocusable/hide window #34442phanium1
Problem: :help/:helpgrep/:lhelpgrep can focus unfocusable/hide window Solution: Ignore unfocusable/hidden window when reusing help buffer.
2025-05-17refactor(helptags): remove useless homegrown encoding checkbfredl1
This check was always broken. it will "detect" a file as other-than-UTF-8 if the first line of a help file only is ASCII. This only works by accident, as all our help files are UTF-8 (or ASCII-only, which is fully compatible), but are all ASCII-only on the first line of every help file which means that all helpfiles gets detected as not-UTF8 which makes the "consistency" test pass by accident even though the actual consistency is that every single file is UTF-8 compatible. This means that the "!_TAG_FILE_ENCODING\tutf-8\t" meta-tag already did not get emitted but YAGNI in either case as no encoding tag just means that 'encoding' is used which in neovim always is UTF-8 anyway. An alternative approach would be to integrate the real encoding detection already present in the codebase (an editor which edits text of various encodings) which checks the entire file instead of a weird first-line-only-hack, but as it happens to be 2025 the resolution of encoding trouble is to just use UTF-8 everywhere. And if you use something else you have to keep track yourself anyway it is not like we can detect if one helpfile of your plugin is latin-1 and another is latin-2 or whatever. Also, Nvim will detect the encoding of the file when you open the file as a :help buffer anyway.
2024-06-14revert: "refactor: use S_LEN macro" (#29319)Lewis Russell1
revert: "refactor: use S_LEN(s) instead of s, n (#29219)" This reverts commit c37695a5d5f2e8914fff86f3581bed70b4c85d3c.
2024-06-11refactor: use S_LEN(s) instead of s, n (#29219)James1
2024-06-04refactor: replace '\0' with NULJames Tirta Halim1
2024-06-01refactor: move shared messages to errors.h #26214Justin M. Keyes1
2024-03-21refactor(options): remove `set_string_option_direct()`Famiu Haque1
Problem: `set_string_option_direct()` contains a separate codepath specifically for setting string options. Not only is that unnecessary code duplication, but it's also limited to only string options. Solution: Replace `set_string_option_direct()` with `set_option_direct()` which calls `set_option()` under the hood. This reduces code duplication and allows directly setting an option of any type.
2024-02-12perf(extmarks): avoid unnecessary invalidations for virt_text (#27435)zeertzjq1
Invalidation of most w_valid flags isn't needed when adding or removing virtual text below cursor.
2024-01-27fix(coverity/471380): null dereference in get_local_additions()Daniil Zhukov1
strrchr returns null pointer if '.' is not present in file name. Notice that filenames are filtered to match "doc/*.??[tx]" pattern earlier so we shouldn't expect null pointer here. However later in code strrchr return value is checked so it seems better and more consistent to do the same here too.
2024-01-11refactor(IWYU): fix headersdundargoc1
Remove `export` pramgas from defs headers as it causes IWYU to believe that the definitions from the defs headers comes from main header, which is not what we really want.
2024-01-10refactor(options): remove `OPT_FREE` (#26963)Famiu Haque1
Problem: `OPT_FREE` macro doesn't seem to do anything as `P_ALLOCED` already handles allocations. Solution: Remove `OPT_FREE`.
2023-12-30refactor: follow style guidedundargoc1
2023-12-20refactor: eliminate cyclic includesdundargoc1
2023-12-20fix(buffer): do not filter help bufferChristian Clason1
Problem: If a help buffer is opened without legacy syntax set (because treesitter is enabled), Vim strips (some) markup. This means the syntax engine fails to parse (some) syntax if treesitter highlighting is disabled again. Solution: Do not strip the help buffer of markup since (legacy or treesitter) highlighting is always enabled in Nvim. Similarly, remove redundant setting of filetype and give the function a more descriptive name.
2023-12-09refactor(options): reduce `findoption()` usageFamiu Haque1
Problem: Many places in the code use `findoption()` to access an option using its name, even if the option index is available. This is very slow because it requires looping through the options array over and over. Solution: Use option index instead of name wherever possible. Also introduce an `OptIndex` enum which contains the index for every option as enum constants, this eliminates the need to pass static option names as strings.
2023-11-30build: don't define FUNC_ATTR_* as empty in headers (#26317)zeertzjq1
FUNC_ATTR_* should only be used in .c files with generated headers. Defining FUNC_ATTR_* as empty in headers causes misuses of them to be silently ignored. Instead don't define them by default, and only define them as empty after a .c file has included its generated header.
2023-11-28refactor: fix headers with IWYUdundargoc1
2023-11-27refactor: rename types.h to types_defs.hdundargoc1
2023-11-27build(IWYU): fix includes for undo_defs.hdundargoc1
2023-11-27build(IWYU): fix includes for func_attr.hdundargoc1
2023-11-27build(IWYU): replace most private mappings with pragmas (#26247)zeertzjq1
2023-11-19refactor: follow style guidedundargoc1
- reduce variable scope - prefer initialization over declaration and assignment
2023-11-13refactor: follow style guidedundargoc1
- reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values
2023-11-12build: remove PVSdundargoc1
We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
2023-11-11refactor: remove redundant castsdundargoc1
2023-11-05refactor: the long goodbyedundargoc1
long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
2023-09-30refactor: reorganize option header files (#25437)zeertzjq1
- Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
2023-09-30build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq1
2023-09-29refactor(message): smsg_attr -> smsgbfredl1
2023-08-26refactor(change): do API changes to buffer without curbuf switchbfredl1
Most of the messy things when changing a non-current buffer is not about the buffer, it is about windows. In particular, it is about `curwin`. When editing a non-current buffer which is displayed in some other window in the current tabpage, one such window will be "borrowed" as the curwin. But this means if two or more non-current windows displayed the buffers, one of them will be treated differenty. this is not desirable. In particular, with nvim_buf_set_text, cursor _column_ position was only corrected for one single window. Two new tests are added: the test with just one non-current window passes, but the one with two didn't. Two corresponding such tests were also added for nvim_buf_set_lines. This already worked correctly on master, but make sure this is well-tested for future refactors. Also, nvim_create_buf no longer invokes autocmds just because you happened to use `scratch=true`. No option value was changed, therefore OptionSet must not be fired.
2023-08-24refactor(memline): distinguish mutating uses of ml_get_buf()bfredl1
ml_get_buf() takes a third parameters to indicate whether the caller wants to mutate the memline data in place. However the vast majority of the call sites is using this function just to specify a buffer but without any mutation. This makes it harder to grep for the places which actually perform mutation. Solution: Remove the bool param from ml_get_buf(). it now works like ml_get() except for a non-current buffer. Add a new ml_get_buf_mut() function for the mutating use-case, which can be grepped along with the other ml_replace() etc functions which can modify the memline.
2023-08-18vim-patch:9.0.1730: passing multiple patterns to runtime not working (#24771)zeertzjq1
Problem: passing multiple patterns to runtime not working Solution: prepend prefix to each argument separately closes: vim/vim#12617 https://github.com/vim/vim/commit/008c91537b55835aa91cd8fbe1a139256581da31
2023-07-13perf(rtp): reduce rtp scans (#24191)Lewis Russell1
* perf(rtp): reduce rtp scans Problem: Scanning the filesystem is expensive and particularly affects startuptime. Solution: Reduce the amount of redundant directory scans by relying less on glob patterns and handle vim and lua sourcing lower down.
2023-06-11fix(helptags): make multibyte help tags work properly (#23975)zeertzjq1
2023-06-07refactor(options): remove `getoption_T` and introduce `OptVal` (#23850)Famiu Haque1
Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options.
2023-05-13refactor: remove typval.h from most header files (#23601)zeertzjq1
Because typval_defs.h is enough for most of them.
2023-04-07refactor: remove redundant castsii141
2023-04-07refactor: remove redundant const char * castsii141
2023-03-13fix(help): force tree reparse after local addition insertionChristian Clason1
Problem: *local-additions* in `help.txt` are inserted via `ml_append`, which messes up treesitter highlighting of this file as the buffer becomes desynced from the tree. Solution: Add hack on top of hack by explicitly calling `mark_adjust` and `changed_lines_buf` after each insertion.
2023-03-04refactor: replace char_u with char or uint8_t (#22400)dundargoc1
Work on https://github.com/neovim/neovim/issues/459
2023-02-12refactor: reduce scope of locals as per the style guide 3 (#22221)dundargoc1
refactor: reduce scope of locals as per the style guide
2023-02-11refactor: replace char_u with char (#21901)dundargoc1
refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459