From 6854c8f5c088ac84009692e6f19848dea5962428 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Sat, 7 Nov 2009 00:29:16 +0100 Subject: vimperator: upgrade buftabs to 1.1 --- vimperator/plugin/buftabs.js | 46 ++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'vimperator') diff --git a/vimperator/plugin/buftabs.js b/vimperator/plugin/buftabs.js index f10a616..e0a5087 100644 --- a/vimperator/plugin/buftabs.js +++ b/vimperator/plugin/buftabs.js @@ -3,8 +3,8 @@ let PLUGIN_INFO = Buftabs Add buffer tabs to the statusline to save space. - 1.0 - GGLucas + 1.1 + Lucas de Vries (GGLucas) WTFPL version 2 (http://sam.zoy.org/wtfpl/) 2.2 2.2 @@ -15,17 +15,13 @@ let PLUGIN_INFO = you can use the "buftabs" option to toggle it on or off. == Styling == - You can style the buftabs with: - - :style * .buftab { } - - and - - :style * .buftab_selected { } + Use the BufTab and BufTabSelected highlight groups to style the buftabs. + Make sure you've called the "loadplugins" command before using the highlight + groups in your vimperatorrc. == Length == - You can set the max length of a title before it is cut off with the buftabs_maxlength - option. It is set to 25 by default. + You can set the max length of a title before it is cut off with the + buftabs_maxlength option. It is set to 25 by default. ]]> ; @@ -129,12 +125,13 @@ buftabs = { label.setAttribute("value", tabvalue); + // Set the correct highlight group if (tabs.index() == label.tabpos) - { - label.className = "buftab_selected"; - } else { - label.className = "buftab"; - } + label.setAttributeNS(NS.uri, "highlight", "BufTabSelected"); + else + label.setAttributeNS(NS.uri, "highlight", "BufTab"); + + }, // Create the horizontal box for adding the tabs to @@ -166,6 +163,7 @@ buftabs = { } } +/// Attach to events in order to update the tabline var tabContainer = tabs.getBrowser().mTabContainer; buftabs._statusline_updateUrl = statusline.updateUrl; @@ -191,10 +189,16 @@ tabs.getBrowser().addEventListener("load", function (event) { statusline.updateUrl(); }, false); +/// Initialise highlight groups +highlight.loadCSS(String()); + /// Options -options.add(["buftabs", "buftabs"], +options.add(["buftabs"], "Control whether to use buftabs in the statusline", - "boolean", 1, + "boolean", true, { setter: function (value) { @@ -215,14 +219,14 @@ options.add(["buftabs", "buftabs"], completer: function (context) [ - [0, "Don't show buftabs, show the url"], - [1, "Show buftabs"] + [false, "Don't show buftabs, show the url"], + [true, "Show buftabs"] ], validator: Option.validateCompleter }); -options.add(["buftabs_maxlength", "buftabs_maxlength"], +options.add(["buftabs_maxlength"], "Max length of an entry in the buftabs list", "number", "25", { -- cgit v1.2.3