Changing the configuration of telescope a bit to add in the use of the file_browser extension, and adding a shortcut to open the file_browser where the current buffer's file is.

This commit is contained in:
Finch 2024-03-04 15:44:40 -06:00
parent 7817df3b90
commit 1e55d6394d

View File

@ -1,36 +1,64 @@
return {
'nvim-telescope/telescope.nvim',
config = function()
config = function(_, opts)
local telescope = require('telescope')
local actions = require('telescope.actions')
require('telescope').setup {
defaults = {
file_ignore_patterns = {
'.png$',
'.jpg$',
'.jpeg$',
'.ico$',
'.icns$',
'.webp$',
'.uproject$',
'-workspace$',
local fb_actions = telescope.extensions.file_browser.actions
opts.defaults = {
file_ignore_patterns = {
'.png$',
'.jpg$',
'.jpeg$',
'.ico$',
'.icns$',
'.webp$',
'.uproject$',
'-workspace$',
},
layout_config = { prompt_position = 'top' },
layout_strategy = 'horizontal',
mappings = {
i = {
['<ESC>'] = actions.close
},
-- layout_strategy = 'vertical',
-- layout_config = {
-- height = 0.0
-- },
results_title = false,
prompt_prefix = '',
selection_caret = '',
},
prompt_prefix = '',
results_title = false,
selection_caret = '',
sorting_strategy = 'ascending',
winblend = 0,
}
opts.pickers = {
diagnostics = {
theme = 'ivy',
initial_mode = 'normal',
layout_config = {
preview_cutoff = 9999,
},
},
}
opts.extensions = {
file_browser = {
theme = 'dropdown',
hijack_netrw = true,
mappings = {
i = {
['<ESC>'] = actions.close
['n'] = {
['N'] = fb_actions.create,
['h'] = fb_actions.goto_parent_dir,
},
},
},
}
telescope.setup(opts)
telescope.load_extension('file_browser')
end,
dependencies = {
'nvim-lua/plenary.nvim'
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-file-browser.nvim',
},
keys = {
{
@ -94,5 +122,26 @@ return {
require('telescope.builtin').lsp_dynamic_workspace_symbols()
end
},
{
'sf',
function()
local telescope = require('telescope')
local function telescope_buffer_dir()
return vim.fn.expand('%:p:h')
end
telescope.extensions.file_browser.file_browser({
path = '%:p:h',
cwd = telescope_buffer_dir(),
respect_gitignore = false,
hidden = true,
grouped = true,
previewer = false,
initial_mode = 'normal',
layout_config = {height = 40},
})
end,
},
},
}