Awesome
Description
This Plugin extend's the capability of find, till and text manipulation(yank/delete/change) command's in nvim. With the help of this Plugin you can find multiple characters rather than one at a time.
🔥 This Plugins Effects the following commands:
f|F (find commands)
t|T (till commands)
;|, (last pattern commands)
c{t|T|f|f} (change command)
d{t|T|f|f} (delete command)
y{t|T|f|f} (yank command)
By default after pressing any of these commands now you have to type two characters(or more you can specify characters length) rather than One to go to next position.
✨ Features
- adds capability to add more characters to finding command's.
- yank/delete/change(y/d/c) text same as finding.
- Highlight the yanked area(see :h vim.highlight.range()).
- timeout to find pattern before the
chars_length
variable lenght has completed. - provide number like
2
before key to go to second position for the pattern. This is universal for y/d/c or t/T/f/F commands.
🚀 Usage
I have only provided demos for find and delete commands y,c,t,y commands take characters input same as these.
find forward
<img alt="f command" src="https://github.com/TheSafdarAwan/assets/blob/main/find-extender.nvim/fir.gif">find backwards
<img alt="F command" src="https://github.com/TheSafdarAwan/assets/blob/main/find-extender.nvim/backwards_Fir.gif">delete
<img alt="d command" src="https://github.com/TheSafdarAwan/assets/blob/main/find-extender.nvim/dtir.gif">📦 Installation
Install with your preferred package manager:
Plug 'TheSafdarAwan/find-extender.nvim'
use {
opt = true,
"TheSafdarAwan/find-extender.nvim",
-- to lazy load this plugin
keys = {
{ "v", "f" },
{ "v", "F" },
{ "n", "f" },
{ "n", "F" },
{ "n", "T" },
{ "n", "t" },
{ "v", "T" },
{ "v", "t" },
{ "n", "c" },
{ "n", "d" },
{ "n", "y" },
},
config = function()
-- configuration here
end,
}
Setup
require("find-extender").setup({
-- if you want do disable the plugin the set this to false
enable = true,
-- how many characters to find for
chars_length = 2, -- default value is 2 chars
-- timeout before the find-extender.nvim goes to find the available
-- characters on timeout after the limit of start_timeout_after_chars
-- has been reached
-- timeout in ms
timeout = false, -- false by default
-- timeout starting point
start_timeout_after_chars = 2, -- 2 by default
-- key maps config
keymaps = {
modes = "nv",
till = { "T", "t" },
find = { "F", "f" },
-- to delete, copy or change using t,f or T,F commands
text_manipulation = {
-- yank
yank = { "f", "F", "t", "T" },
-- delete
delete = { "f", "F", "t", "T" },
-- change
change = { "f", "F", "t", "T" },
},
},
highlight_on_yank = {
-- whether to highlight the yanked are or not
enable = true,
-- time for which the area will be highlighted
timeout = 40,
-- highlight group for the yanked are color
hl_group = "IncSearch",
}
})
Commands
There are three commands available.
- FindExtenderDisable
- FindExtenderEnable
- FindExtenderToggle
⚙️ Configuration
chars_length
You can change the amount of characters you want to find by specifying the amount in this key.
-- how many characters to find for
chars_length = 2 -- default value is 2 chars
Default is 2 characters and more than that is not recommended because it will slow you down and that's not what i intend this plugin to do.
timeout
Timeout before the find-extender.nvim goes to find the characters that you have entered. before you complete the chars_length character's limit.
-- timeout in ms
timeout = false -- false by default
start_timeout_after_chars
How many characters after which the timeout should be triggered.
start_timeout_after_chars = 1, -- 1 by default
⌨ keymaps
Keymaps are exposed to user if any key you want to remove just remove it from the tbl
keymaps = {
modes = "nv",
till = { "T", "t" },
find = { "F", "f" },
},
Modes is a string with the modes name initials.
text_manipulation
Mappings related to the text manipulation like change, delete and yank(copy). If you want to disable any of the macro then set it to false.
keymaps = {
...,
-- to delete, copy or change using t,f or T,F commands
text_manipulation = {
-- yank
yank = { "f", "F", "t", "T" },
-- delete
delete = { "f", "F", "t", "T" },
-- change
change = { "f", "F", "t", "T" },
},
}
highlight on yank
These options control the highlight when yanking text.
highlight_on_yank = {
-- whether to highlight the yanked are or not
enable = true,
-- time for which the area will be highlighted
timeout = 40,
-- highlight group for the yanked are color
hl_group = "IncSearch",
}
Related Plugins
👉 Written in vimscript
👉 Written in lua