aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_defaults.lua
Commit message (Collapse)AuthorAge
* docs: miscdundargoc2025-01-30
| | | | | | | | | Co-authored-by: Dustin S. <dstackmasta27@gmail.com> Co-authored-by: Ferenc Fejes <fejes@inf.elte.hu> Co-authored-by: Maria José Solano <majosolano99@gmail.com> Co-authored-by: Yochem van Rosmalen <git@yochem.nl> Co-authored-by: brianhuster <phambinhanctb2004@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* refactor: use nvim.foo.bar format for autocommand groupsMaria José Solano2025-01-14
|
* feat(api): deprecate nvim_out/err_write(ln)Luuk van Baal2025-01-09
|
* feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343Justin M. Keyes2024-12-19
| | | | | | | | | | | | Problem: `termopen` has long been a superficial wrapper around `jobstart`, and has no real purpose. Also, `vim.system` and `nvim_open_term` presumably will replace all features of `jobstart` and `termopen`, so centralizing the logic will help with that. Solution: - Introduce `eval/deprecated.c`, where all deprecated eval funcs will live. - Introduce "term" flag of `jobstart`. - Deprecate `termopen`.
* feat(defaults): disable 'foldcolumn' in terminal buffers (#31480)Micah Halter2024-12-06
|
* fix(defaults): don't replace keycodes in Visual search mappings (#31460)zeertzjq2024-12-05
| | | Also remove "silent" to be more consistent with Normal mode search.
* defaults: disable 'number', 'relativenumber', and 'signcolumn' in terminal ↵Gregory Anders2024-12-04
| | | | buffers (#31443)
* feat(tui): update 'background' on theme change events (#31350)Gregory Anders2024-11-26
| | | | | | | | | | | | | Enabling private DEC mode 2031 tells the terminal to notify Nvim whenever the OS theme changes (i.e. light mode to dark mode or vice versa) or the terminal emulator's palette changes. When we receive one of these notifications we query the terminal color's background color again to see if it has changed and update the value of 'background' if it has. We only do this though if the user has not explicitly set the value of 'bg' themselves. The help text is updated slightly to hint to users that they probably shouldn't set this value: on modern terminal emulators Nvim is able to completely determine this automatically.
* fix(defaults): omit empty line from unimpaired mapping messages (#31347)Marcus Caisey2024-11-25
| | | | | | | | | | | | | | | | | | | | | Problem: The default unimpaired mappings display an empty line after the command's output. This results (with default configuration) in the `Press ENTER or type command to continue` prompt to be displayed, like so: ``` (2 of 16): item2 Press ENTER or type command to continue ``` Solution: The cause is that we're checking the second return value from `pcall(vim.api.nvim_cmd, opts, {})` to determine whether the call was successful. `nvim_cmd` returns an empty string on success, so this value is an empty string in the successful path which we then display. The fix is simple: check the first return value instead which is the "status code" of the call.
* feat(defaults): dot-repeat [<Space> #31186Peter Aronoff2024-11-17
| | | | | | Problem: `[<Space>` and `]<Space>` do not support repetition. Solution: use `operatorfunc` and `g@l` to make these mappings dot repeatable.
* feat(default): bind `vim.lsp.buf.signature_help` in select mode (#31223)Yi Ming2024-11-15
|
* feat(defaults): unimpaired empty line below/above cursor #30984Yochem van Rosmalen2024-11-04
|
* fix(defaults): omit extraneous info from unimpaired mapping errors (#30983)Gregory Anders2024-10-29
|
* feat(defaults): map gO to LSP document_symbol #30781Nikita Revenco2024-10-28
|
* fix(defaults): missing ]Q/[Q unimpaired mappings #30943Maria José Solano2024-10-25
|
* fix(defaults): error messages UX for unimpaired mappings #30884Maria José Solano2024-10-23
|
* feat(defaults): map gri to vim.lsp.buf.implementation() (#30764)Gregory Anders2024-10-11
| | | | Continuing the default LSP maps under the "gr" prefix. Mnemonic: "i" for "implementation".
* fix(defaults): use "range" instead of "count" for some mappings (#30642)Gregory Anders2024-10-04
| | | | | | | Some commands don't accept "count" and only work with "range". It's not clear why. The issue is tracked at [1], but this is a workaround for now. [1]: https://github.com/neovim/neovim/issues/30641
* fix(defaults): properly pass count to quickfix commands (#30632)zeertzjq2024-10-03
|
* feat(defaults): add default unimpaired style mappings (#28525)Gregory Anders2024-10-01
|
* fix(defaults): cannot remove "How-to disable mouse" menu item #30375Jaehwang Jung2024-09-14
|
* feat(defaults): popupmenu "Open in browser", "Go to definition" #30261Justin M. Keyes2024-09-05
| | | | - Use the popup to expose more features such as LSP and gx. - Move the copy/paste items lower in the menu, they are lower priority.
* feat(ui): gx: use url extmark attribute and tree-sitter directive (#30192)Gregory Anders2024-08-31
| | | | | Use the "url" extmark attribute as well as the "url" tree-sitter metadata key to determine if the cursor is over something Nvim considers a URL.
* fix(defaults): default @/Q broken when 'ignorecase' is set (#29343)Jerry2024-06-15
| | | | | | | | | | | | | | | Problem: When 'ignorecase' is set, the default keymap Q and Q would exit visual mode. This issue was raised in #28287 and a fix was applied in #28289. However, `==` operator is subject to user `ignorecase` setting. Solution: Switching to `==#` operator would guarantee case sensitive comparison between visual mode and linewise visual mode. Co-authored-by: Kuanju Chen <kuanju.chen@mksinst.com>
* fix(terminal): set local values of window options (#29326)zeertzjq2024-06-14
|
* refactor(terminal): move :terminal defaults to _defaults.luaGregory Anders2024-06-12
|
* fix(tui): move $COLORTERM check to _defaults.lua (#29197)Gregory Anders2024-06-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently check $COLORTERM in the TUI process to determine if the terminal supports 24 bit color (truecolor). If $COLORTERM is "truecolor" or "24bit" then we automatically assume that the terminal supports truecolor, but if $COLORTERM is set to any other value we still query the terminal. The `rgb` flag of the UI struct is a boolean which only indicates whether the UI supports truecolor, but does not have a 3rd state that we can use to represent "we don't know if the UI supports truecolor". We currently use `rgb=false` to represent this "we don't know" state, and we use XTGETTCAP and DECRQSS queries to determine at runtime if the terminal supports truecolor. However, if $COLORTERM is set to a value besides "truecolor" or "24bit" (e.g. "256" or "16) that is a clear indication that the terminal _does not_ support truecolor, so it is incorrect to treat `rgb=false` as "we don't know" in that case. Instead, in the TUI process we only check for the terminfo capabilities. This must be done in the TUI process because we do not have access to this information in the core Neovim process when `_defaults.lua` runs. If the TUI cannot determine truecolor support from terminfo alone, we set `rgb=false` to indicate "we don't know if the terminal supports truecolor yet, keep checking". When we get to `_defaults.lua`, we can then check $COLORTERM and only query the terminal if it is unset. This means that users can explicitly opt out of truecolor determination by setting `COLORTERM=256` (or similar) in their environment.
* feat: add "jump" options to vim.diagnostic.config() (#29067)Gregory Anders2024-05-28
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: There is no easy way to configure the behavior of the default diagnostic "jump" mappings. For example, some users way want to show the floating window, and some may not (likewise, some way want to only move between warnings/errors, or disable the "wrap" parameter). Solution: Add a "jump" table to vim.diagnostic.config() that sets default values for vim.diagnostic.jump(). Alternatives: Users can override the default mappings to use the exact options to vim.diagnostic.jump() that they want, but this has a couple issues: - While the default mappings are not complicated, they are also not trivial, so overriding them requires users to understand implementation details (specifically things like setting "count" properly). - If plugins want to change the default mappings, or configure the behavior in any way (e.g. floating window display), it becomes even harder for users to tweak specific behavior. vim.diagnostic.config() already works quite well as the "entry point" for tuning knobs with diagnostic UI elements, so this fits in nicely and composes well with existing mental models and idioms.
* feat(defaults): use vim.diagnostic.jump() for default mappings (#29066)Gregory Anders2024-05-28
| | | | This allows the mappings to work with a count and also enables new ]D and [D mappings to go to the last/first diagnostic in the buffer.
* feat(defaults): add LSP default mappings (again) (#28650)Gregory Anders2024-05-24
|
* fix: show swapfile warning as a warning (#28971)Gregory Anders2024-05-24
| | | | | The new default SwapExists autocommand displays warning text (W325) but does not use the WarningMsg highlight group as other warnings do. Use the WARN log level when displaying this warning.
* feat: allow gx to function for markdown linksdundargoc2024-05-24
| | | | | | | In other words, `gx` works regardless of where it was used in `[...](https://...)`. This only works on markdown buffers. Co-authored-by: ribru17 <ribru17@gmail.com>
* revert: default LSP mappings (#28649)Gregory Anders2024-05-06
| | | | | | | | | Revert the default LSP mappings before the 0.10 release as these might need some further consideration. In particular, it's not clear if "c" prefixed maps in Normal mode are acceptable as defaults since they interfere with text objects or operator ranges. We will re-introduce default mappings at the beginning of the 0.11 release cycle, this reversion is only for the imminent 0.10 release.
* fix(defaults): diagnostic mappings descriptions #28646Evgeni Chasnovski2024-05-05
|
* fix(vim.ui)!: change open() to return `result|nil, errmsg|nil` #28612Justin M. Keyes2024-05-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | reverts e0d92b9cc20b58179599f53dfa74ca821935a539 #28502 Problem: `vim.ui.open()` has a `pcall()` like signature, under the assumption that this is the Lua idiom for returning result-or-error. However, the `result|nil, errmsg|nil` pattern: - has precedent in: - `io.open` - `vim.uv` (`:help luv-error-handling`) - has these advantages: - Can be used with `assert()`: ``` local result, err = assert(foobar()) ``` - Allows LuaLS to infer the type of `result`: ``` local result, err = foobar() if err then ... elseif result then ... end ``` Solution: - Revert to the `result|nil, errmsg|nil` pattern. - Document the pattern in our guidelines.
* docs: misc #24163Justin M. Keyes2024-04-30
| | | | | | | | | | - Also delete old perl scripts which are not used since 8+ years ago. fix #23251 fix #27367 ref https://github.com/neovim/neovim/issues/2252#issuecomment-1902662577 Helped-by: Daniel Kongsgaard <dakongsgaard@gmail.com> Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
* feat(defaults): visual CTRL-R for LSP mappings #28537Justin M. Keyes2024-04-28
| | | | | | | | | | Problem: The new LSP "refactor menu" keybinding "crr" is also defined in visual mode, which overlaps with the builtin "c". Solution: Use CTRL-R instead of "crr" for visual mode. fix #28528
* feat(defaults): improve :grep defaults #28545Luna Saphie Mittelbach2024-04-28
| | | | | | Based on feedback from #28324, pass -H and -I to regular grep (available on all platforms officially supported by Neovim), and only pass -uu to ripgrep. This makes :grep ignore binary files by default in both cases.
* fix(diagnostic): get border from config (#28531)glepnir2024-04-28
| | | | Co-authored-by: Justin M. Keyes <justinkz@gmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com>
* feat(diagnostic): add default mappings for diagnostics (#16230)Gregory Anders2024-04-26
|
* feat(lsp): add more LSP defaults (#28500)Gregory Anders2024-04-26
| | | | | | - crn for rename - crr for code actions - gr for references - <C-S> (in Insert mode) for signature help
* fix: lua annotationsLewis Russell2024-04-26
|
* fix(vim.ui)!: change open() to return pcall-like values #28502Justin M. Keyes2024-04-25
| | | | | | | | | Problem: `vim.ui.open` unnecessarily invents a different success/failure convention. Its return type was changed in 57adf8c6e01d, so we might as well change it to have a more conventional form. Solution: Change the signature to use the `pcall` convention of `status, result`.
* feat(defaults): use ripgrep (rg) for 'grepprg' if availableLuna Saphie Mittelbach2024-04-16
|
* fix(vim.ui): open() may wait indefinitely #28325Justin M. Keyes2024-04-15
| | | | | | | | | | | | Problem: vim.ui.open "locks up" Nvim if the spawned process does not terminate. #27986 Solution: - Change `vim.ui.open()`: - Do not call `wait()`. - Return a `SystemObj`. The caller can decide if it wants to `wait()`. - Change `gx` to `wait()` only a short time. - Allows `gx` to show a message if the command fails, without the risk of waiting forever.
* fix(defaults): only repeat macro for each selected line if linewise (#28289)zeertzjq2024-04-15
| | | | | | As mentioned in #28287, repeating a macro for each selected line doesn't really make sense in non-linewise Visual mode. Fix #28287
* fix(defaults): auto-close terminal for &shell with args (#28276)Jaehwang Jung2024-04-13
| | | | | | | | | Problem: The `:terminal` auto-close logic does not support `&shell` that has arguments, e.g., `/bin/bash -O globstar`. Solution: Join `argv` and match `&shell`. This is not perfect since `&shell` may contain irregular spaces and quotes, but it seems to be good enough.
* test: macros in Visual mode without default mappings (#28288)zeertzjq2024-04-12
|
* feat(comment): add built-in commentingEvgeni Chasnovski2024-04-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Design - Enable commenting support only through `gc` mappings for simplicity. No ability to configure, no Lua module, no user commands. Yet. - Overall implementation is a simplified version of 'mini.comment' module of 'echasnovski/mini.nvim' adapted to be a better suit for core. It basically means reducing code paths which use only specific fixed set of plugin config. All used options are default except `pad_comment_parts = false`. This means that 'commentstring' option is used as is without forcing single space inner padding. As 'tpope/vim-commentary' was considered for inclusion earlier, here is a quick summary of how this commit differs from it: - **User-facing features**. Both implement similar user-facing mappings. This commit does not include `gcu` which is essentially a `gcgc`. There are no commands, events, or configuration in this commit. - **Size**. Both have reasonably comparable number of lines of code, while this commit has more comments in tricky areas. - **Maintainability**. This commit has (purely subjectively) better readability, tests, and Lua types. - **Configurability**. This commit has no user configuration, while 'vim-commentary' has some (partially as a counter-measure to possibly modifying 'commentstring' option). - **Extra features**: - This commit supports tree-sitter by computing `'commentstring'` option under cursor, which can matter in presence of tree-sitter injected languages. - This commit comments blank lines while 'tpope/vim-commentary' does not. At the same time, blank lines are not taken into account when deciding the toggle action. - This commit has much better speed on larger chunks of lines (like above 1000). This is thanks to using `nvim_buf_set_lines()` to set all new lines at once, and not with `vim.fn.setline()`.
* feat(defaults): add :Inspect to right-click menu (#28181)zeertzjq2024-04-05
| | | | | | | Ref #21393 - Move default user commands to _defaults.lua as that now contains all kinds of defaults rather than just default mappings and menus. - Remove the :aunmenu as there are no menus when _defaults.lua is run.