# HG changeset patch # User Steve Losh # Date 1327511475 18000 # Node ID 5acdb884ff937894cfcc829e22d3429e508ea649 # Parent 33b701e7a4eb2c5af31ea3191878938cf3dfdcb5 Oh god I have not committed in so long. diff -r 33b701e7a4eb -r 5acdb884ff93 .gitconfig --- a/.gitconfig Wed Jan 18 16:30:31 2012 -0500 +++ b/.gitconfig Wed Jan 25 12:11:15 2012 -0500 @@ -8,8 +8,10 @@ excludesfile = /Users/sjl/.gitignore [alias] - gl = log -16 --color=always --all --graph --topo-order --pretty='format: %Cgreen%h%Creset %s%Cred%d%Creset%n' - gll = log --color=always --all --graph --topo-order --pretty='format: %Cgreen%h%Creset %s%Cred%d%Creset%n' + l = log -16 --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset' + ll = log --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset' + gl = log -16 --color=always --all --graph --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(by %an)%Creset%C(yellow bold)%d%Creset%n' + gll = log --color=always --all --graph --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(by %an)%Creset%C(yellow bold)%d%Creset%n' pull = pull --ff-only merge = merge --no-ff diff -r 33b701e7a4eb -r 5acdb884ff93 keymando/keymandorc.rb --- a/keymando/keymandorc.rb Wed Jan 18 16:30:31 2012 -0500 +++ b/keymando/keymandorc.rb Wed Jan 25 12:11:15 2012 -0500 @@ -4,7 +4,7 @@ disable "Remote Desktop Connection" disable /VirtualBox/ -map "", "" +map "", "" map "", lambda { reload() } # Application Switching ------------------------------------------------------------ diff -r 33b701e7a4eb -r 5acdb884ff93 keyremap4macbook/private.xml --- a/keyremap4macbook/private.xml Wed Jan 18 16:30:31 2012 -0500 +++ b/keyremap4macbook/private.xml Wed Jan 25 12:11:15 2012 -0500 @@ -1,36 +1,15 @@ - - Shift_R to Backspace - private.shift_r_to_backspace - --KeyToKey-- KeyCode::SHIFT_R, KeyCode::DELETE - - - - - Help to Capslock - private.help_to_capslock - --KeyToKey-- KeyCode::HELP, KeyCode::CAPSLOCK - + + Tab to Option_R + (+ When you type Tab only, send Tab) + private.tab_to_option + --KeyOverlaidModifier-- KeyCode::TAB, KeyCode::OPTION_R, KeyCode::TAB + - Option+CR to something that actually works - private.alt_cr - --KeyToKey-- KeyCode::RETURN, VK_OPTION, KeyCode::DOT, ModifierFlag::OPTION_L - - - - - Ctrl+; to something that actually works (Ctrl+G) - private.ctrl_semicolon_to_ctrl_g - --KeyToKey-- KeyCode::SEMICOLON, VK_CONTROL, KeyCode::G, ModifierFlag::CONTROL_L - - - - - Swap parens and brackets private.swap_parens_and_brackets --KeyToKey-- KeyCode::BRACKET_LEFT, ModifierFlag::NONE, KeyCode::KEY_9, ModifierFlag::SHIFT_R @@ -41,6 +20,13 @@ + + Command_R to Option+Backspace + private.cmd_r_kill_word + --KeyToKey-- KeyCode::COMMAND_R, KeyCode::DELETE, ModifierFlag::OPTION_L + + + Use the correct goddamed shift keys. private.fucking_shift_keys_how_do_they_work diff -r 33b701e7a4eb -r 5acdb884ff93 mutt/muttrc --- a/mutt/muttrc Wed Jan 18 16:30:31 2012 -0500 +++ b/mutt/muttrc Wed Jan 25 12:11:15 2012 -0500 @@ -9,6 +9,11 @@ set editor = "vim +/^$ +:s/^$/\\\\r\\\\r/ +:noh -c 'normal! k' -c 'set nolist' -c 'redraw'" # use vim set print_command = /usr/bin/enscript # print with enscript +# address book +set query_command = "lbdbq '%s' | sed -e 's/(null)//g'" +bind editor complete-query +bind editor ^T complete + # main options set mbox_type = Maildir # mailbox type set folder = ~/.mail # mailbox location diff -r 33b701e7a4eb -r 5acdb884ff93 vim/.vimrc --- a/vim/.vimrc Wed Jan 18 16:30:31 2012 -0500 +++ b/vim/.vimrc Wed Jan 25 12:11:15 2012 -0500 @@ -285,7 +285,7 @@ set foldlevelstart=0 " Make the current location sane. -nnoremap zvzz +nnoremap zvzt " Space to toggle folds. nnoremap za @@ -708,6 +708,11 @@ " }}} " Convenience mappings ---------------------------------------------------- {{{ +" Highlight Group +nnoremap :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' +\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" +\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + " Clean trailing whitespace nnoremap w :%s/\s\+$//:let @/='' @@ -735,6 +740,7 @@ " Formatting, TextMate-style nnoremap Q gqip +vnoremap Q gq " Easier linewise reselection nnoremap V V`] @@ -784,7 +790,18 @@ set completeopt=longest,menuone,preview " Sudo to write -cmap w!! w !sudo tee % >/dev/null +cnoremap w!! w !sudo tee % >/dev/null + +" Typos +command! -bang E e +command! -bang Q q +command! -bang W w +command! -bang QA qa +command! -bang Qa qa +command! -bang Wa wa +command! -bang WA wa +command! -bang Wq wq +command! -bang WQ wq " I suck at typing. nnoremap = == @@ -906,10 +923,10 @@ let ctrlp_filter_greps = "". \ "egrep -iv '\\.(" . - \ "swp|swo|log|so|o|pyc|jpe?g|png|gif|mo|po" . + \ "jar|class|swp|swo|log|so|o|pyc|jpe?g|png|gif|mo|po" . \ ")$' | " . \ "egrep -v '^(\\./)?(" . - \ "libs/|deploy/vendor/|.git/|.hg/|.svn/|.*migrations/" . + \ "lib/|classes/|libs/|deploy/vendor/|.git/|.hg/|.svn/|.*migrations/" . \ ")'" let my_ctrlp_user_command = "" . @@ -1038,6 +1055,7 @@ let g:pymode_doc_key = 'ds' let g:pydoc = 'pydoc' let g:pymode_syntax = 0 +let g:pymode_syntax_all = 0 let g:pymode_run = 0 let g:pymode_lint = 0 let g:pymode_breakpoint = 0 @@ -1283,10 +1301,6 @@ " }}} " Utils ------------------------------------------------------------------- {{{ -function! g:echodammit(msg) - exec 'echom "----------> ' . a:msg . '"' -endfunction - " Synstack {{{ " Show the stack of syntax hilighting classes affecting whatever is under the @@ -1295,7 +1309,7 @@ echo join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), " > ") endfunc "}}} -nnoremap ß :call SynStack() +nnoremap :call SynStack() " }}} " Toggle whitespace in diffs {{{ diff -r 33b701e7a4eb -r 5acdb884ff93 weechat/buffers.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/weechat/buffers.conf Wed Jan 25 12:11:15 2012 -0500 @@ -0,0 +1,42 @@ +# +# buffers.conf -- weechat v0.3.6 +# + +[color] +current_bg = green +current_fg = black +default_bg = default +default_fg = default +hotlist_highlight_bg = default +hotlist_highlight_fg = lightmagenta +hotlist_low_bg = default +hotlist_low_fg = white +hotlist_message_bg = default +hotlist_message_fg = green +hotlist_private_bg = default +hotlist_private_fg = lightgreen +none_channel_bg = default +none_channel_fg = default +number = green +number_char = green +whitelist_default = default +whitelist_highlight_bg = default +whitelist_highlight_fg = default +whitelist_low_bg = default +whitelist_low_fg = default +whitelist_message_bg = default +whitelist_message_fg = default +whitelist_private_bg = default +whitelist_private_fg = default + +[look] +hide_merged_buffers = on +indenting = off +indenting_number = on +number_char = " " +prefix = off +prefix_empty = on +short_names = on +show_number = on +sort = number +whitelist_buffers = "" diff -r 33b701e7a4eb -r 5acdb884ff93 weechat/perl/autoload/buffers.pl --- a/weechat/perl/autoload/buffers.pl Wed Jan 18 16:30:31 2012 -0500 +++ b/weechat/perl/autoload/buffers.pl Wed Jan 25 12:11:15 2012 -0500 @@ -19,6 +19,16 @@ # Display sidebar with list of buffers. # # History: +# +# 2012-01-04, Sébastien Helleu : +# 2.7: fix regex lookup in whitelist buffers list +# 2011-12-04, Nils G : +# 2.6: add own config file (buffers.conf) +# add new behavior for indenting (under_name) +# add new option to set different color for server buffers and buffers with free content +# 2011-10-30, Nils G : +# 2.5: add new options "show_number_char" and "color_number_char", +# add help-description for options # 2011-08-24, Sébastien Helleu : # v2.4: add mouse support # 2011-06-06, Nils G : @@ -71,57 +81,20 @@ # v0.1: script creation # # Help about settings: -# display short names (remove text before first "." in buffer name): -# /set plugins.var.perl.buffers.short_names on -# use indenting for some buffers like IRC channels: -# /set plugins.var.perl.buffers.indenting on -# use indenting for numbers: -# /set plugins.var.perl.buffers.indenting_number on -# hide merged buffers: -# /set plugins.var.perl.buffers.hide_merged_buffers on -# show prefix: -# /set plugins.var.perl.buffers.show_prefix on -# /set plugins.var.perl.buffers.show_prefix_empty on -# change colors: -# /set plugins.var.perl.buffers.color_number color -# /set plugins.var.perl.buffers.color_default color -# /set plugins.var.perl.buffers.color_hotlist_low color -# /set plugins.var.perl.buffers.color_hotlist_message color -# /set plugins.var.perl.buffers.color_hotlist_private color -# /set plugins.var.perl.buffers.color_hotlist_highlight color -# /set plugins.var.perl.buffers.color_current color -# (replace "color" by your color, which may be "fg" or "fg,bg") +# display all settings for script (or use iset.pl script to change settings): +# /set buffers* +# show help text for option buffers.look.whitelist_buffers: +# /help buffers.look.whitelist_buffers # use strict; -my $version = "2.4"; - -# -------------------------------[ config ]------------------------------------- +# -------------------------------[ internal ]------------------------------------- +my $version = "2.7"; -my %default_options = ("short_names" => "on", - "indenting" => "on", - "indenting_number" => "on", - "hide_merged_buffers" => "off", - "show_number" => "on", - "show_prefix" => "off", - "show_prefix_empty" => "on", - "sort" => "number", # "number" or "name" - "color_hotlist_low" => "white", - "color_hotlist_message" => "yellow", - "color_hotlist_private" => "lightgreen", - "color_hotlist_highlight" => "magenta", - "color_current" => "lightcyan,red", - "color_default" => "default", - "color_number" => "lightgreen", - "color_whitelist_buffers" => "", - "color_whitelist_default" => "", - "color_whitelist_low" => "", - "color_whitelist_message" => "", - "color_whitelist_private" => "", - "color_whitelist_highlight" => "", +my $BUFFERS_CONFIG_FILE_NAME = "buffers"; +my $buffers_config_file; - ); my %mouse_keys = ("\@item(buffers):button1*" => "hsignal:buffers_mouse"); my %options; my %hotlist_level = (0 => "low", 1 => "message", 2 => "private", 3 => "highlight"); @@ -129,18 +102,12 @@ my @buffers_focus = (); # --------------------------------[ init ]-------------------------------------- - weechat::register("buffers", "Sébastien Helleu ", $version, "GPL3", "Sidebar with list of buffers", "", ""); +my $weechat_version = weechat::info_get("version_number", "") || 0; -foreach my $option (keys %default_options) -{ - if (!weechat::config_is_set_plugin($option)) - { - weechat::config_set_plugin($option, $default_options{$option}); - } -} -buffers_read_options(); +buffers_config_init(); +buffers_config_read(); weechat::bar_item_new("buffers", "build_buffers", ""); weechat::bar_new("buffers", "0", "0", "root", "", "left", "horizontal", @@ -148,9 +115,7 @@ "buffers"); weechat::hook_signal("buffer_*", "buffers_signal_buffer", ""); weechat::hook_signal("hotlist_*", "buffers_signal_hotlist", ""); -weechat::hook_config("plugins.var.perl.buffers.*", "buffers_signal_config", ""); weechat::bar_item_update("buffers"); -my $weechat_version = weechat::info_get("version_number", "") || 0; if ($weechat_version >= 0x00030600) { weechat::hook_focus("buffers", "buffers_focus_buffers", ""); @@ -158,21 +123,185 @@ weechat::key_bind("mouse", \%mouse_keys); } -# ------------------------------------------------------------------------------ - -sub buffers_read_options +# -------------------------------- [ config ] -------------------------------- +sub buffers_config_read +{ + return weechat::config_read($buffers_config_file) if ($buffers_config_file ne ""); +} +sub buffers_config_write +{ + return weechat::config_write($buffers_config_file) if ($buffers_config_file ne ""); +} +sub buffers_config_reload_cb +{ + my ($data,$config_file) = ($_[0], $_[1]); + return weechat::config_read($config_file) +} +sub buffers_config_init { - foreach my $option (keys %default_options) + $buffers_config_file = weechat::config_new($BUFFERS_CONFIG_FILE_NAME,"buffers_config_reload_cb",""); + return if ($buffers_config_file eq ""); + + # section "color" + my $section_color = weechat::config_new_section($buffers_config_file,"color", 0, 0, "", "", "", "", "", "", "", "", "", ""); + if ($section_color eq "") { - $options{$option} = weechat::config_get_plugin($option); + weechat::config_free($buffers_config_file); + return; } - @whitelist_buffers = split(/,/, $options{color_whitelist_buffers}); + $options{"color_current_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "current_fg", "color", "foreground color for current buffer", "", 0, 0, + "lightcyan", "lightcyan", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_current_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "current_bg", "color", "background color for current buffer", "", 0, 0, + "red", "red", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_default_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "default_fg", "color", "default foreground color for buffer name", "", 0, 0, + "default", "default", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_default_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "default_bg", "color", "default background color for buffer name", "", 0, 0, + "default", "default", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_hotlist_highlight_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "hotlist_highlight_fg", "color", "change foreground color of buffer name if a highlight messaged received", "", 0, 0, + "magenta", "magenta", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_hotlist_highlight_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "hotlist_highlight_bg", "color", "change background color of buffer name if a highlight messaged received", "", 0, 0, + "default", "default", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_hotlist_low_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "hotlist_low_fg", "color", "change foreground color of buffer name if a low message received", "", 0, 0, + "white", "white", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_hotlist_low_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "hotlist_low_bg", "color", "change background color of buffer name if a low message received", "", 0, 0, + "default", "default", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_hotlist_message_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "hotlist_message_fg", "color", "change foreground color of buffer name if a normal message received", "", 0, 0, + "yellow", "yellow", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_hotlist_message_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "hotlist_message_bg", "color", "change background color of buffer name if a normal message received", "", 0, 0, + "default", "default", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_hotlist_private_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "hotlist_private_fg", "color", "change foreground color of buffer name if a private message received", "", 0, 0, + "lightgreen", "lightgreen", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_hotlist_private_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "hotlist_private_bg", "color", "change background color of buffer name if a private message received", "", 0, 0, + "default", "default", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_number"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "number", "color", "color for buffer number", "", 0, 0, + "lightgreen", "lightgreen", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_number_char"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "number_char", "color", "color for buffer number char", "", 0, 0, + "lightgreen", "lightgreen", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_default"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_default", "color", "default color for whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_low_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_low_fg", "color", "low color of whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_low_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_low_bg", "color", "low color of whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_message_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_message_fg", "color", "message color of whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_message_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_message_bg", "color", "message color of whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_private_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_private_fg", "color", "private color of whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_private_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_private_bg", "color", "private color of whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_highlight_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_highlight_fg", "color", "highlight color of whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_whitelist_highlight_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "whitelist_highlight_bg", "color", "highlight color of whitelist buffer name", "", 0, 0, + "", "", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_none_channel_fg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "none_channel_fg", "color", "foreground color for none channel buffer (e.g.: core/server/plugin buffer)", "", 0, 0, + "default", "default", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"color_none_channel_bg"} = weechat::config_new_option( + $buffers_config_file, $section_color, + "none_channel_bg", "color", "background color for none channel buffer (e.g.: core/server/plugin buffer)", "", 0, 0, + "default", "default", 0, "", "", "buffers_signal_config", "", "", ""); + + # section "look" + my $section_look = weechat::config_new_section($buffers_config_file,"look", 0, 0, "", "", "", "", "", "", "", "", "", ""); + if ($section_look eq "") + { + weechat::config_free($buffers_config_file); + return; + } + $options{"color_whitelist_buffers"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "whitelist_buffers", "string", "comma separated list of buffers for using a differnt color scheme (for example: freenode.#weechat,freenode.#weechat-fr)", "", 0, 0,"", "", 0, "", "", "buffers_signal_config_whitelist", "", "", ""); + $options{"hide_merged_buffers"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "hide_merged_buffers", "boolean", "hide merged buffers", "", 0, 0, + "off", "off", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"indenting"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "indenting", "integer", "use indenting for some buffers like IRC channels", "off|on|under_name", 0, 0, + "off", "off", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"indenting_number"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "indenting_number", "boolean", "use indenting for numbers", "", 0, 0, + "on", "on", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"short_names"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "short_names", "boolean", "display short names (remove text before first \".\" in buffer name)", "", 0, 0, + "on", "on", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"show_number"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "show_number", "boolean", "display channel number in front of buffername", "", 0, 0, + "on", "on", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"show_number_char"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "number_char", "string", "display a char after channel number", "", 0, 0, + ".", ".", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"show_prefix"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "prefix", "boolean", "show your prefix for channel", "", 0, 0, + "off", "off", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"show_prefix_empty"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "prefix_empty", "boolean", "use a placeholder for channels without prefix", "", 0, 0, + "on", "on", 0, "", "", "buffers_signal_config", "", "", ""); + $options{"sort"} = weechat::config_new_option( + $buffers_config_file, $section_look, + "sort", "integer", "sort buffer-list by \"number\" or \"name\"", "number|name", 0, 0, + "number", "number", 0, "", "", "buffers_signal_config", "", "", ""); } sub build_buffers { my $str = ""; - + # get bar position (left/right/top/bottom) my $position = "left"; my $option_position = weechat::config_get("weechat.bar.buffers.position"); @@ -180,7 +309,7 @@ { $position = weechat::config_string($option_position); } - + # read hotlist my %hotlist; my $infolist = weechat::infolist_get("hotlist", "", ""); @@ -190,7 +319,7 @@ weechat::infolist_integer($infolist, "priority"); } weechat::infolist_free($infolist); - + # read buffers list @buffers_focus = (); my @buffers; @@ -245,7 +374,7 @@ } @buffers = (@buffers, @current2, @current1); weechat::infolist_free($infolist); - + # sort buffers by number, name or shortname my %sorted_buffers; if (1) @@ -254,10 +383,10 @@ for my $buffer (@buffers) { my $key; - if ($options{"sort"} eq "name") + if (weechat::config_integer( $options{"sort"} ) eq 1) # number = 0, name = 1 { my $name = $buffer->{"name"}; - $name = $buffer->{"short_name"} if ($options{"short_names"} eq "on"); + $name = $buffer->{"short_name"} if (weechat::config_boolean( $options{"short_names"} ) eq 1); $key = sprintf("%s%08d", lc($name), $buffer->{"number"}); } else @@ -268,70 +397,61 @@ $number++; } } - + # build string with buffers $old_number = -1; foreach my $key (sort keys %sorted_buffers) { my $buffer = $sorted_buffers{$key}; - if (($options{"hide_merged_buffers"} eq "on") && (! $buffer->{"active"})) + if ( (weechat::config_boolean( $options{"hide_merged_buffers"} ) eq 1) && (! $buffer->{"active"}) ) { next; } - + push(@buffers_focus, $buffer); my $color = ""; - # whitelist buffer? - if (grep /^$buffer->{"name"}$/, @whitelist_buffers) + my $bg = ""; + + $color = weechat::config_color( $options{"color_default_fg"} ); + $bg = weechat::config_color( $options{"color_default_bg"} ); + # check for none channel and private buffer + if ( (weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "channel" ) and ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "private") ) { - # options empty? - if ($options{"color_whitelist_default"} eq "") - { - $color = $options{"color_default"}; - } - else - { - # use color - $color = $options{"color_whitelist_default"}; - } + $color = weechat::config_color( $options{"color_none_channel_fg"} ); + $bg = weechat::config_color( $options{"color_none_channel_bg"} ); } - else + # default whitelist buffer? + if (grep {$_ eq $buffer->{"name"}} @whitelist_buffers) { - # no whitelist buffer - $color = $options{"color_default"}; + $color = weechat::config_color( $options{"color_whitelist_default"} ); } $color = "default" if ($color eq ""); - my $bg = ""; if (exists $hotlist{$buffer->{"pointer"}}) { - if (grep /^$buffer->{"name"}$/, @whitelist_buffers) + if (grep {$_ eq $buffer->{"name"}} @whitelist_buffers) { - if ($options{"color_whitelist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}} eq "") # no color in settings - { - $color = $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}}; # use standard colors - } - else - { - $color = $options{"color_whitelist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}}; - } + $bg = weechat::config_color( $options{"color_whitelist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_bg"} ); + $color = weechat::config_color( $options{"color_whitelist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_fg"} ); } else { - $color = $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}}; + $bg = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_bg"} ); + $color = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_fg"} ); } } + if ($buffer->{"current_buffer"}) { - $color = $options{"color_current"}; - $bg = $1 if ($color =~ /.*,(.*)/); + $color = weechat::config_color( $options{"color_current_fg"} ); + $bg = weechat::config_color( $options{"color_current_bg"} ); } my $color_bg = ""; $color_bg = weechat::color(",".$bg) if ($bg ne ""); - if ($options{"show_number"} eq "on") + if ( weechat::config_boolean( $options{"show_number"} ) eq 1) { - if (($options{"indenting_number"} eq "on") + if (( weechat::config_boolean( $options{"indenting_number"} ) eq 1) && (($position eq "left") || ($position eq "right"))) { $str .= weechat::color("default").$color_bg @@ -339,12 +459,14 @@ } if ($old_number ne $buffer->{"number"}) { - $str .= weechat::color($options{"color_number"}) + $str .= weechat::color( weechat::config_color( $options{"color_number"} ) ) .$color_bg .$buffer->{"number"} .weechat::color("default") .$color_bg - ."."; + .weechat::color( weechat::config_color( $options{"color_number_char"} ) ) + .weechat::config_string( $options{"show_number_char"} ) + .$color_bg; } else { @@ -355,16 +477,23 @@ .$indent; } } - if (($options{"indenting"} eq "on") + if (( weechat::config_integer( $options{"indenting"} ) ne 0 ) # indenting NOT off && (($position eq "left") || ($position eq "right"))) { my $type = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type"); if (($type eq "channel") || ($type eq "private")) { - $str .= " "; + if ( weechat::config_integer( $options{"indenting"} ) eq 1 ) + { + $str .= " "; + } + elsif ( (weechat::config_integer($options{"indenting"}) eq 2) and (weechat::config_integer($options{"indenting_number"}) eq 0) ) + { + $str .= ( (" " x ( $max_number_digits - length($buffer->{"number"}) ))." " ); + } } } - if ($options{"show_prefix"} eq "on") + if (weechat::config_boolean( $options{"show_prefix"} ) eq 1) { my $nickname = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_nick"); if ($nickname ne "") @@ -382,7 +511,7 @@ && (weechat::infolist_string($infolist_nick, "name") eq $nickname)) { my $prefix = weechat::infolist_string($infolist_nick, "prefix"); - if (($prefix ne " ") or ($options{"show_prefix_empty"} eq "on")) + if (($prefix ne " ") or (weechat::config_boolean( $options{"show_prefix_empty"} ) eq 1)) { # with version >= 0.3.5, it is now a color name (for older versions: option name with color) if (int($version) >= 0x00030500) @@ -404,8 +533,8 @@ } } } - $str .= weechat::color($color); - if ($options{"short_names"} eq "on") + $str .= weechat::color($color) . weechat::color(",".$bg); + if (weechat::config_boolean( $options{"short_names"} ) eq 1) { $str .= $buffer->{"short_name"}; } @@ -416,8 +545,7 @@ $str .= "\n"; $old_number = $buffer->{"number"}; } - - + return $str; } @@ -433,9 +561,16 @@ return weechat::WEECHAT_RC_OK; } + +sub buffers_signal_config_whitelist +{ + @whitelist_buffers = split( /,/, weechat::config_string( $options{"color_whitelist_buffers"} ) ); + weechat::bar_item_update("buffers"); + return weechat::WEECHAT_RC_OK; +} + sub buffers_signal_config { - buffers_read_options(); weechat::bar_item_update("buffers"); return weechat::WEECHAT_RC_OK; } @@ -488,3 +623,4 @@ weechat::buffer_set($ptrbuf, "display", "1"); } } + diff -r 33b701e7a4eb -r 5acdb884ff93 weechat/weechat.conf --- a/weechat/weechat.conf Wed Jan 18 16:30:31 2012 -0500 +++ b/weechat/weechat.conf Wed Jan 25 12:11:15 2012 -0500 @@ -33,7 +33,7 @@ day_change_time_format = "%a, %d %b %Y" eat_newline_glitch = off highlight = "sjl" -highlight_regex = "^all[,:]" +highlight_regex = "(sjl|^all[,:])" highlight_tags = "" hotlist_add_buffer_if_away = on hotlist_buffer_separator = ", " @@ -94,7 +94,7 @@ chat_buffer = white chat_channel = white chat_delimiters = green -chat_highlight = *lightmagenta +chat_highlight = 207 chat_highlight_bg = default chat_host = cyan chat_inactive_buffer = darkgray