vim: make it easy to reload plugin configs with :lua R('...').config()
This commit is contained in:
parent
350d0073f7
commit
b185ac5311
8 changed files with 177 additions and 168 deletions
|
@ -9,7 +9,8 @@ M.lazy = false -- trows an error when lazy loading
|
||||||
local chars = { '│', '¦', '┆', '┊', '┊', '┊', '┊', '┊', '┊', '┊' }
|
local chars = { '│', '¦', '┆', '┊', '┊', '┊', '┊', '┊', '┊', '┊' }
|
||||||
local show_first_level = false
|
local show_first_level = false
|
||||||
|
|
||||||
M.opts = {
|
M.config = function()
|
||||||
|
require('indent_blankline').setup {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
use_treesitter = true,
|
use_treesitter = true,
|
||||||
show_first_indent_level = show_first_level,
|
show_first_indent_level = show_first_level,
|
||||||
|
@ -19,5 +20,6 @@ M.opts = {
|
||||||
context_char_list = chars,
|
context_char_list = chars,
|
||||||
indent_level = #chars + (not show_first_level and 1 or 0),
|
indent_level = #chars + (not show_first_level and 1 or 0),
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -8,7 +8,8 @@ M.keys = {
|
||||||
{ '<leader>gn', '<cmd>Neogit<cr>' },
|
{ '<leader>gn', '<cmd>Neogit<cr>' },
|
||||||
}
|
}
|
||||||
|
|
||||||
M.opts = {
|
M.config = function()
|
||||||
|
require('neogit').setup {
|
||||||
disable_hint = true,
|
disable_hint = true,
|
||||||
signs = {
|
signs = {
|
||||||
section = { '', '' },
|
section = { '', '' },
|
||||||
|
@ -22,6 +23,7 @@ M.opts = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ M.keys = {
|
||||||
{ '<leader>nc', '<cmd>NvimTreeClose<cr>' },
|
{ '<leader>nc', '<cmd>NvimTreeClose<cr>' },
|
||||||
}
|
}
|
||||||
|
|
||||||
M.opts = {
|
M.config = function()
|
||||||
|
require('nvim-tree').setup {
|
||||||
disable_netrw = true, -- replace netrw with nvim-tree
|
disable_netrw = true, -- replace netrw with nvim-tree
|
||||||
hijack_cursor = true, -- keep the cursor on begin of the filename
|
hijack_cursor = true, -- keep the cursor on begin of the filename
|
||||||
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
|
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
|
||||||
|
@ -72,6 +73,7 @@ M.opts = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ M.keys = {
|
||||||
{ '<leader>f<leader>', pickers.resume ' Resume' , desc = ' Telescope Resume ' },
|
{ '<leader>f<leader>', pickers.resume ' Resume' , desc = ' Telescope Resume ' },
|
||||||
}
|
}
|
||||||
|
|
||||||
M.opts = function()
|
M.config = function()
|
||||||
local actions = require('telescope.actions')
|
local actions = require('telescope.actions')
|
||||||
local layout = require('telescope.actions.layout')
|
local layout = require('telescope.actions.layout')
|
||||||
local trouble = vim.F.npcall(require, 'trouble.providers.telescope') or {}
|
local trouble = vim.F.npcall(require, 'trouble.providers.telescope') or {}
|
||||||
|
@ -136,7 +136,7 @@ M.opts = function()
|
||||||
['<c-b>'] = trouble.smart_open_with_trouble,
|
['<c-b>'] = trouble.smart_open_with_trouble,
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
require('telescope').setup {
|
||||||
defaults = {
|
defaults = {
|
||||||
mappings = {
|
mappings = {
|
||||||
i = mappings,
|
i = mappings,
|
||||||
|
@ -182,10 +182,7 @@ M.opts = function()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
M.config = function(_, opts)
|
|
||||||
require('telescope').setup(opts)
|
|
||||||
require('telescope').load_extension 'fzf'
|
require('telescope').load_extension 'fzf'
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('User', {
|
vim.api.nvim_create_autocmd('User', {
|
||||||
|
|
|
@ -14,7 +14,8 @@ M.keys = {
|
||||||
{ '<leader>ft', '<cmd>TodoTelescope<cr>' },
|
{ '<leader>ft', '<cmd>TodoTelescope<cr>' },
|
||||||
}
|
}
|
||||||
|
|
||||||
M.opts = {
|
M.config = function()
|
||||||
|
require('todo-comments').setup {
|
||||||
keywords = {
|
keywords = {
|
||||||
TODO = { icon = ' ' },
|
TODO = { icon = ' ' },
|
||||||
FIX = { icon = ' ' },
|
FIX = { icon = ' ' },
|
||||||
|
@ -25,6 +26,7 @@ M.opts = {
|
||||||
TEST = { icon = ' ' },
|
TEST = { icon = ' ' },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,8 @@ M.keys = {
|
||||||
{ '<leader>tn', '<cmd>TSNodeUnderCursor<cr>' },
|
{ '<leader>tn', '<cmd>TSNodeUnderCursor<cr>' },
|
||||||
}
|
}
|
||||||
|
|
||||||
M.main = 'nvim-treesitter.configs'
|
M.config = function()
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
M.opts = {
|
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'bash',
|
'bash',
|
||||||
'c',
|
'c',
|
||||||
|
@ -105,6 +104,7 @@ M.opts = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,12 @@ M.keys = {
|
||||||
{ '<leader>ld', '<cmd>TroubleToggle document_diagnostics<cr>' },
|
{ '<leader>ld', '<cmd>TroubleToggle document_diagnostics<cr>' },
|
||||||
}
|
}
|
||||||
|
|
||||||
M.opts = {
|
M.config = function()
|
||||||
|
require('trouble').setup {
|
||||||
padding = false, -- don't add an extra new line of top of the list
|
padding = false, -- don't add an extra new line of top of the list
|
||||||
auto_preview = false, -- don't preview automatically
|
auto_preview = false, -- don't preview automatically
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,11 @@ M.keys = {
|
||||||
{ '<leader>sc', toggle_colorcolumn, desc = 'Toggle virtual colunn' },
|
{ '<leader>sc', toggle_colorcolumn, desc = 'Toggle virtual colunn' },
|
||||||
}
|
}
|
||||||
|
|
||||||
M.opts = {
|
M.config = function()
|
||||||
|
require('virt-column').setup {
|
||||||
char = '│',
|
char = '│',
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue