this hurts
This commit is contained in:
parent
05b0210dae
commit
e2c332c3ae
2 changed files with 78 additions and 74 deletions
|
@ -1,42 +1,47 @@
|
|||
-- Utilities for creating configurations
|
||||
local util = require "formatter.util"
|
||||
local util = require("formatter.util")
|
||||
|
||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
||||
require("formatter").setup {
|
||||
-- Enable or disable logging
|
||||
logging = true,
|
||||
log_level = vim.log.levels.WARN,
|
||||
filetype = {
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
function()
|
||||
return {
|
||||
exe = "stylua",
|
||||
args = {
|
||||
"--search-parent-directories",
|
||||
"--stdin-filepath",
|
||||
util.escape_path(util.get_current_buffer_file_path()),
|
||||
"--",
|
||||
"-",
|
||||
},
|
||||
stdin = true,
|
||||
}
|
||||
end
|
||||
},
|
||||
nix = {
|
||||
require("formatter.filetypes.nix").alejandra,
|
||||
function()
|
||||
return {
|
||||
exe = "alejandra",
|
||||
stdin = true,
|
||||
args = {
|
||||
"--quiet"
|
||||
},
|
||||
}
|
||||
end
|
||||
},
|
||||
["*"] = {
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace
|
||||
}
|
||||
}
|
||||
}
|
||||
require("formatter").setup({
|
||||
-- Enable or disable logging
|
||||
logging = true,
|
||||
log_level = vim.log.levels.WARN,
|
||||
filetype = {
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
function()
|
||||
return {
|
||||
exe = "stylua",
|
||||
args = {
|
||||
"--search-parent-directories",
|
||||
"--stdin-filepath",
|
||||
util.escape_path(util.get_current_buffer_file_path()),
|
||||
"--",
|
||||
"-",
|
||||
},
|
||||
stdin = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
nix = {
|
||||
require("formatter.filetypes.nix").alejandra,
|
||||
function()
|
||||
return {
|
||||
exe = "alejandra",
|
||||
stdin = true,
|
||||
args = {
|
||||
"--quiet",
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
["*"] = {
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_command("augroup FormatAutogroup")
|
||||
vim.api.nvim_command("autocmd!")
|
||||
vim.api.nvim_command("autocmd BufWritePost * FormatWrite")
|
||||
vim.api.nvim_command("augroup END")
|
||||
|
|
|
@ -6,74 +6,73 @@ require("mason").setup()
|
|||
require("mason-lspconfig").setup()
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, {})
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, {})
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
|
||||
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {})
|
||||
vim.keymap.set("n", "gr", require("telescope.builtin").lsp_references, {})
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {})
|
||||
vim.keymap.set("n", "gr", require("telescope.builtin").lsp_references, {})
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
|
||||
end
|
||||
|
||||
-- enable autocomplete
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- funny lsp config stuff
|
||||
require('lspconfig').nil_ls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
require("lspconfig").nil_ls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
|
||||
require("lspconfig").lua_ls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").omnisharp.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").cmake.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").clangd.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").tsserver.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").html.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").eslint.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
command = "EslintFixAll",
|
||||
})
|
||||
end,
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
command = "EslintFixAll",
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
require("lspconfig").pyright.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").cssls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require('lspconfig')['hls'].setup {
|
||||
filetypes = { 'haskell', 'lhaskell', 'cabal' },
|
||||
}
|
||||
require("lspconfig")["hls"].setup({
|
||||
filetypes = { "haskell", "lhaskell", "cabal" },
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue