dotfiles/nvim/.config/nvim/after/plugin/mini.lua
Sanchayan Maity 29c657b395
nvim: Use modules from mini.nvim
We drop Comment, hop & vim-surround in favour of modules from mini.
This change is triggered by the fact that hop's author has decided
to not maintain it any more. There is also pounce but mini seems
simple and we can also use other modules it provides.
2023-06-07 12:42:40 +05:30

70 lines
1.7 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()
-- For f, F, t, t motions/Horizontal movement
require('mini.jump').setup({silent = true})
-- 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)