mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-21 02:55:09 +02:00
60c7ad77fd
* perf: lazy load most plugins
* fix(lazy): suggested fixes for pref/lazyloading branch (#3754)
fix(lazy): Suggested fixes from previous comments
fix(lazy): applying suggestions from code review
Co-authored-by: LostNeophyte <lostneophyte@tuta.io>
Co-authored-by: Pratyush Bharati <pbharati@Pratyushs-MacBook-Pro.local>
Co-authored-by: LostNeophyte <lostneophyte@tuta.io>
* chore: format
* move lazy utils to modules.lua
* simplify telescope actions
* refactor: cmp_window local name
* feat: more lazy loading cmds
* refactor(cmp): minor clean up
* perf: set lazy loading by default
* refactor(alpha): remove broken lazy load
* revert: explictily set lazy loading
This reverts commit ba38193e4e
.
* test: enable lazy-loading for bigfile
* perf: defer projects and alpha to VimEnter
* refactor(bufferline): add comment
* perf: better lazy load dap/dapui
* perf: lazy load ts-commentstring with Comment.nvim pre_hook
---------
Co-authored-by: pr-313 <46706232+pr-313@users.noreply.github.com>
Co-authored-by: Pratyush Bharati <pbharati@Pratyushs-MacBook-Pro.local>
Co-authored-by: opalmay <opal.mizrahi2@gmail.com>
Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
86 lines
2.2 KiB
Lua
86 lines
2.2 KiB
Lua
local M = {}
|
|
|
|
function M.config()
|
|
lvim.builtin.comment = {
|
|
active = true,
|
|
on_config_done = nil,
|
|
---Add a space b/w comment and the line
|
|
---@type boolean
|
|
padding = true,
|
|
|
|
---Whether cursor should stay at the
|
|
---same position. Only works in NORMAL
|
|
---mode mappings
|
|
sticky = true,
|
|
|
|
---Lines to be ignored while comment/uncomment.
|
|
---Could be a regex string or a function that returns a regex string.
|
|
---Example: Use '^$' to ignore empty lines
|
|
---@type string|function
|
|
ignore = "^$",
|
|
|
|
---Whether to create basic (operator-pending) and extra mappings for NORMAL/VISUAL mode
|
|
---@type table
|
|
mappings = {
|
|
---operator-pending mapping
|
|
---Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}`
|
|
basic = true,
|
|
---Extra mapping
|
|
---Includes `gco`, `gcO`, `gcA`
|
|
extra = true,
|
|
},
|
|
|
|
---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode
|
|
---@type table
|
|
toggler = {
|
|
---line-comment toggle
|
|
line = "gcc",
|
|
---block-comment toggle
|
|
block = "gbc",
|
|
},
|
|
|
|
---LHS of line and block comment operator-mode mapping in NORMAL/VISUAL mode
|
|
---@type table
|
|
opleader = {
|
|
---line-comment opfunc mapping
|
|
line = "gc",
|
|
---block-comment opfunc mapping
|
|
block = "gb",
|
|
},
|
|
|
|
---LHS of extra mappings
|
|
---@type table
|
|
extra = {
|
|
---Add comment on the line above
|
|
above = "gcO",
|
|
---Add comment on the line below
|
|
below = "gco",
|
|
---Add comment at the end of line
|
|
eol = "gcA",
|
|
},
|
|
|
|
---Pre-hook, called before commenting the line
|
|
---@type function|nil
|
|
pre_hook = function(...)
|
|
local loaded, ts_comment = pcall(require, "ts_context_commentstring.integrations.comment_nvim")
|
|
if loaded and ts_comment then
|
|
return ts_comment.create_pre_hook()(...)
|
|
end
|
|
end,
|
|
|
|
---Post-hook, called after commenting is done
|
|
---@type function|nil
|
|
post_hook = nil,
|
|
}
|
|
end
|
|
|
|
function M.setup()
|
|
local nvim_comment = require "Comment"
|
|
|
|
nvim_comment.setup(lvim.builtin.comment)
|
|
if lvim.builtin.comment.on_config_done then
|
|
lvim.builtin.comment.on_config_done(nvim_comment)
|
|
end
|
|
end
|
|
|
|
return M
|