Remove all org files using a new script to more config over, The old org file configuaration were great but required org. This new version only requires the scripts that is included in the repo. The configuration are all done but have not ported the theming system yet. Signed-off-by: Steve Beaulac <steve@sagacity.ca> Change-Id: I14cd7fe058a71c8ba9d6d35397dc8d7e6a6a6964
33 lines
1.5 KiB
Lua
33 lines
1.5 KiB
Lua
function R(name)
|
|
require("plenary.reload").reload_module(name)
|
|
end
|
|
|
|
function websearch(url, o)
|
|
-- Get visual selection or prompt for search
|
|
local search_term
|
|
|
|
-- Check if there's a visual selection
|
|
if vim.fn.mode() == 'v' or vim.fn.mode() == 'V' then
|
|
-- Get the visual selection
|
|
local start_pos = vim.fn.getpos("'<")
|
|
local end_pos = vim.fn.getpos("'>")
|
|
local lines = vim.fn.getline(start_pos[2], end_pos[2])
|
|
local selected_text = table.concat(lines, " ")
|
|
search_term = selected_text
|
|
else
|
|
search_term = (o and o.args) or vim.fn.input("Search: ")
|
|
end
|
|
|
|
-- Encode the search term for URLs
|
|
local escaped = vim.uri_encode(search_term)
|
|
|
|
-- Construct and execute the search URL
|
|
local search_url = (url):format(escaped)
|
|
|
|
vim.ui.open(search_url)
|
|
end
|
|
-- Command to call the search function
|
|
vim.api.nvim_create_user_command('DuckDuckGo', function(o) websearch('https://duckduckgo.com/?q=%s', o) end, { nargs = 1 })
|
|
vim.api.nvim_create_user_command('Docsrs', function(o) websearch('https://docs.rs/%s', o) end, { nargs = 1})
|
|
vim.api.nvim_create_user_command('RustStd', function(o) websearch('https://doc.rust-lang.org/std/?search=%s', o) end, { nargs = 1})
|
|
vim.keymap.set({ 'n', 'v'}, '<leader>sW', function() websearch('https://duckduckgo.com/?q=%s', null) end, { desc = "Search on DuckDuckGo" }) |