Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ajnasz/nvim-rfind
neovim plugin to search within a range
https://github.com/ajnasz/nvim-rfind
lua-plugin lua-script neovim neovim-plugin plugin vim
Last synced: 5 days ago
JSON representation
neovim plugin to search within a range
- Host: GitHub
- URL: https://github.com/ajnasz/nvim-rfind
- Owner: Ajnasz
- License: mit
- Created: 2023-10-04T17:19:02.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-05T05:56:22.000Z (about 1 year ago)
- Last Synced: 2024-04-29T21:15:19.699Z (7 months ago)
- Topics: lua-plugin, lua-script, neovim, neovim-plugin, plugin, vim
- Language: Fennel
- Homepage:
- Size: 7.81 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.MIT
Awesome Lists containing this project
README
# NVIM Rsearch
Script which helps to populate the search command within the selected visual
range. See [search-range](https://neovim.io/doc/user/pattern.html#search-range)https://github.com/Ajnasz/nvim-rfind/assets/38329/22a19eea-76de-4475-b41f-f6ae91ef0526
## Setting a keymap
It turned out the plugin is not needed to search in visual select, just just the [`\%V` atom](https://neovim.io/doc/user/pattern.html#%2F%5C%25V) in the search expression
```lua
vim.keymap.set("x", "/", "/\\%V")
```
***```lua
local rfind = require("rfind")
vim.keymap.set("x", "/", rfind.visual)
vim.keymap.set("n", "", rfind.visual)
```Then press `/` in visual mode or `F7` in normal mode to search in the last
selected section.## Custom command
```lua
vim.api.nvim_create_user_command(
"RangeFind",
function(opts)
local rfind = require("rfind")
return rfind.range(opts.fargs[1], opts.fargs[2])
end,
{nargs = "*"}
)
```Then typing `RangeFind 10 50` will start the search between lines 10 and 50 (inclusive).