Merge pull request #3 from youvegotmoxie/feature/add-telescope-zoxide-extension
Add telescope zoxide extension and update dashboard plugin
This commit is contained in:
commit
897cc8f596
12
init.lua
12
init.lua
|
@ -330,6 +330,7 @@ require('lazy').setup({
|
|||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'jonarrien/telescope-cmdline.nvim',
|
||||
'jvgrootveld/telescope-zoxide',
|
||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
|
||||
|
@ -385,6 +386,15 @@ require('lazy').setup({
|
|||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
},
|
||||
zoxide = {
|
||||
mappings = {
|
||||
default = {
|
||||
after_action = function(selection)
|
||||
print('Update to (' .. selection.z_score .. ') ' .. selection.path)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -392,6 +402,7 @@ require('lazy').setup({
|
|||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
pcall(require('telescope').load_extension, 'cmdline')
|
||||
pcall(require('telescope').load_extension, 'zoxide')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require 'telescope.builtin'
|
||||
|
@ -408,6 +419,7 @@ require('lazy').setup({
|
|||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>Z', require('telescope').extensions.zoxide.list, { desc = 'Open [Z]oxide' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
|
|
|
@ -1,19 +1,70 @@
|
|||
return {
|
||||
{
|
||||
'nvimdev/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
config = function()
|
||||
require('dashboard').setup {
|
||||
theme = 'hyper',
|
||||
lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
|
||||
dependencies = {
|
||||
{ 'nvim-tree/nvim-web-devicons' },
|
||||
},
|
||||
opts = function()
|
||||
local logo = [[
|
||||
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]]
|
||||
|
||||
logo = string.rep('\n', 8) .. logo .. '\n\n'
|
||||
|
||||
local builtin = require 'telescope.builtin'
|
||||
local opts = {
|
||||
theme = 'doom',
|
||||
hide = {
|
||||
-- this is taken care of by lualine
|
||||
-- enabling this messes up the actual laststatus setting after loading a file
|
||||
statusline = false,
|
||||
},
|
||||
config = {
|
||||
week_header = { enable = true },
|
||||
footer = {},
|
||||
shortcut = {
|
||||
{ desc = ' Update Lazy', group = '@property', action = 'Lazy update', key = 'u' },
|
||||
},
|
||||
header = vim.split(logo, '\n'),
|
||||
-- stylua: ignore
|
||||
center = {
|
||||
{ action = builtin.find_files, desc = " Find File", icon = " ", key = "f" },
|
||||
{ action = "ene | startinsert", desc = " New File", icon = " ", key = "n" },
|
||||
{ action = builtin.oldfiles, desc = " Recent Files", icon = " ", key = "r" },
|
||||
{ action = builtin.live_grep, desc = " Find Text", icon = " ", key = "g" },
|
||||
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
|
||||
{ action = "Lazy", desc = " Lazy", icon = " ", key = "l" },
|
||||
{ action = "Mason", desc = " Mason", icon = "⌘ ", key = "m" },
|
||||
{ action = function() vim.api.nvim_input("<cmd>qa!<cr>") end, desc = " Quit", icon = " ", key = "q" },
|
||||
},
|
||||
footer = function()
|
||||
local stats = require('lazy').stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return { '⚡ Neovim loaded ' .. stats.loaded .. '/' .. stats.count .. ' plugins in ' .. ms .. 'ms' }
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
for _, button in ipairs(opts.config.center) do
|
||||
button.desc = button.desc .. string.rep(' ', 43 - #button.desc)
|
||||
button.key_format = ' %s'
|
||||
end
|
||||
|
||||
-- open dashboard after closing lazy
|
||||
if vim.o.filetype == 'lazy' then
|
||||
vim.api.nvim_create_autocmd('WinClosed', {
|
||||
pattern = tostring(vim.api.nvim_get_current_win()),
|
||||
once = true,
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_exec_autocmds('UIEnter', { group = 'dashboard' })
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return opts
|
||||
end,
|
||||
dependencies = { { 'nvim-tree/nvim-web-devicons' } },
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue