telescope/nvim-tree migrated

This commit is contained in:
Daniel B Sherry 2025-05-16 13:05:57 -05:00
parent 6e636ad325
commit 6f06ad0baa
21 changed files with 368 additions and 504 deletions

37
lua/Saved/lazy.lua Normal file
View file

@ -0,0 +1,37 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- My plugins here
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

View file

@ -1,5 +0,0 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}

41
lua/plugins.lua Normal file
View file

@ -0,0 +1,41 @@
return {
{ "wbthomason/packer.nvim" }, -- Have packer manage itself
{ "nvim-lua/popup.nvim" }, -- An implementation of the Popup API from vim in Neovim
{ "nvim-lua/plenary.nvim" }, -- Useful lua functions used ny lots of plugins
{ "windwp/nvim-autopairs" }, -- Autopairs
-- "numToStr/Comment.nvim" -- Easily comment stuff
{ 'kyazdani42/nvim-web-devicons' },
{ 'kyazdani42/nvim-tree.lua' },
-- Colorschemes
-- "lunarvim/colorschemes" -- A bunch of colorschemes you can try out
{ "lunarvim/darkplus.nvim" },
{ "akinsho/bufferline.nvim" },
{ "moll/vim-bbye" },
-- cmp plugins
{ "hrsh7th/nvim-cmp" }, -- The completion plugin
{ "hrsh7th/cmp-buffer" }, -- buffer completions
{ "hrsh7th/cmp-path" }, -- path completions
{ "hrsh7th/cmp-cmdline" }, -- cmdline completions
{ "saadparwaiz1/cmp_luasnip" }, -- snippet completions
{ "hrsh7th/cmp-nvim-lsp" },
-- snippets
{ "L3MON4D3/LuaSnip" }, --snippet engine
{ "rafamadriz/friendly-snippets" }, -- a bunch of snippets to use
-- LSP
{ "neovim/nvim-lspconfig" }, -- enable LSP
{ "williamboman/mason.nvim" }, -- simple to use language server installer
{ "williamboman/mason-lspconfig.nvim" }, -- simple to use language server installer
-- Telescope
{ "nvim-telescope/telescope-media-files.nvim" },
-- Treesitter
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
-- "p00f/nvim-ts-rainbow"
-- "nvim-treesitter/playground"
}

147
lua/plugins/nvim-tree.lua Normal file
View file

@ -0,0 +1,147 @@
return {
{
"nvim-tree/nvim-tree.lua",
version = "*",
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
keys = {
{ "<leader>e", "<cmd>NvimTreeToggle<CR>", desc = "Toggle NvimTree" },
{ "<leader>fe", "<cmd>NvimTreeFocus<CR>", desc = "Focus NvimTree" },
},
lazy = false,
dependencies = {
"nvim-tree/nvim-web-devicons", -- optional icons
},
opts = function()
local api = require("nvim-tree.api")
return {
-- disable_netrw = false,
-- hiack_netrw = true,
view = {
width = 35,
side = "left",
preserve_window_proportions = true,
},
hijack_cursor = true,
view = {
adaptive_size = true,
},
renderer = {
highlight_git = true,
highlight_opened_files = "name",
indent_markers = {
enable = true,
},
icons = {
show = {
git = true,
folder = true,
file = true,
folder_arrow = true,
},
},
},
git = {
enable = true,
ignore = false,
},
actions = {
open_file = {
quit_on_open = true,
},
},
on_attach = function(bufnr)
api.config.mappings.default_on_attach(bufnr)
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
local map = vim.keymap.set
map("n", "<CR>", api.node.open.edit, opts("Open"))
map("n", "l", api.node.open.edit, opts("Open"))
map("n", "o", api.node.open.edit, opts("Open"))
map("n", "v", api.node.open.vertical, opts("Open Vertical"))
map("n", "s", api.node.open.horizontal, opts("Open Horizontal"))
map("n", "a", api.fs.create, opts("Create"))
map("n", "d", api.fs.remove, opts("Delete"))
map("n", "r", api.fs.rename, opts("Rename"))
map("n", "x", api.fs.cut, opts("Cut"))
map("n", "y", api.fs.copy.node, opts("Copy"))
map("n", "p", api.fs.paste, opts("Paste"))
map("n", "q", api.tree.close, opts("Close"))
map("n", "?", api.tree.toggle_help, opts("Help"))
map("n", "<C-t>", api.tree.change_root_to_parent, opts("Up"))
map("n", "h", api.node.navigate.parent_close, opts("close_node"))
end,
}
end,
}
}
-- local function opts(desc)
-- return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
-- end
-- -- default mappings
-- api.config.mappings.default_on_attach(bufnr)
-- -- custom mappings
-- end
-- -- set termguicolors to enable highlight groups
-- vim.opt.termguicolors = true
-- -- OR setup with some options
-- nvim_tree.setup({
-- on_attach = my_on_attach,
-- sort_by = "case_sensitive",
-- renderer = {
-- highlight_git = true,
-- root_folder_modifier = ":t",
-- icons = {
-- show = {
-- file = true,
-- folder = true,
-- folder_arrow = true,
-- git = true,
-- },
-- glyphs = {
-- default = "",
-- symlink = "",
-- git = {
-- unstaged = "",
-- staged = "S",
-- unmerged = "",
-- renamed = "➜",
-- deleted = "",
-- untracked = "U",
-- ignored = "◌",
-- },
-- folder = {
-- default = "",
-- open = "",
-- empty = "",
-- empty_open = "",
-- symlink = "",
-- },
-- }
-- }
-- },
-- filters = {
-- dotfiles = true,
-- },
-- update_cwd = true,
-- diagnostics = {
-- enable = true,
-- icons = {
-- hint = "",
-- info = "",
-- warning = "",
-- error = "",
-- },
-- },
-- })
-- }

