vim: add telescope file browser

This commit is contained in:
Fernando Schauenburg 2022-10-12 23:05:11 +02:00
parent 6cf3c04ae4
commit facde2d550
2 changed files with 53 additions and 34 deletions

View file

@ -2,6 +2,58 @@ local ok, telescope = pcall(require, 'telescope')
if not ok then return end
local actions = require 'telescope.actions'
telescope.setup {
defaults = {
prompt_prefix = ' ',
selection_caret = '',
layout_strategy = 'flex',
layout_config = {
anchor = 'center',
width = 0.92,
height = 0.95,
flex = {
flip_columns = 130,
},
horizontal = {
preview_width = 0.5,
preview_cutoff = 130,
},
vertical = {
preview_height = 0.5,
},
},
mappings = {
i = {
['<c-j>'] = actions.cycle_history_next,
['<c-k>'] = actions.cycle_history_prev,
},
},
},
extensions = {
file_browser = {
theme = 'ivy',
mappings = {
n = {
-- normal mode mappings go here
},
i = {
-- insert mode mappings go here
},
},
},
},
}
telescope.load_extension 'file_browser'
vim.keymap.set('n', '<leader>br', '<cmd>Telescope file_browser<cr>')
local builtin = require 'telescope.builtin'
local find_buffers = function()
@ -53,40 +105,6 @@ local find_options = function()
}
end
telescope.setup {
defaults = {
prompt_prefix = ' ',
selection_caret = '',
layout_strategy = 'flex',
layout_config = {
anchor = 'center',
width = 0.92,
height = 0.95,
flex = {
flip_columns = 130,
},
horizontal = {
preview_width = 0.5,
preview_cutoff = 130,
},
vertical = {
preview_height = 0.5,
},
},
mappings = {
i = {
['<c-j>'] = actions.cycle_history_next,
['<c-k>'] = actions.cycle_history_prev,
},
},
},
}
vim.keymap.set('n', '<leader>fb', find_buffers)
vim.keymap.set('n', '<leader>fc', find_commits)
vim.keymap.set('n', '<leader>fd', find_dotfiles)

View file

@ -32,6 +32,7 @@ packer.startup(function(use)
-- Navigation -------------------------------------------------------------
use 'nvim-telescope/telescope.nvim'
use 'nvim-telescope/telescope-file-browser.nvim'
use 'kyazdani42/nvim-tree.lua'
-- Editing ----------------------------------------------------------------