diff options
author | Steven Ward <planet36@users.noreply.github.com> | 2023-06-05 22:05:51 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2023-07-06 10:29:50 +0200 |
commit | abd380e28d48dd155b1e29cd2453f13b28bf7e08 (patch) | |
tree | 57a0e8450895f61685b4f4fbe5be8f2d9a1429d1 /runtime/doc/lua.txt | |
parent | 4e34ca8ae71d7dfac5c93ffe8e4e8d00f915c593 (diff) | |
download | rneovim-abd380e28d48dd155b1e29cd2453f13b28bf7e08.tar.gz rneovim-abd380e28d48dd155b1e29cd2453f13b28bf7e08.tar.bz2 rneovim-abd380e28d48dd155b1e29cd2453f13b28bf7e08.zip |
fix(defaults): visual mode star (*,#) is fragile
Problem:
Visual mode "*", "#" mappings don't work on text with "/", "\", "?", and
newlines.
Solution:
Get the visual selection and escape it as a search pattern.
Add functions vim.get_visual_selection and _search_for_visual_selection.
Fix #21676
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r-- | runtime/doc/lua.txt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 77a89a123d..9d3a3dec71 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1410,6 +1410,25 @@ deprecate({name}, {alternative}, {version}, {plugin}, {backtrace}) Return: ~ Deprecated message, or nil if no message was shown. + *vim.get_visual_selection()* +get_visual_selection({list}, {append_empty}) + Gets the content of the visual selection. + + The result is either a string or, if {list} is `true`, a list of strings. + If not in any |visual-mode|, `nil` is returned. + + Parameters: ~ + • {list} boolean|nil Return a list of strings instead of a + string. See |getreg()|. Defaults to `false`. + • {append_empty} boolean|nil Append an empty string to the result when + in |linewise-visual| mode and {list} is `true`. This + will preserve the trailing newline of the selection + when the result is concatenated with `"\n"`. Defaults + to `false`. + + Return: ~ + string|table + inspect({object}, {options}) *vim.inspect()* Gets a human-readable representation of the given object. |