From 0cde83cfa15c5c0b8d117c34a8bfae38b4dec39c Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Sun, 26 Mar 2023 19:37:38 +0200 Subject: feat: remove mind since is deprecated --- lua/alpha/telescope/actions.lua | 6 ++++++ lua/alpha/telescope/init.lua | 14 +++++++++++++- lua/alpha/telescope/mappings.lua | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'lua/alpha/telescope') diff --git a/lua/alpha/telescope/actions.lua b/lua/alpha/telescope/actions.lua index abd3381..c7cdaa8 100644 --- a/lua/alpha/telescope/actions.lua +++ b/lua/alpha/telescope/actions.lua @@ -160,4 +160,10 @@ M.enable_plugin = function(prompt_bufnr) end) end +M.create_scratch_file = function(prompt_bufnr) + local new_scratch = action_state.get_current_line() + actions.close(prompt_bufnr) + vim.cmd(string.format("edit ~/.config/nvim/lua/scratchs/%s.lua", new_scratch)) +end + return M diff --git a/lua/alpha/telescope/init.lua b/lua/alpha/telescope/init.lua index b5087b3..28397b0 100644 --- a/lua/alpha/telescope/init.lua +++ b/lua/alpha/telescope/init.lua @@ -8,7 +8,6 @@ local reloader = function() end end -local action_state = require "telescope.actions.state" local fb_actions = require("telescope").extensions.file_browser.actions local actions = require "telescope.actions" local my_actions = require "alpha.telescope.actions" @@ -94,6 +93,19 @@ function M.my_plugins() } end +function M.scratchs() + require("telescope.builtin").find_files { + prompt_title = "Scratchs", + no_ignore = true, + cwd = "~/.config/nvim/lua/scratchs/", + attach_mappings = function (_, map) + map("i", "", my_actions.create_scratch_file) + + return true + end + } +end + function M.projectionist() return require("telescope").extensions.projectionist.projectionist() end diff --git a/lua/alpha/telescope/mappings.lua b/lua/alpha/telescope/mappings.lua index 7d0f697..be59eaf 100644 --- a/lua/alpha/telescope/mappings.lua +++ b/lua/alpha/telescope/mappings.lua @@ -29,6 +29,7 @@ map_tele("pf", "projectionist") map_tele("rc", "search_config") map_tele("rn", "find_nvim_config") map_tele("rp", "find_nvim_plugin") +map_tele("rs", "scratchs") map_tele("ph", "help_tags") map_tele("pe", "buffers") map_tele("pr", "treesitter") -- cgit v1.2.3