dotfiles/nvim/.config/nvim/after/plugin/mini.lua
Sanchayan Maity 9c9dc6a6b8
nvim: after/plugin/mini: Use jump2d for f, F, t, T motions
mini.jump module does not give multiple hints when moving on the
same line like hop use to. Use the jump2d module to achieve this
functionality. This makes it easy to jump forward or backward on
the same line with just one hop instead of having to press f/F
multiple times which is just annoying and stupid.
2023-06-29 19:32:05 +05:30

83 lines
2.1 KiB
Lua

local remap = vim.keymap.set
local opts = { noremap=true, silent=true, unique=true }
-- Align text/easy-align replacement
require('mini.align').setup({
mappings = {
start = '',
start_with_preview = 'ga',
},
})
-- Comment lines
require('mini.comment').setup()
-- Vertical jumps/movement
require('mini.jump2d').setup({
allowed_lines = {
blank = true,
cursor_before = true,
cursor_at = true,
cursor_after = true,
fold = true,
},
allowed_windows = {
current = true ,
not_current = false,
},
labels = 'arstgmneioqwfpbjluyzxcdvkh',
mappings = { start_jumping = '' },
silent = true,
view = {
dim = true,
n_steps_ahead = 0,
},
})
-- Surround actions/vim-surround replacement
require('mini.surround').setup({})
-- Highlight and remove white space
require('mini.trailspace').setup({})
-- Key mappings for all mini modules we use
remap({ 'n', 'o', 'x' }, 'gS', function()
return require('mini.jump2d').start({
allowed_lines = {
blank = false,
cursor_before = true ,
cursor_at = false,
cursor_after = false,
fold = false,
}
})
end, opts)
remap({ 'n', 'o', 'x' }, 'gs', function()
return require('mini.jump2d').start({
allowed_lines = {
blank = false,
cursor_before = false,
cursor_at = false,
cursor_after = true ,
fold = false,
}
})
end, opts)
remap({ 'n', 'o', 'x' }, 'gl', function()
local mini_jump2d = require('mini.jump2d')
local line_start = mini_jump2d.builtin_opts.line_start
return mini_jump2d.start(line_start)
end, opts)
-- Replacement for f, F, t, T motions/Horizontal movement
remap({ 'n', 'o', 'x' }, 'f', function()
local mini_jump2d = require('mini.jump2d')
local single_char = mini_jump2d.builtin_opts.single_character
single_char.allowed_lines = {
blank = false,
cursor_before = false,
cursor_at = true ,
cursor_after = false,
fold = false,
}
return mini_jump2d.start(single_char)
end, opts)