# HG changeset patch # User Steve Losh # Date 1418957954 18000 # Node ID 603bb1ae9da27c6e08ab115df1cb5d8f6a1442c3 # Parent 70b6d271f34d6031c52e5e0f1e54be2fda4c6e2d# Parent c8b7d567fbc1b2d25c5f719cb78d33cfaa161ba0 Merge. diff -r 70b6d271f34d -r 603bb1ae9da2 .hgsubstate --- a/.hgsubstate Thu Dec 18 21:59:00 2014 -0500 +++ b/.hgsubstate Thu Dec 18 21:59:14 2014 -0500 @@ -26,7 +26,7 @@ a1433c485eb254838c1db52e087d5ec4d1e77cfd vim/bundle/nerdtree 871bc88a5bbcb6e8844a64450b8e7f8ac13aac24 vim/bundle/orgmode b6b7d8b1982b67a0bba936c198041f6f3a2286a4 vim/bundle/paredit -f84e170fce4f6cb60b6d1b4baa30076f2b372f1e vim/bundle/pgsql +1a436f7d875b4ec630da081b041c73264235c7e7 vim/bundle/pgsql 2af074850fde676743f655775e3e151925751adf vim/bundle/powerline 1b4b8f1a8f1c88d8caae6c1b12c22c52ef418f32 vim/bundle/python-mode eb8baa5428bde10ecc1cb14eed1d6e16f5f24695 vim/bundle/rainbow-parentheses @@ -38,7 +38,7 @@ 8e1c1dc358de2132b7fbc1adaf94f528e3238e4d vim/bundle/splice 26fbdd7d1f1aa5600d2ebf39bbdd292c38aac16e vim/bundle/strftimedammit 1a73f607f8f5477d6942df2eb6e7245c4864f4d3 vim/bundle/surround -14cb306414dda411b1809a088e18eb2796030095 vim/bundle/syntastic +67ffe58818930e95163ead541a2700cec41c13f7 vim/bundle/syntastic c4dda1da8d6b290c9d01f5568cfb6f0effeeb3de vim/bundle/timl bf4a599901e0a9c85238158c661351dfaa1c91c2 vim/bundle/tslime2 84365f56fc87c11f1f04eed487d256cf8b128f7c vim/bundle/vitality diff -r 70b6d271f34d -r 603bb1ae9da2 bin/lein --- a/bin/lein Thu Dec 18 21:59:00 2014 -0500 +++ b/bin/lein Thu Dec 18 21:59:14 2014 -0500 @@ -4,7 +4,7 @@ # somewhere on your $PATH, like ~/bin. The rest of Leiningen will be # installed upon first run into the ~/.lein/self-installs directory. -export LEIN_VERSION="2.3.4" +export LEIN_VERSION="2.5.0" case $LEIN_VERSION in *SNAPSHOT) SNAPSHOT="YES" ;; @@ -27,7 +27,7 @@ # ensure we have native paths if $cygwin && [[ "$1" == /* ]]; then echo -n "$(cygpath -wp "$1")" - elif [[ "$OSTYPE" == "msys" && "$1" == /* ]]; then + elif [[ "$OSTYPE" == "msys" && "$1" == /?/* ]]; then echo -n "$(sh -c "(cd $1 2 /dev/null - download_failed_message "$LEIN_URL" + download_failed_message "$LEIN_URL" "$exit_code" exit 1 fi } @@ -175,7 +176,7 @@ ORIG_PWD="$PWD" cd "$LEIN_DIR" - $0 classpath .lein-classpath + LEIN_NO_USER_PROFILES=1 $0 classpath .lein-classpath sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj" > \ .lein-project-checksum cd "$ORIG_PWD" @@ -205,8 +206,9 @@ export JAVA_CMD="${JAVA_CMD:-"java"}" export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-$JAVA_CMD}" -if [[ "$(basename "$LEIN_JAVA_CMD")" == *drip* ]]; then +if [[ -z "${DRIP_INIT+x}" && "$(basename "$LEIN_JAVA_CMD")" == *drip* ]]; then export DRIP_INIT="$(printf -- '-e\n(require (quote leiningen.repl))')" + export DRIP_INIT_CLASS="clojure.main" fi # Support $JAVA_OPTS for backwards-compatibility. @@ -265,6 +267,10 @@ LEIN_SCRIPT_URL="https://github.com/technomancy/leiningen/raw/$TARGET_VERSION/bin/lein" $HTTP_CLIENT "$TARGET" "$LEIN_SCRIPT_URL" if [ $? == 0 ]; then + cmp -s "$TARGET" "$SCRIPT" + if [ $? == 0 ]; then + echo "Leiningen is already up-to-date." + fi mv "$TARGET" "$SCRIPT" && chmod +x "$SCRIPT" exec "$SCRIPT" version else @@ -290,14 +296,22 @@ echo "Leiningen's classpath: $CLASSPATH" fi - if ([ "$LEIN_FAST_TRAMPOLINE" != "" ] || [ -r .lein-fast-trampoline ]) && - [ -r project.clj ]; then + if [ -r .lein-fast-trampoline ]; then + export LEIN_FAST_TRAMPOLINE='y' + fi + + if [ "$LEIN_FAST_TRAMPOLINE" != "" ] && [ -r project.clj ]; then INPUTS="$@ $(cat project.clj) $LEIN_VERSION $(test -f "$LEIN_HOME/profiles.clj" && cat "$LEIN_HOME/profiles.clj")" - INPUT_CHECKSUM=$(echo $INPUTS | shasum - | cut -f 1 -d " ") + export INPUT_CHECKSUM=$(echo $INPUTS | shasum - | cut -f 1 -d " ") # Just don't change :target-path in project.clj, mkay? TRAMPOLINE_FILE="target/trampolines/$INPUT_CHECKSUM" else - TRAMPOLINE_FILE="$(mktemp /tmp/lein-trampoline-XXXXXXXXXXXXX)" + if hash mktemp 2>/dev/null; then + # Check if mktemp is available before using it + TRAMPOLINE_FILE="$(mktemp /tmp/lein-trampoline-XXXXXXXXXXXXX)" + else + TRAMPOLINE_FILE="/tmp/lein-trampoline-$$" + fi trap "rm -f $TRAMPOLINE_FILE" EXIT fi @@ -312,11 +326,12 @@ exec sh -c "exec $(cat $TRAMPOLINE_FILE)" else export TRAMPOLINE_FILE - "$LEIN_JAVA_CMD" -client \ + "$LEIN_JAVA_CMD" \ "${BOOTCLASSPATH[@]}" \ - $LEIN_JVM_OPTS \ -Dfile.encoding=UTF-8 \ -Dmaven.wagon.http.ssl.easy=false \ + -Dmaven.wagon.rto=10000 \ + $LEIN_JVM_OPTS \ -Dleiningen.original.pwd="$ORIGINAL_PWD" \ -Dleiningen.script="$SCRIPT" \ -classpath "$CLASSPATH" \ @@ -345,4 +360,3 @@ fi fi fi - diff -r 70b6d271f34d -r 603bb1ae9da2 bin/sort-scala-imports --- a/bin/sort-scala-imports Thu Dec 18 21:59:00 2014 -0500 +++ b/bin/sort-scala-imports Thu Dec 18 21:59:14 2014 -0500 @@ -5,6 +5,7 @@ bracket_padding = None +MAX_LINE_WIDTH = 100 def next_line(): return sys.stdin.readline().rstrip('\n') @@ -30,6 +31,7 @@ """ prefix = self.prefix guts = self.guts + guts.sort(key=lambda s: s.lower()) if not prefix: # This is just a single-line, single-item import, so we don't need @@ -40,10 +42,9 @@ bracket_padding, ', '.join(guts), bracket_padding) - if len(single) > 100: + if len(single) > MAX_LINE_WIDTH: self.main_line = prefix + '{' self.guts = guts - self.guts.sort(key=lambda s: s.lower()) else: self.main_line = single self.guts = [] diff -r 70b6d271f34d -r 603bb1ae9da2 dotcss/weather.com.css --- a/dotcss/weather.com.css Thu Dec 18 21:59:00 2014 -0500 +++ b/dotcss/weather.com.css Thu Dec 18 21:59:14 2014 -0500 @@ -1,209 +0,0 @@ -// First grab Stylebot: https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha?hl=en - -#wx-breaking-now { - display: none; -} - -#wx-wrapper { - border-style: none; -} - -#wx-rail { - display: none; -} - -div.wx-inner { - display: none; -} - -div.wx-module.wx-gptADS { - display: none; -} - -div.wx-next a { - display: none; -} - -div.wx-nav-arrow.wx-k-lg-rt { - display: none; -} - -div.wx-content { - display: none; -} - -div.wx-social-share-ls-wrapper ul { - display: none; -} - -div.wx-search form input { - display: none; -} - -div.wx-searchButton { - display: none; -} - -div.wx-search { - display: none; -} - -#wx-bottom-inner { - height: 400px; -} - -dl.wx-1 { - display: none; -} - -dl.wx-2 { - display: none; -} - -dl.wx-3 { - display: none; -} - -dl.wx-4 { - display: none; -} - -ul.wx-social { - display: none; -} - -div.wx-legal { - display: none; -} - -#wx-Strip { - display: none; -} - -#wx-header-tools { - display: none; -} - -div.wx-desktop-weather-btn a { - display: none; -} - -div.wx-desktop-weather-bg { - display: none; -} - -span.wx-icon.wx-desktop-weather { - display: none; -} - -li.twc-weather-edit-location { - display: none; -} - -div.wx-grid6of6 { - height: 0; - margin-bottom: 0; - padding-bottom: 0; -} - -#wx-inner-rail { - clear: left; -} - -div.fby-tab.fby-tab-r a { - display: none; -} - -div.fby-tab.fby-tab-r { - display: none; -} - -div.wx-prev a { - display: none; -} - -div.wx-nav-arrow.wx-k-lg-lt { - display: none; -} - -div.wx-free-title h3 { - display: none; -} - -a.wx-icon.wx-cond.wx-phone { - display: none; -} - -a.wx-icon.wx-cond.wx-desktop { - display: none; -} - -a.wx-icon.wx-cond.wx-tablet { - display: none; -} - -div.wx-social-share-bar { - display: none; -} - -div.wx-lifestyles div { - display: none; -} - -#fsr_modalOverlay { - display: none; -} - -div.fsrwin { - display: none; -} - -div.wx-24hour.wx-module.wx-grid3of6.wx-weather { - margin-left: 0; - padding-left: 0; -} - -div#wx-footer { - border-top: 0; -} - -div#wx-top-wrap { - width: 660px; -} - -div#wx-main { - float: none; - margin: 0 auto; -} - -div.trc_rbox_outer { - display: none; -} - -div.trc_rbox_header.trc_rbox_border_elm { - display: none; -} - -div.trc_rbox_container div { - display: none; -} - -div.wx-map { - margin-left: 165px; -} - -div#wx-forecast-container div.wx-map { - margin-left: 0; -} - -.wx-grid6of6 { - width: auto; -} - -div.wx-corsican { - display: none; -} - -div.wx-module.wx-featured.wx-wwir-module.wx-cond-bg { - display: none; -} \ No newline at end of file diff -r 70b6d271f34d -r 603bb1ae9da2 dotjs/500px.com.js --- a/dotjs/500px.com.js Thu Dec 18 21:59:00 2014 -0500 +++ b/dotjs/500px.com.js Thu Dec 18 21:59:14 2014 -0500 @@ -1,8 +0,0 @@ -$(function() { - var i = $("img#mainphoto.clickable").attr("src"); - - $('body').append(""); - - $('#fucking-let-me-drag-you-assholes').css('position', 'absolute').css('top', '40px').css('left', '40px'); - -}); diff -r 70b6d271f34d -r 603bb1ae9da2 fish/config.fish --- a/fish/config.fish Thu Dec 18 21:59:00 2014 -0500 +++ b/fish/config.fish Thu Dec 18 21:59:14 2014 -0500 @@ -19,6 +19,10 @@ function ....; cd ../../..; end function .....; cd ../../../..; end +# I give up +alias :q exit +alias :qa exit + # }}} # Completions {{{ diff -r 70b6d271f34d -r 603bb1ae9da2 fish/functions/fy.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/fy.fish Thu Dec 18 21:59:14 2014 -0500 @@ -0,0 +1,20 @@ +function fy + echo -n ' / \ + |\_/| + |---| + | | + | | + _ |=-=| _ + _ / \| |/ \ + / \| | | ||\ +| | | | | \> +| | | | | \ +| - - - - |) ) +| / + \ / + \ / + \ / + \ / + | | + ' | pbcopy +end diff -r 70b6d271f34d -r 603bb1ae9da2 gitconfig --- a/gitconfig Thu Dec 18 21:59:00 2014 -0500 +++ b/gitconfig Thu Dec 18 21:59:14 2014 -0500 @@ -105,7 +105,7 @@ ; ksshow will open a single specific commit in kaleidoscope ; it includes the commit log info as a separate file - ksshow = "!sh -c 'export KSID=`uuidgen`; git log -n1 $1 > .git/LOG_MESSAGE; ksdiff --partial-changeset --UUID $KSID -- /dev/null .git/LOG_MESSAGE; git ksdiffid $1^..$1; ksdiff --mark-changeset-as-closed $KSID' -" + ksshow = "!sh -c 'export KSID=`uuidgen`; git log -n1 $1 > .git/LOG_MESSAGE_$KSID; ksdiff --partial-changeset --UUID $KSID -- /dev/null .git/LOG_MESSAGE_$KSID; git ksdiffid $1^..$1; ksdiff --mark-changeset-as-closed $KSID' -" ; ksreview takes a branch, finds all commits in that branch that aren't ; merged into master, and opens them one-by-one with ksshow. It's good for @@ -116,6 +116,7 @@ ; review takes a pull request URL and reviews it ; only works if you have the PR-fetching turned on and shit review = "!sh -c 'git fetch upstream && git ksreviewfor `echo $1 | sed -Ee \"s_.*pull/([0-9]+)_refs/pull/upstream/\\1_\"` upstream/master' -" + reviewcombined = "!sh -c 'git fetch upstream && git ksdiff upstream/master `echo $1 | sed -Ee \"s_.*pull/([0-9]+)_refs/pull/upstream/\\1_\"`' -" ; END KALEIDOSCOPE SECTION diff -r 70b6d271f34d -r 603bb1ae9da2 keyremap4macbook/private.xml --- a/keyremap4macbook/private.xml Thu Dec 18 21:59:00 2014 -0500 +++ b/keyremap4macbook/private.xml Thu Dec 18 21:59:14 2014 -0500 @@ -68,6 +68,24 @@ --KeyToKey-- KeyCode::SPACE, ModifierFlag::SHIFT_R, KeyCode::KEY_0, ModifierFlag::SHIFT_L, KeyCode::SPACE + Remap Held Tab to Hyper + OS X doesn't have a Hyper. This maps Held Tab to Control + Shift + Option + Command. + You can use this key in your own custom keyboard shortcuts you create in apps. + + space_cadet.held_tab_to_hyper + + + --KeyOverlaidModifier-- + KeyCode::TAB, + ModifierFlag::NONE, + + KeyCode::COMMAND_L, + ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L, + + KeyCode::TAB + + + Remap Left Control to Hyper OS X doesn't have a Hyper. This maps Left Control to Control + Shift + Option + Command. You can use this key in your own custom keyboard shortcuts you create in apps. diff -r 70b6d271f34d -r 603bb1ae9da2 mutt/muttrc --- a/mutt/muttrc Thu Dec 18 21:59:00 2014 -0500 +++ b/mutt/muttrc Thu Dec 18 21:59:14 2014 -0500 @@ -45,14 +45,14 @@ # }}} # Sidebar Patch {{{ -set sidebar_delim = ' │' -set sidebar_visible = yes -set sidebar_width = 26 -color sidebar_new color221 color233 -bind index,pager sidebar-next -bind index,pager sidebar-prev -bind index,pager sidebar-open -set sidebar_format = "%B %> %S" +# set sidebar_delim = ' │' +# set sidebar_visible = yes +# set sidebar_width = 26 +# color sidebar_new color221 color233 +# bind index,pager sidebar-next +# bind index,pager sidebar-prev +# bind index,pager sidebar-open +# set sidebar_format = "%B %> %S" # }}} # Status Bar {{{ @@ -70,6 +70,7 @@ set uncollapse_jump # don't collapse on an unread message set sort_re # thread based on regex set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" +set folder_format = "%2C %t %N %8s %f" # }}} # Pager View Options {{{ @@ -176,8 +177,9 @@ macro index M "?" "move a message to a mailbox" # Quickly change mailboxes -macro index \' "+simple/INBOX" "go to INBOX" -macro index \" "+simple/archive" "go to archive" +macro index c "?" "change folder" +macro index \' "+INBOX" "go to INBOX" +macro index \" "+archive" "go to archive" # Search with notmuch macro index S "unset wait_keymutt-notmuch-py -G ~/.mail/search+search" "search mail (using notmuch)" diff -r 70b6d271f34d -r 603bb1ae9da2 vim/after/plugin/tslime2.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/after/plugin/tslime2.vim Thu Dec 18 21:59:14 2014 -0500 @@ -0,0 +1,2 @@ + +source ~/.vim/bundle/tslime2/plugin/tslime.tim diff -r 70b6d271f34d -r 603bb1ae9da2 vim/custom-dictionary.utf-8.add --- a/vim/custom-dictionary.utf-8.add Thu Dec 18 21:59:00 2014 -0500 +++ b/vim/custom-dictionary.utf-8.add Thu Dec 18 21:59:14 2014 -0500 @@ -161,5 +161,9 @@ Reykjavík meatspace scrollback +tmux precompute fuckery +healthcheck +cron4j +realtime diff -r 70b6d271f34d -r 603bb1ae9da2 vim/vimrc --- a/vim/vimrc Thu Dec 18 21:59:00 2014 -0500 +++ b/vim/vimrc Thu Dec 18 21:59:14 2014 -0500 @@ -23,8 +23,8 @@ " specifying files to load and none of them work? " " Computers are bullshit. -let $BASH_ENV = "~/.bash_profile" -set shell=/bin/bash +" let $BASH_ENV = "~/.bash_profile" +set shell=/bin/bash\ --login filetype off call pathogen#infect() @@ -309,6 +309,7 @@ noremap p :silent! set paste"*p:set nopaste " noremap p mz:r!pbpaste`z vnoremap y :call g:FuckingCopyTheTextPlease() +nnoremap y VV:call g:FuckingCopyTheTextPlease() " I constantly hit "u" in visual mode when I mean to "y". Use "gu" for those rare occasions. " From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim @@ -403,7 +404,7 @@ inoremap :call InsertCloseTag()a " Source -vnoremap S y:execute @@:echo 'Sourced selection.' +vnoremap S y:@" nnoremap S ^vg_y:execute @@:echo 'Sourced line.' " Marks and Quotes @@ -472,7 +473,7 @@ nnoremap R :silent !ranger:redraw! " Jump (see the J mini-plugin later on) -nnoremap j :J +nnoremap J :J " Insert Mode Completion {{{ @@ -678,6 +679,19 @@ augroup END " }}} +" Bullshit {{{ + +augroup ft_bullshit + au! + + " Send to tmux with localleader e + au FileType bullshit nnoremap e :let bullshit_tslime_view = winsaveview()vip"ry:call SendToTmux(@r):call winrestview(bullshit_tslime_view) + + " kill pager with q + au FileType bullshit nnoremap q :call SendToTmuxRaw("q") +augroup END + +" }}} " C {{{ augroup ft_c @@ -781,6 +795,10 @@ " Indent top-level form. au FileType clojure nmap = mz99[(v%='z " ]) + + " Not sure about this but we'll give it a try. + au FileType clojure nmap gi mz99[(v%='z + " ]) augroup END " }}} @@ -799,9 +817,6 @@ " }}} " Common Lisp {{{ -" function! SendToTmuxStripped(text) -" call SendToTmux(substitute(a:text, '\v\n*$', '', '')) -" endfunction function! SetLispWords() if exists("g:did_set_lisp_words") return @@ -814,6 +829,39 @@ set lispwords+=eswitch endfunction +function! SendLispForm() + let view = winsaveview() + + execute "normal! vab\" + SendSelectionToTmuxTrimmed + + call winrestview(view) +endfunction + +function! SendToplevelLispForm() + let view = winsaveview() + + " If we're on the first char of the form, calling PareditFindDefunBck will + " move us to the previous form, which we don't want. So instead we'll just + " always move a char to the right. + silent! normal! l + + call PareditFindDefunBck() + execute "normal! vab\" + SendSelectionToTmuxTrimmed + + call winrestview(view) +endfunction + +function! SendLispBuffer() + let view = winsaveview() + + execute "normal! ggVG\" + SendSelectionToTmuxTrimmed + + call winrestview(view) +endfunction + augroup ft_commonlisp au! @@ -832,13 +880,13 @@ " \c - send ctrl-l [c]lear " Send the current form to the REPL - au FileType lisp nnoremap f :let lisp_tslime_view = winsaveview()vab"ry:call SendToTmuxStripped(@r):call winrestview(lisp_tslime_view) + au FileType lisp nnoremap f :call SendLispForm() " Send the current top-level form to the REPL - au FileType lisp nnoremap e :let lisp_tslime_view = winsaveview():silent! normal! l:call PareditFindDefunBck()vab"ry:call SendToTmuxStripped(@r):call winrestview(lisp_tslime_view) - - " Send the entire buffer to the REPL - au FileType lisp nnoremap r :let lisp_tslime_view = winsaveview()ggVG"ry:call SendToTmuxStripped(@r):call winrestview(lisp_tslime_view) + au FileType lisp nnoremap e :call SendToplevelLispForm() + + " Send the entire buffer to the REPL ([r]eload) + au FileType lisp nnoremap r :call SendLispBuffer() " Clear the REPL au FileType lisp nnoremap c :call SendToTmuxRaw(" ") @@ -863,7 +911,7 @@ " )) " Indent top-level form. - au FileType lisp nmap = mz99[(v%='z + au FileType lisp nmap gi mz99[(v%='z " ]) augroup END @@ -1330,6 +1378,8 @@ au syntax timl RainbowParenthesesLoadSquare au syntax timl RainbowParenthesesLoadBraces + au FileType timl call PareditInitBuffer() + " Friendlier Paredit mappings. au FileType timl noremap () :call PareditWrap("(", ")") au FileType timl noremap )( :call PareditSplice() @@ -1341,10 +1391,8 @@ au FileType timl noremap ] :call PareditSmartJumpClosing(0) " ))) - au FileType timl call PareditInitBuffer() - " Indent top-level form. - au FileType timl nmap = mz99[(v%='z + au FileType timl nmap gi mz99[(v%='z " ]) augroup END @@ -1507,6 +1555,11 @@ " "Hub" vnoremap H :Gbrowse +nnoremap H V:Gbrowse + +" "(Upstream) Hub" +vnoremap u :Gbrowse @upstream +nnoremap u V:Gbrowse @upstream " }}} " GnuPG {{{ @@ -1735,6 +1788,11 @@ let g:tslime_vars_mapping = 't' " }}} +" tslime2 {{{ + +let g:tslime2_ensure_trailing_newlines = 1 + +" }}} " YankRing {{{ function! YRRunAfterMaps() diff -r 70b6d271f34d -r 603bb1ae9da2 weechat/python/autoload/quotes.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/weechat/python/autoload/quotes.py Thu Dec 18 21:59:14 2014 -0500 @@ -0,0 +1,100 @@ +import subprocess + +SCRIPT_NAME = 'quotes' +SCRIPT_AUTHOR = 'Steve Losh ' +SCRIPT_VERSION = '1.0' +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' + +import_ok = True + +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 hd(fn, name, obj, attr): + return fn(weechat.hdata_get(name), obj, attr) + +def hdp(name, obj, attr): + return hd(weechat.hdata_pointer, name, obj, attr) + +def hds(name, obj, attr): + return hd(weechat.hdata_string, name, obj, attr) + +def get_lines(buffer, numlines): + lines = hdp("buffer", buffer, "own_lines") + if not lines: + # null pointer wat do + return None + + last_lines = [] + + line = hdp("lines", lines, "last_line") + for _ in range(numlines): + if not line: + # shit we're at the top of the buffer + break + + data = hdp("line", line, "data") + msg = hds("line_data", data, "message") + pre = hds("line_data", data, "prefix") + + msg = weechat.string_remove_color(msg, "") + pre = weechat.string_remove_color(pre, "") + + last_lines.append("<%s> %s" % (pre.strip(), msg.strip())) + + line = hdp("line", line, "prev_line") + + last_lines.reverse() + return last_lines + +def quote_grab(data, buffer, args, numlines=15): + lines = get_lines(buffer, numlines) + + with open(QUOTE_FILE, 'a') as f: + f.write("\n---\n") + f.write('\n'.join(lines)) + + subprocess.call(["vim", QUOTE_FILE, + # start at the bottom of the file + "+", + # move up N lines, where N is how many we appended + "-c", "normal! %dk" % len(lines)]) + weechat.command("", "/window refresh") + + 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, '', ''): + weechat_version = weechat.info_get('version_number', '') or 0 + weechat.hook_command( + SCRIPT_COMMAND, + 'Appends the last 15 lines of the current buffer to your quotes ' + 'file and opens it in Vim so you can trim it.', + '', + '', + '', + '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', + '') diff -r 70b6d271f34d -r 603bb1ae9da2 weechat/weechat.conf --- a/weechat/weechat.conf Thu Dec 18 21:59:00 2014 -0500 +++ b/weechat/weechat.conf Thu Dec 18 21:59:14 2014 -0500 @@ -35,8 +35,8 @@ day_change_message_1date = "-- %a, %d %b %Y --" day_change_message_2dates = "-- %%a, %%d %%b %%Y (%a, %d %b %Y) --" eat_newline_glitch = off -highlight = "sjl,slosh,slj,clojerks" -highlight_regex = "(^all[,:]|backend(ia)?[^s/]|red[- ]tape|steve ?losh|rob ford|(jesus )?fucking christ|bring me my [A-Za-z0-9_]+ (pant|breeche|kilt|skirt|short|jort|plort)s?|([[:<:]]((mother)?fuck([ie]ng?|er)?|(god?)?damn(ed)?|dammit|(bull|horse)?shite?)[[:>:]].*){3,})" +highlight = "sjl,slosh,slj,clojerks,horrifying" +highlight_regex = "(^all[,:]|backend(ia)?[^s/]|red[- ]tape|steve ?losh|rob ford|(jesus )?fucking christ|bring me my [A-Za-z0-9_]+ (pant|breeche|kilt|skirt|short|jort|plort)s?|(horse|mouse|clown)fuckers?|([[:<:]]((mother)?fuck([ie]ng?|er)?|(god?)?damn(ed)?|dammit|(bull|horse)?shite?)[[:>:]].*){3,}|actual footage)" highlight_tags = "" hotlist_add_buffer_if_away = on hotlist_buffer_separator = ", " @@ -88,7 +88,7 @@ read_marker_always_show = on read_marker_string = "◡◡◠" save_config_on_exit = off -save_layout_on_exit = none +save_layout_on_exit = "all" scroll_amount = 3 scroll_bottom_after_switch = off scroll_page_percent = 100