diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-10-25 16:46:25 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2025-11-15 22:47:38 -0500 |
| commit | 3f16037e45cfd7e66986e938ff2a6ff6165ebbed (patch) | |
| tree | c1bb015a34e8a5aaedf4214262e66ea237353549 /runtime/doc/lua.txt | |
| parent | 30634f63e26da1ecfd8642eec4a53f4c220247d7 (diff) | |
| download | rneovim-3f16037e45cfd7e66986e938ff2a6ff6165ebbed.tar.gz rneovim-3f16037e45cfd7e66986e938ff2a6ff6165ebbed.tar.bz2 rneovim-3f16037e45cfd7e66986e938ff2a6ff6165ebbed.zip | |
docs: getpos, getregion, lsp
Diffstat (limited to 'runtime/doc/lua.txt')
| -rw-r--r-- | runtime/doc/lua.txt | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 35c0353fce..4c361f30f3 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2410,15 +2410,13 @@ vim.filetype.match({args}) *vim.filetype.match()* Mutually exclusive with {buf}. Return (multiple): ~ - (`string?`) If a match was found, the matched filetype. - (`function?`) A function that modifies buffer state when called (for - example, to set some filetype specific buffer variables). The function - accepts a buffer number as its only argument. - (`boolean?`) Return true if a match was found by falling back to a - generic configuration file (i.e., ".conf"). If true, the filetype - should be set with `:setf FALLBACK conf`, which enables a later - |:setf| command to override the filetype. See `:help setf` for more - information. + (`string?`) The matched filetype, if any. + (`function?`) A function `fun(buf: integer)` that modifies buffer + state when called (for example, to set some filetype specific buffer + variables). + (`boolean?`) true if a match was found by falling back to a generic + filetype (i.e., ".conf"), which indicates the filetype should be set + with `:setf FALLBACK conf`. See |:setfiletype|. ============================================================================== @@ -2434,6 +2432,13 @@ Example: >lua end < + *vim.fs.read()* +You can use |readblob()| to get a file's contents without explicitly opening/closing it. + +Example: >lua + vim.print(vim.fn.readblob('.git/config')) +< + vim.fs.abspath({path}) *vim.fs.abspath()* Convert path to an absolute path. A tilde (~) character at the beginning @@ -3438,6 +3443,18 @@ vim.keymap.set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* end, { expr = true }) -- Map "[%%" to a <Plug> mapping: vim.keymap.set('n', '[%%', '<Plug>(MatchitNormalMultiBackward)') + + -- Use `getregionpos(getpos('v'))` to get the "current visual selection": + vim.keymap.set('x', 'M', function() + local region = vim.fn.getregionpos(vim.fn.getpos('v'), vim.fn.getpos('.'), { + type = 'v', + exclusive = false, + eol = false, + }) + local line1 = region[1][1][2] + local line2 = region[#region][1][2] + vim.print({ line1, line2 }) + end) < Parameters: ~ |