# HG changeset patch # User Steve Losh # Date 1389738469 18000 # Node ID e8bc4f9704f3e4a87e22f9b386643423414a60d1 # Parent 579ee6ce9270ac924ab9a7443319621e0599fb5c# Parent d66bfb2537feead7f6c88fdc7d0d5a69bf491ddc Merge. diff -r 579ee6ce9270 -r e8bc4f9704f3 .hgsub --- a/.hgsub Tue Jan 14 17:25:57 2014 -0500 +++ b/.hgsub Tue Jan 14 17:27:49 2014 -0500 @@ -14,6 +14,7 @@ vim/bundle/dispatch = [git]git://github.com/tpope/vim-dispatch.git vim/bundle/fireplace = [git]git://github.com/tpope/vim-fireplace.git vim/bundle/fugitive = [git]git://github.com/tpope/vim-fugitive.git +vim/bundle/gnupg = [git]git://github.com/jamessan/vim-gnupg.git vim/bundle/gundo = [hg]https://bitbucket.org/sjl/gundo.vim/ vim/bundle/html5 = [git]git://github.com/othree/html5.vim.git vim/bundle/indent-object = [git]git://github.com/michaeljsmith/vim-indent-object.git diff -r 579ee6ce9270 -r e8bc4f9704f3 .hgsubstate --- a/.hgsubstate Tue Jan 14 17:25:57 2014 -0500 +++ b/.hgsubstate Tue Jan 14 17:27:49 2014 -0500 @@ -13,7 +13,8 @@ c1646e3c28d75bcc834af4836f4c6e12296ba891 vim/bundle/ctrlp ffbd5eb50c9daf67657b87fd767d1801ac9a15a7 vim/bundle/dispatch b96ccf7441ada22d764af8223b61f18896d82dc9 vim/bundle/fireplace -cff78c3ab4605d490e6be8d8af02f1e7efd25c95 vim/bundle/fugitive +34e2d2538a634a0a820a56994333ffa1fec1bc58 vim/bundle/fugitive +6e9f52a160e3d15060848a8f453bd1b5bfa70db2 vim/bundle/gnupg eb9fc8676b8959c3c2c95bf6b6e8f0f44317c5c0 vim/bundle/gundo 34b407d2344a3c2a94b56e9d443e18e01e8544d9 vim/bundle/html5 78fffa609b3e6b84ef01ee4c9aba6d7435d7b18e vim/bundle/indent-object @@ -35,8 +36,8 @@ 10d6c6b52fcdd12f3ba457126f66fee4ccceec04 vim/bundle/securemodelines 78ab4b3df24fa2753d3dfc1be75ed5a3df1565b8 vim/bundle/smartinput c6197a10ace82e0fe0c08e5cf5c017b7069a978e vim/bundle/sparkup -01e68795c7a14b97ec2ebbd70b0fcb42d1adac61 vim/bundle/splice -6eec2c131213850ed65fd6da494dfd1a0d620a4e vim/bundle/strftimedammit +8e1c1dc358de2132b7fbc1adaf94f528e3238e4d vim/bundle/splice +26fbdd7d1f1aa5600d2ebf39bbdd292c38aac16e vim/bundle/strftimedammit 1a73f607f8f5477d6942df2eb6e7245c4864f4d3 vim/bundle/surround 14cb306414dda411b1809a088e18eb2796030095 vim/bundle/syntastic 2dee007ddae8156735cbae7f0cd4e0a24ba7287b vim/bundle/tslime diff -r 579ee6ce9270 -r e8bc4f9704f3 bash_profile --- a/bash_profile Tue Jan 14 17:25:57 2014 -0500 +++ b/bash_profile Tue Jan 14 17:27:49 2014 -0500 @@ -31,3 +31,6 @@ function psg() { ps auxww | grep --color=always $* | grep -v grep | collapse | cuts -f 2,11- } + +GPG_TTY=`tty` +export GPG_TTY diff -r 579ee6ce9270 -r e8bc4f9704f3 bin/bootstrap.sh --- a/bin/bootstrap.sh Tue Jan 14 17:25:57 2014 -0500 +++ b/bin/bootstrap.sh Tue Jan 14 17:27:49 2014 -0500 @@ -47,5 +47,6 @@ ensure_link "lib/dotfiles/bash_profile" ".bash_profile" ensure_link "lib/dotfiles/inputrc" ".inputrc" ensure_link "lib/dotfiles/fish/config.fish" ".config/fish/config.fish" +ensure_link "lib/dotfiles/fish/functions" ".config/fish/functions" echo completed diff -r 579ee6ce9270 -r e8bc4f9704f3 bin/sort-scala-imports --- a/bin/sort-scala-imports Tue Jan 14 17:25:57 2014 -0500 +++ b/bin/sort-scala-imports Tue Jan 14 17:27:49 2014 -0500 @@ -1,9 +1,11 @@ #!/usr/bin/env python -import sys +import re, sys from operator import attrgetter +bracket_padding = None + def next_line(): return sys.stdin.readline().rstrip('\n') @@ -19,14 +21,26 @@ self.guts = [] def slurp(self): - global l + global l, bracket_padding + if self.main_line.endswith('}'): # This is a line like: import foo.{ a, b, c } + if bracket_padding is None: + if self.main_line[self.main_line.index("{") + 1] == " ": + bracket_padding = " " + else: + bracket_padding = "" + prefix, rest = self.main_line.split('{', 1) + guts = [item.strip() for item in - rest.rstrip('}, ').split(',')] + re.split(", +| +|,", rest.strip('{}, '))] guts.sort(key=lambda s: s.lower()) - self.main_line = '%s{ %s }' % (prefix, ', '.join(guts)) + + self.main_line = '%s{%s%s%s}' % (prefix, + bracket_padding, + ', '.join(guts), + bracket_padding) l = next_line() elif self.main_line.endswith('{'): while True: diff -r 579ee6ce9270 -r e8bc4f9704f3 ctags --- a/ctags Tue Jan 14 17:25:57 2014 -0500 +++ b/ctags Tue Jan 14 17:27:49 2014 -0500 @@ -2,12 +2,14 @@ --javascript-kinds=cm --fields=-s --fields=+l +--fields=+n --languages=-html --languages=-javascript --exclude=flowplayer --exclude=.hg +--exclude=.git --exclude=.ropeproject --exclude=libs --exclude=build @@ -31,3 +33,17 @@ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*val[ \t]+([a-zA-Z0-9_]+)/\3/l,constants/ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*var[ \t]+([a-zA-Z0-9_]+)/\3/l,variables/ --regex-scala=/^[ \t]*package[ \t]+([a-zA-Z0-9_.]+)/\1/p,packages/ + +--langdef=Clojure +--langmap=Clojure:.clj +--regex-clojure=/\([ \t]*create-ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/ +--regex-clojure=/\([ \t]*def[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/d,definition/ +--regex-clojure=/\([ \t]*defn-?[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/f,function/ +--regex-clojure=/\([ \t]*defmacro[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/m,macro/ +--regex-clojure=/\([ \t]*definline[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/i,inline/ +--regex-clojure=/\([ \t]*defmulti[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/a,multimethod definition/ +--regex-clojure=/\([ \t]*defmethod[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/b,multimethod instance/ +--regex-clojure=/\([ \t]*defonce[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/c,definition (once)/ +--regex-clojure=/\([ \t]*defstruct[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/s,struct/ +--regex-clojure=/\([ \t]*intern[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/v,intern/ +--regex-clojure=/\([ \t]*ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/ diff -r 579ee6ce9270 -r e8bc4f9704f3 dotcss/bank.simple.com.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dotcss/bank.simple.com.css Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +#payment-goals-message { display: none !important; } +span.trade { display: none !important; } +#sts-flag { background: #EBA000 !important; text-shadow: 0px 2px 0px black;} diff -r 579ee6ce9270 -r e8bc4f9704f3 dotcss/simple.com.css --- a/dotcss/simple.com.css Tue Jan 14 17:25:57 2014 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#payment-goals-message { display: none !important; } diff -r 579ee6ce9270 -r e8bc4f9704f3 dotcss/vimeo.com.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dotcss/vimeo.com.css Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,2 @@ + +#likes_extras, .related_collections, #brozar { display: none !important;} diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/config.fish --- a/fish/config.fish Tue Jan 14 17:25:57 2014 -0500 +++ b/fish/config.fish Tue Jan 14 17:27:49 2014 -0500 @@ -1,16 +1,5 @@ # Useful functions {{{ -function serve_this; python -m SimpleHTTPServer; end -function fabric; fab -i ~/.ssh/stevelosh $argv; end -function oldgcc; set -g CC /usr/bin/gcc-4.0 $argv; end -function tm; tmux -u2 $argv; end -function c; clear; end -function hl; less -R; end -function paththis; set PATH (pwd) $PATH $argv; end -function clc; ./bin/get-last-commit-url.py | pbcopy; end - -function swank; dtach -A /tmp/dtach-swank.sock -r winch lein ritz; end - function ef; vim ~/.config/fish/config.fish; end function ev; vim ~/.vimrc; end function ed; vim ~/.vim/custom-dictionary.utf-8.add; end @@ -24,140 +13,10 @@ function eg; vim ~/.gitconfig; end function es; vim ~/.slate; end -function sjoin -d "Join input lines into a single line with spaces"; tr '\n' ' '; end - -function lstrip -d "Strip whitespace from the left of each line" - sed -e 's/^[ \t]*//' -end - -function rstrip -d "Strip whitespace from the right of each line" - sed -e 's/[ \t]*$//' -end - -function lrstrip -d "Strip whitespace from both ends of each line" - lstrip | rstrip -end - -function pj - python -m json.tool | pygmentize -l json -end - -function vup - set -x VAGRANT_LOG debug - vagrant up $argv - set -e VAGRANT_LOG -end - -function ss; bcvi --wrap-ssh -- $argv; end -function bcvid; dtach -A /tmp/bcvi.socket bcvi --listener; end - -function spotlight-off; sudo mdutil -a -i off ; and sudo mv /System/Library/CoreServices/Search.bundle/ /System/Library/CoreServices/SearchOff.bundle/ ; and killall SystemUIServer; end -function spotlight-on; sudo mdutil -a -i on ; and sudo mv /System/Library/CoreServices/SearchOff.bundle/ /System/Library/CoreServices/Search.bundle/ ; and killall SystemUIServer; end -function spotlight-wat; sudo fs_usage -w -f filesys mdworker | grep "open" ; end - -set MUTT_BIN (which mutt) -function mutt; bash --login -c "cd ~/Desktop; $MUTT_BIN"; end - -function h; hg $argv; end -function g; git $argv; end - -function pbc; pbcopy; end -function pbp; pbpaste; end -function pbpb; pbp | pb; end - -function weechat; weechat-curses $argv; end - -function collapse; sed -e 's/ */ /g'; end -function cuts; cut -d' ' $argv; end - -function emptytrash -d "Empty the OS X trash folders" - sudo rm -rfv /Volumes/*/.Trashes - sudo rm -rfv ~/.Trash - sudo rm -rfv /private/var/log/asl/*.asl -end - -function urlencode - python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);" $argv -end -function urldecode - python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])" $argv -end - -function fixopenwith -d "Fix the shitty OS X Open With menu duplicates" - /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user - killall Finder - echo "Open With has been rebuilt, Finder will relaunch" -end - -function v; vim $argv; end -function V; vim . $argv; end - -function vu; vagrant up; end -function vs; vagrant suspend; end - -function o; open $argv; end -function oo; open .; end - -function wo; workon $argv; end -function deact; deactivate; end - -function psg -d "Grep for a running process, returning its PID and full string" - ps auxww | grep -i --color=always $argv | grep -v grep | collapse | cuts -f 2,11- -end - -function hey_virtualbox_shut_down_or_i_will_fucking_cut_you - VBoxManage controlvm $argv poweroff -end - -set AG_BIN (which ag) -function actual_ag - # Fuck you fish this is fucking ridiculous. Let me use $AG_BIN as - # a command. Or at least give me a way to do it like run $AG_BIN args or - # something jesus. - if test $AG_BIN = '/usr/local/bin/ag' - /usr/local/bin/ag $argv - else - if test $AG_BIN = '/usr/bin/ag' - /usr/bin/ag $argv - else - echo "Fish is a dick, sorry." - end - end -end -function ag -d "Run Ag with appropriate options." - if test -f '.agignore' - # Extra if statement because I can't figure out how to && things in - # a fish conditional and the documentation does not see fit to explain - # that little tidbit and can we please get a shell without complete - # bullshit as a scripting language syntax? - if grep -q 'pragma: skipvcs' '.agignore' - actual_ag --search-files -U $argv - else - actual_ag --search-files $argv - end - else - actual_ag --search-files $argv - end -end - -function count_t_tasks; ~/lib/t/t.py --task-dir="~/Dropbox/tasks" --list=tasks.txt | wc -l $argv; end -# set -g T_TASK_COUNT (count_t_tasks) -function t - ~/lib/t/t.py --task-dir="~/Dropbox/tasks" --list=tasks.txt $argv - set -g T_TASK_COUNT (count_t_tasks) -end - -function packfor - cp ~/Dropbox/tasks/pack-archive ~/Dropbox/tasks/pack.txt -end -function p - ~/lib/t/t.py --task-dir="~/Dropbox/tasks" --list=pack.txt $argv -end - -function s - ~/lib/t/t.py --task-dir="~/.simple-tasks" --list=tasks.txt $argv - set -g T_TASK_COUNT (count_t_tasks) -end +function ..; cd ..; end +function ...; cd ../..; end +function ....; cd ../../..; end +function .....; cd ../../../..; end # }}} # Completions {{{ @@ -234,6 +93,8 @@ set -g -x MAVEN_OPTS "-Xmx512M -XX:MaxPermSize=512M" set -g -x _JAVA_OPTIONS "-Djava.awt.headless=true" +set -g -x GPG_TTY (tty) + function headed_java -d "Put Java into headed mode" echo "Changing _JAVA_OPTIONS" echo "from: $_JAVA_OPTIONS" @@ -247,6 +108,7 @@ echo " to: $_JAVA_OPTIONS" end + # }}} # Python variables {{{ @@ -270,19 +132,10 @@ . ~/.config/fish/virtualenv.fish # }}} -# Rubby {{{ - -if test -s /usr/local/bin/rbenv - /usr/local/bin/rbenv rehash 2>/dev/null -end - -# }}} # Z {{{ . ~/src/z-fish/z.fish -function j; z $argv; end - # }}} # Prompt {{{ @@ -360,42 +213,9 @@ end # }}} -# Directories {{{ - -function ..; cd ..; end -function ...; cd ../..; end -function ....; cd ../../..; end -function .....; cd ../../../..; end - -function md; mkdir -p $argv; end - -function l1; tree --dirsfirst -ChFL 1 $argv; end -function l2; tree --dirsfirst -ChFL 2 $argv; end -function l3; tree --dirsfirst -ChFL 3 $argv; end -function l4; tree --dirsfirst -ChFL 4 $argv; end -function l5; tree --dirsfirst -ChFL 5 $argv; end -function l6; tree --dirsfirst -ChFL 6 $argv; end - -function ll1; tree --dirsfirst -ChFupDaL 1 $argv; end -function ll2; tree --dirsfirst -ChFupDaL 2 $argv; end -function ll3; tree --dirsfirst -ChFupDaL 3 $argv; end -function ll4; tree --dirsfirst -ChFupDaL 4 $argv; end -function ll5; tree --dirsfirst -ChFupDaL 5 $argv; end -function ll6; tree --dirsfirst -ChFupDaL 6 $argv; end - -function l; l1 $argv; end -function ll; ll1 $argv; end - -# }}} -# Misc {{{ - -# }}} -# Local Settings {{{ if test -s $HOME/.config/fish/local.fish . $HOME/.config/fish/local.fish end -# }}} - true diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/ag.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/ag.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,32 @@ +set -g -x AG_BIN (which ag) + +function actual_ag + # Fuck you fish this is fucking ridiculous. Let me use $AG_BIN as + # a command. Or at least give me a way to do it like run $AG_BIN args or + # something jesus. + if test $AG_BIN = '/usr/local/bin/ag' + /usr/local/bin/ag $argv + else + if test $AG_BIN = '/usr/bin/ag' + /usr/bin/ag $argv + else + echo "Fish is a dick, sorry." + end + end +end + +function ag -d "Run Ag with appropriate options." + if test -f '.agignore' + # Extra if statement because I can't figure out how to && things in + # a fish conditional and the documentation does not see fit to explain + # that little tidbit and can we please get a shell without complete + # bullshit as a scripting language syntax? + if grep -q 'pragma: skipvcs' '.agignore' + actual_ag --search-files -U $argv + else + actual_ag --search-files $argv + end + else + actual_ag --search-files $argv + end +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/collapse.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/collapse.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function collapse -d "Collapse multiple spaces into single spaces" + sed -e 's/ */ /g' +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/cuts.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/cuts.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function cuts -d "Cut on space characters instead of tabs" + cut -d' ' $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/deact.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/deact.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function deact -d "deactivate" + deactivate +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/empty-trash.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/empty-trash.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,5 @@ +function emptytrash -d "Empty the OS X trash folders" + sudo rm -rfv /Volumes/*/.Trashes + sudo rm -rfv ~/.Trash + sudo rm -rfv /private/var/log/asl/*.asl +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/fabric.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/fabric.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function fabric -d "fab with my SSH identity" + fab -i ~/.ssh/stevelosh $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/fix-open-with.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/fix-open-with.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,7 @@ +function fix-open-with -d "Fix the shitty OS X Open With menu duplicates" + /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user + killall Finder + echo "Open With has been rebuilt, Finder will relaunch" +end + + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/g.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/g.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function g -d "git" + git $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/h.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/h.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function h -d "hg" + hg $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/hey-virtualbox-shut-down-or-i-will-fucking-cut-you.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/hey-virtualbox-shut-down-or-i-will-fucking-cut-you.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,4 @@ +function hey-virtualbox-shut-down-or-i-will-fucking-cut-you + VBoxManage controlvm $argv poweroff +end + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/hi.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/hi.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,4 @@ +function hi --argument pattern -d "Highlight a pattern in a stream of text" + grep -E --color=always --line-buffered "$pattern|\$" +end + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/hl.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/hl.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function hl -d "Highlighted Less" + less -R +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/j.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/j.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function j -d "j is the new z is the new j" + z $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/l.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/l.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function l + l1 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/l1.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/l1.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function l1 + tree --dirsfirst -ChFL 1 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/l2.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/l2.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function l2 + tree --dirsfirst -ChFL 2 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/l3.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/l3.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function l3 + tree --dirsfirst -ChFL 3 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/l4.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/l4.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function l4 + tree --dirsfirst -ChFL 4 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/l5.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/l5.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function l5 + tree --dirsfirst -ChFL 5 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/l6.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/l6.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function l6 + tree --dirsfirst -ChFL 6 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/ll.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/ll.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function ll + ll1 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/ll1.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/ll1.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function ll1 + tree --dirsfirst -ChFupDaL 1 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/ll2.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/ll2.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function ll2 + tree --dirsfirst -ChFupDaL 2 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/ll3.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/ll3.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function ll3 + tree --dirsfirst -ChFupDaL 3 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/ll4.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/ll4.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function ll4 + tree --dirsfirst -ChFupDaL 4 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/ll5.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/ll5.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function ll5 + tree --dirsfirst -ChFupDaL 5 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/ll6.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/ll6.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function ll6 + tree --dirsfirst -ChFupDaL 6 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/lrstrip.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/lrstrip.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,5 @@ +function lrstrip -d "Strip whitespace from both ends of each line" + lstrip | rstrip +end + + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/lstrip.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/lstrip.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,4 @@ +function lstrip -d "Strip whitespace from the left of each line" + sed -e 's/^[ \t]*//' +end + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/md.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/md.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function md -d "mkdir" + mkdir -p $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/mutt.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/mutt.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,5 @@ +set -g -x MUTT_BIN (which mutt) + +function mutt + bash --login -c "cd ~/Desktop; $MUTT_BIN \$@" custom_mutt $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/o.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/o.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function o -d "open" + open $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/oldgcc.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/oldgcc.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function oldgcc -d "Set \$CC to the old GCC" + set -g CC /usr/bin/gcc-4.0 +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/oo.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/oo.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function oo -d "open ." + open . +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/p.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/p.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function p + ~/lib/t/t.py --task-dir="~/Dropbox/tasks" --list=pack.txt $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/packfor.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/packfor.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function packfor + cp ~/Dropbox/tasks/pack-archive ~/Dropbox/tasks/pack.txt +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/path_this.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/path_this.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function path_this -d "Add the cwd to the front of PATH" + set PATH (pwd) $PATH +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/pbc.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/pbc.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function pbc -d "pbcopy" + pbcopy $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/pbp.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/pbp.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function pbp -d "pbpaste" + pbpaste $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/pbpb.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/pbpb.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function pbpb -d "pbpaste to pastebin site" + pbp | pb +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/pj.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/pj.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,4 @@ +function pj -d "Prettify JSON" + python -m json.tool | pygmentize -l json +end + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/psg.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/psg.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,5 @@ +function psg -d "Grep for a running process, returning its PID and full string" + ps auxww | grep -i --color=always $argv | grep -v grep | collapse | cuts -f 2,11- +end + + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/rstrip.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/rstrip.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function rstrip -d "Strip whitespace from the right of each line" + sed -e 's/[ \t]*$//' +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/sc.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/sc.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function sc -d "Launch a Scala console" + mvn scala:console $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/serve-this.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/serve-this.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function serve-this -d "Launch a webserver on 8000 serving the cwd" + python -m SimpleHTTPServer +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/sjoin.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/sjoin.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function sjoin -d "Join input lines into a single line with spaces" + tr '\n' ' ' +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/spotlight-off.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/spotlight-off.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,5 @@ +function spotlight-off -d "Turn off Spotlight indexing" + sudo mdutil -a -i off + and sudo mv /System/Library/CoreServices/Search.bundle/ /System/Library/CoreServices/SearchOff.bundle/ + and killall SystemUIServer +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/spotlight-on.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/spotlight-on.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,5 @@ +function spotlight-on -d "Turn on Spotlight indexing" + sudo mdutil -a -i on + and sudo mv /System/Library/CoreServices/SearchOff.bundle/ /System/Library/CoreServices/Search.bundle/ + and killall SystemUIServer +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/spotlight-tail.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/spotlight-tail.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function spotlight-tail -d "Watch what Spotlight is doing" + sudo fs_usage -w -f filesys mdworker | grep "open" +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/t.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/t.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,4 @@ +function t + ~/lib/t/t.py --task-dir="~/Dropbox/tasks" --list=tasks.txt $argv +end + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/tm.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/tm.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function tm "tmux" + tmux -u2 $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/urldecode.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/urldecode.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function urldecode -d "Urldecode the input into plaintext output" + python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])" $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/urlencode.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/urlencode.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,4 @@ +function urlencode -d "Urlencode the plaintext input" + python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);" $argv +end + diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/weechat.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/weechat.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function weechat + weechat-curses $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 fish/functions/wo.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/functions/wo.fish Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,3 @@ +function wo -d "workon" + workon $argv +end diff -r 579ee6ce9270 -r e8bc4f9704f3 gitconfig --- a/gitconfig Tue Jan 14 17:25:57 2014 -0500 +++ b/gitconfig Tue Jan 14 17:27:49 2014 -0500 @@ -53,9 +53,10 @@ unshel = unshelve delete-local-branch = branch -D - delete-remote-branch = push origin --delete - delete-local-reference-to-remote-branch = branch -rd - delete-branch = "!sh -c 'git delete-local-branch $1; git delete-local-reference-to-remote-branch origin/$1; git delete-local-reference-to-remote-branch upstream/$1' -" + delete-local-reference-to-remote-branch = "!sh -c 'git branch -rd $1/$2' -" + delete-remote-branch = "!sh -c 'git push $1 --delete $2' -" + ; delete-branch = "!sh -c 'git delete-local-branch $1; git delete-local-reference-to-remote-branch origin/$1; git delete-local-reference-to-remote-branch upstream/$1' -" + delete-branch = "!sh -c 'git delete-local-branch $1; git remotes | cut -f1 | sort | uniq | xargs -n1 -J % git delete-local-reference-to-remote-branch % $1' -" currentbranch = rev-parse --abbrev-ref HEAD diff -r 579ee6ce9270 -r e8bc4f9704f3 vim/after/indent/clojure.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/after/indent/clojure.vim Tue Jan 14 17:27:49 2014 -0500 @@ -0,0 +1,1 @@ +setlocal lispwords+=->,->>,do,match diff -r 579ee6ce9270 -r e8bc4f9704f3 vim/vimrc --- a/vim/vimrc Tue Jan 14 17:25:57 2014 -0500 +++ b/vim/vimrc Tue Jan 14 17:27:49 2014 -0500 @@ -254,8 +254,8 @@ " Convenience mappings ---------------------------------------------------- {{{ " Fuck you, help key. -noremap -inoremap +noremap :checktime +inoremap :checktime " Stop it, hash key. inoremap # X# @@ -297,7 +297,7 @@ vnoremap gu u " Rebuild Ctags (mnemonic RC -> CR -> ) -nnoremap :silent !myctags:redraw! +nnoremap :silent !myctags >/dev/null 2>&1 &:redraw! " Highlight Group(s) nnoremap :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' @@ -498,8 +498,19 @@ " screen. Both will pulse the cursor line so you can see where the hell you " are. will also fold everything in the buffer and then unfold just " enough for you to see the destination line. -nnoremap mzzvzz15`z:Pulse -nnoremap vmzzMzvzz15`z:Pulse +function! JumpToTag() + execute "normal! \mzzvzz15\" + execute "keepjumps normal! `z" + Pulse +endfunction +function! JumpToTagInSplit() + execute "normal! \v\mzzMzvzz15\" + execute "keepjumps normal! `z" + Pulse +endfunction +nnoremap :silent! call JumpToTag() +nnoremap :silent! call JumpToTagInSplit() +" nnoremap vmzzMzvzz15`z:Pulse " Keep search matches in the middle of the window. nnoremap n nzzzv @@ -580,9 +591,8 @@ nnoremap za vnoremap za -" Make zO recursively open whatever top level fold we're in, no matter where the -" cursor happens to be. -nnoremap zO zCzO +" Make zO recursively open whatever fold we're in, even if it's partially open. +nnoremap zO zczO " "Focus" the current line. Basically: " @@ -667,6 +677,8 @@ let g:clojure_highlight_extra_defs = [ \ 'defparser', + \ 'deftest', + \ 'match', \ \ 'defproject', \ @@ -941,7 +953,8 @@ " Use 1/2/3 to add headings. au Filetype markdown nnoremap 1 yypVr=:redraw au Filetype markdown nnoremap 2 yypVr-:redraw - au Filetype markdown nnoremap 3 mzI###`zllll + au Filetype markdown nnoremap 3 mzI###`zllll + au Filetype markdown nnoremap 4 mzI####`zlllll au Filetype markdown nnoremap p VV:'<,'>!python -m json.tool au Filetype markdown vnoremap p :!python -m json.tool @@ -1267,6 +1280,11 @@ vnoremap H :Gbrowse " }}} +" GnuPG {{{ + +let g:GPGPreferArmor = 1 + +" }}} " Gundo {{{ nnoremap :GundoToggle @@ -1439,7 +1457,9 @@ " Syntastic {{{ let g:syntastic_enable_signs = 1 -let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_open = 0 +let g:syntastic_check_on_wq = 0 +let g:syntastic_auto_jump = 0 let g:syntastic_java_checker = 'javac' let g:syntastic_mode_map = { \ "mode": "active", @@ -2006,18 +2026,13 @@ " Pulse Line {{{ function! s:Pulse() " {{{ - let current_window = winnr() - windo set nocursorline - execute current_window . 'wincmd w' - setlocal cursorline - redir => old_hi silent execute 'hi CursorLine' redir END let old_hi = split(old_hi, '\n')[0] let old_hi = substitute(old_hi, 'xxx', '', '') - let steps = 9 + let steps = 8 let width = 1 let start = width let end = steps * width diff -r 579ee6ce9270 -r e8bc4f9704f3 weechat/perl/autoload/colorize_lines.pl --- a/weechat/perl/autoload/colorize_lines.pl Tue Jan 14 17:25:57 2014 -0500 +++ b/weechat/perl/autoload/colorize_lines.pl Tue Jan 14 17:27:49 2014 -0500 @@ -1,5 +1,6 @@ # -# Copyright (c) 2010-2012 by Nils Görs +# Copyright (c) 2010-2013 by Nils Görs +# Copyleft (ɔ) 2013 by oakkitten # # colors the channel text with nick color and also highlight the whole line # colorize_nicks.py script will be supported @@ -17,9 +18,37 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# for settings see help page -# +# with version 3.0 some options were renamed or have new possible values: +# old: new: +# avail_buffer buffer +# blacklist_channels blacklist_buffers +# highlight new values + +# obsolete options: +# buffer_autoset +# hotlist_max_level_nicks_add +# highlight_regex +# highlight_words +# shuffle +# chat see option highlight + # history: +# 3.0: large part of script rewritten +# fix: works nicely with irc colors +# improved: highlight_regex and highlight_words work in a natural way +# removed: command /colorize_lines +# removed: option shuffle +# 2.2: fix: regex with [tab] in message (patch by sqrrl) +# 2.1: fix: changing highlight color did not apply messages already displayed (reported by rafi_) +# 2.0: fix: debugging weechat::print() removed (thanks demure) +# 1.9: fix: display bug with nick_mode +# 1.8 add: option "use_irc_colors" (requested by Zertap) +# fix: empty char for nick_mode was used, even when "irc.look.nick_mode_empty" was OFF (reported by FlashCode) +# 1.7: fix: broken lines in dcc chat (reported by equatorping) +# 1.6: improved: wildcard "*" can be used for server and/or nick. (requested by ldvx) +# : add: new value, "only", for option "own_lines" (read help!) +# 1.5: sync: option weechat.look.nickmode changed in 0.3.9 to "irc.look.nick_mode" +# 1.4: fix: whole ctcp message was display in prefix (reported by : Mkaysi) # 1.3: fix: now using weechat::buffer_get_string() instead of regex to prevent problems with dots inside server-/channelnames (reported by surfhai) # 1.2: add: hook_modifier("colorize_lines") to use colorize_lines with another script. # : fix: regex was too greedy and also hit tag "prefix_nick_ccc" @@ -31,12 +60,12 @@ # : clean up code # 0.8.1: fix: regex() # 0.8: added: option "avail_buffer" and "nicks" (please read help-page) (suggested by ldvx) -# : fix: blacklist_channels wasn't load at start +# : fix: blacklist_buffers wasn't load at start # : fix: nick_modes wasn't displayed since v0.7 # : rewrote init() routine # : thanks to stfn for hint with unescaped variables in regex. # 0.7: fix: bug when irc.look.nick_suffix was set (reported and beta-testing by: hw2) (>= weechat 0.3.4) -# blacklist_channels option supports servername +# blacklist_buffers option supports servername # clean up code # 0.6: code optimazations. # rename of script (rainbow_text.pl -> colorize_lines.pl) (suggested by xt and flashcode) @@ -55,528 +84,168 @@ # # Development is currently hosted at # https://github.com/weechatter/weechat-scripts -# -# requirements: sunglasses ;-) + +# use Data::Dumper +# $Data::Dumper::Useqq=1; use strict; my $prgname = "colorize_lines"; -my $version = "1.3"; -my $description = "colors text in chat area with according nick color. Highlight messages will be fully highlighted in chat area"; +my $version = "3.0"; +my $description = "colors text in chat area with according nick color, including highlights"; -# default values -my %default_options = ( "var_highlight" => "on", # script options in weechat - "var_avail_buffer" => "all", # all, channel, query - "var_chat" => "on", - "var_shuffle" => "off", - "var_buffer_autoset" => "off", - "var_look_highlight" => "off", - "var_look_highlight_regex" => "off", - "var_hotlist_max_level_nicks_add" => "off", - "var_blacklist_channels" => "", - "var_nicks" => "", - "var_own_lines" => "off", +my %config = ("buffers" => "all", # all, channel, query + "blacklist_buffers" => "", # "a,b,c" + "lines" => "on", + "highlight" => "on", # on, off, nicks + "nicks" => "", # "d,e,f", "/file" + "own_lines" => "on", # on, off, only ); -my %help_desc = ( "avail_buffer" => "messages will be colored in buffer (all = all buffers, channel = channel buffers, query = query buffers (default: all ", - "blacklist_channels" => "comma separated list with channelname. Channels in this list will be ignored. (e.g.: freenode.#weechat,freenode.#weechat-fr)", - "shuffle" => "toggle shuffle color mode for chats area (default: off)", - "chat" => "colors text in chat area with according nick color (default: on)", - "highlight" => "highlight messages will be fully highlighted in chat area (on = whole line will be highlighted, off = only nick will be highlighted, always = a highlight will always color the whole message) (default: on)", - "hotlist_max_level_nicks_add" => "toggle highlight for hotlist (default: off)", - "buffer_autoset" => "toggle highlight color in chat area for buffer_autoset (default: off)", - "look_highlight" => "toggle highlight color in chat area for option weechat.look.highlight (default: off)", - "look_highlight_regex" => "toggle highlight color in chat area for option weechat.look.highlight_regex (default: off)", - "nicks" => "comma separated list with nicknames. Only messages from nicks in this list will be colorized. (e.g.: freenode.nils_2,freenode.flashcode,freenode.weebot). You can also give a filename with nicks. The filename has to start with \"/\" (e.g.: /buddylist.txt). The format has to be: one nick each line with .", - "own_lines" => "colors own written messages (default: off)", +my %help_desc = ("buffers" => "buffer type affected by the script (all/channel/query, default: all)", + "blacklist_buffers" => "comma-separated list of channels to be ignored (e.g. freenode.#weechat,*.#python)", + "lines" => "apply nickname color to the non-highlighted lines (off/on/nicks). the latter will limit highlighting to nicknames in option 'nicks'", + "highlight" => "apply highlight color to the highlighted lines (off/on/nicks). the latter will limit highlighting to nicknames in option 'nicks'", + "nicks" => "comma-separater list of nicks (e.g. freenode.cat,*.dog) OR file name starting with '/' (e.g. /file.txt). in the latter case, nicknames will get loaded from that file inside weechat folder (e.g. from ~/.weechat/file.txt). nicknames in file are newline-separated (e.g. freenode.dog\\n*.cat)", + "own_lines" => "apply nickname color to own lines (off/on/only). the latter turns off all other kinds of coloring altogether", ); -my $zahl = 0; -my $weechat_version = 0; -my $nick_mode = ""; -my $get_prefix_action = ""; -my @var_blacklist_channels = ""; -my @nick_list = ""; - -# standard colours. -my %colours = ( 0 => "darkgray", 1 => "red", 2 => "lightred", 3 => "green", - 4 => "lightgreen", 5 => "brown", 6 => "yellow", 7 => "blue", - 8 => "lightblue", 9 => "magenta", 10 => "lightmagenta", 11 => "cyan", - 12 => "lightcyan", 13 => "white"); +#################################################################################################### config # program starts here sub colorize_cb { -my ( $data, $modifier, $modifier_data, $string ) = @_; - -if (index($modifier_data,"irc_privmsg") == -1){ # its neither a channel nor a query buffer - return $string; -} - -if ($default_options{var_highlight} eq "off" and $default_options{var_chat} eq "off"){ # all options OFF - return $string; -} - -# get servername and channelname. Do not use regex to extract server- and channelname out of $modifier_data. You will FAIL! -# some possible names: freenode.#weechat, freenode.#weechat.de, freenode.query, chat.freenode.net.#weechat, chat.freenode.net.#weechat.de -$modifier_data =~ (m/(.*);(.*);/); -my $plugin = $1; -my $name = $2; -my $buf_pointer = weechat::buffer_search($plugin,$name); -return $string if ($buf_pointer eq ""); -my $servername = weechat::buffer_get_string($buf_pointer, "localvar_server"); -my $channel_name = weechat::buffer_get_string($buf_pointer, "localvar_channel"); - -my $my_nick = weechat::info_get( 'irc_nick', $servername ); # get nick with servername (;freenode.) - -if ( grep /^$servername.$channel_name$/, @var_blacklist_channels ) { # check for blacklist_channels - return $string; -} - -$string =~ m/^(.*)\t(.*)/; # get the nick name: nick[tab]string -my $nick = $1; # nick with nick_mode and color codes -my $line = $2; # get written text - -$line = weechat::string_remove_color($line,""); # remove color-codes from line, first -# get the nick name from modifier_data (without nick_mode and color codes! Take care of tag "prefix_nick_ccc") -$modifier_data =~ m/(^|,)nick_(.*),/; -my $nick_wo_suffix = $2; # nickname without nick_suffix - -if ( lc($nick_wo_suffix) eq lc($my_nick) ){ # this one checks for own messages - if ( $default_options{var_avail_buffer} ne "all" ){ # check for option avail_buffer - if ( substr($channel_name, 0, 1) eq "#" ){ # get first chat of buffer. - return $string if ( $default_options{var_avail_buffer} ne "channel" ); # channel? yes - }else{ # query buffer? - return $string if ( $default_options{var_avail_buffer} ne "query" ); # yes - } - } -} + my ( $data, $modifier, $modifier_data, $string ) = @_; -# recreate irc.look.nick_suffix and irc.color.nick_suffix -my $nick_suffix_with_color = ""; -my $nick_suffix = weechat::config_string( weechat::config_get("irc.look.nick_suffix")); -if ( $nick_suffix ne "" ){ - my $nick_suffix_color = weechat::color( weechat::config_color( weechat::config_get( "irc.color.nick_suffix" ))); - $nick_suffix_with_color = $nick_suffix_color . $nick_suffix; -} -# recreate irc.look.nick_prefix and irc.color.nick_prefix -my $nick_prefix_with_color = ""; -my $nick_prefix = weechat::config_string( weechat::config_get("irc.look.nick_prefix")); -if ( $nick_prefix ne "" ){ - my $nick_prefix_color = weechat::color( weechat::config_color( weechat::config_get( "irc.color.nick_prefix" ))); - $nick_prefix_with_color = $nick_prefix_color . $nick_prefix; -} - -# check for action (/me) -my $prefix_action_with_color = ""; -if (index($modifier_data,"irc_action") >= 0){ - my $prefix_action_color = weechat::color( weechat::config_color( weechat::config_get( "weechat.color.chat_prefix_action" ))); - my $prefix_action = weechat::config_string( weechat::config_get("weechat.look.prefix_action")); - $prefix_action_with_color = $prefix_action_color . $prefix_action; -} - -# check if look.nickmode is ON and no prefix and no query buffer -$nick_mode = ""; -if ( weechat::config_boolean(weechat::config_get("weechat.look.nickmode")) == 1 and ($nick ne $get_prefix_action) and (index($modifier_data,"notify_private")) == -1){ -# if ($nick =~ m/^\@|^\%|^\+|^\~|^\*|^\&|^\!|^\-/) { # check for nick modes (@%+~*&!-) without colour - my $nick_pointer = weechat::nicklist_search_nick($buf_pointer,"",$nick_wo_suffix); - $nick_mode = weechat::nicklist_nick_get_string($buf_pointer,$nick_pointer,"prefix"); - my $color_mode = weechat::color( weechat::nicklist_nick_get_string($buf_pointer, $nick_pointer, "prefix_color") ); - if ( $nick_mode eq "" or $color_mode eq ""){ # no nick_mode! - $nick_mode = ""; - }else{ # nick_mode exists - $nick_mode = $color_mode . $nick_mode; - } -} - -# i wrote the message -#weechat::print("","nick_wo: $nick_wo_suffix"); -#weechat::print("","my_nick: $my_nick"); - if ($nick_wo_suffix eq $my_nick ){ # i wrote the message - return $string if check_whitelist_nicks($servername, $my_nick, $nick_wo_suffix); # check for whitelist - if ($default_options{var_chat} eq "on"){ - my $nick_color = weechat::config_color(weechat::config_get("weechat.color.chat_nick_self")); # get my nick color - $nick_color = weechat::color($nick_color); - $line = colorize_nicks($nick_color,$modifier_data,$line); - - if (index($modifier_data,"irc_action") >= 0){ # /me message? - $nick = $prefix_action_with_color; - $nick_mode = ""; # clear nick_mode for /me - }else{ - $nick = $nick_prefix_with_color . $nick_color . $nick_wo_suffix . $nick_suffix_with_color; - } - $line = $nick_mode . $nick_color . $nick . "\t" . $nick_color . $line . weechat::color('reset'); - return $line; - }else{ - return $string; - } + # quit if it's not a privmsg or ctcp + # or we are not supposed to + if ((index($modifier_data,"irc_privmsg") == -1) || + (index($modifier_data,"irc_ctcp") >= 0)) { + return $string; } - -# get nick color -$nick = $nick_wo_suffix; -#$nick = weechat::string_remove_color($nick_wo_suffix,""); # remove colour-codes from nick -my $nick_color = weechat::info_get('irc_nick_color', $nick_wo_suffix); # get nick-colour - - my $var_hl_max_level_nicks_add = 0; -# highlight message received? - if ( $default_options{var_highlight} eq "on" or $default_options{var_highlight} eq "always" ){# highlight_mode on? -# this one check for other nick!! - - unless ( $default_options{var_highlight} eq "always" ){ # option is not "always" - return $string if check_whitelist_nicks($servername, $my_nick, $nick_wo_suffix); # check for whitelist - } - - if ( $default_options{var_buffer_autoset} eq "on" || $default_options{var_look_highlight} eq "on" ){# buffer_autoset or look_highlight "on"? - my $highlight_words = ""; + # find buffer pointer + $modifier_data =~ m/([^;]*);([^;]*);/; + my $buffer = weechat::buffer_search($1, $2); + return $string if ($buffer eq ""); - # get strings from buffer_autoset and/or weechat.look.highlight and weechat.look.highlight_regex - if ($default_options{var_buffer_autoset} eq "on"){ - my $highlight_words_add = weechat::config_string(weechat::config_get("buffer_autoset.buffer.irc.".$servername.".".$channel_name.".highlight_words_add")); - $highlight_words .= $highlight_words_add . ","; - } - - if ($default_options{var_look_highlight} eq "on"){ - my $look_highlight = weechat::config_string( weechat::config_get("weechat.look.highlight") ); - $highlight_words .= $look_highlight; - } - if ( $default_options{var_hotlist_max_level_nicks_add} eq "on" and weechat::config_string(weechat::config_get("buffer_autoset.buffer.irc.".$servername.".".$channel_name.".hotlist_max_level_nicks_add")) =~ /$nick\:[0-2]/ ){ - $var_hl_max_level_nicks_add = 1; - } - - $/ = ","; # kill "," at end of string - - chomp($highlight_words); - -# weechat::print("",$highlight_words); - foreach ( split( /,+/, $highlight_words ) ) { # check for highlight_words - if ($_ eq ""){next;} # ignore empty string - my $search_string = shell2regex($_); + # find buffer name, server name + # return if buffer is in a blacklist + my $buffername = weechat::buffer_get_string($buffer, "name"); + return $string if weechat::string_has_highlight($buffername, $config{blacklist_buffers}); + my $servername = weechat::buffer_get_string($buffer, "localvar_server"); - if ($string =~ m/\b$search_string\b/gi){ # i (ignorecase) - my $color_highlight = weechat::config_color(weechat::config_get("weechat.color.chat_highlight")); - my $color_highlight_bg = weechat::config_color(weechat::config_get("weechat.color.chat_highlight_bg")); - my $high_color = weechat::color("$color_highlight,$color_highlight_bg"); - if (index($modifier_data,"irc_action") >= 0){ - $line = colorize_nicks($high_color,$modifier_data,$line); - $nick = $prefix_action_with_color; - $line = $high_color . $nick . "\t" . $high_color . $line . weechat::color('reset'); - return $line; - } - $line = colorize_nicks($high_color,$modifier_data,$line); - $line = $nick_mode . $high_color . $nick_prefix_with_color . $nick . $nick_suffix_with_color . "\t" . $high_color . $line . weechat::color('reset'); - return $line; - } - } - } - # buffer_autoset is off. - if ( weechat::string_has_highlight($line, $my_nick) >= 1){ -# if (lc($string) =~ m/(\w.*$my_nick.*)/){ # my name called in string (case insensitiv)? - my $color_highlight = weechat::config_color(weechat::config_get("weechat.color.chat_highlight")); - my $color_highlight_bg = weechat::config_color(weechat::config_get("weechat.color.chat_highlight_bg")); - - my $high_color = weechat::color("$color_highlight,$color_highlight_bg"); + # find stuff between \t + $string =~ m/^([^\t]*)\t(.*)/; + my $left = $1; + my $right = $2; - if (index($modifier_data,"irc_action") >= 0){ # action used (/me)? - $line = colorize_nicks($high_color,$modifier_data,$line); - $nick = $prefix_action_with_color; - $line = $high_color . $nick . "\t" . $high_color . $line . weechat::color('reset'); - return $line; - } + # find nick of the sender + # find out if we are doing an action + my $nick = ($modifier_data =~ m/(^|,)nick_([^,]*)/) ? $2 : weechat::string_remove_color($left, ""); + my $action = ($modifier_data =~ m/\birc_action\b/) ? 1 : 0; -# highlight whole line - if ( $var_hl_max_level_nicks_add eq 0 ){ - $line = colorize_nicks($high_color,$modifier_data,$line); - $line = $nick_prefix_with_color . $nick_mode . $high_color . $nick . $nick_suffix_with_color . "\t" . $high_color . $line . weechat::color('reset'); - return $line; - } - } - } # highlight area finished - -return $string if check_whitelist_nicks($servername, $my_nick, $nick_wo_suffix); # check for whitelist -# this one check for other nick!! -if ( $default_options{var_avail_buffer} ne "all" ){ # check for option avail_buffer - if ( index($modifier_data,"notify_message") > -1){ # message is public - return $string if ( $default_options{var_avail_buffer} ne "channel" ); - }elsif ( index($modifier_data,"notify_private") > -1){ # message is privat - return $string if ( $default_options{var_avail_buffer} ne "query" ); - } -} + ######################################## get color -# simple channel message - if ($default_options{var_chat} eq "on"){ # chat_mode on? - if ($default_options{var_shuffle} eq "on"){ # color_shuffle on? - my $zahl2 = 0; - my $my_color = weechat::config_color(weechat::config_get("weechat.color.chat_nick_self"));# get my own nick colour - for (1){ # get a random colour but don't use - redo if ( $zahl == ($zahl2 = int(rand(14))) or ($colours{$zahl2} eq $my_color) );# latest color nor own nick color - $zahl = $zahl2; - } - $nick_color = weechat::color($colours{$zahl}); # get new random color - } - -# check for weechat version and use weechat.look.highlight_regex option - if ( $weechat_version eq 1 ){ # weechat is >= 0.3.4? - if ( $default_options{var_look_highlight_regex} eq "on" ){ - if ( weechat::string_has_highlight_regex($line,weechat::config_string(weechat::config_get("weechat.look.highlight_regex"))) eq 1 ){ - my $color_highlight = weechat::config_color(weechat::config_get("weechat.color.chat_highlight")); - my $color_highlight_bg = weechat::config_color(weechat::config_get("weechat.color.chat_highlight_bg")); - - my $high_color = weechat::color("$color_highlight,$color_highlight_bg"); - $line = colorize_nicks($high_color,$modifier_data,$line); - $line = $nick_prefix_with_color . $nick_mode . $high_color . $nick . $nick_suffix_with_color . "\t" . $high_color . $line . weechat::color('reset'); - return $line; - } - } - } - if (index($modifier_data,"irc_action") >= 0){ -# if ($default_options{prefix_action} eq $nick){ - my $nick_color = weechat::info_get('irc_nick_color', $nick_wo_suffix); # get nick-color - $line = colorize_nicks($nick_color,$modifier_data,$line); - $nick = $prefix_action_with_color; - $line = $nick . "\t" . $nick_color . $line . weechat::color('reset'); - return $line; - } - - $line = colorize_nicks($nick_color,$modifier_data,$line); - $line = $nick_prefix_with_color . $nick_mode . $nick_color . $nick . $nick_suffix_with_color . "\t" . $nick_color . $line . weechat::color('reset'); # create new line nick_color+nick+separator+text - return $line; - }else{ - return $string; # return original string - } -} # end of sub colorize_cb{} - -# whitelist nicks -sub check_whitelist_nicks{ -my ( $servername, $my_nick, $nick_wo_suffix ) = @_; - if ( $default_options{var_nicks} ne "" and $default_options{var_own_lines} eq "off" ){ # nicks in option and own_lines = off - return 1 unless (grep /^\Q$servername.$nick_wo_suffix\E$/i, @nick_list) # check other nicks - }elsif ( $default_options{var_nicks} ne "" and $default_options{var_own_lines} eq "on" ){ # nicks in option and own_lines = on - if ( $nick_wo_suffix ne $my_nick){ # not my nick! - return 1 unless (grep /^\Q$servername.$nick_wo_suffix\E$/i, @nick_list) # check other nicks - } - }elsif( $default_options{var_nicks} eq "" and $default_options{var_own_lines} eq "off" ){ # no nicks and do not color my line? - if ( $nick_wo_suffix eq $my_nick){ # my nick? - return 1; # yes - } - } -return 0; -} - -# converts shell wildcard characters to regex -sub shell2regex { - my $globstr = shift; - my %patmap = ( - '*' => '.*', - '?' => '.', - '[' => '[', - ']' => ']', - ); - $globstr =~ s{(.)} { $patmap{$1} || "\Q$1" }ge; - return $globstr; -} - -# check for colorize_nicks script an set colour before and after nick name -sub colorize_nicks{ -my ( $nick_color, $mf_data, $line ) = @_; - -my $pyth_ptn = weechat::infolist_get("python_script","","colorize_nicks"); -weechat::infolist_next($pyth_ptn); - -if ( "colorize_nicks" eq weechat::infolist_string($pyth_ptn,"name") ){ # does colorize_nicks is installed? - $line = weechat::hook_modifier_exec( "colorize_nicks",$mf_data,$line); # call colorize_nicks function and color the nick(s) - my @array = ""; - my $color_code_reset = weechat::color('reset'); - @array=split(/$color_code_reset/,$line); - my $new_line = ""; - foreach (@array){ - $new_line .= $nick_color . $_ . weechat::color('reset'); - } - $new_line =~ s/\s+$//g; # remove space at end - $line = $new_line; -} -weechat::infolist_free($pyth_ptn); - -return $line; -} - -# -----------------------------[ config ]----------------------------------- -sub init_config{ - foreach my $option ( keys %default_options ){ - $option = substr($option,4,length($option)-4); - if (!weechat::config_is_set_plugin($option)){ - weechat::config_set_plugin($option, $default_options{"var_" . $option}); - }else{ - $default_options{"var_" . $option} = lc( weechat::config_get_plugin($option) ); + my $color = ""; + my $my_nick = weechat::buffer_get_string($buffer, "localvar_nick"); + if ($my_nick eq $nick) { + # it's our own line + # process only if own_lines is "on" or "only" (i.e. not "off") + return $string if ($config{own_lines} eq "off"); + $color = weechat::color("chat_nick_self"); + } else { + # it's someone else's line + # don't process is own_lines are "only" + # in order to get correct matching, remove colors from the string + return $string if ($config{own_lines} eq "only"); + my $right_nocolor = weechat::string_remove_color($right, ""); + if (weechat::string_has_highlight($right_nocolor, weechat::buffer_string_replace_local_var($buffer, weechat::buffer_get_string($buffer, "highlight_words"))) || + weechat::string_has_highlight($right_nocolor, weechat::config_string(weechat::config_get("weechat.look.highlight"))) || + weechat::string_has_highlight_regex($right_nocolor, weechat::config_string(weechat::config_get("weechat.look.highlight_regex"))) || + weechat::string_has_highlight_regex($right_nocolor, weechat::buffer_get_string($buffer, "highlight_regex")) + ) { + # we have a hilight! get a hilight color + # and replace the first occurance of coloring, that'd be nick color + # process only if highlight is "on" OR "nicks" & nick's in nicks + return $string if ($config{highlight} eq "off" || + ($config{highlight} eq "nicks" && !weechat::string_has_highlight("$servername.$nick", $config{nicks}))); + $color = weechat::color('chat_highlight'); + $right =~ s/\31[^\31 ]+?\Q$nick/$color$nick/ if ($action); + } else { + # that's not a highlight + # process only if lines is "on" OR "nicks" & nick's in nicks + return $string if ($config{lines} eq "off" || + ($config{lines} eq "nicks" && !weechat::string_has_highlight("$servername.$nick", $config{nicks}))); + $color = weechat::info_get('irc_nick_color', $nick); } } - if ( ($weechat_version ne "") && (weechat::info_get("version_number", "") >= 0x00030500) ) { # v0.3.5 - description_options(); - } + ######################################## inject colors and go! - if ( $default_options{"var_blacklist_channels"} ne "" ){ - @var_blacklist_channels = ""; - @var_blacklist_channels = split( /,/, $default_options{"var_blacklist_channels"} ); - } - if ( $default_options{var_nicks} ne "" ){ - undef (@nick_list); - if ( substr($default_options{var_nicks}, 0, 1) eq "/" ){ # get first chat of nicks "/" ? - nicklist_read(); # read nicks from file - }else{ - @nick_list = split( /,/, $default_options{var_nicks} ); # use nicks from option - } - } - -} - -sub toggle_config_by_set{ -my ( $pointer, $name, $value ) = @_; - $name = substr($name,length("plugins.var.perl.$prgname."),length($name)); - $default_options{"var_" . $name} = lc($value); - - if ( $name eq "blacklist_channels" ){ - @var_blacklist_channels = ""; - @var_blacklist_channels = split( /,/, $default_options{"var_" . $name} ); + my $out = ""; + if ($action) { + # remove the first color reset - after * nick + # make other resets reset to our color + $right =~ s/\34//; + $right =~ s/\34/\34$color/g; + $out = $left . "\t" . $right . "\34" + } else { + # make other resets reset to our color + $right =~ s/\34/\34$color/g; + $out = $left . "\t" . $color . $right . "\34" } - if ( $name eq "nicks" ){ - undef (@nick_list); - if ( $default_options{"var_".$name} eq "" ){ # no nicks given - undef (@nick_list); -# count_nicks(); - }elsif ( substr($default_options{var_nicks}, 0, 1) eq "/" ){ # get first chat of nicks "/" ? - nicklist_read(); # read nicks from file -# count_nicks(); - }else{ - @nick_list = split( /,/, $default_options{"var_" . $name} ); -# count_nicks(); - } - } - -$default_options{var_avail_buffer} = "all" if ( $default_options{var_avail_buffer} eq "" ); - -return weechat::WEECHAT_RC_OK ; -} - -# create description options for script... -sub description_options{ - foreach my $option ( keys %help_desc ){ - weechat::config_set_desc_plugin( $option,$help_desc{$option} ); - } -} - -# toggle functions on/off with command line -sub change_settings{ -my $getarg = lc($_[2]); # switch to lower-case - - foreach my $option ( keys %default_options ){ - $option = substr($option,4,length($option)-4); # remove "var_" from option - if ( $getarg eq $option ){ - if ( $default_options{"var_" . $option} eq "on" ){ - weechat::config_set_plugin( $option, "off" ); - }else{ - weechat::config_set_plugin( $option, "on" ); - } - } - } -return weechat::WEECHAT_RC_OK; + #weechat::print("", ""); weechat::print("", "\$str " . Dumper($string)); weechat::print("", "\$out " . Dumper($out)); + return $out; } +#################################################################################################### config + +# read nicknames if $conf{nisks} starts with / +# after this, $conf{nisks} is of form a,b,c,d +# if it doesnt start with /, assume it's already a,b,c,d sub nicklist_read { - undef (@nick_list); - my $weechat_dir = weechat::info_get( "weechat_dir", "" ); - my $nicklist = weechat::config_get_plugin("nicks"); - $nicklist = $weechat_dir.$nicklist; - $default_options{var_nicks} = "" unless -e $nicklist; - return unless -e $nicklist; - open (WL, "<", $nicklist) || DEBUG("$nicklist: $!"); - while () { - chomp; # kill LF - my ( $servername, $nickname ) = split /\./; # servername,nickname (seperator could be "," or ".") - if (not defined $nickname){ - close WL; - weechat::print("",weechat::prefix("error")."$prgname: $nicklist is not valid format (.)."); - return; - } - push @nick_list,($servername.".".$nickname."," ); # servername.nickname+"," - } - close WL; - chop @nick_list; # remove last "," + return if (substr($config{nicks}, 0, 1) ne "/"); + my $file = weechat::info_get("weechat_dir", "") . $config{nicks}; + return unless -e $file; + my $nili = ""; + open (WL, "<", $file) || DEBUG("$file: $!"); + while () { + chomp; # kill LF + $nili .= $_ . ","; + } + close WL; + chop $nili; # remove last "," + $config{nicks} = $nili; } -# debug.... -sub count_nicks{ - my $anzahl=@nick_list; - weechat::print("","anzahl: $anzahl"); - - foreach (@nick_list){ - weechat::print ("","$_"); - } +# called when a config option ha been changed +# $name = plugins.var.perl.$prgname.nicks etc +sub toggle_config_by_set { + my ($pointer, $name, $value) = @_; + $name = substr($name,length("plugins.var.perl.$prgname."),length($name)); + $config{$name} = lc($value); + nicklist_read() if ($name eq "nicks"); } -# -------------------------------[ init ]------------------------------------- -# first function called by a WeeChat-script. -weechat::register($prgname, "Nils Görs ", $version, - "GPL3", $description, "", ""); -# check weechat version - $weechat_version = weechat::info_get("version_number", ""); - if (( $weechat_version eq "" ) or ( $weechat_version < 0x00030400 )){ - weechat::print("",weechat::prefix("error")."$prgname: needs WeeChat >= 0.3.4. Please upgrade: http://www.weechat.org/"); - weechat::command("","/wait 1ms /perl unload $prgname"); - } - -init_config(); - - -$get_prefix_action = weechat::config_string(weechat::config_get("weechat.look.prefix_action")); -weechat::hook_modifier("weechat_print","colorize_cb", ""); -weechat::hook_modifier("colorize_lines","colorize_cb", ""); - - if (( $weechat_version ne "" ) && ( $weechat_version >= 0x00030400 )){ # v0.3.4? - $weechat_version = 1; # yes! - - # read nick colours if exists (>= weechat 0.3.4) in %colours - my $colours_buf = weechat::config_string(weechat::config_get("weechat.color.chat_nick_colors")); - if ( $colours_buf ne "" ) { - my @array = split(/,/,$colours_buf); - my $i = 0; - foreach (@array){ - $colours{$i++} = $_; +# read configuration from weechat OR +# set default options and +# set dectription if weechat >= 0.3.5 +# after done, read nicklist from file if needed +sub init_config { + my $weechat_version = weechat::info_get('version_number', '') || 0; + foreach my $option (keys %config){ + if (!weechat::config_is_set_plugin($option)) { + weechat::config_set_plugin($option, $config{$option}); + weechat::config_set_desc_plugin($option, $help_desc{$option}) if ($weechat_version >= 0x00030500); # v0.3.5 + } else { + $config{$option} = lc(weechat::config_get_plugin($option)); } - undef $colours_buf; - undef @array; } - } - -weechat::hook_command($prgname, $description, - - " || || || || || || || ", + nicklist_read(); +} - " toggle highlight color in chat area (on/off)\n". - " colors the text in chat area with according nick color (on/off)\n". - " toggle shuffle color mode on/off\n". - " toggle highlight color mode for buffer_autoset on/off\n". - " toggle highlight color mode for weechat.look.highlight on/off\n". - " toggle highlight color in chat area for option weechat.look.highlight_regex on/off\n". - " toggle hotlist_max_level_nicks_add on/off\n". - " toggle coloring of own lines on/off\n". - "\n". - "Options (script):\n". - " 'plugins.var.perl.$prgname.highlight' : $help_desc{highlight}\n". - " 'plugins.var.perl.$prgname.hotlist_max_level_nicks_add' : $help_desc{hotlist_max_level_nicks_add}\n". - " 'plugins.var.perl.$prgname.buffer_autoset' : $help_desc{buffer_autoset}\n". - " 'plugins.var.perl.$prgname.look_highlight' : $help_desc{look_highlight}\n". - " 'plugins.var.perl.$prgname.look_highlight_regex' : $help_desc{look_highlight_regex}\n". - " 'plugins.var.perl.$prgname.chat' : $help_desc{chat}\n". - " 'plugins.var.perl.$prgname.shuffle' : $help_desc{shuffle}\n". - " 'plugins.var.perl.$prgname.blacklist_channels' : $help_desc{blacklist_channels}\n". - " 'plugins.var.perl.$prgname.avail_buffer' : $help_desc{avail_buffer}\n". - " 'plugins.var.perl.$prgname.nicks' : $help_desc{nicks}\n". - " 'plugins.var.perl.$prgname.own_lines' : $help_desc{own_lines}\n". - "\n". - "Options (global):\n". - " 'weechat.color.chat_highlight' : highlight color\n". - " 'weechat.color.chat_highlight_bg' : highlight background color\n". - " 'weechat.color.chat_nick*' : colors for nicks\n\n". - "To use options \"buffer_autoset\" and/or \"hotlist_max_level_nicks_add\" install buffer_autoset script from: http://www.weechat.org/scripts/\n", - "highlight|chat|shuffle|autoset|look_highlight|look_highlight_regex|hotlist|own_lines %-", "change_settings", ""); +#################################################################################################### start -weechat::hook_config( "plugins.var.perl.$prgname.*", "toggle_config_by_set", "" ); +weechat::register($prgname, "Nils Görs ", $version, "GPL3", $description, "", ""); +weechat::hook_modifier("500|weechat_print","colorize_cb", ""); +init_config(); +weechat::hook_config("plugins.var.perl.$prgname.*", "toggle_config_by_set", ""); diff -r 579ee6ce9270 -r e8bc4f9704f3 weechat/plugins.conf --- a/weechat/plugins.conf Tue Jan 14 17:25:57 2014 -0500 +++ b/weechat/plugins.conf Tue Jan 14 17:27:49 2014 -0500 @@ -29,11 +29,14 @@ perl.buffers.sort = "number" perl.check_license = "on" perl.colorize_lines.avail_buffer = "all" +perl.colorize_lines.blacklist_buffers = "" perl.colorize_lines.blacklist_channels = "" perl.colorize_lines.buffer_autoset = "off" +perl.colorize_lines.buffers = "all" perl.colorize_lines.chat = "off" perl.colorize_lines.highlight = "on" perl.colorize_lines.hotlist_max_level_nicks_add = "off" +perl.colorize_lines.lines = "off" perl.colorize_lines.look_highlight = "on" perl.colorize_lines.look_highlight_regex = "on" perl.colorize_lines.nicks = "" @@ -61,8 +64,10 @@ [desc] perl.colorize_lines.avail_buffer = "messages will be colored in buffer (all = all buffers, channel = channel buffers, query = query buffers (default: all " +perl.colorize_lines.blacklist_buffers = "comma-separated list of channels to be ignored (e.g. freenode.#weechat,*.#python)" perl.colorize_lines.blacklist_channels = "comma separated list with channelname. Channels in this list will be ignored. (e.g.: freenode.#weechat,freenode.#weechat-fr)" perl.colorize_lines.buffer_autoset = "toggle highlight color in chat area for buffer_autoset (default: off)" +perl.colorize_lines.buffers = "buffer type affected by the script (all/channel/query, default: all)" perl.colorize_lines.chat = "colors text in chat area with according nick color (default: on)" perl.colorize_lines.highlight = "highlight messages will be fully highlighted in chat area (on = whole line will be highlighted, off = only nick will be highlighted, always = a highlight will always color the whole message) (default: on)" perl.colorize_lines.hotlist_max_level_nicks_add = "toggle highlight for hotlist (default: off)" diff -r 579ee6ce9270 -r e8bc4f9704f3 weechat/weechat.conf --- a/weechat/weechat.conf Tue Jan 14 17:25:57 2014 -0500 +++ b/weechat/weechat.conf Tue Jan 14 17:27:49 2014 -0500 @@ -32,8 +32,8 @@ day_change = on day_change_time_format = "%a, %d %b %Y" eat_newline_glitch = off -highlight = "sjl" -highlight_regex = "(sjl|^all[,:]|backend(ia)?[^/]|slosh|slj|clojerks|red[- ]tape|c2c|arroway|[mM]oney ?[dD]rop)" +highlight = "sjl,slosh,slj,clojerks,c2c,arroway,ingester" +highlight_regex = "(^all[,:]|backend(ia)?[^/]|red[- ]tape|[mM]oney ?[dD]rop)" highlight_tags = "" hotlist_add_buffer_if_away = on hotlist_buffer_separator = ", " @@ -270,7 +270,7 @@ ctrl-Co = "/input insert \x0F" ctrl-Cr = "/input insert \x12" ctrl-Cu = "/input insert \x15" -ctrl-D = "/input delete_next_char" +ctrl-D = "/buffer close" ctrl-E = "/input move_end_of_line" ctrl-F = "/input move_next_char" ctrl-H = "/input delete_previous_char"