Commit Graph

116 Commits

Author SHA1 Message Date
Gregory Anders
07ade91f21
docs: vim.regex is case sensitive by default (#18595) 2022-05-16 13:30:00 -06:00
ii14
e501e4ed4b
feat(lua): add traceback to vim.deprecate #18575 2022-05-15 18:07:36 -07:00
dundargoc
a1b663cce8
build(lua2dox): add parenthesis around parameter types in documentation (#18532)
This will check if the string after the variable in a @param is either
"number", "string", "table", "boolean" and "function" and if so add a
parenthesis around it. This will help separate the variable type with
the following text. Had all our functions been annotated with emmylua
then a more robust solution might have been preferable (such as always
assuming the third string is parameter type without making any checks).
I believe however this is a clear improvement over the current situation
and will suffice for now.
2022-05-12 08:02:46 -06:00
Famiu Haque
2bbd588e73
feat(lua): vim.cmd() with kwargs acts like nvim_cmd() #18523 2022-05-12 06:34:38 -07:00
adrian5
a6f4cfdefa
docs(api): improve shared lua functions docs (#17933) 2022-05-11 10:23:46 -06:00
ii14
70e2c5d10d
feat(lsp): add logging level "OFF" (#18379) 2022-05-03 08:49:23 -06:00
dundargoc
73741e9486
feat(lua): vim.deprecate() #18320
This is primarily intended to act as documentation for the developer so
they know exactly when and what to remove. This will help prevent the
situation of deprecated code lingering for far too long as developers
don't have to worry if a function is safe to remove.
2022-05-03 06:42:41 -07:00
Christian Clason
6c8a3013ac
docs(lua): explain and link to lua patterns (#18206)
also correct explanation of when it's allowed to omit parens in Lua function calls
2022-04-21 21:46:07 +02:00
atusy
5ecbbba6ee docs: vim.keymap.set can specify buffer as an option 2022-04-21 10:45:39 +09:00
dundargoc
e63e5d1dbd
docs: typo fixes (#17859)
Co-authored-by: Elias Alves Moura <eliamoura.alves@gmail.com>
Co-authored-by: venkatesh <shariharanvenkatesh@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Vikas Raj <24727447+numToStr@users.noreply.github.com>
Co-authored-by: Steve Vermeulen <sfvermeulen@gmail.com>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: rwxd <rwxd@pm.me>
Co-authored-by: casswedson <58050969+casswedson@users.noreply.github.com>
2022-04-15 12:35:06 +02:00
Gregory Anders
9a35704333
Merge pull request #15491 from Diomendius/lua_docs
docs(lua): fix, clarify Lua require() docs
2022-04-13 10:50:03 -06:00
Lewis Russell
3cc29b7f0d fix(keymap): don't coerce false to '' 2022-04-01 09:09:30 +01:00
bfredl
dc48330b9d
Merge pull request #17842 from lewis6991/keymap
feat(keymap): return nil from an expr keymap
2022-04-01 00:48:46 +02:00
Michael Lingelbach
69f1de86dc
feat: add vim.tbl_get (#17831)
vim.tbl_get takes a table with subsequent string arguments (variadic) that
index into the table. If the value pointed to by the set of keys exists,
the function returns the value. If the set of keys does not exist, the
function returns nil.
2022-03-24 12:01:04 -07:00
Lewis Russell
58140a9428 feat(keymap): return nil from an expr keymap
For Lua callback expr keymaps, returning `nil` or `false` is equivalent
to an empty string
2022-03-24 13:59:20 +00:00
marvim
809dd65396 docs: regenerate [skip ci] 2022-03-20 18:00:30 +00:00
Daiki Mizukami
ecc36c3d1c
docs: remove extra whitespaces 2022-03-14 08:16:01 +09:00
dundargoc
a7b1c8893c
chore: fix typos (#17331)
Co-authored-by: Hongyi Lyu <hongyi.lyu95@gmail.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: notomo <notomo.motono@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-03-10 14:34:55 +08:00
bfredl
c65d93e60a
Merge pull request #16969 from shadmansaleh/enhance/ingore_nore_on_plug_keymaps
feat: ignore nore on <Plug> maps
2022-02-27 16:47:55 +01:00
shadmansaleh
c031e038df chore: remove <Plug> detection from vim.keymap 2022-02-27 08:21:21 +06:00
bfredl
850b3e19c9 refactor(lua): cleanup and docs for threads 2022-02-26 15:00:13 +01:00
Christian Clason
10a46a20ce
refactor(highlight)!: optional arguments for highlight.range as table (#17462)
also update documentation

BREAKING CHANGE: signature of highlight.range is now
     vim.highlight.range(bufnr, ns, hlgroup, start, finish,
         { regtype = regtype, inclusive = inclusive, priority = priority })

Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2022-02-21 21:21:42 +01:00
marvim
45e666fb92 docs: regenerate [skip ci] 2022-02-13 13:44:51 +00:00
Daniel Steinberg
a94632d212 vim-patch:8.2.3917: the eval.txt help file is way too big
Problem:    The eval.txt help file is way too big.
Solution:   Move the builtin function details to a separate file.
1cae5a0a03

Note: Neovim-specific references to |functions| were changed to
|builtin-functions|. This included updates to:
  1. test/functional/vimscript/functions_spec.lua
  2. test/functional/vimscript/eval_spec.lua
  3. runtime/doc/lua.txt
2022-01-29 15:19:29 -05:00
marvim
2c94b75eac docs: regenerate [skip ci] 2022-01-17 18:28:23 +00:00
Shadman
287d3566de
fix(lua): print multiple return values with =expr (#16933) 2022-01-06 11:42:31 -07:00
Gregory Anders
d78e46679d
feat(lua): add notify_once() (#16956)
Like vim.notify(), but only displays the notification once.
2022-01-06 11:10:56 -07:00
Björn Linse
2f779e3361
Merge pull request #16591 from shadmansaleh/feat/lua_keymaps2
feat(lua): add support for lua keymaps
2022-01-06 18:35:31 +01:00
dundargoc
0b0c4f7dfa
chore: fix typos (#16816)
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Sebastian Volland <seb@baunz.net>
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-01-04 11:07:40 -07:00
shadmansaleh
6d41f65aa4 feat(lua): add vim.keymap
This introduces two new functions `vim.keymap.set` & `vim.keymap.del`

differences compared to regular set_keymap:
- remap is used as opposite of noremap. By default it's true for <Plug> keymaps and false for others.
- rhs can be lua function.
- mode can be a list of modes.
- replace_keycodes option for lua function expr maps. (Default: true)
- handles buffer specific keymaps

Examples:
```lua
vim.keymap.set('n', 'asdf', function() print("real lua function") end)
vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, {buffer=true})
vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", {silent = true, buffer = 5 })
vim.keymap.set('i', '<Tab>', function()
  return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>"
end, {expr = true})
vim.keymap.set('n', '[%', '<Plug>(MatchitNormalMultiBackward)')

vim.keymap.del('n', 'asdf')
vim.keymap.del({'n', 'i', 'v'}, '<leader>w', {buffer = 5 })
```
2022-01-04 22:31:59 +06:00
Gregory Anders
3fd454bd4a
feat: filetype.lua (#16600)
Adds a new vim.filetype module that provides support for filetype detection in
Lua.
2022-01-04 07:28:29 -07:00
shadmansaleh
d44254641f feat(lua): make =expr print result of expr 2022-01-04 16:08:07 +06:00
Shadman
55c4393e9f
feat(lua): add support for multiple optional types in vim.validate (#16864) 2022-01-01 12:35:15 -07:00
dundargoc
08616571f4
chore: fix typos (#16506)
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com>
Co-authored-by: Alef Pereira <ealefpereira@gmail.com>
Co-authored-by: AusCyber <willp@outlook.com.au>
Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
2021-12-28 18:15:16 +01:00
Lewis Russell
e11a44aa22
feat(lua): add vim.spell (#16620) 2021-12-25 12:36:56 -07:00
Gregory Anders
b6e531c1d9 docs(lsp): add annotations for private functions 2021-11-30 09:03:41 +01:00
ii14
bc1d13bb36 chore: fix typos
Co-authored-by: ii14 <ii14@users.noreply.github.com>
2021-11-30 09:03:41 +01:00
github-actions[bot]
b51b0aecc9
docs: regenerate (#16390)
Co-authored-by: marvim <marvim@users.noreply.github.com>
2021-11-27 11:26:49 -05:00
dundargoc
caa6992a10
chore: fix typos (#16361)
Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: István Donkó <istvan.donko@gmail.com>
Co-authored-by: Julian Berman <Julian@GrayVines.com>
Co-authored-by: bryant <bryant@users.noreply.github.com>
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com>
Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com>
Co-authored-by: Jesse Wertheim <jaawerth@gmail.com>
Co-authored-by: dm1try <me@dmitry.it>
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl>
Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com>
Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: István Donkó <istvan.donko@gmail.com>
Co-authored-by: Julian Berman <Julian@GrayVines.com>
Co-authored-by: bryant <bryant@users.noreply.github.com>
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com>
Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com>
Co-authored-by: Jesse Wertheim <jaawerth@gmail.com>
Co-authored-by: dm1try <me@dmitry.it>
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl>
Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com>
2021-11-27 11:10:48 -05:00
Mathias Fußenegger
72d62aa6aa
chore(docs): clarify vim.notify log_level parameter (#16436) 2021-11-25 20:06:42 +01:00
Michael Lingelbach
a2749482d9
chore(lsp): clean up initialization process (#16369)
* send vim.NIL instead of not sending workspaceFolders
* read fallback rootPath and rootUri from workspaceFolders
* update documentation
2021-11-21 11:39:30 -05:00
Diomendius
89270346f9 docs(lua): further improve Lua require() docs
Change docs to reflect recent changes to require() search order and add
info on `.` in module names and search order for shared library modules.
2021-11-22 00:43:18 +13:00
Diomendius
0d32e5ba30 docs(lua): fix, clarify Lua require() docs
Corrects lua.txt help file to say that require() searches runtimepath
and loads the first module found, not the last.

Also adds additional clarification on require() and module search order.

Closes #15480
2021-11-21 21:30:13 +13:00
marvim
2d340a3746 docs: regenerate 2021-11-18 21:50:55 +00:00
Mathias Fußenegger
d249e18bbf
fix(uri): use valid EmmyLua annotations (#16359)
See:

- https://emmylua.github.io/annotations/param.html
- https://emmylua.github.io/annotations/return.html
2021-11-18 21:12:21 +01:00
Sebastian Lyng Johansen
16d4af6d2f
feat(ui): add vim.ui.input and use in lsp rename (#15959)
* vim.ui.input is an overridable function that prompts for user input
* take an opts table and the `on_confirm` callback, see `:help vim.ui.input` for more details
* defaults to a wrapper around vim.fn.input(opts)
* switches the built-in client's rename handler to use vim.ui.input by default
2021-11-07 07:13:53 -08:00
Justin M. Keyes
a141f6e922
fix(vim.mpack): rename pack/unpack => encode/decode #16175
Problem:
1. "unpack" has an unrelated meaning in Lua:
   https://www.lua.org/manual/5.1/manual.html#pdf-unpack
2. We already have msgpackparse()/msgpackdump() and
   json_encode()/json_decode(), so introducing another name for the same
   thing is entropy.

Solution:
- Rename vim.mpack.pack/unpack => vim.mpack.encode/decode

Caveat:
This is incongruent with the `Unpacker` and `Packer` functions.
- It's probably too invasive to rename those.
- They also aren't part of our documented interface.
- This commit is "reversible" in the sense that we can always revert
  it and add `vim.mpack.encode/decode` as _aliases_ to
  `vim.mpack.pack/unpack`, at any time in the future, if we want
  stricter fidelity with upstream libmpack. Meanwhile,
  `vim.mpack.encode/decode` is currently the total _documented_
  interface of `vim.mpack`, so this change serves the purpose of
  consistent naming in the Nvim stdlib.
2021-10-30 06:59:59 -07:00
Björn Linse
9dd371bb2e feat(lua): document support of packages with v:lua syntax
this already worked in 0.5 but was not properly documented or tested
2021-10-23 18:24:00 +02:00
Björn Linse
208d259e83
Merge pull request #15767 from lewis6991/lua_var_index
feat(lua): allow passing handles to `vim.b/w/t`
2021-10-19 22:21:31 +02:00
Gregory Anders
dfef90a518
fix(gen_vimdoc.py): spacing around inline elements #16092
The spacing fix drew attention to a couple of places that were using
incorrect formatting such as the key listing for `nvim_open_win`, so
those were fixed too.
2021-10-19 12:55:22 -07:00