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