diff options
Diffstat (limited to 'lua/aotrix/plugins')
| -rw-r--r-- | lua/aotrix/plugins/telescope.lua | 47 | ||||
| -rw-r--r-- | lua/aotrix/plugins/theme.lua | 5 |
2 files changed, 49 insertions, 3 deletions
diff --git a/lua/aotrix/plugins/telescope.lua b/lua/aotrix/plugins/telescope.lua index e7c11aa..6345f45 100644 --- a/lua/aotrix/plugins/telescope.lua +++ b/lua/aotrix/plugins/telescope.lua @@ -1,3 +1,42 @@ +local builtin = require('telescope.builtin') +local action_state = require('telescope.actions.state') +local actions = require('telescope.actions') + +buffer_searcher = function() + builtin.buffers { + sort_mru = true, + ignore_current_buffer = true, + show_all_buffers = false, + attach_mappings = function(prompt_bufnr, map) + local refresh_buffer_searcher = function() + actions.close(prompt_bufnr) + vim.schedule(buffer_searcher) + end + + local delete_buf = function() + local selection = action_state.get_selected_entry() + vim.api.nvim_buf_delete(selection.bufnr, {force = true}) + refresh_buffer_searcher() + end + + local delete_multiple_buf = function() + local picker = action_state.get_current_picker(prompt_bufnr) + local selection = picker:get_multi_selection() + for _, entry in ipairs(selection) do + vim.api.nvim_buf_delete(entry.bufnr, {force = true}) + end + refresh_buffer_searcher() + end + + map('n', 'dd', delete_buf) + map('n', '<C-d>', delete_multiple_buf) + map('i', '<C-d>', delete_multiple_buf) + + return true + end + } +end + return { 'nvim-telescope/telescope.nvim', branch = 'master', @@ -19,7 +58,6 @@ return { -- map actions.which_key to <C-h> (default: <C-/>) -- actions.which_key shows the mappings for your picker, -- e.g. git_{create, delete, ...}_branch for the git_branches picker - ["<esc>"] = actions.close, ["<C-c>"] = actions.close, ["<CR>"] = actions.select_default } @@ -38,7 +76,10 @@ return { scroll_strategy = "limit", file_ignore_patterns = {".git/[^h]"} }, - pickers = {find_files = {hidden = true}}, + pickers = { + find_files = {hidden = true}, + buffers = {initial_mode = "normal"} + }, extensions = {fzf = {}} }) @@ -106,6 +147,8 @@ return { require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + map("<leader>pb", buffer_searcher, "[P]roject [B]uffers", {"n"}) + -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame') diff --git a/lua/aotrix/plugins/theme.lua b/lua/aotrix/plugins/theme.lua index 76e2df0..278222f 100644 --- a/lua/aotrix/plugins/theme.lua +++ b/lua/aotrix/plugins/theme.lua @@ -1,4 +1,7 @@ return { "rebelot/kanagawa.nvim", - config = function() vim.cmd("colorscheme kanagawa-wave") end + config = function() + -- vim.cmd("colorscheme kanagawa-wave") + vim.cmd("colorscheme default") + end } |
