this hurts

This commit is contained in:
Sakooooo 2023-08-23 16:58:07 +00:00
parent 05b0210dae
commit e2c332c3ae
Signed by: sako
GPG key ID: FE52FD65B76E4751
2 changed files with 78 additions and 74 deletions

View file

@ -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")

View file

@ -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" },
})