feat: basic folding (should revisit at one point)
This commit is contained in:
parent
a20b64fb56
commit
b94daf0bd3
|
@ -31,6 +31,9 @@ function M.setup()
|
||||||
|
|
||||||
-- Set leader
|
-- Set leader
|
||||||
helpers.global("mapleader", "<Space>")
|
helpers.global("mapleader", "<Space>")
|
||||||
|
|
||||||
|
-- Import other options
|
||||||
|
require("my.options.folding").setup()
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
15
dotfiles/neovim/lua/my/options/folding.lua
Normal file
15
dotfiles/neovim/lua/my/options/folding.lua
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
vim.o.foldmethod = "marker"
|
||||||
|
|
||||||
|
-- vim.cmd([[
|
||||||
|
-- augroup remember_folds
|
||||||
|
-- autocmd!
|
||||||
|
-- autocmd BufWinLeave *.* if &ft !=# 'help' | mkview | endif
|
||||||
|
-- autocmd BufWinEnter *.* if &ft !=# 'help' | silent! loadview | endif
|
||||||
|
-- augroup END
|
||||||
|
-- ]])
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -1,8 +1,5 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
-- Command for formatting lua code
|
|
||||||
local formatLua = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb"
|
|
||||||
|
|
||||||
local function map(buf, mode, lhs, rhs, opts)
|
local function map(buf, mode, lhs, rhs, opts)
|
||||||
local options = {noremap = true, silent = true}
|
local options = {noremap = true, silent = true}
|
||||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||||
|
@ -32,9 +29,12 @@ function M.on_attach(client, bufnr)
|
||||||
map(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
|
map(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
|
||||||
|
|
||||||
-- Workspace stuff
|
-- Workspace stuff
|
||||||
map(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
map(bufnr, 'n', '<space>wa',
|
||||||
map(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
|
'<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||||
map(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
|
map(bufnr, 'n', '<space>wr',
|
||||||
|
'<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
|
||||||
|
map(bufnr, 'n', '<space>wl',
|
||||||
|
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
|
||||||
|
|
||||||
-- Code actions
|
-- Code actions
|
||||||
map(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
|
map(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
|
||||||
|
@ -77,12 +77,23 @@ local servers = {
|
||||||
},
|
},
|
||||||
cmd = {"lua-language-server"}
|
cmd = {"lua-language-server"}
|
||||||
},
|
},
|
||||||
purescriptls = {settings = {purescript = {censorWarnings = {"UnusedName", "ShadowedName", "UserDefinedWarning"}, formatter = "purs-tidy"}}},
|
purescriptls = {
|
||||||
|
settings = {
|
||||||
|
purescript = {
|
||||||
|
censorWarnings = {
|
||||||
|
"UnusedName", "ShadowedName", "UserDefinedWarning"
|
||||||
|
},
|
||||||
|
formatter = "purs-tidy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
rnix = {}
|
rnix = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp
|
||||||
|
.protocol
|
||||||
|
.make_client_capabilities())
|
||||||
|
|
||||||
-- Setup basic language servers
|
-- Setup basic language servers
|
||||||
for lsp, details in pairs(servers) do
|
for lsp, details in pairs(servers) do
|
||||||
|
@ -101,16 +112,6 @@ function M.setup()
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: replace this with null-ls
|
|
||||||
local efmLanguages = {lua = {{formatCommand = formatLua, formatStdin = true}}}
|
|
||||||
|
|
||||||
-- Setup auto-formatting
|
|
||||||
require"lspconfig".efm.setup {
|
|
||||||
init_options = {documentFormatting = true},
|
|
||||||
filetypes = {"lua"},
|
|
||||||
settings = {rootMarkers = {".git/"}, languages = efmLanguages}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -6,7 +6,10 @@ function M.setup()
|
||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
local sources = {
|
local sources = {
|
||||||
null_ls.builtins.formatting.prettierd.with({extra_filetypes = {"markdown"}}) -- format ts files
|
null_ls.builtins.formatting.prettierd.with({
|
||||||
|
extra_filetypes = {"markdown"}
|
||||||
|
}), -- format ts files
|
||||||
|
null_ls.builtins.formatting.lua_format -- format lua code
|
||||||
}
|
}
|
||||||
|
|
||||||
null_ls.setup({sources = sources, on_attach = lspconfig.on_attach})
|
null_ls.setup({sources = sources, on_attach = lspconfig.on_attach})
|
||||||
|
|
Loading…
Reference in a new issue