bfd9b1f910a3

Update
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 11 Oct 2017 11:09:36 -0400
parents 6e6277efc27e
children f433f96e0b21
branches/tags (none)
files .hgsub .hgsubstate bin/confirm bin/cuts fish/functions/cuts.fish gitconfig weechat/python/autoload/editor.py weechat/weechat.conf

Changes

--- a/.hgsub	Mon Oct 09 21:20:31 2017 -0400
+++ b/.hgsub	Wed Oct 11 11:09:36 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/
--- a/.hgsubstate	Mon Oct 09 21:20:31 2017 -0400
+++ b/.hgsubstate	Wed Oct 11 11:09:36 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/confirm	Wed Oct 11 11:09:36 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/cuts	Wed Oct 11 11:09:36 2017 -0400
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+cut -d' ' $@
--- a/fish/functions/cuts.fish	Mon Oct 09 21:20:31 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
--- a/gitconfig	Mon Oct 09 21:20:31 2017 -0400
+++ b/gitconfig	Wed Oct 11 11:09:36 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
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/weechat/python/autoload/editor.py	Wed Oct 11 11:09:36 2017 -0400
@@ -0,0 +1,66 @@
+import subprocess
+import os
+import tempfile
+
+SCRIPT_NAME = 'editor'
+SCRIPT_AUTHOR = 'Steve Losh <steve@stevelosh.com>'
+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(initial_data):
+    with tempfile.NamedTemporaryFile(suffix=".tmp", 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):
+    line = weechat.buffer_get_string(buffer, "input")
+
+    data = get_data(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',
+            '',
+            '',
+            '',
+            'editor',
+            '')
--- a/weechat/weechat.conf	Mon Oct 09 21:20:31 2017 -0400
+++ b/weechat/weechat.conf	Wed Oct 11 11:09:36 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"