trying built-in telescope browser instead of vinegar
This commit is contained in:
parent
cd91da4ce2
commit
61eae2fd0f
5 changed files with 55 additions and 21 deletions
|
@ -1,6 +1,3 @@
|
|||
-- launch file browser when opening on a directory
|
||||
vim.api.nvim_command('au VimEnter * lua require("userfuncs").browse_if_dir()')
|
||||
|
||||
-- recognize csx files as csharp
|
||||
vim.api.nvim_command('au BufRead,BufNewFile *.csx set filetype=cs')
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ vim.api.nvim_set_keymap('i', '<Up>', '<c-\\><c-o>gk', snoremap)
|
|||
vim.api.nvim_set_keymap('i', '<Down>', '<c-\\><c-o>gj', snoremap)
|
||||
|
||||
-- file navigation
|
||||
vim.api.nvim_set_keymap('n', '-', '<cmd>lua require("telescope").extensions.vinegar.file_browser()<cr>', noremap)
|
||||
vim.api.nvim_set_keymap('n', '-', '<cmd>:Telescope file_browser<cr>', noremap)
|
||||
vim.api.nvim_set_keymap('n', '<F1>', '<cmd>b#<cr>', noremap)
|
||||
vim.api.nvim_set_keymap('i', '<F1>', '<cmd>b#<cr>', noremap)
|
||||
vim.api.nvim_set_keymap('n', '<leader>-', '<cmd>lua require("telescope.builtin").find_files('..cwdopt..')<cr>', noremap)
|
||||
|
|
|
@ -37,16 +37,64 @@ require('luasnip.loaders.from_snipmate').lazy_load({
|
|||
})
|
||||
|
||||
-- replace built in selector with telescope
|
||||
local fb_actions = require'telescope'.extensions.file_browser.actions
|
||||
require('telescope').setup {
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {
|
||||
-- even more opts
|
||||
}
|
||||
}
|
||||
require("telescope.themes").get_dropdown {}
|
||||
},
|
||||
file_browser = {
|
||||
initial_mode = "normal",
|
||||
hijack_netrw = true,
|
||||
dir_icon = "",
|
||||
mappings = {
|
||||
["i"] = {
|
||||
["<A-c>"] = false,
|
||||
["<S-CR>"] = false,
|
||||
["<A-r>"] = false,
|
||||
["<A-m>"] = false,
|
||||
["<A-y>"] = false,
|
||||
["<A-d>"] = false,
|
||||
["<C-o>"] = false,
|
||||
["<C-g>"] = false,
|
||||
["<C-e>"] = false,
|
||||
["<C-w>"] = false,
|
||||
["<C-t>"] = false,
|
||||
["<C-f>"] = false,
|
||||
["<C-h>"] = false,
|
||||
["<C-s>"] = false,
|
||||
["<Tab>"] = false,
|
||||
["<S-Tab>"] = false,
|
||||
["<bs>"] = false,
|
||||
},
|
||||
["n"] = {
|
||||
c = false,
|
||||
r = false,
|
||||
m = false,
|
||||
y = false,
|
||||
d = false,
|
||||
o = false,
|
||||
g = false,
|
||||
e = false,
|
||||
w = false,
|
||||
t = false,
|
||||
f = false,
|
||||
h = false,
|
||||
s = false,
|
||||
["<Tab>"] = false,
|
||||
["<S-Tab>"] = false,
|
||||
["-"] = fb_actions.goto_parent_dir,
|
||||
["/"] = function()
|
||||
vim.cmd('startinsert')
|
||||
end,
|
||||
["+"] = fb_actions.create,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
require('telescope').load_extension('ui-select')
|
||||
require('telescope').load_extension('file_browser')
|
||||
|
||||
-- autocomplete config
|
||||
local cmp = require 'cmp'
|
||||
|
@ -203,7 +251,7 @@ require'lualine'.setup {
|
|||
lualine_x = {{
|
||||
"diagnostics",
|
||||
sources = {"nvim_lsp"},
|
||||
icons_enabled = false
|
||||
icons_enabled = true
|
||||
}},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'},
|
||||
|
|
|
@ -2,6 +2,7 @@ return require('packer').startup(function()
|
|||
local pid = vim.fn.getpid()
|
||||
|
||||
use 'wbthomason/packer.nvim' -- plugin manager
|
||||
use 'nvim-tree/nvim-web-devicons' -- file icons
|
||||
use 'rktjmp/lush.nvim'
|
||||
use { -- color scheme
|
||||
'catppuccin/nvim',
|
||||
|
@ -35,7 +36,6 @@ return require('packer').startup(function()
|
|||
use 'Pocco81/TrueZen.nvim' -- distraction free writing
|
||||
use 'https://code.sitosis.com/rudism/telescope-dict.nvim.git' -- thesaurus and dictionary
|
||||
use 'nvim-telescope/telescope-file-browser.nvim' -- file picker
|
||||
use 'https://code.sitosis.com/rudism/telescope-vinegar.nvim.git' -- thesaurus and dictionary
|
||||
use 'tpope/vim-dadbod' -- database query runner
|
||||
use 'tpope/vim-dotenv' -- .env configuration support
|
||||
use 'kristijanhusak/vim-dadbod-completion' -- sql completion
|
||||
|
|
|
@ -25,17 +25,6 @@ local rootfiles = {
|
|||
'*.sln'
|
||||
}
|
||||
|
||||
M.browse_if_dir = function()
|
||||
if require('plenary.path'):new(vim.fn.expand('%:p')):is_dir() then
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
vim.api.nvim_buf_set_option(buf, 'buftype', 'nofile')
|
||||
vim.api.nvim_buf_set_option(buf, 'buflisted', false)
|
||||
vim.api.nvim_buf_set_option(buf, 'swapfile', false)
|
||||
vim.api.nvim_buf_set_option(buf, 'bufhidden', 'hide')
|
||||
require('telescope').extensions.vinegar.file_browser()
|
||||
end
|
||||
end
|
||||
|
||||
M.find_project_root = function()
|
||||
local stop_at = parent_dir(os.getenv('HOME'))
|
||||
local cwd = vim.fn.expand('%:p:h')
|
||||
|
|
Loading…
Reference in a new issue