vim: add telescope file browser
This commit is contained in:
parent
6cf3c04ae4
commit
facde2d550
2 changed files with 53 additions and 34 deletions
|
@ -2,6 +2,58 @@ local ok, telescope = pcall(require, 'telescope')
|
||||||
if not ok then return end
|
if not ok then return end
|
||||||
|
|
||||||
local actions = require 'telescope.actions'
|
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 builtin = require 'telescope.builtin'
|
||||||
|
|
||||||
local find_buffers = function()
|
local find_buffers = function()
|
||||||
|
@ -53,40 +105,6 @@ local find_options = function()
|
||||||
}
|
}
|
||||||
end
|
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>fb', find_buffers)
|
||||||
vim.keymap.set('n', '<leader>fc', find_commits)
|
vim.keymap.set('n', '<leader>fc', find_commits)
|
||||||
vim.keymap.set('n', '<leader>fd', find_dotfiles)
|
vim.keymap.set('n', '<leader>fd', find_dotfiles)
|
||||||
|
|
|
@ -32,6 +32,7 @@ packer.startup(function(use)
|
||||||
|
|
||||||
-- Navigation -------------------------------------------------------------
|
-- Navigation -------------------------------------------------------------
|
||||||
use 'nvim-telescope/telescope.nvim'
|
use 'nvim-telescope/telescope.nvim'
|
||||||
|
use 'nvim-telescope/telescope-file-browser.nvim'
|
||||||
use 'kyazdani42/nvim-tree.lua'
|
use 'kyazdani42/nvim-tree.lua'
|
||||||
|
|
||||||
-- Editing ----------------------------------------------------------------
|
-- Editing ----------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Reference in a new issue