aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/help.c
Commit message (Collapse)AuthorAge
* refactor(charset)!: delete 'isprint' and cleanup 'iskeyword' and friendsbfredl2026-09-22
| | | | | | | | | | | | | In the `enc=utf-8` only world, the 'isprint' option is quite obsolete. The function is only consulted for decoded U+0080 to U+00FF chars whose printability is defined by the unicode charset, just like higher codepoints. Meanwhile, invalid `\x80` to `\xFF` bytes are always unprintable. Disentangle 'iskeyword', 'isfname' and 'isident' from each other by giving them all separate bitsets. Now these can be updated individually. These updaters can back out of errors gracefully, no need for extra panic logic in option[str].c to restore partially updated chartabs.
* feat(help): generate :helptags using TreesitterYochem van Rosmalen2026-08-25
| | | | | | | | | | | | | | | | | | | | Problem: Tags are manually parsed in C which is not flexible and prone to errors. Extending the help system to allow for other formats (e.g. Markdown) would require a large rewrite in the C core, while with Treesitter it only needs a query update. Solution: Use the power of treesitter to extract the tags from helpfiles. - build: set `$VIMRUNTIME` when generating helptags, like `cmake/Util.cmake` already does for other generators. - fix(help): only accept tags delimited by whitespace. The old C parser only accepted a `*tag*` preceded by start-of-line or whitespace and followed by whitespace or end-of-line. The vimdoc parser also captures tags followed by other text, e.g. `*$XDG_STATE_HOME*/.../logs` in starting.txt, which caused an E154 duplicate tag error for docs that were previously fine.
* refactor(path): pathcmp() #41035tao2026-08-07
| | | | | | | | | | | | | | | | | | | | | | Problem: Redudant code Solution: Add `path_fold_char()` to normalize path sep. Refactor `pathcmp()` and `path_fnamencmp()` into `path_cmp`. | feature | pathcmp | path_fnamencmp | path_cmp(now) | | ------------------------ | -------------- | -------------- | ------------- | | case folding | `mb_toupper()` | `utf_fold()` | `utf_fold()` | | consults fileignorecase | ✅ | ✅ | `ic` param | | `maxlen` | ✅ | ✅ | ✅ | | `/` == `\` | ✅ | ✅ | ✅ | | MSWIN drive letter | ❌ | ✅ | ✅ | | sep affects sorting | ✅ | ❌ | ✅ | | ignores a trailing slash | ✅ | ❌ | ✅ | Refactor `path_fnamecmp` and `path_full_compare` into `path_equal`, with flags controlling "no filesystem" comparison (i.e. `path_cmp`), env variables expansion, absolute path resolution and filesystem access.
* refactor(options): drop OptVal, use ObjectJustin M. Keyes2026-07-29
| | | | | | | | | | | | | Problem: The object subsystem has an intermediate representation for no real reason. Besides the code cost, this also adds an extra (api <=> OptVal) conversion step, which is a (small) perf cost. Solution: We already have `Object`, so use it instead. - drop `OptVal`, `OptValData`, `OptValType`, and related boilerplate. - add `kObjectTypeUnset`.
* refactor(lua): rename nlua_call_typvalJustin M. Keyes2026-07-06
|
* fix(ui): z=, tselect with async vim.ui.selectJustin M. Keyes2026-04-30
| | | | | | | | | | | Problem: After 55ceb31, z= and tselect don't work if `vim.ui.select` is an async provider (especially terminal buffers). Solution: Drop the `vim.wait()` approach, use an async approach. fix #39506
* refactor(excmd): migrate help.c to LuaJustin M. Keyes2026-04-20
|
* fix(help): show error when using :help! with nothing at cursor #38775zeertzjq2026-04-05
| | | | 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.
* fix(ux): drop "Sorry" from messages #38318Justin M. Keyes2026-03-16
| | | | | | | | | 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.
* feat(help): super K (":help!") guesses tag at cursor #36205Justin M. Keyes2026-03-15
| | | | | | | | | | | | | 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.
* refactor(help): move local-additions to Lua #37831Yochem van Rosmalen2026-02-14
| | | | | | | | | | | 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.
* refactor(help): move escaping logic to Lua #37757Yochem van Rosmalen2026-02-10
| | | | | | | | | | 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.
* vim-patch:9.1.1754: :helptags doesn't skip examples with syntaxzeertzjq2025-09-12
| | | | | | | | | | | 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
* refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl2025-08-14
| | | | | | | | | 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.
* fix(help): :help can focus unfocusable/hide window #34442phanium2025-06-29
| | | | | | | Problem: :help/:helpgrep/:lhelpgrep can focus unfocusable/hide window Solution: Ignore unfocusable/hidden window when reusing help buffer.
* refactor(helptags): remove useless homegrown encoding checkbfredl2025-05-17
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* revert: "refactor: use S_LEN macro" (#29319)Lewis Russell2024-06-14
| | | | | revert: "refactor: use S_LEN(s) instead of s, n (#29219)" This reverts commit c37695a5d5f2e8914fff86f3581bed70b4c85d3c.
* refactor: use S_LEN(s) instead of s, n (#29219)James2024-06-11
|
* refactor: replace '\0' with NULJames Tirta Halim2024-06-04
|
* refactor: move shared messages to errors.h #26214Justin M. Keyes2024-06-01
|
* refactor(options): remove `set_string_option_direct()`Famiu Haque2024-03-21
| | | | | | 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.
* perf(extmarks): avoid unnecessary invalidations for virt_text (#27435)zeertzjq2024-02-12
| | | | Invalidation of most w_valid flags isn't needed when adding or removing virtual text below cursor.
* fix(coverity/471380): null dereference in get_local_additions()Daniil Zhukov2024-01-27
| | | | | | | | 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.
* refactor(IWYU): fix headersdundargoc2024-01-11
| | | | | | 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.
* refactor(options): remove `OPT_FREE` (#26963)Famiu Haque2024-01-10
| | | | | | Problem: `OPT_FREE` macro doesn't seem to do anything as `P_ALLOCED` already handles allocations. Solution: Remove `OPT_FREE`.
* refactor: follow style guidedundargoc2023-12-30
|
* refactor: eliminate cyclic includesdundargoc2023-12-20
|
* fix(buffer): do not filter help bufferChristian Clason2023-12-20
| | | | | | | | | | | | 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.
* refactor(options): reduce `findoption()` usageFamiu Haque2023-12-09
| | | | | | 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.
* build: don't define FUNC_ATTR_* as empty in headers (#26317)zeertzjq2023-11-30
| | | | | | 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.
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* refactor: rename types.h to types_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for undo_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
|
* build(IWYU): replace most private mappings with pragmas (#26247)zeertzjq2023-11-27
|
* refactor: follow style guidedundargoc2023-11-19
| | | | | - reduce variable scope - prefer initialization over declaration and assignment
* refactor: follow style guidedundargoc2023-11-13
| | | | | | - reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values
* build: remove PVSdundargoc2023-11-12
| | | | | | | 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.
* refactor: remove redundant castsdundargoc2023-11-11
|
* refactor: the long goodbyedundargoc2023-11-05
| | | | | | 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.
* refactor: reorganize option header files (#25437)zeertzjq2023-09-30
| | | | | | - 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
* build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|
* refactor(message): smsg_attr -> smsgbfredl2023-09-29
|
* refactor(change): do API changes to buffer without curbuf switchbfredl2023-08-26
| | | | | | | | | | | | | | | | | | | | | | | 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.
* refactor(memline): distinguish mutating uses of ml_get_buf()bfredl2023-08-24
| | | | | | | | | | | | | | 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.
* vim-patch:9.0.1730: passing multiple patterns to runtime not working (#24771)zeertzjq2023-08-18
| | | | | | | | 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
* perf(rtp): reduce rtp scans (#24191)Lewis Russell2023-07-13
| | | | | | | | | | | * 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.
* fix(helptags): make multibyte help tags work properly (#23975)zeertzjq2023-06-11
|
* refactor(options): remove `getoption_T` and introduce `OptVal` (#23850)Famiu Haque2023-06-07
| | | | | | | | 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.
* refactor: remove typval.h from most header files (#23601)zeertzjq2023-05-13
| | | Because typval_defs.h is enough for most of them.