Skip to content

Instantly share code, notes, and snippets.

@Ferus
Last active March 27, 2016 04:53
Show Gist options
  • Save Ferus/429fd911b910b7206562 to your computer and use it in GitHub Desktop.
Save Ferus/429fd911b910b7206562 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
#
# Mail: ferus@ zodiaclabs.org
# IRC: Ferus@ irc://hacking.with.computer:+6697/hacking
# This "script" is a helper for vimode.py script for WeeChat
# Make sure to chmod +x :)
# It requires vimode (/script install vimode.py) and xdotool
# Enable line numbers `weechat.bar.vi_line_numbers.hidden = off`
# Bind keys meta-q## to `/exec </path/to/script.sh> ##` where ## is the range of numbers 01-99
# /perlexec weechat::command('','/print /key bind meta-q'.sprintf("%02d",$_).' /exec -nosh -bg /home/ferus/.weechat/helpers/vimode_quote_helper.sh '.sprintf('%d',$_)) for (01..99)
# ???
# Press meta-q## and hope it doesnt break anything, since this is a very dirty hack.
# Numbers 1-9 are referred to with leading zeros as to not interfere with other double-digits
#1: Input <Esc> to drop to normal mode
#2: Input : to enter ex mode
#3: Input ## for the line number
#4: Input <Enter> to select the line
#5: Input q to quote the line
#6: Input i to return to insert mode
# TODO
# Possibly read --delay from invocation of script? (#1)
# Possibly add support for other vimode quoting types? (#5)
# Vimode supports: (Q, m and q) (we use q)
# Q: TIME NICK MESSAGE
# m: MESSAGE
# q: NICK MESSAGE
xdotool key --clearmodifiers --delay 100 Escape key --clearmodifiers colon type --clearmodifiers $1;
xdotool key --clearmodifiers Return type --clearmodifiers qi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment