b21e7cb29335

more
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 08 Oct 2014 13:30:08 -0400
parents cbcb1ac55566
children 33d393113753
branches/tags (none)
files fish/functions/fy.fish vim/vimrc weechat/python/autoload/quotes.py

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fish/functions/fy.fish	Wed Oct 08 13:30:08 2014 -0400
@@ -0,0 +1,20 @@
+function fy
+     echo -n '         / \
+        |\_/|
+        |---|
+        |   |
+        |   |
+      _ |=-=| _
+  _  / \|   |/ \
+ / \|   |   |   ||\
+|   |   |   |   | \>
+|   |   |   |   |   \
+| -   -   -   - |)   )
+|                   /
+ \                 /
+  \               /
+   \             /
+    \           /
+     |         |
+    ' | pbcopy
+end
--- a/vim/vimrc	Thu Sep 18 12:07:16 2014 -0400
+++ b/vim/vimrc	Wed Oct 08 13:30:08 2014 -0400
@@ -678,6 +678,19 @@
 augroup END
 
 " }}}
+" Bullshit {{{
+
+augroup ft_bullshit
+    au!
+
+    " Send to tmux with localleader e
+    au FileType bullshit nnoremap <buffer> <silent> <localleader>e :let bullshit_tslime_view = winsaveview()<cr>vip"ry:call SendToTmux(@r)<cr>:call winrestview(bullshit_tslime_view)<cr>
+
+    " kill pager with q
+    au FileType bullshit nnoremap <buffer> <silent> <localleader>q :call SendToTmuxRaw("q")<cr>
+augroup END
+
+" }}}
 " C {{{
 
 augroup ft_c
--- a/weechat/python/autoload/quotes.py	Thu Sep 18 12:07:16 2014 -0400
+++ b/weechat/python/autoload/quotes.py	Wed Oct 08 13:30:08 2014 -0400
@@ -6,6 +6,7 @@
 SCRIPT_LICENSE = 'MIT/X11'
 SCRIPT_DESC = 'Grab quotes and shove them into a text file.'
 SCRIPT_COMMAND = 'quo'
+SCRIPT_COMMAND_LONG = 'quoo'
 
 QUOTE_FILE = '/Users/sjl/Dropbox/quotes.txt'
 
@@ -28,7 +29,7 @@
 def hds(name, obj, attr):
     return hd(weechat.hdata_string, name, obj, attr)
 
-def get_lines(buffer):
+def get_lines(buffer, numlines):
     lines = hdp("buffer", buffer, "own_lines")
     if not lines:
         # null pointer wat do
@@ -37,7 +38,7 @@
     last_lines = []
 
     line = hdp("lines", lines, "last_line")
-    for _ in range(15):
+    for _ in range(numlines):
         if not line:
             # shit we're at the top of the buffer
             break
@@ -56,8 +57,8 @@
     last_lines.reverse()
     return last_lines
 
-def quote_grab(data, buffer, args):
-    lines = get_lines(buffer)
+def quote_grab(data, buffer, args, numlines=15):
+    lines = get_lines(buffer, numlines)
 
     with open(QUOTE_FILE, 'a') as f:
         f.write("\n---\n")
@@ -72,6 +73,9 @@
 
     return weechat.WEECHAT_RC_OK
 
+def quote_grab_long(data, buffer, args):
+    return quote_grab(data, buffer, args, 75)
+
 if __name__ == '__main__' and import_ok:
     if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                         SCRIPT_LICENSE, SCRIPT_DESC, '', ''):
@@ -85,3 +89,12 @@
             '',
             'quote_grab',
             '')
+        weechat.hook_command(
+            SCRIPT_COMMAND_LONG,
+            'Appends the last 75 lines of the current buffer to your quotes '
+            'file and opens it in Vim so you can trim it.',
+            '',
+            '',
+            '',
+            'quote_grab_long',
+            '')