diff --git a/lua/sourcer/init.lua b/lua/sourcer/init.lua index dcc51ba..1e162ac 100644 --- a/lua/sourcer/init.lua +++ b/lua/sourcer/init.lua @@ -1,9 +1,18 @@ local M = {} function M.lookup() - local keywords = vim.fn.getreg("*") + local keywords = vim.fn.getreg("") -- receive highlighted text + local url = "https://dl.acm.org/action/doSearch?AllField=" .. keywords - print(keywords) + -- Setup a http socket and request + local http = require("socket.http") + local response, status_code, headers = http.request(url) + + if status_code == 200 then + print(response) + else + print("Getting sources failed with error code " .. status_code .. "!") + end end return M