ce2f184901ce

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 14 Oct 2017 17:58:15 -0400
parents 07fbabc1f02d (current diff) f433f96e0b21 (diff)
children b887f32e40cd 1cd90a0458e4
branches/tags (none)
files fish/functions/cuts.fish

Changes

--- 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/
--- 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
--- /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
--- /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' ' $@
--- 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
--- 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
 
--- /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 <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(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',
+            '')
--- 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"