Skip to content

Instantly share code, notes, and snippets.

@changa
Created January 21, 2011 10:58
Show Gist options
  • Save changa/789535 to your computer and use it in GitHub Desktop.
Save changa/789535 to your computer and use it in GitHub Desktop.
Nice autoselection transforms for urxvt & vim
# ~/.Xdefaults
# Shamelessly stolen from https://github.com/tpope/tpope/blob/master/.Xresources
# and http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod
# This will automatically put "+line_number file_name" in the clipboard when clicking on a Ruby backtrace
URxvt.perl-lib: /usr/lib64/urxvt/perl # YMMV
URxvt.perl-ext-common: default,selection-autotransform,selection-pastebin,remote-clipboard
URxvt.selection-autotransform.0: if(/\\n\\[?\\d\\d(\\d\\d-|:)\\d\\d/) { s{^\\[?[\\d:_-]+\\]? +}{}; s/\\s*\\n\\[?[\\d:_-]{5,}\\]? +/ || /g; s/^\\s+/ /mg; s/( ?) \*\\n( ?)/($1||$2)/eg; s{ $}{}; };
URxvt.selection-autotransform.1: if(/^irb.*?> /) { s{^irb.*?[>*]\\s*}{}mg; s/\\n=>/ #=>/mg; s{\\n$}{};}
URxvt.selection-autotransform.2: if(m{^[ab]/}) { s{^[ab]/}{}g; }
URxvt.selection-autotransform.3: s/^([^:\\s]*):(\\d+)(:|:in)?$/+$2 $1/g;
@spk
Copy link

spk commented Jan 25, 2011

nodejs trace give the file:line:column
URxvt.selection-autotransform.4: s/^([^:\s]*):(\d+):(\d+)$/+$2 +'$3|' $1/g;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment