xyb3rt / urxvt-perls Goto Github PK
View Code? Open in Web Editor NEWPerl extensions for the rxvt-unicode terminal emulator
License: GNU General Public License v2.0
Perl extensions for the rxvt-unicode terminal emulator
License: GNU General Public License v2.0
Hej!
Would it be possible to bump the release once again to include all the fixes since 2.1? I'd like to submit a package to the voidlinux repos.
Regards,
nem
Yanking normal or line selections updates both the primary selection and the clipboard when autocopy is on. But block selections yanks updates only the primary selection, despite the value of autocopy. This is pretty strange.
Here's a patch to fix a typo in clipboard
:
https://gist.github.com/3727136
Hi first of all, I want to thank you for the awesome extensions. Everything works fine so far.
My question is, if there is any possibility to copy the test selected with keyboard-select to clipboard instead of primary. I tried to do it myself, but as I don't know perl, I wasn't able to do this
Hello,
Thanks for these tools, I use them every day. It saves me a lot of keystrokes and trackpad gestures, love it.
The default behavior of url-select match the last url of the screen. Is there a chance to add a new option to define the matching order ?
Thanks
Is it possible to add a configuration in ~/.Xresources
so that we can use clipboard rather than primary to save the selected text in keyboard-select
? Thanks.
Meta Esc
Shift V
All the lines seem to be selecting just fine, as I can yank/paste the entire selection.
Also, when you yank the selected lines with y
, the upper lines that didn't get highlighted are now highlighted, probably because the script inverts the color of the entire selection.
I think it would be useful to add a mechanism to be able to open local files (absolute paths) in the same manner as URLs.
OS: Ubuntu 10.04 LTS
Error messages when I pressed Alt+V (intend to paste from clipboard):
urxvt: Can't locate object method "tt_paste" via package "urxvt::term" at (eval 80) line 4.
but Alt+C (copy) is work.
BTW, in Ubuntu 11.10, both Alt+C and Alt+V would work.
That is weird...
my .Xdefaults config:
URxvt.perl-lib: /home/goldie/.urxvt
URxvt.perl-ext-common: default,matcher,tabbed,clipboard,selection-autotransform
URxvt.keysym.M-c: perl:clipboard:copy
URxvt.keysym.M-v: perl:clipboard:paste
URxvt.keysym.M-C-v: perl:clipboard:paste_escaped
It would be useful to copy the current line to the clipboard efficiently as it is a frequent operation.
It would be nice to have a setting to select the buffer to copy to in url-select
and keyboard-select
modes.
It's annoying to be forced to paste with a middle click in GTK apps.
Urxvt comes with a pastebin plugin (selection-pastebin) which can be triggered by calling selection-pastebin:remote-pastebin
Since:
So I would like a key in the selection plugin to invoke the selection-pastebin command selection-pastebin:remote-pastebin, maybe 'p' ?
When a url spans accross several lines in the terminal, only the first line part is selected.
It should select the whole url rather than the truncated part
Hi, the cursor doesn't get visible when it's invisible (like in mutt or cmus) with the keyboard-select plugin.
The following URL:
http://en.wikipedia.org/wiki/Dunning–Kruger_effect
is parsed as:
http://en.wikipedia.org/wiki/Dunning
I encountered this problem when I was playing around with recently-used.xbel
file, the freedesktop bookmark file, consists of lots of URIs. While doing cat recently-used.xbel
, urxvt performs just fine. But when I do tr -d "\n" < recently-used.xbel
(joining all the lines), urxvt just hangs. Unfortunately I don't know any perl at all so I cannot really debug the code myself. I'm using rxvt-unicode (urxvt) v9.12 - released: 2011-06-29
, perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-thread-multi
on Arch Linux and urxvt-perls
is latest master.
Hello,
There seems to be an error in the url-script.
perl url-select
Bareword "urxvt::RS_Uline" not allowed while "strict subs" in use at url-select line 71.
Execution of url-select aborted due to compilation errors.
I am not sure if this is a real bug or not. The reason I tried the "perl url-select" is because I keep getting these errors, whenever I start "urxvt &"
urxvt &
[1] 4895
--(~/dev/conf/urxvt/urxvt-perls)-----------------------------------------------------------------------------------------------------------(pts/0@backup)--
urxvt: perl extension 'url-select' not found in perl library search path
Thanks and sorry for the bother
Joe
It seems the left and right brackets characters are not considered to be valid URL characters.
Currently the protocols are hard coded in https://github.com/muennich/urxvt-perls/blob/master/url-select#L64, it would be nice if new protocols could be added from .xdefaluts/.xresources.
Cheers,
Since rxvt-unicode 9.14, perl extensions can be placed in $HOME/.urxvt/ext and urxvt will look there automatically. Might be a useful addition to the README, enabling more portability; your call. Thanks for putting these together!
Great scripts. One thing is missing: I hate it when the URLs are so long that they span more than one line. Can you expand the keyboard interface for your URL grabber to continue after a newline?
[Using FreeBSD, Arch Linux default URxvt 9.15 package, and urxvt-perls from github]
Hi,
I just noticed an annoying itch when using PRIMARY for paste.
URxvt.clipboard.pastecmd: xclip -o
If I select text in URxvt and then call clipboard:paste or clipboard:paste_escaped from the same terminal, then it hangs hangs forever.
It does not happen if I call xclip -o (or xsel -o) manually, nor if I call the aforementioned commands from another terminal.
Seems like that the subfunction hangs at
my $str = `$self->{paste_cmd}`;
If I kill xclip it kills the urxvt session that called it.
If I use xclip -quiet -o, then killing xclip will not kill urxvt, and the session will resume.
Xresources :
URxvt.perl-ext-common : keyboard-select,clipboard
URxvt.keysym.C-M-v: perl:clipboard:paste
URxvt.keysym.C-M-c: perl:clipboard:paste_escaped
URxvt.clipboard.pastecmd: xclip -o -quiet
Cheers.
Here is an example of what I mean:
http://i.imgur.com/9yrPSuJ.png
I am running debian on rxvt-unicode-256color
Is anyone else experiencing this issue?
I altered the 3 occurences of "sel_grab" to "on_sel_grab" and this has fixed the issue.
Thanks
P.S. Please document URxvt.clipboard.autocopy....
Hi, the url-select plugin only selects (and open) the first line of mutiline URLs.
For example, of
http://wiki.arraigodigital.org.ar/RedLibre/Gu%C3%A
Das/PasoAPaso
only http://wiki.arraigodigital.org.ar/RedLibre/Gu%C3%A gets selected and opened, instead of the whole URL (http://wiki.arraigodigital.org.ar/RedLibre/Gu%C3%ADas/PasoAPaso)
When I receive a particularly long link in an e-mail and it wraps, only the first line is highlighted. This occurs in Mutt (and I assume other ncurses based programs), but not in regular operation without a TUI. I assume it occurs because the text is manually placed instead of being wrapped.
This will not work for all cases (for example, if a sidebar is being used), and there may be a more elegant solution, but one way to perhaps solve this in the majority of cases would be to, if at the last character of line and still in a matching URL, allow the next line to continue it.
It is quite possible that this sucks too much to implement it, I just wanted to get your thoughts on it, since my main use of URL selection is within Mutt.
You can see this here: http://imgur.com/83WrrN9
Thanks for sharing these great scripts!
I have placed the clipboard script into my own urxvt perl folder (its not the only one I'm using) and added a keybinding for Control-v to trigger a paste, but nothing happens.
I'm on perl 5.18 on debian. This broke a few of my other scripts - is perl 5.18 compatible with your script?
Would it be possible to get an updated release? I've been using the clipboard autocopy option for a while now, and it seems stable to me. (The Arch Linux urxvt-perls community package lacks the autocopy feature, since it is based on the last repo release.)
My keyboard don't have Meta
key.
I searched Meta
, somebody said it is equivalent to Atl
or Win
.
But when I try <A-Esc>
or <Win-Esc>
, Terminal has no change.
When urxvt wraps a line containing an url, url-select only catches the first line.
That is, for example, if the window is wide enough for the url to be displayed in one physical line, url-select will underline the whole url. If the url needs to be wrapped, only the first line will be underlined. This seems to happen only in terminal applications, although apparently not when working on the shell proper.
The attached images (displaying a long url in vim in a wide window and a not so wide one) show what I mean.
Thanks!
The selections of urxvt-perls always use inverted fg/bg colors for the highlight, no matter what the value of the highlightColor resource is. The builtin mouse selection of urxvt does honour this setting, though.
I'm not sure whether this is a defect in the perl api or in urxvt-perls itself. There is urxvt::SET_COLOR
that may help.
Not really a bug, more of a usability thing. Could keyboard-select plugin be modified such that it would tell you that you're in "vim normal" mode rather than regular typing mode?
Perhaps create a bar at the bottom of the urxvt window when you're in that mode? Otherwise it gets confusing with multiple terminals open, especially since in vim normal mode is the default, but in terminal insert mode makes more sense to be the default.
The relevant X resources are:
URxvt.perl-ext-common: default,url-select
URxvt.urlLauncher: /usr/bin/firefox
URxvt.urlButton: 1
Steps to reproduce:
Type, for example, the following text in urxvt:
foo http://www.example.com bar
Select text with mouse button 1, pressing down at f
, and releasing anywhere in the middle of the URL, say a
.
The browser will be launched for the URL. This is unexpected.
The same problem does not happen with the matcher
perl extension.
When using "urxvt-perls/url-select" instead of "matcher" to open a link (using button=2, middle mouse), the click gets passed on to Vim running in the terminal (additionally to open the URL), where the X selection gets pasted then.
This does not happen when using "matcher" (also with button=2), or when clicking a link in the "normal shell" (zsh, not running Vim).
I am using set mouse=a
in Vim. The default set mouse=
does not trigger this behavior of additionally pasting.
My workaround is to use URxvt.url-select.button: S-2
(Shift-middle-button).
I'm not sure how easy it is to reproduce but I manage to make urxvt crash by opening urls with the 'o' binding.
urxvt crash on the second or the third opened url.
There should be an option to also copy to the CLIPBOARD selection - possibly by just calling into the copy
function of the clipboard
extension.
hi,
Thanks for your work which've made my CLI sessions even more accurate.
I wonder if the url catcher can understand the difference between misc links and image links.
When there is an image link, the behavior of the url catcher could be to delegate the opening of the link to an image viewer.
Regards,
Buridan
I'm on Debian testing using ratpoison, if that minds, and sometimes, apparently randomly, alt-u doesn't work as expected, i.e. it doesn't select the URL. Whem that happens, for it to work I have to navigate between ratpoison's windows, do some "random" things until alt-u actually select the URL.
Hi,
your extensions are great, but I'm missing one.
suppose I'm running urxvt, and I do a search with ack
(which is like grep -R .
, but better),
it will show the results grouped by file, each result on a line, with the line number at the beginning.
Like this:
$ ack theme.sbar
window.lua
190: [s.l.loaded] = theme.sbar_loaded_fg,
200: [s.l.ebox] = theme.sbar_bg,
201: [s.r.ebox] = theme.sbar_bg,
202: [s.sep] = theme.sbar_bg,
203: [s.ebox] = theme.sbar_bg,
212: [s.l.loaded] = theme.sbar_loaded_font,
theme.lua
42:theme.sbar_fg = "#fff"
43:theme.sbar_bg = "#000"
$
Then, I look over the results and decide "oh okay, now I want to go edit window.lua on line 201 because that contains the match I was looking for". I want a urxvt extension that can cycle through the results (and supports a search mode with '/', so that I can go on the line containing a result, if I then press enter, I want vim to be opened on that specific line.
Is that possible? :)
url-select copies the URL to the primary selection. I'd like it to be copied to the clipboard without using URxvt.clipboard.autocopy
since doing that interferes with normal operation.
For some applications it's easier to paste from the clipboard. Is that currently possible with an option?
Hi,
urxvt won't launch anymore on my Archlinux (running testing repos) due to following error:
./rxvtperl.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xdb80080)
I can't find any clue how to solve this, so I thought I'd ask the developers ;)
keyboard-select copies to primary, while the clipboard plugin lets me copy/paste to and from clipboard. Since I have to reach over to my mouse to paste from primary, I'd like for keyboard-select to be able to copy to clipboard instead.
When pasting the character "█" it instead pastes "â". I have my locale set to UTF-8 and used Chromium browser set to UTF-8 also.
It pastes correctly without using your clipboard. I needed to paste this character from the tabbedex extension, which is how i discovered it. https://raw.github.com/unkie/urxvt-tabbedex/master/tabbedex
locale
LANG=en_AU.UTF-8
LANGUAGE=en_AU:en
LC_CTYPE="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8"
LC_TIME="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_PAPER="en_AU.UTF-8"
LC_NAME="en_AU.UTF-8"
LC_ADDRESS="en_AU.UTF-8"
LC_TELEPHONE="en_AU.UTF-8"
LC_MEASUREMENT="en_AU.UTF-8"
LC_IDENTIFICATION="en_AU.UTF-8"
LC_ALL=
Hello,
I am using openSuse 13.2 with KDE and klipper. The yank command of the keyboard-select extension does not make the yanked text available immediately for pasting by ctrl-v
but instead it appears only in the yank history of klipper. Now I learned that there are three clipboards under xorg by
Would sending the yanked text to the CLIPBOARD clipboard instead of the PRIMARY clipboard resolve this?
As far as I can tell, there are no options in Klipper to unify with the PRIMARY clipboard.
url-select fails to include trailing closing parens )
. Try these test cases:
(nested parens http://en.wikipedia.org/wiki/Heuristic_(engineering))
(http://en.wikipedia.org/wiki/Heuristic)
http://en.wikipedia.org/wiki/Heuristic_(engineering)
Current master works for all URLs except the last one, where it misses the closing )
.
Previously I’ve used a modified mark-yank-urls version, which uses the following regex which passes all of the cases above:
qr{
(?:https?://|ftp://|news://|mailto:|file://|\bwww\.)
[\w\-\@;\/?:&=%\$.+!*\x27,~#]*
(
\([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\) # Allow a pair of matched parentheses
| #
[\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic)
)+
}x;
which is basically a modification of the original regex like this:
prefix``many-chars``less-chars-at-end
(original)
prefix``many-chars``(many-chars-enclosed-by-parens)``less-chars-at-end
(modified)
However, I’ve failed to modify url-select in a similar way and I don’t see why it breaks. The underlines are completely wrong and URLs always exclude any trailing )
. I hope that you have an idea why this occurs and can help me out.
Given there are so many Wikipedia-Links with trailing )
, this corner-case isn’t very uncommon, either.
Current Arch Linux distro running on MacBookPro9,2 (mid-2012), using:
extra/xorg-server 1.16.4-1
community/i3-wm 4.8-3
community/rxvt-unicode 9.21-1
community/urxvt-perls 2.1-1
$ cat .Xresources |grep perl|grep -v ^!
URxvt.perl-ext-common: default,keyboard-select,clipboard,url-select
URxvt.keysym.M-Escape: perl:keyboard-select:activate
URxvt.keysym.M-s: perl:keyboard-select:search
URxvt.keysym.M-c: perl:clipboard:copy
URxvt.keysym.M-v: perl:clipboard:paste
URxvt.keysym.M-C-v: perl:clipboard:paste_escaped
URxvt.keysym.M-u: perl:url-select:select_next
$ cat .xinitrc|grep urxvt
urxvtd -q -o -f
Your documentation from /usr/lib/urxvt/perl/keyboard-select reads in part:
Use Meta-Escape to activate selection mode, then use the following keys:
h/j/k/l: Move cursor left/down/up/right (also with arrow keys)
g/G/0/^/$/H/M/L/f/F/;/,/w/W/b/B/e/E: More vi-like cursor movement keys
'/'/?: Start forward/backward search
n/N: Repeat last search, N: in reverse direction
Ctrl-f/b: Scroll down/up one screen
Ctrl-d/u: Scroll down/up half a screen
v/V/Ctrl-v: Toggle normal/linewise/blockwise selection
y/Return: Copy selection to primary buffer, Return: deactivate afterwards
q/Escape: Deactivate keyboard selection mode
and documentation in /usr/lib/urxvt/perl/clipboard reads in part:
The use of the functions should be self-explanatory!
and indeed, this is pretty clear to me:
URxvt.keysym.M-c: perl:clipboard:copy
URxvt.keysym.M-v: perl:clipboard:paste
...and gives me the impression that your code should be copying to the CLIPBOARD buffer in X, not the PRIMARY buffer.
Everything described in the docs seems to work for me except the following key-combination:
"M-c" (I know that's Meta-c or in my case, alt/option-c)
In attempting to use these tools, I carefully used the following 4 procedures:
1a) modify .Xresources;
2a) run "$ #xrdb ~/.Xresources" to reload modified .Xresources;
3a) $mod-Return (an i3 key combination; it spawns a new urxvtc for me);
4a) in new urxvtc, generate some text in the terminal;
5a) "M-Escape" (terminal feedback: "Bot" highlighted in yellow at bottom right of terminal);
6a) multiple presses of "k" and "h" to position cursor;
7a) "v" to toggle normal selection mode (terminal feedback: "-V- Bot" highlighted in yellow);
8a) multiple presses of "l" (lowercase L) to highlight text desired for selection (terminal feedback: background/foreground colors reversed for selected text);
9a) "M-c" to attempt to copy selection to CLIPBOARD buffer (terminal feedback: none visible)
10a) "Escape" to deactivate keyboard selection mode (terminal feedback: "-V- Bot" disappears)
11a) "M-v" to attempt to paste this copied CLIPBOARD buffer content to the terminal (terminal feedback: not the most-recently-attempted copied text, but the previous-to-that-copied-text from using firefox with mouse-selected text followed by "C-c" is pasted into terminal)
I've also tried steps 1a-9a above followed by:
10b) "Return" to copy selection to primary buffer, Return: deactivate afterwards
11b) "two-finger-tap" on synaptics touchpad (desired copied text is pasted to destination)
And I've also tried steps 1a-9a above followed by:
10c) "y" to copy selection to primary buffer (terminal feedback: reversed color selection returns to normal)
11c) "q" to deactivate keyboard selection mode (terminal feedback: "-V- Bot" disappears)
12c) "two-finger-tap" on synaptics touchpad (desired copied text is pasted to destination)
And I tried steps 1a-10a above followed by:
11d) "two-finger-tap" on synaptics touchpad (desired copied text is NOT pasted to destination)
Both procedures b and c work fine, I think because "y" and "Return" copy the selection to the PRIMARY buffer rather than the CLIPBOARD buffer. But I get the impression from your documentation and from the filename itself (/usr/lib/urxvt/perl/clipboard) that "M-c" should be copying the selected text to the CLIPBOARD buffer, not the PRIMARY buffer in X. Just to make sure I wasn't interpreting your documentation incorrectly, I tried procedure d, and again got behavior different than I expected.
I noticed your additional words:
You can also overwrite the system commands to use for copying/pasting.
The default ones are:
URxvt.clipboard.copycmd: xsel -ib
URxvt.clipboard.pastecmd: xsel -ob
So I added these lines to .Xresources:
URxvt.clipboard.copycmd: xsel -ib
URxvt.clipboard.pastecmd: xsel -ob
and still don't get selected text copied to the CLIPBOARD buffer.
$ xsel -ob
from the command-line works as expected when I precede that command by selecting text in firefox with the mouse and then copy it to the X CLIPBOARD buffer using "C-c".
So is this a bug/issue? Or are my expections wrong? Perhaps I'm interpreting your documentation about the use and function of "M-c" in the clipboard script incorrectly. Any thoughts on what's going on here?
I think keyboard-select searching behaviour should behave in the way it works in searchable-scrollback
plugin, so one can see match result immediately when typing.
Can you make the license permissive so we can include the scripts with dot-configs that are permissive-licensed also?
I don't know if it is possible but it would be nice to be able to see the cursor in applications where it is disabled (for example mocp).
Can't tell if this is a config problem or something else. I'm running Arch with Xmonad in VMware Fusion on OS X. Cut and paste works using xsel. I can't get keyboard select or url select going. When I hit M-Esc, nothing. I know isn't a keybinding problem because I have cut and paste. Ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.