aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-09-18 19:55:13 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-09-19 08:18:18 -0300
commit524edea420a1797ecfa3a68f44879f5214ca8a27 (patch)
tree3e389ad533ea71e6ab39a3bb3dbe1c998d3cc3d3
parent880f1223919a0f165b48fb1639fd79ba3f755cc1 (diff)
downloadluakit-524edea420a1797ecfa3a68f44879f5214ca8a27.tar.gz
luakit-524edea420a1797ecfa3a68f44879f5214ca8a27.tar.bz2
More yanking
-rw-r--r--config.dot/luakit.link/binds.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/config.dot/luakit.link/binds.lua b/config.dot/luakit.link/binds.lua
index 4ec70ec..b2b10d4 100644
--- a/config.dot/luakit.link/binds.lua
+++ b/config.dot/luakit.link/binds.lua
@@ -186,6 +186,56 @@ add_binds("normal", {
w:notify("Yanked title: " .. title)
end),
+ -- Yank URL and title as a Markdown link
+ buf("^ym$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = '[' .. title .. '](' .. uri .. ')'
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
+ -- Yank URL and title as a reStructuredText link
+ buf("^yr$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = '`' .. title .. '` <' .. uri .. '>`_'
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
+ -- Yank URL and title as a Trac link
+ buf("^yc$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = '[' .. uri .. ' ' .. title .. ']'
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
+ -- Yank URL and title as an HTML link
+ buf("^yh$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = '<a href="' .. uri .. '">' .. title .. '</a>'
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
+ -- Yank URL and title as a shareable link
+ buf("^ys$", function (w)
+ local title = w.view.title
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ local link = title .. ' - ' .. uri
+ luakit.selection.primary = link
+ luakit.selection.clipboard = link
+ w:notify("Yanked link: " .. link)
+ end),
+
-- Commands
key({"Control"}, "a", function (w) w:navigate(w:inc_uri(1)) end),
key({"Control"}, "x", function (w) w:navigate(w:inc_uri(-1)) end),