115
lua/plugins/telescope.lua Normal file
View file

@ -0,0 +1,115 @@
return {
'nvim-telescope/telescope.nvim',
dependencies = { {'nvim-lua/plenary.nvim'} },
opts = function()
local actions = require "telescope.actions"
local builtin = require "telescope.builtin"
return {
defaults = {
prompt_prefix = ">> ",
selection_caret = "$ ",
path_display = { "smart" },
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-c>"] = actions.close,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-l>"] = actions.complete_tag,
["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
},
n = {
["<esc>"] = actions.close,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["?"] = actions.which_key,
},
},
},
}
end,
}
-- local status_ok, telescope = pcall(require, "telescope")
-- if not status_ok then
-- return
-- end
-- telescope.load_extension('media_files')
-- telescope.setup {
-- pickers = {
-- -- find_files = { theme = 'dropdown'},
-- -- Default configuration for builtin pickers goes here:
-- -- picker_name = {
-- -- picker_config_key = value,
-- -- ...
-- -- },
-- -- Now the picker_config_key will be applied every time you call this
-- -- builtin picker
-- planets = {
-- show_pluto = true,
-- show_moon = true,
-- },
-- },
-- extensions = {
-- media_files = {
-- -- filetypes whitelist
-- -- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
-- filetypes = {"png", "webp", "jpg", "jpeg"},
-- -- find command (defaults to `fd`)
-- find_cmd = "rg"
-- }
-- },
-- }

View file

@ -1,80 +0,0 @@
local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
return
end
local function my_on_attach(bufnr)
local api = require "nvim-tree.api"
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set("n", "<C-t>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
vim.keymap.set("n", "l", api.node.open.edit, opts("Open"))
vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("close_node"))
end
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
-- OR setup with some options
nvim_tree.setup({
on_attach = my_on_attach,
sort_by = "case_sensitive",
view = {
adaptive_size = true,
},
hijack_cursor = true,
renderer = {
highlight_git = true,
root_folder_modifier = ":t",
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
glyphs = {
default = "",
symlink = "",
git = {
unstaged = "",
staged = "S",
unmerged = "",
renamed = "",
deleted = "",
untracked = "U",
ignored = "",
},
folder = {
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
},
}
}
},
filters = {
dotfiles = true,
},
update_cwd = true,
diagnostics = {
enable = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
})

View file

@ -1,93 +0,0 @@
local fn = vim.fn
-- Automatically install packer
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
PACKER_BOOTSTRAP = fn.system {
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
}
print "Installing packer close and reopen Neovim..."
vim.cmd [[packadd packer.nvim]]
end
-- Autocommand that reloads neovim whenever you save the plugins.lua file
vim.cmd [[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerSync
augroup end
]]
-- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, "packer")
if not status_ok then
return
end
-- Have packer use a popup window
packer.init {
display = {
open_fn = function()
return require("packer.util").float { border = "rounded" }
end,
},
}
-- Install your plugins here
return packer.startup(function(use)
-- My plugins here
use "wbthomason/packer.nvim" -- Have packer manage itself
use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim
use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins
use "windwp/nvim-autopairs" -- Autopairs
-- use "numToStr/Comment.nvim" -- Easily comment stuff
use 'kyazdani42/nvim-web-devicons'
use 'kyazdani42/nvim-tree.lua'
-- Colorschemes
-- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out
use "lunarvim/darkplus.nvim"
use "akinsho/bufferline.nvim"
use "moll/vim-bbye"
-- cmp plugins
use "hrsh7th/nvim-cmp" -- The completion plugin
use "hrsh7th/cmp-buffer" -- buffer completions
use "hrsh7th/cmp-path" -- path completions
use "hrsh7th/cmp-cmdline" -- cmdline completions
use "saadparwaiz1/cmp_luasnip" -- snippet completions
use "hrsh7th/cmp-nvim-lsp"
-- snippets
use "L3MON4D3/LuaSnip" --snippet engine
use "rafamadriz/friendly-snippets" -- a bunch of snippets to use
-- LSP
use "neovim/nvim-lspconfig" -- enable LSP
use "williamboman/mason.nvim" -- simple to use language server installer
use "williamboman/mason-lspconfig.nvim" -- simple to use language server installer
-- Telescope
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
use "nvim-telescope/telescope-media-files.nvim"
-- Treesitter
use {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
}
-- use "p00f/nvim-ts-rainbow"
-- use "nvim-treesitter/playground"
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end)

View file

@ -1,108 +0,0 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
telescope.load_extension('media_files')
local actions = require "telescope.actions"
local builtin = require 'telescope.builtin'
telescope.setup {
defaults = {
prompt_prefix = "",
selection_caret = "",
path_display = { "smart" },
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-c>"] = actions.close,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-l>"] = actions.complete_tag,
["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
},
n = {
["<esc>"] = actions.close,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["?"] = actions.which_key,
},
},
},
pickers = {
-- find_files = { theme = 'dropdown'},
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- },
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
planets = {
show_pluto = true,
show_moon = true,
},
},
extensions = {
media_files = {
-- filetypes whitelist
-- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
filetypes = {"png", "webp", "jpg", "jpeg"},
-- find command (defaults to `fd`)
find_cmd = "rg"
}
},
}