add telescope file browser

This commit is contained in:
ksyasuda 2022-11-04 18:31:16 -07:00
parent a091ec5959
commit 2efde35597
4 changed files with 36 additions and 5 deletions

View File

@ -43,6 +43,7 @@ source ~/.config/nvim/plugin-confs/presence.lua
source ~/.config/nvim/plugin-confs/treesitter.lua source ~/.config/nvim/plugin-confs/treesitter.lua
source ~/.config/nvim/plugin-confs/whichkey.lua source ~/.config/nvim/plugin-confs/whichkey.lua
source ~/.config/nvim/plugin-confs/telescope.lua source ~/.config/nvim/plugin-confs/telescope.lua
source ~/.config/nvim/plugin-confs/telescope-file-browser.lua
source ~/.config/nvim/plugin-confs/code_actions.lua source ~/.config/nvim/plugin-confs/code_actions.lua
source ~/.config/nvim/plugin-confs/goto-preview.lua source ~/.config/nvim/plugin-confs/goto-preview.lua

View File

@ -15,7 +15,7 @@ require('packer').startup(function(use)
use { use {
"zbirenbaum/copilot.lua", "zbirenbaum/copilot.lua",
after = "lualine.nvim", event = "VimEnter",
config = function () config = function ()
vim.defer_fn(function() vim.defer_fn(function()
require('copilot').setup({ require('copilot').setup({
@ -27,7 +27,7 @@ require('packer').startup(function(use)
jump_next = "]]", jump_next = "]]",
accept = "<CR>", accept = "<CR>",
refresh = "gr", refresh = "gr",
open = "<M-CR>" open = "<C-CR>"
}, },
}, },
suggestion = { suggestion = {
@ -56,6 +56,7 @@ require('packer').startup(function(use)
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer", plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
server_opts_overrides = {}, server_opts_overrides = {},
}) })
require("copilot.suggestion").toggle_auto_trigger()
end, 100) end, 100)
end, end,
} }
@ -65,7 +66,7 @@ require('packer').startup(function(use)
after = { "copilot.lua" }, after = { "copilot.lua" },
config = function () config = function ()
require("copilot_cmp").setup({ require("copilot_cmp").setup({
-- method = "getCompletionsCycling", method = "getCompletionsCycling",
-- formatters = { -- formatters = {
-- insert_text = require("copilot_cmp.format").remove_existing -- insert_text = require("copilot_cmp.format").remove_existing
-- } -- }
@ -146,6 +147,10 @@ require('packer').startup(function(use)
use { use {
'nvim-telescope/telescope.nvim' 'nvim-telescope/telescope.nvim'
} }
use {
'nvim-telescope/telescope-file-browser.nvim'
}
use { use {
'ojroques/nvim-lspfuzzy' 'ojroques/nvim-lspfuzzy'
} }

View File

@ -15,7 +15,7 @@ db.custom_center = {
action ='SessionLoad'}, action ='SessionLoad'},
{icon = '', {icon = '',
desc = 'Recently opened files ', desc = 'Recently opened files ',
action = 'DashboardFindHistory', action = 'Telescope oldfiles',
shortcut = 'SPC f h'}, shortcut = 'SPC f h'},
{icon = '', {icon = '',
desc = 'Find File ', desc = 'Find File ',
@ -23,7 +23,7 @@ db.custom_center = {
shortcut = 'SPC f f'}, shortcut = 'SPC f f'},
{icon = '', {icon = '',
desc ='File Browser ', desc ='File Browser ',
action = 'NvimTreeToggle', action = 'Telescope file_browser',
shortcut = 'SPC f b'}, shortcut = 'SPC f b'},
{icon = '', {icon = '',
desc = 'Find word ', desc = 'Find word ',

View File

@ -0,0 +1,25 @@
local fb_actions = require "telescope".extensions.file_browser.actions
require("telescope").setup {
extensions = {
file_browser = {
-- theme = "ivy",
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = true,
mappings = {
["i"] = {
-- your custom insert mode mappings
["<C-h>"] = fb_actions.goto_home_dir,
["<C-x>"] = function(prompt_bufnr)
end
},
["n"] = {
-- your custom normal mode mappings
f = false,
},
},
},
},
}
-- To get telescope-file-browser loaded and working with telescope,
-- you need to call load_extension, somewhere after setup function:
require("telescope").load_extension "file_browser"