Will rewrite my neovim config
This commit is contained in:
parent
657fecfa64
commit
686bdd12c4
23 changed files with 591 additions and 176 deletions
dotfiles/neovim/lua/my/plugins
|
@ -1,13 +1,227 @@
|
|||
local A = require("my.abbreviations")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.abolish(from, to)
|
||||
vim.cmd(":Abolish " .. from .. " " .. to)
|
||||
-- function M.abolish(from, to)
|
||||
-- vim.cmd(":Abolish -buffer " .. from .. " " .. to)
|
||||
-- end
|
||||
--
|
||||
-- function M.abolishMany(many)
|
||||
-- for _, entry in pairs(many) do M.abolish(entry[1], entry[2]) end
|
||||
-- end
|
||||
|
||||
local function concatTables(t1, t2)
|
||||
assert(type(t1) == "table")
|
||||
assert(type(t2) == "table")
|
||||
|
||||
local t3 = {}
|
||||
for i = 1, #t1 do t3[#t3 + 1] = t1[i] end
|
||||
for i = 1, #t2 do t3[#t3 + 1] = t2[i] end
|
||||
return t3
|
||||
end
|
||||
|
||||
function M.abolishMany(many)
|
||||
for _, entry in pairs(many) do
|
||||
M.abolish(entry[1], entry[2])
|
||||
local function betterAbolish(unprocessed, context, out)
|
||||
local from = unprocessed[1] or {}
|
||||
local to = unprocessed[2] or {}
|
||||
|
||||
assert(type(from) == "table" and type(to) == "table",
|
||||
"Both arguments should be tables. Found " .. vim.inspect(from) .. " and " ..
|
||||
vim.inspect(to) .. " instead.")
|
||||
|
||||
-- print(vim.inspect({ context = context, unprocessed = unprocessed }))
|
||||
|
||||
if #from == 0 and #to == 0 then
|
||||
table.insert(out, context)
|
||||
return
|
||||
end
|
||||
|
||||
for i = 1, 2, 1 do
|
||||
local head = unprocessed[i][1]
|
||||
if type(head) == "string" then
|
||||
local context_clone = { context[1], context[2] }
|
||||
|
||||
context_clone[i] = context_clone[i] .. head
|
||||
|
||||
local unprocessed_clone = { unprocessed[1], unprocessed[2] }
|
||||
unprocessed_clone[i] = { unpack(unprocessed[i], 2) }
|
||||
|
||||
return betterAbolish(unprocessed_clone, context_clone, out)
|
||||
end
|
||||
end
|
||||
|
||||
-- print(vim.inspect({ from, to, context }))
|
||||
|
||||
assert(type(from[1]) == "table", vim.inspect(from) .. " starts with neither a table nor a string")
|
||||
assert(type(to[1]) == "table", vim.inspect(to) .. " does not start with a table")
|
||||
|
||||
for i = 1, #from[1], 1 do
|
||||
local when = from[1][i]
|
||||
local replacement = when
|
||||
|
||||
if #to[1] > 0 then replacement = to[1][((i - 1) % #to[1]) + 1] end
|
||||
|
||||
assert(type(when) == "table")
|
||||
assert(type(replacement) == "table")
|
||||
|
||||
local unprocessed_clone = {
|
||||
concatTables(when, { unpack(from, 2) }),
|
||||
concatTables(replacement, { unpack(to, 2) })
|
||||
}
|
||||
|
||||
-- print(vim.inspect({
|
||||
-- unprocessed_clone = unprocessed_clone,
|
||||
-- when = when,
|
||||
-- replacement = replacement,
|
||||
-- from = from,
|
||||
-- to = to,
|
||||
-- i = i
|
||||
-- }))
|
||||
|
||||
betterAbolish(unprocessed_clone, context, out)
|
||||
end
|
||||
end
|
||||
|
||||
function M.betterAbolish(from, to)
|
||||
local result = {}
|
||||
betterAbolish({ from, to }, { "", "" }, result)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local function withCasing(input)
|
||||
local out = {}
|
||||
|
||||
for i = 1, #input, 1 do
|
||||
local from = input[i][1]
|
||||
local to = input[i][2]
|
||||
|
||||
table.insert(out, { from, to })
|
||||
table.insert(out, { string.upper(from), string.upper(to) })
|
||||
|
||||
if #from and #to then
|
||||
table.insert(out, {
|
||||
string.upper(string.sub(from, 1, 1)) .. string.sub(from, 2),
|
||||
string.upper(string.sub(to, 1, 1)) .. string.sub(to, 2)
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return out
|
||||
end
|
||||
|
||||
---Parses the input for this plugin
|
||||
---@param input string
|
||||
---@param context {delimiters:{left:string,right:string},separator:string}
|
||||
---@return nil|{positio:number,message:string}
|
||||
---@return (string|table)[]|nil
|
||||
local function parse(input, context)
|
||||
local position = 1
|
||||
---@type { start:number, contents:(string|table)[] }[]
|
||||
local stack = { { start = position, contents = {} } }
|
||||
|
||||
local function error(message, pos)
|
||||
return { position = pos or position, message = message }
|
||||
end
|
||||
|
||||
local escaped = false
|
||||
local escapedChars = {
|
||||
["\\"] = true,
|
||||
[context.delimiters.left] = true,
|
||||
[context.delimiters.right] = true
|
||||
}
|
||||
|
||||
-- When encountering {}, instead of treating it like a single
|
||||
-- choice containing an empty string, we must treat it as an empty choice
|
||||
--
|
||||
-- The specialEmpty arg tells us whether to consider such cases.
|
||||
local function saveUp(specialEmpty)
|
||||
local prev = stack[#stack - 1].contents
|
||||
local current = stack[#stack]
|
||||
|
||||
assert(type(prev[#prev]) == "table")
|
||||
---@cast prev table
|
||||
|
||||
-- If specialEmpty is true (so we are processing a '}'),
|
||||
-- we only want to keep empty strings (so those where #current.contents == 0)
|
||||
-- if we've had a , before (so #prev[#prev] > 0)
|
||||
if not specialEmpty or #current.contents > 0 or #prev[#prev] > 0 then
|
||||
table.insert(prev[#prev], current.contents)
|
||||
end
|
||||
end
|
||||
|
||||
while position <= string.len(input) do
|
||||
local first = string.sub(input, position, position)
|
||||
local next = string.sub(input, position + 1, position + 1)
|
||||
local current = stack[#stack]
|
||||
|
||||
if not escaped and first == "\\" and escapedChars[next] then
|
||||
escaped = true
|
||||
|
||||
elseif not escaped and first == context.delimiters.left then
|
||||
table.insert(current.contents, {})
|
||||
stack[#stack + 1] = { start = position, contents = {} }
|
||||
elseif not escaped and first == context.delimiters.right then
|
||||
if #stack == 1 then
|
||||
return nil, error("Delimiter " .. context.delimiters.right .. " never opened")
|
||||
end
|
||||
|
||||
-- we want special treatment for {}
|
||||
saveUp(true)
|
||||
|
||||
stack[#stack] = nil
|
||||
elseif not escaped and first == context.separator and #stack > 1 then
|
||||
-- we want to treat empty strings before , as empty strings
|
||||
saveUp(false)
|
||||
|
||||
current.contents = {}
|
||||
else
|
||||
local last = current.contents[#current.contents]
|
||||
|
||||
if type(last) == "string" then
|
||||
current.contents[#current.contents] = last .. first
|
||||
else
|
||||
table.insert(current.contents, first)
|
||||
end
|
||||
|
||||
escaped = false
|
||||
end
|
||||
|
||||
position = position + 1
|
||||
end
|
||||
|
||||
if #stack > 1 then
|
||||
return nil, error("Delimiter " .. context.delimiters.left .. " never closed", stack[2].start)
|
||||
end
|
||||
|
||||
return stack[1].contents, nil
|
||||
end
|
||||
|
||||
local context = { delimiters = { left = "{", right = "}" }, separator = "," }
|
||||
|
||||
function M.abolishMany(many)
|
||||
local total = 0
|
||||
|
||||
for _, entry in pairs(many) do
|
||||
local left = parse(entry[1], context)
|
||||
local right = parse(entry[2], context)
|
||||
|
||||
local abbreviations = withCasing(M.betterAbolish(left, right))
|
||||
total = total + #abbreviations
|
||||
|
||||
A.manyLocalAbbr(abbreviations)
|
||||
end
|
||||
|
||||
print("Added " .. total .. " abbreviations")
|
||||
end
|
||||
|
||||
-- function M.setup()
|
||||
-- local context = { delimiters = { left = "{", right = "}" }, separator = "," }
|
||||
-- print(vim.inspect({ parse("abc\\d{a, d,e}dsdf\\{sdf\\}", context) }))
|
||||
-- local parsed, _ = parse("ab{e,{f0,1e,d2},f,{3,4,5},\\{{000,111}\\}}cd", context)
|
||||
-- -- local parsed, _ = parse("abc", context)
|
||||
-- print(vim.inspect(parsed))
|
||||
-- local processed = M.betterAbolish(parsed, parsed)
|
||||
-- print(vim.inspect(processed))
|
||||
-- end
|
||||
|
||||
return M
|
||||
|
|
|
@ -2,9 +2,12 @@ local env = require("my.helpers.env")
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("my.plugins.moonwalk").setup()
|
||||
require("my.plugins.chunk")
|
||||
require('nvim_comment').setup()
|
||||
require('fidget').setup()
|
||||
require('dressing').setup()
|
||||
require('abbreinder').setup()
|
||||
|
||||
require("my.plugins.autopairs").setup()
|
||||
require("my.plugins.telescope").setup()
|
||||
|
@ -34,7 +37,8 @@ function M.setup()
|
|||
require("my.plugins.null-ls").setup()
|
||||
require("my.plugins.vimtex").setup()
|
||||
-- require("my.plugins.lean").setup()
|
||||
-- require("my.plugins.notify").setup()
|
||||
require("my.plugins.notify").setup()
|
||||
require("my.plugins.iron").setup()
|
||||
end)
|
||||
|
||||
if env.neovide.active() then
|
||||
|
@ -55,6 +59,7 @@ function M.setup()
|
|||
require("my.plugins.hydra").setup()
|
||||
require("my.plugins.clipboard-image").setup()
|
||||
require("my.plugins.mind").setup()
|
||||
require("my.plugins.ufo").setup()
|
||||
|
||||
-- require("my.plugins.slam").setup()
|
||||
end
|
||||
|
|
47
dotfiles/neovim/lua/my/plugins/iron.lua
Normal file
47
dotfiles/neovim/lua/my/plugins/iron.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local iron = require("iron.core")
|
||||
|
||||
iron.setup {
|
||||
config = {
|
||||
-- Your repl definitions come here
|
||||
repl_definition = {},
|
||||
-- How the repl window will be displayed
|
||||
-- See below for more information
|
||||
repl_open_cmd = require('iron.view').right(40)
|
||||
},
|
||||
-- Iron doesn't set keymaps by default anymore.
|
||||
-- You can set them here or manually add keymaps to the functions in iron.core
|
||||
keymaps = {
|
||||
send_motion = "<space>isc",
|
||||
visual_send = "<space>is",
|
||||
send_file = "<space>isf",
|
||||
send_line = "<space>isl",
|
||||
send_mark = "<space>ism",
|
||||
mark_motion = "<space>imc",
|
||||
mark_visual = "<space>imc",
|
||||
remove_mark = "<space>imd",
|
||||
cr = "<space>is<cr>",
|
||||
interrupt = "<space>is<space>",
|
||||
exit = "<space>isq",
|
||||
clear = "<space>isr"
|
||||
},
|
||||
-- If the highlight is on, you can change how it looks
|
||||
-- For the available options, check nvim_set_hl
|
||||
highlight = { italic = true },
|
||||
ignore_blank_lines = true -- ignore blank lines when sending visual select lines
|
||||
}
|
||||
|
||||
-- iron also has a list of commands, see :h iron-commands for all available commands
|
||||
vim.keymap.set('n', '<space>iss', '<cmd>IronRepl<cr>')
|
||||
vim.keymap.set('n', '<space>ir', '<cmd>IronRestart<cr>')
|
||||
vim.keymap.set('n', '<space>if', '<cmd>IronFocus<cr>')
|
||||
vim.keymap.set('n', '<space>ih', '<cmd>IronHide<cr>')
|
||||
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then wk.register({ ["<leader>i"] = { name = "Iron repl commands" } }) end
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,41 +1,68 @@
|
|||
local M = {}
|
||||
|
||||
function M.on_attach(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("LspFormatting", {}),
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end
|
||||
})
|
||||
-- {{{ Auto format
|
||||
local function format()
|
||||
vim.lsp.buf.format({ async = false, bufnr = bufnr })
|
||||
end
|
||||
|
||||
if false and client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("LspFormatting", { clear = false }),
|
||||
buffer = bufnr,
|
||||
callback = format,
|
||||
})
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Keymap helpers
|
||||
local opts = function(desc)
|
||||
return { noremap = true, silent = true, desc = desc }
|
||||
end
|
||||
|
||||
-- Go to declaration / definition / implementation
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts("Go to declaration"))
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts("Go to definition"))
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts("Go to implementation"))
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts("Go to references"))
|
||||
local nmap = function(from, to, desc)
|
||||
vim.keymap.set("n", from, to, opts(desc))
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Go to declaration / definition / implementation
|
||||
nmap("gd", vim.lsp.buf.definition, "[G]o to [d]efinition")
|
||||
nmap("gi", vim.lsp.buf.implementation, "[G]o to [i]mplementation")
|
||||
nmap("gr", vim.lsp.buf.references, "[G]o to [r]eferences")
|
||||
-- }}}
|
||||
-- {{{ Hover
|
||||
-- Note: diagnostics are already covered in keymaps.lua
|
||||
nmap("K", vim.lsp.buf.hover, "Hover")
|
||||
nmap("L", vim.lsp.buf.signature_help, "Signature help")
|
||||
-- }}}
|
||||
-- {{{ Code actions
|
||||
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
nmap("<leader>f", format, "[F]ormat")
|
||||
nmap("<leader>c", vim.lsp.buf.code_action, "[C]ode actions")
|
||||
|
||||
-- Hover
|
||||
vim.keymap.set("n", "J", vim.diagnostic.open_float, opts("Show diagnostic"))
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts("Hover"))
|
||||
vim.keymap.set("n", "L", vim.lsp.buf.signature_help, opts("Signature help"))
|
||||
|
||||
-- Code actions
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts("Rename"))
|
||||
vim.keymap.set("n", "<leader>c", vim.lsp.buf.code_action, opts("Code actions"))
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, opts("Format"))
|
||||
vim.keymap.set(
|
||||
"v",
|
||||
"<leader>c",
|
||||
":'<,'> lua vim.lsp.buf.range_code_action()",
|
||||
opts("[C]ode actions")
|
||||
)
|
||||
-- }}}
|
||||
-- {{{ Workspace stuff
|
||||
nmap(
|
||||
"<leader>wa",
|
||||
vim.lsp.buf.add_workspace_folder,
|
||||
"[W]orkspace [A]dd Folder"
|
||||
)
|
||||
nmap(
|
||||
"<leader>wr",
|
||||
vim.lsp.buf.remove_workspace_folder,
|
||||
"[W]orkspace [R]emove Folder"
|
||||
)
|
||||
nmap("<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, "[W]orkspace [L]ist Folders")
|
||||
-- }}}
|
||||
end
|
||||
|
||||
-- General server config
|
||||
-- {{{ General server config
|
||||
---@type lspconfig.options
|
||||
local servers = {
|
||||
tsserver = {
|
||||
|
@ -43,39 +70,51 @@ local servers = {
|
|||
-- We handle formatting using null-ls and prettierd
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
M.on_attach(client, bufnr)
|
||||
end
|
||||
end,
|
||||
},
|
||||
dhall_lsp_server = {},
|
||||
purescriptls = {
|
||||
settings = {
|
||||
purescript = {
|
||||
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
|
||||
formatter = "purs-tidy"
|
||||
}
|
||||
}
|
||||
formatter = "purs-tidy",
|
||||
},
|
||||
},
|
||||
},
|
||||
hls = {
|
||||
haskell = {
|
||||
-- set formatter
|
||||
formattingProvider = "ormolu"
|
||||
}
|
||||
formattingProvider = "ormolu",
|
||||
},
|
||||
},
|
||||
rnix = {},
|
||||
cssls = {},
|
||||
jsonls = {},
|
||||
rust_analyzer = {},
|
||||
-- teal_ls = {},
|
||||
sumneko_lua = {
|
||||
cmd = { "lua-language-server", "--logpath=/home/adrielus/.local/share/lua-language-server/log" }
|
||||
}
|
||||
cmd = {
|
||||
"lua-language-server",
|
||||
"--logpath=/home/adrielus/.local/share/lua-language-server/log",
|
||||
},
|
||||
},
|
||||
}
|
||||
-- }}}
|
||||
|
||||
M.capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
-- {{{ Capabilities
|
||||
M.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
-- Add folding capabilities
|
||||
M.capabilities.textDocument.foldingRange =
|
||||
{ dynamicRegistration = false, lineFoldingOnly = true }
|
||||
-- }}}
|
||||
|
||||
function M.setup()
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover,
|
||||
{ border = "single" })
|
||||
-- {{{ Change on-hover borders
|
||||
vim.lsp.handlers["textDocument/hover"] =
|
||||
vim.lsp.with(vim.lsp.handlers.hover, { border = "single" })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" })
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" })
|
||||
-- }}}
|
||||
|
||||
-- Setup basic language servers
|
||||
for lsp, details in pairs(servers) do
|
||||
|
@ -84,15 +123,15 @@ function M.setup()
|
|||
details.on_attach = M.on_attach
|
||||
end
|
||||
|
||||
require('lspconfig')[lsp].setup {
|
||||
require("lspconfig")[lsp].setup({
|
||||
on_attach = details.on_attach,
|
||||
settings = details.settings, -- Specific per-language settings
|
||||
flags = {
|
||||
debounce_text_changes = 150 -- This will be the default in neovim 0.7+
|
||||
debounce_text_changes = 150, -- This will be the default in neovim 0.7+
|
||||
},
|
||||
cmd = details.cmd,
|
||||
capabilities = M.capabilities
|
||||
}
|
||||
capabilities = M.capabilities,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
20
dotfiles/neovim/lua/my/plugins/moonwalk.lua
Normal file
20
dotfiles/neovim/lua/my/plugins/moonwalk.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("moonwalk").add_loader("tl", function(src, path)
|
||||
local tl = require("tl")
|
||||
local errs = {}
|
||||
local _, program = tl.parse_program(tl.lex(src), errs)
|
||||
|
||||
if #errs > 0 then
|
||||
error(
|
||||
path .. ":" .. errs[1].y .. ":" .. errs[1].x .. ": " .. errs[1].msg,
|
||||
0
|
||||
)
|
||||
end
|
||||
|
||||
return tl.pretty_print_ast(program)
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
|
@ -2,7 +2,7 @@ local M = {}
|
|||
|
||||
function M.setup()
|
||||
require("neoconf").setup({
|
||||
-- import existing settinsg from other plugins
|
||||
-- import existing settings from other plugins
|
||||
import = {
|
||||
vscode = true, -- local .vscode/settings.json
|
||||
coc = false, -- global/local coc-settings.json
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
local mapSilent = require("my.keymaps").mapSilent
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
-- Toggle nerdtree with Control-t
|
||||
mapSilent("n", "<C-t>", ":NERDTreeToggle<CR>")
|
||||
-- Toggle nerdtree with Control-t
|
||||
vim.keymaps.set("n", "<C-t>", ":NERDTreeToggle<CR>", { silent = true })
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
vim.notify = require("notify")
|
||||
-- vim.notify = require("notify")
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -4,23 +4,20 @@ local M = {}
|
|||
|
||||
function M.setup()
|
||||
local null_ls = require("null-ls")
|
||||
-- require("refactoring").setup({})
|
||||
|
||||
local sources = {
|
||||
-- null_ls.builtins.formatting.prettierd.with({extra_filetypes = {}}), -- format ts files
|
||||
|
||||
null_ls.builtins.formatting.prettier.with({ extra_filetypes = {} }), -- format ts files
|
||||
null_ls.builtins.formatting.lua_format.with({
|
||||
-- extra_args = function(params)
|
||||
-- return params.options and params.options.tabSize and
|
||||
-- { "--indent-width=" .. params.options.tabSize }
|
||||
-- end
|
||||
}) -- format lua code
|
||||
-- null_ls.builtins.formatting.prettier.with({ extra_filetypes = {} }), -- format ts files
|
||||
null_ls.builtins.formatting.prettierd.with({ extra_filetypes = {} }), -- format ts files
|
||||
-- null_ls.builtins.formatting.lua_format.with({}), -- format lua code
|
||||
null_ls.builtins.formatting.stylua.with({}), -- format lua code
|
||||
-- null_ls.builtins.code_actions.refactoring.with({}), -- refactor stuff
|
||||
}
|
||||
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
on_attach = lspconfig.on_attach,
|
||||
debug = true
|
||||
debug = true,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
18
dotfiles/neovim/lua/my/plugins/ufo.lua
Normal file
18
dotfiles/neovim/lua/my/plugins/ufo.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
vim.o.foldcolumn = '0'
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
|
||||
-- Using ufo provider need remap `zR` and `zM`.
|
||||
-- vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||
-- vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
||||
|
||||
-- Tell the server the capability of foldingRange,
|
||||
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
|
||||
-- require('ufo').setup()
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue