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:
parent
7817df3b90
commit
1e55d6394d
@ -1,9 +1,11 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
config = function()
|
||||
config = function(_, opts)
|
||||
local telescope = require('telescope')
|
||||
local actions = require('telescope.actions')
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
local fb_actions = telescope.extensions.file_browser.actions
|
||||
|
||||
opts.defaults = {
|
||||
file_ignore_patterns = {
|
||||
'.png$',
|
||||
'.jpg$',
|
||||
@ -14,23 +16,49 @@ return {
|
||||
'.uproject$',
|
||||
'-workspace$',
|
||||
},
|
||||
-- layout_strategy = 'vertical',
|
||||
-- layout_config = {
|
||||
-- height = 0.0
|
||||
-- },
|
||||
results_title = false,
|
||||
prompt_prefix = ' ',
|
||||
selection_caret = '➤ ',
|
||||
layout_config = { prompt_position = 'top' },
|
||||
layout_strategy = 'horizontal',
|
||||
mappings = {
|
||||
i = {
|
||||
['<ESC>'] = actions.close
|
||||
},
|
||||
},
|
||||
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 = {
|
||||
['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,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user