Add undo extension to telescope (#1)

Co-authored-by: Musko, Mateusz <mateusz.musko@fujitsu.com>
This commit is contained in:
MuskoM 2024-09-06 12:01:56 +02:00 committed by GitHub
parent 5ed5d6b400
commit 31ab3ac2ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 4 deletions

View File

@ -26,9 +26,10 @@ vim.opt.showmode = false
-- Schedule the setting after `UiEnter` because it can increase startup-time. -- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent. -- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'` -- See `:help 'clipboard'`
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus' -- vim.schedule(function()
end) -- vim.opt.clipboard = 'unnamedplus'
-- end)
-- Enable break indent -- Enable break indent
vim.opt.breakindent = true vim.opt.breakindent = true
@ -60,6 +61,10 @@ vim.opt.splitbelow = true
vim.opt.list = true vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' } vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
-- Define tab as 4 spaces
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
-- Preview substitutions live, as you type! -- Preview substitutions live, as you type!
vim.opt.inccommand = 'nosplit' vim.opt.inccommand = 'nosplit'
@ -281,7 +286,7 @@ require('lazy').setup({
end, end,
}, },
{ 'nvim-telescope/telescope-ui-select.nvim' }, { 'nvim-telescope/telescope-ui-select.nvim' },
{ 'debugloop/telescope-undo.nvim' },
-- Useful for getting pretty icons, but requires a Nerd Font. -- Useful for getting pretty icons, but requires a Nerd Font.
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
}, },
@ -321,12 +326,16 @@ require('lazy').setup({
['ui-select'] = { ['ui-select'] = {
require('telescope.themes').get_dropdown(), require('telescope.themes').get_dropdown(),
}, },
['undo'] = {
-- telescope-undo.nvim config
},
}, },
} }
-- Enable Telescope extensions if they are installed -- Enable Telescope extensions if they are installed
pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select') pcall(require('telescope').load_extension, 'ui-select')
pcall(require('telescope').load_extension, 'undo')
-- See `:help telescope.builtin` -- See `:help telescope.builtin`
local builtin = require 'telescope.builtin' local builtin = require 'telescope.builtin'
@ -340,6 +349,7 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' }) 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>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><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>u', "<cmd> Telescope undo<cr>", {desc = '[u]ndo'})
-- Slightly advanced example of overriding default behavior and theme -- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function() vim.keymap.set('n', '<leader>/', function()