From da501511bc468bf8f86e87cd2236a3f60ed9344a Mon Sep 17 00:00:00 2001 From: zymon Date: Mon, 26 Aug 2024 18:17:08 +0200 Subject: [PATCH] editor: neo-tree + telescope integration --- lua/znvim/plugins/editor.lua | 102 +++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/lua/znvim/plugins/editor.lua b/lua/znvim/plugins/editor.lua index 19b1f3e..54f5979 100644 --- a/lua/znvim/plugins/editor.lua +++ b/lua/znvim/plugins/editor.lua @@ -1,12 +1,114 @@ return { + { -- file explorer + { -- neo-tree file explorer + "https://github.com/nvim-neo-tree/neo-tree.nvim", + cmd = "Neotree", + keys = { + { "fe", "Neotree toggle", desc = "file explorer toggle" }, + { + "ge", + function() + require("neo-tree.command").execute({ + source = "git_status", + toggle = true + }) + end, + desc = "git explorer", + }, + { + "be", + function() + require("neo-tree.command").execute({ + source = "buffers", + toggle = true + }) + end, + desc = "buffer explorer", + }, + }, + dependencies = { + "https://github.com/nvim-lua/plenary.nvim", + "https://github.com/MunifTanjim/nui.nvim", + "https://github.com/kyazdani42/nvim-web-devicons", + }, + opts = { + close_if_last_window = true, + filesystem = { + hijack_netrw_behavior = "open_default", + }, + }, + }, + { -- telescope + "https://github.com/nvim-telescope/telescope.nvim", + cmd = "Telescope", + dependencies = { + "https://github.com/nvim-lua/plenary.nvim", + "https://github.com/nvim-lua/popup.nvim", + "https://github.com/nvim-telescope/telescope-file-browser.nvim", -- @TODO: j and k to moving in or out of directiry + "https://github.com/nvim-telescope/telescope-bibtex.nvim", + "https://github.com/nvim-telescope/telescope-symbols.nvim", + }, + keys = { + { "tb", "Telescope buffers", desc = "buffers" }, + { "tfb", "Telescope file_browser", desc = "file browser" }, + { "tff", "Telescope find_files", desc = "find file" }, + { "tg", "Telescope live_grep", desc = "grep files" }, + { "th", "Telescope help_tags", desc = "help" }, + { "tk", "Telescope keymaps", desc = "key maps" }, + { "tss", "Telescope symbols", desc = "symbols" }, + { "tse", function () + require(telescope.builtin).symbols{ sources = {"emoji"} } + end, + desc = "emoji" + }, + { "tsm", function () + require(telescope.builtin).symbols{ sources = {"math" } } + end, + desc = "math" + }, + { "tt", "Telescope", desc = "telescope" }, + + -- git + { "gf", "Telescope git_files", desc = "files" }, + { "gc", "Telescope git_commits", desc = "commits" }, + { "gst", "Telescope git_status", desc = "status" }, + -- buffer + { "bf", "Telescope buffers", desc = "find buffer" }, + { "bs", "Telescope current_buffer_fuzzy_find", desc = "fuzzy search" }, + }, + opts = { + defaults = { + initial_mode = "normal", + }, + extensions = { + bibtex = { + depth = 2, + }, + }, + }, + config = function(_, opts) + local telescope = require("telescope") + telescope.setup(opts) + telescope.load_extension("file_browser") + telescope.load_extension("bibtex") + end, + }, + { -- displays a popup with possible key bindings "https://github.com/folke/which-key.nvim", + event = "VeryLazy", dependencies = { "https://github.com/kyazdani42/nvim-web-devicons", }, opts = { preset = "helix", + spec = { + { "b", group = "buffer" }, + { "g", group = "git" }, + { "t", group = "telescope" }, + { "u", group = "ui" }, + }, }, },