From 7ddde216b1c08e0ec537f53272f6ff98c3bbf057 Mon Sep 17 00:00:00 2001 From: Hyuga Tsukui Date: Sat, 9 Nov 2024 23:41:44 +0900 Subject: [PATCH] Update .chezmoi.toml Update .chezmoiignore Update .config/nvim/lua/plugins/none-ls.lua Update .config/nvim/lua/plugins/nvim-lspconfig.lua --- .chezmoi.toml.tmpl | 4 +- .chezmoiignore | 1 + dot_config/nvim/lua/plugins/none-ls.lua | 1 + .../nvim/lua/plugins/nvim-lspconfig.lua | 132 +++++++++--------- 4 files changed, 72 insertions(+), 66 deletions(-) diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index 8c03577..113adbc 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -2,5 +2,5 @@ command = "nvim" [git] - ## autoCommit = true - ## autoPush = true + autoCommit = true + autoPush = true diff --git a/.chezmoiignore b/.chezmoiignore index ef0210e..adb5c11 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -1,3 +1,4 @@ README.md tmux/plugins/ +nix/ diff --git a/dot_config/nvim/lua/plugins/none-ls.lua b/dot_config/nvim/lua/plugins/none-ls.lua index e3a5f9d..eea66ef 100644 --- a/dot_config/nvim/lua/plugins/none-ls.lua +++ b/dot_config/nvim/lua/plugins/none-ls.lua @@ -27,6 +27,7 @@ return { null_ls.builtins.formatting.prettierd.with({}), null_ls.builtins.formatting.sqlfmt, + null_ls.builtins.formatting.nixpkgs_fmt, }, on_attach = function(client, bufnr) vim.keymap.set("n", "f", function() diff --git a/dot_config/nvim/lua/plugins/nvim-lspconfig.lua b/dot_config/nvim/lua/plugins/nvim-lspconfig.lua index 270c8e4..52c305f 100644 --- a/dot_config/nvim/lua/plugins/nvim-lspconfig.lua +++ b/dot_config/nvim/lua/plugins/nvim-lspconfig.lua @@ -1,75 +1,79 @@ return { - "neovim/nvim-lspconfig", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - }, - config = function() - local lspconfig = require("lspconfig") + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + }, + config = function() + local lspconfig = require("lspconfig") - if lspconfig.lua_ls then - lspconfig.lua_ls.setup({ - settings = { - Lua = { - diagnostics = { - globals = { - "vim", - }, - }, - }, - }, - }) - end + if lspconfig.lua_ls then + lspconfig.lua_ls.setup({ + settings = { + Lua = { + diagnostics = { + globals = { + "vim", + }, + }, + }, + }, + }) + end - if lspconfig.ts_ls then - lspconfig.ts_ls.setup({}) - end + if lspconfig.ts_ls then + lspconfig.ts_ls.setup({}) + end - if lspconfig.ocamllsp then - lspconfig.ocamllsp.setup({}) - end + if lspconfig.ocamllsp then + lspconfig.ocamllsp.setup({}) + end - if lspconfig.gopls then - lspconfig.gopls.setup({}) - end + if lspconfig.gopls then + lspconfig.gopls.setup({}) + end - if lspconfig.terraformls then - lspconfig.terraformls.setup({ - on_attach = function(client, _) - client.server_capabilities.semanticTokensProvider = nil - end, - }) - end + if lspconfig.terraformls then + lspconfig.terraformls.setup({ + on_attach = function(client, _) + client.server_capabilities.semanticTokensProvider = nil + end, + }) + end - if lspconfig.typos_lsp then - lspconfig.typos_lsp.setup({ - init_options = { - config = "~/.config/typos/.typos.toml", - }, - }) - end + if lspconfig.typos_lsp then + lspconfig.typos_lsp.setup({ + init_options = { + config = "~/.config/typos/.typos.toml", + }, + }) + end - -- Lsp Keymaps. - -- global. - -- vim.keymap.set("n", "e", vim.diagnostic.open_float) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next) - vim.keymap.set("n", "q", vim.diagnostic.setloclist) + if lspconfig.nil_ls then + lspconfig.nil_ls.setup({}) + end - -- after the language server attaches to the current buffer - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), - callback = function(ev) - vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + -- Lsp Keymaps. + -- global. + -- vim.keymap.set("n", "e", vim.diagnostic.open_float) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next) + vim.keymap.set("n", "q", vim.diagnostic.setloclist) - local opts = { buffer = ev.buf } - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) - vim.keymap.set("n", "k", vim.lsp.buf.hover, opts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) - end, - }) - end, + -- after the language server attaches to the current buffer + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + + local opts = { buffer = ev.buf } + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "k", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + end, + }) + end, }