diff options
author | bptato <nincsnevem662@gmail.com> | 2024-01-29 20:22:39 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-01-29 20:33:59 +0100 |
commit | cc3b9ada95c438bf2c9d83fa1037aa3950da07a4 (patch) | |
tree | 06b7f553c4136a2ea9673f107193a7956c379fd4 /res | |
parent | 2a18436ca92bc46034fd8a21b2949b3991f4b0a4 (diff) | |
download | chawan-cc3b9ada95c438bf2c9d83fa1037aa3950da07a4.tar.gz |
Add command to yank link under cursor (yc)
Diffstat (limited to 'res')
-rw-r--r-- | res/chawan.html | 2 | ||||
-rw-r--r-- | res/config.toml | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/res/chawan.html b/res/chawan.html index b162027a..b4720db9 100644 --- a/res/chawan.html +++ b/res/chawan.html @@ -57,6 +57,8 @@ up/down by one row <li><kbd>,</kbd> (comma), <kbd>.</kbd> (period): previous/next buffer <li><kbd>D</kbd>: discard current buffer <li><kbd>M-y</kbd>: copy current buffer's URL to clipboard (needs xsel) +<li><kbd>yc</kbd>: copy the link currently under the cursor to clipboard (needs +xsel) <li><kbd>M-p</kbd>: go to the URL currently on the clipboard (needs xsel) <li><kbd>[</kbd>, <kbd>]</kbd>: move cursor to the previous/next hyperlink <li><kbd>C-d</kbd>, <kbd>C-u</kbd>: scroll up/down by half a page diff --git a/res/config.toml b/res/config.toml index 13691234..71e11d18 100644 --- a/res/config.toml +++ b/res/config.toml @@ -150,7 +150,7 @@ C-v = 'n => pager.cursorToggleSelection(n, {selectionType: "block"})' y = ''' async () => { if (!pager.currentSelection) { - pager.alert("No selection to yank."); + feedNext(); return; } const text = await pager.getSelectionText(pager.currentSelection); @@ -189,6 +189,17 @@ M-y = ''' pager.alert("Failed to copy URL to clipboard. (Is xsel installed?)"); } ''' +yc = ''' +() => { + const link = pager.hoverLink + if (!link) + pager.alert("Please move the cursor above a link and try again."); + else if (pager.externInto('xsel -bi', link)) + pager.alert("Copied URL to clipboard."); + else + pager.alert("Failed to copy URL to clipboard. (Is xsel installed?)"); +} +''' M-p = ''' () => { const s = pager.externCapture('xsel -bo'); |