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.
This commit is contained in:
Sanchayan Maity 2023-06-02 18:47:55 +05:30
parent 10d42d0d42
commit 29c657b395
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3
4 changed files with 70 additions and 45 deletions

View file

@ -1,19 +0,0 @@
require('Comment').setup{
padding = true,
ignore = nil,
mappings = {
basic = true,
extra = true,
extended = false,
},
toggler = {
line = 'gcc',
block = 'gbc',
},
opleader = {
line = 'gc',
block = 'gb',
},
pre_hook = nil,
post_hook = nil,
}

View file

@ -1,23 +0,0 @@
local remap = vim.keymap.set
local opts = { noremap=true, silent=true, unique=true }
require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
remap('n', 'g/', ':HopPattern<CR>' , opts)
remap('n', 'gl', ':HopLineStart<CR>', opts)
remap('n', 'gL', ':HopLine<CR>' , opts)
remap('n', 's' , "<cmd>lua require'hop'.hint_char2()<CR>", opts)
remap('x', 's' , "<cmd>lua require'hop'.hint_char2()<CR>", opts)
remap('o', 's' , "<cmd>lua require'hop'.hint_char2()<CR>", opts)
remap('n', ',s' , "<cmd>lua require'hop'.hint_words()<CR>", opts)
remap('x', ',s' , "<cmd>lua require'hop'.hint_words()<CR>", opts)
remap('o', ',s' , "<cmd>lua require'hop'.hint_words()<CR>", opts)
remap('n', 'f', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})<CR>" , opts)
remap('n', 'F', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})<CR>", opts)
remap('x', 'f', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})<CR>" , opts)
remap('x', 'F', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})<CR>", opts)
remap('o', 'f', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true})<CR>" , opts)
remap('o', 'F', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true})<CR>", opts)

View file

@ -0,0 +1,69 @@
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)

View file

@ -2,7 +2,7 @@
vim.cmd 'packadd cfilter'
require "paq" {
'phaazon/hop.nvim' ,
'echasnovski/mini.nvim' ,
'ibhagwan/fzf-lua' ,
'dcampos/nvim-snippy' ,
'honza/vim-snippets' ,
@ -12,9 +12,7 @@ require "paq" {
'vim-utils/vim-husk' ,
'https://gitlab.com/yorickpeterse/nvim-pqf',
'wellle/targets.vim' ,
'tpope/vim-surround' ,
'chrisgrieser/nvim-various-textobjs' ,
'numToStr/Comment.nvim' ,
'tpope/vim-repeat' ,
'tpope/vim-sleuth' ,
'tpope/vim-dispatch' ,