Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/backdround/improved-ft.nvim
Improve default f/t hop abilities
https://github.com/backdround/improved-ft.nvim
Last synced: about 1 month ago
JSON representation
Improve default f/t hop abilities
- Host: GitHub
- URL: https://github.com/backdround/improved-ft.nvim
- Owner: backdround
- License: mit
- Created: 2023-11-20T22:40:36.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-01-16T23:29:20.000Z (4 months ago)
- Last Synced: 2024-01-24T10:44:25.183Z (4 months ago)
- Language: Lua
- Homepage:
- Size: 172 KB
- Stars: 31
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-neovim - backdround/improved-ft.nvim - Improve default `f`/`t` abilities. (Motion / GitHub)
- awesome-neovim - backdround/improved-ft.nvim - Improve default `f`/`t` abilities. (Motion / GitHub)
README
# Improved-ft.nvim
It's a feature-rich, but straight-forward Neovim plugin that improves default
`f/t` hop abilities.Additional features:
- Works in multiline;
- Works in `insert` mode;
- Has the additional `post` offset;
- Has the ability of stable next / previous hops (don't depend on last hop direction).### Preview
#### Basic#### Past a character
#### In insert mode
---
### Basic configuration
```lua
local ft = require("improved-ft")
ft.setup({
-- Maps default f/F/t/T/;/, keys.
-- default: false
use_default_mappings = true,-- Ignores case of the given characters.
-- default: false
ignore_char_case = true,-- Takes a last hop direction into account during repetition hops
-- default: false
use_relative_repetition = true,-- Uses direction-relative offsets during repetition hops.
-- default: false
use_relative_repetition_offsets = true,
})
```
### Advanced configurationBasic mappings
```lua
local map = function(key, fn, description)
vim.keymap.set({ "n", "x", "o" }, key, fn, {
desc = description,
expr = true,
})
endmap("f", ft.hop_forward_to_char, "Hop forward to a given char")
map("F", ft.hop_backward_to_char, "Hop backward to a given char")map("t", ft.hop_forward_to_pre_char, "Hop forward before a given char")
map("T", ft.hop_backward_to_pre_char, "Hop backward before a given char")map(";", ft.repeat_forward, "Repeat hop forward to a last given char")
map(",", ft.repeat_backward, "Repeat hop backward to a last given char")
```Post character mappings
```lua
local map = function(key, fn, description)
vim.keymap.set({ "n", "x", "o" }, key, fn, {
desc = description,
expr = true,
})
endmap("s", ft.hop_forward_to_post_char, "Hop forward after a given char")
map("S", ft.hop_backward_to_post_char, "Hop backward after a given char")```
Insert mode mappings
```lua
local imap = function(key, fn, description)
vim.keymap.set("i", key, fn, {
desc = description,
expr = true,
})
endimap("", ft.hop_forward_to_char, "Hop forward to a given char")
imap("", ft.hop_backward_to_char, "Hop forward to a given char")imap("", ft.hop_forward_to_pre_char, "Hop forward before a given char")
imap("", ft.hop_backward_to_pre_char, "Hop forward before a given char")imap("", ft.repeat_forward, "Repeat hop forward to a last given char")
imap("", ft.repeat_backward, "Repeat hop backward to a last given char")
```