f8ea2a0220bb

update
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 08 Jul 2015 11:51:55 -0400
parents be4d78a65702
children e7f1e7f3a797
branches/tags (none)
files vim/vimrc weechat/python/autoload/quotes.py

Changes

--- a/vim/vimrc	Mon Jun 29 12:27:36 2015 -0400
+++ b/vim/vimrc	Wed Jul 08 11:51:55 2015 -0400
@@ -394,7 +394,7 @@
 "
 " Useful for writing GitHub comments in actual Markdown and then translating it
 " to their bastardized version of Markdown.
-nnoremap <leader>J mzvipJ`z
+nnoremap <leader>j mzvipJ`z
 
 " Split line (sister to [J]oin lines)
 " The normal use of S is covered by cc, so don't worry about shadowing it.
--- a/weechat/python/autoload/quotes.py	Mon Jun 29 12:27:36 2015 -0400
+++ b/weechat/python/autoload/quotes.py	Wed Jul 08 11:51:55 2015 -0400
@@ -7,8 +7,10 @@
 SCRIPT_DESC = 'Grab quotes and shove them into a text file.'
 SCRIPT_COMMAND = 'quo'
 SCRIPT_COMMAND_LONG = 'quoo'
+SCRIPT_COMMAND_COPY = 'cop'
 
 QUOTE_FILE = '/Users/sjl/Dropbox/quotes.txt'
+COPY_FILE = '/Users/sjl/.ircopy.irc'
 
 import_ok = True
 
@@ -76,6 +78,19 @@
 def quote_grab_long(data, buffer, args):
     return quote_grab(data, buffer, args, 75)
 
+def quote_grab_copy(data, buffer, args):
+    lines = get_lines(buffer, 1000)
+
+    with open(COPY_FILE, 'w') as f:
+        f.write('\n'.join(lines))
+
+    subprocess.call(["vim", COPY_FILE,
+                     # start at the bottom of the file
+                     "+"])
+    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, '', ''):
@@ -98,3 +113,11 @@
             '',
             'quote_grab_long',
             '')
+        weechat.hook_command(
+            SCRIPT_COMMAND_COPY,
+            'Open the last 1000 lines of the file in Vim so you can copy.',
+            '',
+            '',
+            '',
+            'quote_grab_copy',
+            '')