diff --git a/lua/pika/plugins/lsp/lspconfig.lua b/lua/pika/plugins/lsp/lspconfig.lua index 806b393..4b68229 100644 --- a/lua/pika/plugins/lsp/lspconfig.lua +++ b/lua/pika/plugins/lsp/lspconfig.lua @@ -2,10 +2,14 @@ return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, dependencies = { - "hrsh7th/cmp-nvim-lsp", + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" }, + }, { "antosha417/nvim-lsp-file-operations", config = true }, { "folke/neodev.nvim", opts = {} }, }, + config = function() local lspconfig = require("lspconfig") local mason_lspconfig = require("mason-lspconfig") @@ -38,7 +42,6 @@ return { keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary end, }) - -- used to enable autocompletion (assign to every lsp server config) local capabilities = cmp_nvim_lsp.default_capabilities() diff --git a/lua/pika/plugins/mini-pairs.lua.disabled b/lua/pika/plugins/mini-pairs.lua.disabled deleted file mode 100644 index c98e7a7..0000000 --- a/lua/pika/plugins/mini-pairs.lua.disabled +++ /dev/null @@ -1,21 +0,0 @@ -return { - "echasnovski/mini.pairs", - name = "mini-pairs", - lazy = false, - event = "VeryLazy", - opts = { - modes = { insert = true, command = true, terminal = false }, - -- skip autopair when next character is one of these - skip_next = [=[[%w%%%'%[%"%.%`%$]]=], - -- skip autopair when the cursor is inside these treesitter nodes - skip_ts = { "string" }, - -- skip autopair when next character is closing pair - -- and there are more closing pairs than opening pairs - skip_unbalanced = true, - -- better deal with markdown code blocks - markdown = true, - }, - config = function() - require("mini-pairs") - end, -} diff --git a/lua/pika/plugins/neo-tree.lua.disabled b/lua/pika/plugins/neo-tree.lua.disabled deleted file mode 100644 index 9ec9e0b..0000000 --- a/lua/pika/plugins/neo-tree.lua.disabled +++ /dev/null @@ -1,119 +0,0 @@ -local function setup_open_file_indicators() - -- Table to store open buffers - local open_buffers = {} - - -- Function to update open_buffers table - local function update_open_buffers() - open_buffers = {} - for _, buf in ipairs(vim.api.nvim_list_bufs()) do - if vim.api.nvim_buf_is_valid(buf) and vim.bo[buf].buflisted then - local file_path = vim.api.nvim_buf_get_name(buf) - open_buffers[file_path] = true - end - end - end - - -- Update open_buffers initially - update_open_buffers() - - -- Set up autocmds to update open_buffers and refresh Neo-tree - local group = vim.api.nvim_create_augroup("NeoTreeOpenFileIndicator", { clear = true }) - vim.api.nvim_create_autocmd({ "BufAdd", "BufDelete", "BufWipeout" }, { - group = group, - callback = function() - update_open_buffers() - if package.loaded["neo-tree.sources.manager"] then - require("neo-tree.sources.manager").refresh("filesystem") - end - end, - }) - - -- Custom component to display open file indicator - local function open_file_indicator(config, node, state) - local result = require("neo-tree.sources.common.components").icon(config, node, state) - if node.type == "file" and open_buffers[node:get_id()] then - result.text = result.text .. "󱞇 " - end - return result - end - - return open_file_indicator -end - -return { - { - "nvim-neo-tree/neo-tree.nvim", - opts = function() - -- Set the keymap when the Neo-tree buffer is opened - vim.api.nvim_create_autocmd("FileType", { - pattern = "neo-tree", - callback = function() - vim.api.nvim_buf_set_keymap( - 0, - "n", - "cd", - "FineCmdline Neotree dir=", - { noremap = true, silent = true } - ) - end, - }) - return { - sources = { "filesystem", "buffers", "git_status" }, - open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, - close_if_last_window = false, - popup_border_style = "rounded", - use_float = true, - enable_git_status = true, - enable_diagnostics = true, - filesystem = { - bind_to_cwd = false, - follow_current_file = { enabled = true }, - use_libuv_file_watcher = true, - components = { - icon = setup_open_file_indicators(), - }, - }, - window = { - mappings = { - ["l"] = "open", - ["o"] = "open", - ["C-v"] = "open_split", - ["h"] = "close_node", - [""] = "none", - ["O"] = { - function(state) - require("lazy.util").open(state.tree:get_node().path, { system = true }) - end, - desc = "Open with System Application", - }, - ["P"] = { "toggle_preview", config = { use_float = true } }, - }, - }, - default_component_configs = { - indent = { - with_expanders = true, - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - git_status = { - symbols = { - unstaged = "󰄱", - staged = "󰱒", - }, - }, - }, - } - end, - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "3rd/image.nvim", - }, - }, - --- ─< Toggle NvimTree >───────────────────────────────────────────────────────────────── -vim.keymap.set("n", "e", ":Neotree toggle", { noremap = true, silent = true, desc = "[e]xplorer" }) - -} diff --git a/lua/pika/plugins/nvim-cmp.lua b/lua/pika/plugins/nvim-cmp.lua index 0ea75e5..42fb51e 100644 --- a/lua/pika/plugins/nvim-cmp.lua +++ b/lua/pika/plugins/nvim-cmp.lua @@ -6,10 +6,8 @@ return { "hrsh7th/cmp-path", -- source for file system paths { "L3MON4D3/LuaSnip", - -- follow latest release. - version = "v2.*", -- Replace by the latest released major (first number of latest release) - -- install jsregexp (optional!). - build = "make install_jsregexp", + version = "v2.*", -- latest release of LuaSnip + build = "make install_jsregexp", -- optional regex support for LuaSnip }, "saadparwaiz1/cmp_luasnip", -- for autocompletion "rafamadriz/friendly-snippets", -- useful snippets @@ -20,8 +18,9 @@ return { local luasnip = require("luasnip") local lspkind = require("lspkind") - -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + -- Load snippets from friendly-snippets and custom directory require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load({ paths = { "~/.config/nvim/snippets" } }) cmp.setup({ completion = { @@ -77,4 +76,4 @@ return { }, }) end, -} \ No newline at end of file +} diff --git a/lua/pika/plugins/scissors.lua b/lua/pika/plugins/scissors.lua new file mode 100644 index 0000000..dd3cbdc --- /dev/null +++ b/lua/pika/plugins/scissors.lua @@ -0,0 +1,11 @@ +return { + { + "chrisgrieser/nvim-scissors", + lazy = false, + dependencies = { "nvim-telescope/telescope.nvim", "garymjr/nvim-snippets" }, + opts = { + snippetDir = "~/.config/nvim/snippets", + }, + }, + vim.keymap.set("v", "sm", ":ScissorsAddNewSnippet"), +} diff --git a/lua/pika/plugins/telesnip.lua b/lua/pika/plugins/telesnip.lua.disabled similarity index 100% rename from lua/pika/plugins/telesnip.lua rename to lua/pika/plugins/telesnip.lua.disabled