From a6e7531696234478b6918ca7409922c202f4c308 Mon Sep 17 00:00:00 2001 From: Hyuga Tsukui Date: Wed, 13 Nov 2024 00:29:59 +0900 Subject: [PATCH] Update .config/nvim/init.lua Update .config/nvim/lua/plugins/Comment.lua Update .config/nvim/lua/plugins/fzf.lua Update .config/nvim/lua/plugins/gitsigns.lua Update .config/nvim/lua/plugins/harpoon.lua Update .config/nvim/lua/plugins/nvim-cmp.lua Update .config/nvim/lua/plugins/nvim-lspconfig.lua Update .config/nvim/lua/plugins/nvim-surround.lua --- dot_config/nvim/init.lua | 28 +++++++++---------- dot_config/nvim/lua/plugins/Comment.lua | 2 +- dot_config/nvim/lua/plugins/fzf.lua | 4 +++ dot_config/nvim/lua/plugins/gitsigns.lua | 7 +++++ dot_config/nvim/lua/plugins/harpoon.lua | 4 +++ dot_config/nvim/lua/plugins/nvim-cmp.lua | 2 +- .../nvim/lua/plugins/nvim-lspconfig.lua | 7 +++++ dot_config/nvim/lua/plugins/nvim-surround.lua | 2 +- 8 files changed, 39 insertions(+), 17 deletions(-) diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index b397685..b26ff90 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -1,19 +1,19 @@ if not vim.g.vscode then - require("core.options") - require("core.keymaps") - -- disable netrw at the very start of your init.lua - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 + require("core.options") + require("core.keymaps") + -- disable netrw at the very start of your init.lua + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 - vim.opt.laststatus = 3 + vim.opt.laststatus = 3 - require("config.lazy") + require("config.lazy") - vim.diagnostic.config({ - virtual_text = { - format = function(diagnostic) - return string.format("%s (%s: %s)", diagnostic.message, diagnostic.source, diagnostic.code) - end, - }, - }) + vim.diagnostic.config({ + virtual_text = { + format = function(diagnostic) + return string.format("%s (%s: %s)", diagnostic.message, diagnostic.source, diagnostic.code) + end, + }, + }) end diff --git a/dot_config/nvim/lua/plugins/Comment.lua b/dot_config/nvim/lua/plugins/Comment.lua index 3284a9e..9127887 100644 --- a/dot_config/nvim/lua/plugins/Comment.lua +++ b/dot_config/nvim/lua/plugins/Comment.lua @@ -1,6 +1,6 @@ return { "numToStr/Comment.nvim", - event = "VeryLazy", + keys = { "gcc", "gbc", "gc", "gb" }, config = function() require("Comment").setup() end, diff --git a/dot_config/nvim/lua/plugins/fzf.lua b/dot_config/nvim/lua/plugins/fzf.lua index c0ba148..4d0fd21 100644 --- a/dot_config/nvim/lua/plugins/fzf.lua +++ b/dot_config/nvim/lua/plugins/fzf.lua @@ -1,5 +1,9 @@ return { "ibhagwan/fzf-lua", + keys = { + "", + "", + }, config = function() require("fzf-lua").setup({ keymap = { diff --git a/dot_config/nvim/lua/plugins/gitsigns.lua b/dot_config/nvim/lua/plugins/gitsigns.lua index b9ba5f8..d142a9d 100644 --- a/dot_config/nvim/lua/plugins/gitsigns.lua +++ b/dot_config/nvim/lua/plugins/gitsigns.lua @@ -1,5 +1,12 @@ return { "lewis6991/gitsigns.nvim", + event = { "BufRead", "BufNewFile" }, + cond = function() + -- 現在のバッファのファイルタイプが特定のもの (例: NvimTree) でないことを確認 + local exclude_filetypes = { "NvimTree" } + return not vim.tbl_contains(exclude_filetypes, vim.bo.filetype) + end, + config = function() require("gitsigns").setup({ on_attach = function(bufnr) diff --git a/dot_config/nvim/lua/plugins/harpoon.lua b/dot_config/nvim/lua/plugins/harpoon.lua index 20e8245..e6313f2 100644 --- a/dot_config/nvim/lua/plugins/harpoon.lua +++ b/dot_config/nvim/lua/plugins/harpoon.lua @@ -2,6 +2,10 @@ return { "ThePrimeagen/harpoon", branch = "harpoon2", dependencies = { "nvim-lua/plenary.nvim" }, + keys = { + "m", + "", + }, config = function() local harpoon = require("harpoon") harpoon:setup() diff --git a/dot_config/nvim/lua/plugins/nvim-cmp.lua b/dot_config/nvim/lua/plugins/nvim-cmp.lua index 08b2d87..3af9732 100644 --- a/dot_config/nvim/lua/plugins/nvim-cmp.lua +++ b/dot_config/nvim/lua/plugins/nvim-cmp.lua @@ -45,7 +45,7 @@ return { [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), + -- [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = false }), [""] = vim.schedule_wrap(function(fallback) if cmp.visible() and has_words_before() then diff --git a/dot_config/nvim/lua/plugins/nvim-lspconfig.lua b/dot_config/nvim/lua/plugins/nvim-lspconfig.lua index efd2325..a268c48 100644 --- a/dot_config/nvim/lua/plugins/nvim-lspconfig.lua +++ b/dot_config/nvim/lua/plugins/nvim-lspconfig.lua @@ -5,16 +5,23 @@ return { require("mason").setup({}) end, cmd = { "Mason" }, + lazy = true, }, { "williamboman/mason-lspconfig.nvim", config = function() require("mason-lspconfig").setup({}) end, + lazy = true, }, { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, + cond = function() + -- 現在のバッファのファイルタイプが特定のもの (例: NvimTree) でないことを確認 + local exclude_filetypes = { "NvimTree" } + return not vim.tbl_contains(exclude_filetypes, vim.bo.filetype) + end, config = function() local lspconfig = require("lspconfig") require("mason-lspconfig").setup_handlers({ diff --git a/dot_config/nvim/lua/plugins/nvim-surround.lua b/dot_config/nvim/lua/plugins/nvim-surround.lua index f3dbea8..8805368 100644 --- a/dot_config/nvim/lua/plugins/nvim-surround.lua +++ b/dot_config/nvim/lua/plugins/nvim-surround.lua @@ -1,7 +1,7 @@ return { "kylechui/nvim-surround", version = "*", -- Use for stability; omit to use `main` branch for the latest features - event = "VeryLazy", + keys = { "ys" }, config = function() require("nvim-surround").setup({ -- Configuration here, or leave empty to use defaults