# HG changeset patch # User Steve Losh # Date 1508018295 14400 # Node ID ce2f184901ce92013ab667b9a36fe98f5e3c8853 # Parent 07fbabc1f02d9ee439cc76dad92d5d42a9b129f3# Parent f433f96e0b210f7a74565ce589352163fb430f40 Merge. diff -r 07fbabc1f02d -r ce2f184901ce .hgsub --- a/.hgsub Sat Oct 14 17:56:56 2017 -0400 +++ b/.hgsub Sat Oct 14 17:58:15 2017 -0400 @@ -1,5 +1,6 @@ mercurial/hg-prompt = [hg]https://bitbucket.org/sjl/hg-prompt mercurial/templates = [hg]https://bitbucket.org/sjl/mercurial-cli-templates +vim/bundle/abolish = [git]git://github.com/tpope/vim-abolish.git vim/bundle/ack = [git]git://github.com/mileszs/ack.vim.git vim/bundle/badwolf = [hg]https://bitbucket.org/sjl/badwolf/ vim/bundle/clam = [hg]https://bitbucket.org/sjl/clam.vim/ diff -r 07fbabc1f02d -r ce2f184901ce .hgsubstate --- a/.hgsubstate Sat Oct 14 17:56:56 2017 -0400 +++ b/.hgsubstate Sat Oct 14 17:58:15 2017 -0400 @@ -1,5 +1,6 @@ 5334581e231a5167d03689ff47b3a6fdf082011c mercurial/hg-prompt 1fc4a9fbead7e0acc4c828b346f3be2658ec3df9 mercurial/templates +b6a8b49e2173ba5a1b34d00e68e0ed8addac3ebd vim/bundle/abolish a16a9b63eb85cc0960a7f25c54647ac1f99f3360 vim/bundle/ack 5e4a535e2d239cba3db19b6b79abedbc7c541727 vim/bundle/badwolf a4d79fc208764917cb58e2aed6fbaeb5e3356d33 vim/bundle/clam diff -r 07fbabc1f02d -r ce2f184901ce bin/confirm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/confirm Sat Oct 14 17:58:15 2017 -0400 @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +read -p "Are you sure? " -r +if [[ $REPLY =~ ^[Yy](es)?$ ]] +then + exit 0 +else + exit 1 +fi diff -r 07fbabc1f02d -r ce2f184901ce bin/cuts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/cuts Sat Oct 14 17:58:15 2017 -0400 @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cut -d' ' $@ diff -r 07fbabc1f02d -r ce2f184901ce fish/functions/cuts.fish --- a/fish/functions/cuts.fish Sat Oct 14 17:56:56 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function cuts -d "Cut on space characters instead of tabs" --wraps "cut" - cut -d' ' $argv -end diff -r 07fbabc1f02d -r ce2f184901ce gitconfig --- a/gitconfig Sat Oct 14 17:56:56 2017 -0400 +++ b/gitconfig Sat Oct 14 17:58:15 2017 -0400 @@ -89,6 +89,9 @@ import-patch = am + untracked = "!sh -c 'git status -s | grep -E '''^[?][?] '''' | cuts -f2" + purge = "!sh -c 'git untracked && confirm && git actually-purge'" + actually-purge = "!sh -c 'git untracked | xargs rm'" g = !git fuum diff -r 07fbabc1f02d -r ce2f184901ce weechat/python/autoload/editor.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/weechat/python/autoload/editor.py Sat Oct 14 17:58:15 2017 -0400 @@ -0,0 +1,68 @@ +import subprocess +import os +import tempfile + +SCRIPT_NAME = 'editor' +SCRIPT_AUTHOR = 'Steve Losh ' +SCRIPT_VERSION = '1.0' +SCRIPT_LICENSE = 'MIT/X11' +SCRIPT_DESC = 'Launch an external editor to compose a message' +SCRIPT_COMMAND = 'editor' + +import_ok = True + +EDITOR = os.environ.get('EDITOR','vim') + +try: + import weechat +except ImportError: + print 'This is a weechat script, what are you doing, run it in weechat, jesus' + import_ok = False + +weechat_version = 0 + + +def get_data(suffix, initial_data): + with tempfile.NamedTemporaryFile(suffix=".%s" % suffix, mode="w+") as tf: + tf.write(initial_data) + tf.flush() + + if subprocess.call([EDITOR, tf.name]) != 0: + return None + + # Reopen, because most editors do atomic write-tmp+rename saves which + # fucks with Python here. + tf.file.close() + tf = file(tf.name) + + return tf.readlines() + +def editor(data, buffer, args): + suffix = args or "tmp" + + line = weechat.buffer_get_string(buffer, "input") + + data = get_data(suffix, line) + if data: + weechat.command(buffer, "/input delete_line") + + for line in data: + weechat.command(buffer, line) + + weechat.command("", "/window refresh") + + return weechat.WEECHAT_RC_OK + + +if __name__ == '__main__' and import_ok: + if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, + SCRIPT_LICENSE, SCRIPT_DESC, '', ''): + weechat_version = weechat.info_get('version_number', '') or 0 + weechat.hook_command( + SCRIPT_COMMAND, + 'Open $EDITOR to compose a message', + '[file-extension]', + 'If an argument is given, it will be used as the extension for the temporary file.', + '', + 'editor', + '') diff -r 07fbabc1f02d -r ce2f184901ce weechat/weechat.conf --- a/weechat/weechat.conf Sat Oct 14 17:56:56 2017 -0400 +++ b/weechat/weechat.conf Sat Oct 14 17:58:15 2017 -0400 @@ -188,8 +188,9 @@ connection_timeout = 60 # gnutls_ca_file = "%h/ssl/CAs.pem" # gnutls_ca_file = "~/.weechat/certs/ca-bundle.crt" -gnutls_ca_file = "/usr/local/etc/openssl/cert.pem" +# gnutls_ca_file = "/usr/local/etc/openssl/cert.pem" # gnutls_ca_file = "/Users/sjl/src/sighborg/certs/ssl_ca_bundle.pem" +gnutls_ca_file = "~/certs.pem" gnutls_handshake_timeout = 30 proxy_curl = "" @@ -300,6 +301,7 @@ ctrl-L = "/window refresh" ctrl-M = "/input return" ctrl-N = "/buffer +1" +ctrl-O = "/editor" ctrl-P = "/buffer -1" ctrl-R = "/input search_text" ctrl-Sctrl-U = "/input set_unread"