telescope/nvim-tree migrated
This commit is contained in:
parent
6e636ad325
commit
6f06ad0baa
21 changed files with 368 additions and 504 deletions
147
lua/plugins/nvim-tree.lua
Normal file
147
lua/plugins/nvim-tree.lua
Normal 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
115
lua/plugins/telescope.lua
Normal 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"
|
||||
-- }
|
||||
-- },
|
||||
-- }
|
||||
Loading…
Add table
Add a link
Reference in a new issue