diff --git a/dots/.config/nvim/lua/plugins/configs/telescope.lua b/dots/.config/nvim/lua/plugins/configs/telescope.lua index a993d470..c1f49c4e 100644 --- a/dots/.config/nvim/lua/plugins/configs/telescope.lua +++ b/dots/.config/nvim/lua/plugins/configs/telescope.lua @@ -3,7 +3,6 @@ return { "nvim-telescope/telescope.nvim", cmd = { "Telescope", - "Search", }, keys = { { @@ -164,70 +163,6 @@ return { telescope.load_extension("smart_history") telescope.load_extension("undo") telescope.load_extension("frecency") - - vim.api.nvim_create_user_command("Search", function() - -- Thank you u/SPEKTRUMdagreat :) - local search = vim.fn.input("Search: ") - local pickers = require("telescope.pickers") - local finders = require("telescope.finders") - local conf = require("telescope.config").values - ---@diagnostic disable-next-line: redefined-local - local actions = require("telescope.actions") - local action_state = require("telescope.actions.state") - - -- our picker function: colors - local searcher = function(opts) - opts = opts or {} - pickers - .new(opts, { - prompt_title = "OmniSearch", - finder = finders.new_table({ - results = { - { - "Stack Overflow", - ("https://www.stackoverflow.com/search?q=" .. search:gsub(" ", "+")), - }, - { "Google Search", ("www.google.com/search?q=" .. search:gsub(" ", "+")) }, - { - "Youtube", - ("https://www.youtube.com/results?search_query=" .. search:gsub(" ", "+")), - }, - { - "Wikipedia", - ("https://en.wikipedia.org/w/index.php?search=" .. search:gsub(" ", "+")), - }, - { "Github", ("https://github.com/search?q=" .. search:gsub(" ", "+")) }, - }, - entry_maker = function(entry) - return { value = entry, display = entry[1], ordinal = entry[1] } - end, - }), - sorter = conf.generic_sorter(opts), - attach_mappings = function(prompt_bufnr, _) - actions.select_default:replace(function() - actions.close(prompt_bufnr) - local selection = action_state.get_selected_entry() - ---@param obj vim.SystemCompleted - vim.system({ "xdg-open", selection["value"][2] }, { text = true }, function(obj) - if obj.code ~= 0 then - vim.notify( - string.format( - "Failed to open selection, exit code: %s!\n---Stdout---\n%s\n---Stderr---\n%s", - obj.code, - obj.stdout, - obj.stderr - ) - ) - end - end) - end) - return true - end, - }) - :find() - end - searcher(require("telescope.themes").get_dropdown({})) - end, { nargs = 0 }) end, }, }