Skip to content

Commit

Permalink
refactor: replace plugins with mini.*
Browse files Browse the repository at this point in the history
  • Loading branch information
BBboy01 committed Nov 22, 2023
1 parent 982a309 commit 3d0d46b
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 40 deletions.
8 changes: 4 additions & 4 deletions lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
"gitsigns.nvim": { "branch": "main", "commit": "0ccd5fb2316b3f8d8b2f775bc31cae7bc6a77a55" },
"indentmini.nvim": { "branch": "main", "commit": "a58129ae424fd6d8e0e2e7f6ce06c0443101e370" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lspsaga.nvim": { "branch": "main", "commit": "496ea37208fdd670751f3b1b04b5d2cfdb12af91" },
"lspsaga.nvim": { "branch": "main", "commit": "d3dfaea0125315110ea720c337ab88aa451d75e7" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mini.ai": { "branch": "main", "commit": "4a2e387b121352dfb478f440c9a5313a9d97006c" },
"mini.comment": { "branch": "main", "commit": "3d9c8009615857e982f09bc5357fc95f2a2175f3" },
"mini.pairs": { "branch": "main", "commit": "71f117fd57f930da6ef4126b24f594dd398bac26" },
"mini.surround": { "branch": "main", "commit": "af8129efcabe95fc08a233e9f91569829bed031f" },
"neodev.nvim": { "branch": "main", "commit": "627b5b543f4df551fcddb99c17a8e260c453400d" },
"neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" },
"none-ls.nvim": { "branch": "main", "commit": "fa9be1679db7bf57d44128a018db43da5488a07f" },
"none-ls.nvim": { "branch": "main", "commit": "ac5a9a63abeb48d6236ba71a9db4f7814e65ed82" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
"nvim-lspconfig": { "branch": "master", "commit": "7fedba8b1f8d0080c775851c429b88fd2ed4c6f5" },
"nvim-lspconfig": { "branch": "master", "commit": "addad5176dbbe8bcc82ef91c51c5f1bf6629ec2d" },
"nvim-tree.lua": { "branch": "master", "commit": "086bf310bd19a7103ee7d761eb59f89f3dd23e21" },
"nvim-treesitter": { "branch": "master", "commit": "1610b1aafb9b7b3a7b54c853ed45c6cb1a3d0df2" },
"nvim-treesitter": { "branch": "master", "commit": "7da3cb6323d1e1fbfc4d7dc05cac74946458b8a0" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" },
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "bdd2a3293340465a516b126d10894f6d5cb5213c" },
Expand Down
19 changes: 19 additions & 0 deletions lua/plugins/ai.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
return {
'echasnovski/mini.ai',
event = 'VeryLazy',
opts = function()
local ai = require('mini.ai')
return {
n_lines = 500,
custom_textobjects = {
o = ai.gen_spec.treesitter({
a = { '@block.outer', '@conditional.outer', '@loop.outer' },
i = { '@block.inner', '@conditional.inner', '@loop.inner' },
}, {}),
f = ai.gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }, {}),
c = ai.gen_spec.treesitter({ a = '@class.outer', i = '@class.inner' }, {}),
t = { '<([%p%w]-)%f[^<%w][^<>]->.-</%1>', '^<.->().*()</[^/]->$' },
},
}
end,
}
10 changes: 3 additions & 7 deletions lua/plugins/autopairs.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = function()
return {
disable_filetype = { 'TelescopePrompt', 'vim' },
}
end,
'echasnovski/mini.pairs',
event = 'VeryLazy',
opts = {},
}
26 changes: 7 additions & 19 deletions lua/plugins/comment.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
return {
'numToStr/Comment.nvim',
'echasnovski/mini.comment',
event = 'VeryLazy',
opts = function()
return {
pre_hook = function(ctx)
local U = require('Comment.utils')

local location = nil
if ctx.ctype == U.ctype.block then
location = require('ts_context_commentstring.utils').get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require('ts_context_commentstring.utils').get_visual_start_location()
end

return require('ts_context_commentstring.internal').calculate_commentstring({
key = ctx.ctype == U.ctype.line and '__default' or '__multiline',
location = location,
})
opts = {
options = {
custom_commentstring = function()
return require('ts_context_commentstring.internal').calculate_commentstring() or vim.bo.commentstring
end,
}
end,
},
},
}
8 changes: 7 additions & 1 deletion lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ return {
dependencies = 'nvim-treesitter/nvim-treesitter',
config = true,
},
'JoosepAlviste/nvim-ts-context-commentstring',
{
'JoosepAlviste/nvim-ts-context-commentstring',
lazy = true,
opts = {
enable_autocmd = false,
},
},
'nvim-tree/nvim-web-devicons', -- File icons
'b0o/schemastore.nvim', -- json schemas to use with lspconfig
}
2 changes: 1 addition & 1 deletion lua/plugins/luasnip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ return {
'L3MON4D3/LuaSnip',
build = (not jit.os:find('Windows'))
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
or nil,
or nil,
dependencies = {
'rafamadriz/friendly-snippets',
config = function()
Expand Down
36 changes: 29 additions & 7 deletions lua/plugins/surround.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
return {
'kylechui/nvim-surround',
version = '*', -- Use for stability; omit to use `main` branch for the latest features
event = 'VeryLazy',
config = function()
require('nvim-surround').setup({
-- Configuration here, or leave empty to use defaults
})
'echasnovski/mini.surround',
keys = function(_, keys)
-- Populate the keys based on the user's options
local plugin = require('lazy.core.config').spec.plugins['mini.surround']
local opts = require('lazy.core.plugin').values(plugin, 'opts', false)
local mappings = {
{ opts.mappings.add, desc = 'Add surrounding', mode = { 'n', 'v' } },
{ opts.mappings.delete, desc = 'Delete surrounding' },
{ opts.mappings.find, desc = 'Find right surrounding' },
{ opts.mappings.find_left, desc = 'Find left surrounding' },
{ opts.mappings.highlight, desc = 'Highlight surrounding' },
{ opts.mappings.replace, desc = 'Replace surrounding' },
{ opts.mappings.update_n_lines, desc = 'Update `MiniSurround.config.n_lines`' },
}
mappings = vim.tbl_filter(function(m)
return m[1] and #m[1] > 0
end, mappings)
return vim.list_extend(mappings, keys)
end,
opts = {
mappings = {
add = 'gsa', -- Add surrounding in Normal and Visual modes
delete = 'gsd', -- Delete surrounding
find = 'gsf', -- Find surrounding (to the right)
find_left = 'gsF', -- Find surrounding (to the left)
highlight = 'gsh', -- Highlight surrounding
replace = 'gsr', -- Replace surrounding
update_n_lines = 'gsn', -- Update `n_lines`
},
},
}
7 changes: 6 additions & 1 deletion lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ return {

{
'nvim-treesitter/nvim-treesitter',
event = 'BufRead',
version = false,
build = ':TSUpdate',
event = 'BufRead',
init = function(plugin)
require('lazy.core.loader').add_to_rtp(plugin)
require('nvim-treesitter.query_predicates')
end,
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
'windwp/nvim-ts-autotag',
Expand Down

0 comments on commit 3d0d46b

Please sign in to comment.