1
0
Fork 0

editor: neo-tree + telescope integration

This commit is contained in:
zymon 2024-08-26 18:17:08 +02:00
parent 370b79af2a
commit da501511bc

View file

@ -1,12 +1,114 @@
return {
{ -- file explorer
{ -- neo-tree file explorer
"https://github.com/nvim-neo-tree/neo-tree.nvim",
cmd = "Neotree",
keys = {
{ "<leader>fe", "<cmd>Neotree toggle<cr>", desc = "file explorer toggle" },
{
"<leader>ge",
function()
require("neo-tree.command").execute({
source = "git_status",
toggle = true
})
end,
desc = "git explorer",
},
{
"<leader>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 = {
{ "<leader>tb", "<cmd>Telescope buffers<cr>", desc = "buffers" },
{ "<leader>tfb", "<cmd>Telescope file_browser<cr>", desc = "file browser" },
{ "<leader>tff", "<cmd>Telescope find_files<cr>", desc = "find file" },
{ "<leader>tg", "<cmd>Telescope live_grep<cr>", desc = "grep files" },
{ "<leader>th", "<cmd>Telescope help_tags<cr>", desc = "help" },
{ "<leader>tk", "<cmd>Telescope keymaps<cr>", desc = "key maps" },
{ "<leader>tss", "<cmd>Telescope symbols<cr>", desc = "symbols" },
{ "<leader>tse", function ()
require(telescope.builtin).symbols{ sources = {"emoji"} }
end,
desc = "emoji"
},
{ "<leader>tsm", function ()
require(telescope.builtin).symbols{ sources = {"math" } }
end,
desc = "math"
},
{ "<leader>tt", "<cmd>Telescope<cr>", desc = "telescope" },
-- git
{ "<leader>gf", "<cmd>Telescope git_files<cr>", desc = "files" },
{ "<leader>gc", "<cmd>Telescope git_commits<cr>", desc = "commits" },
{ "<leader>gst", "<cmd>Telescope git_status<cr>", desc = "status" },
-- buffer
{ "<leader>bf", "<cmd>Telescope buffers<cr>", desc = "find buffer" },
{ "<leader>bs", "<cmd>Telescope current_buffer_fuzzy_find<cr>", 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 = {
{ "<leader>b", group = "buffer" },
{ "<leader>g", group = "git" },
{ "<leader>t", group = "telescope" },
{ "<leader>u", group = "ui" },
},
},
},