diff --git a/content/events.js b/content/events.js index d41a379e..609b60a1 100644 --- a/content/events.js +++ b/content/events.js @@ -625,7 +625,7 @@ vimperator.Events = function() //{{{ vimperator.input.count = parseInt(count_str, 10); if (isNaN(vimperator.input.count)) vimperator.input.count = -1; - if (map.flags & Mappings.flags.ARGUMENT) + if (map.flags & vimperator.Mappings.flags.ARGUMENT) { vimperator.input.pendingArgMap = map; vimperator.input.buffer += key; @@ -640,7 +640,7 @@ vimperator.Events = function() //{{{ vimperator.input.buffer = ""; } // no count support for these commands yet - else if (map.flags & Mappings.flags.MOTION) + else if (map.flags & vimperator.Mappings.flags.MOTION) { vimperator.input.pendingMotionMap = map; vimperator.input.buffer = ""; diff --git a/content/mappings.js b/content/mappings.js index 14291b21..c898aa63 100644 --- a/content/mappings.js +++ b/content/mappings.js @@ -46,9 +46,9 @@ vimperator.Map = function(mode, cmds, action, extra_info) //{{{ else { this.usage = this.names[0]; // only the first command name - if (this.flags & Mappings.flags.COUNT) + if (this.flags & vimperator.Mappings.flags.COUNT) this.usage = "[count]" + this.usage; - if (this.flags & Mappings.flags.ARGUMENT) + if (this.flags & vimperator.Mappings.flags.ARGUMENT) this.usage += " {arg}"; this.usage = [this.usage]; // FIXME: usage an array - needed for the help } @@ -81,17 +81,17 @@ vimperator.Map.prototype.hasName = function(name) vimperator.Map.prototype.execute = function(motion, count, argument) { var args = []; - if (this.flags & Mappings.flags.MOTION) + if (this.flags & vimperator.Mappings.flags.MOTION) args.push(motion); - if (this.flags & Mappings.flags.COUNT) + if (this.flags & vimperator.Mappings.flags.COUNT) args.push(count); - if (this.flags & Mappings.flags.ARGUMENT) + if (this.flags & vimperator.Mappings.flags.ARGUMENT) args.push(argument); this.action.apply(this, args); } //}}} -function Mappings() //{{{ +vimperator.Mappings = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -173,7 +173,7 @@ function Mappings() //{{{ ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - Mappings.flags = { + vimperator.Mappings.flags = { MOTION: 1 << 0, COUNT: 1 << 1, ARGUMENT: 1 << 2 @@ -363,7 +363,7 @@ function Mappings() //{{{ { short_help: "Focus next frame", help: "Transfers keyboard focus to the [count]th next frame in order. The newly focused frame is briefly colored red. Does not wrap.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["[f"], @@ -371,7 +371,7 @@ function Mappings() //{{{ { short_help: "Focus previous frame", help: "Transfers keyboard focus to the [count]th previous frame in order. The newly focused frame is briefly colored red. Does not wrap.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["b"], @@ -394,7 +394,7 @@ function Mappings() //{{{ { short_help: "Repeat last :buffer[!] command", help: "This is useful to quickly jump between buffers which have a similar URL or title.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gB"], @@ -402,7 +402,7 @@ function Mappings() //{{{ { short_help: "Repeat last :buffer[!] command in reverse direction", help: "Just like gb but in the other direction.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["d"], @@ -411,7 +411,7 @@ function Mappings() //{{{ short_help: "Delete current buffer (=tab)", help: "Count is supported, 2d removes the current and next tab and the one to the right is selected. " + "Does not wrap if [count] is larger than available tabs to the right.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["D"], @@ -420,7 +420,7 @@ function Mappings() //{{{ short_help: "Delete current buffer (=tab)", help: "Count is supported, 2D removes the current and previous tab and the one to the left is selected. " + "Does not wrap if [count] is larger than available tabs to the left.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gh"], @@ -450,7 +450,7 @@ function Mappings() //{{{ usage: ["go{a-zA-Z0-9}"], help: "Open any QuickMark in the current tab. You can mark any URLs with M{a-zA-Z0-9}. " + "These QuickMarks are persistent across browser sessions.", - flags: Mappings.flags.ARGUMENT + flags: vimperator.Mappings.flags.ARGUMENT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gn"], @@ -466,7 +466,7 @@ function Mappings() //{{{ help: "Works like go{a-zA-Z0-9} but opens the QuickMark in a new tab. " + "Whether the new tab is activated or not depends on the 'activate' option.
" + "Mnemonic: Go in a new tab. gt would make more sense but is already taken.", - flags: Mappings.flags.ARGUMENT + flags: vimperator.Mappings.flags.ARGUMENT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gP"], @@ -486,7 +486,7 @@ function Mappings() //{{{ { short_help: "Go to the next tab", help: "Cycles to the first tab, when the last is selected.
Count is supported: 3gt goes to the third tab.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gT", "", ""], @@ -494,7 +494,7 @@ function Mappings() //{{{ { short_help: "Go to the previous tab", help: "Cycles to the last tab, when the first is selected.
Count is supported: 3gT goes to the third tab.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ['', ''], @@ -539,7 +539,7 @@ function Mappings() //{{{ short_help: "Set mark at the cursor position", usage: ["m{a-zA-Z}"], help: "Marks a-z are local to the buffer, whereas A-Z are valid between buffers.", - flags: Mappings.flags.ARGUMENT + flags: vimperator.Mappings.flags.ARGUMENT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["'", "`"], @@ -548,7 +548,7 @@ function Mappings() //{{{ short_help: "Jump to the mark in the current buffer", usage: ["'{a-zA-Z}"], help: "Marks a-z are local to the buffer, whereas A-Z are valid between buffers.", - flags: Mappings.flags.ARGUMENT + flags: vimperator.Mappings.flags.ARGUMENT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["M"], @@ -567,7 +567,7 @@ function Mappings() //{{{ usage: ["M{a-zA-Z0-9}"], help: "You can go to a marked URL in the current tab with go{a-zA-Z0-9} or in a new tab with gn{a-zA-Z0-9}. " + "These QuickMarks are persistent across browser sessions.", - flags: Mappings.flags.ARGUMENT + flags: vimperator.Mappings.flags.ARGUMENT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["o"], @@ -638,7 +638,7 @@ function Mappings() //{{{ { short_help: "Undo closing of a tab", help: "If a count is given, don't close the last but the [count]th last tab.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["y"], @@ -668,28 +668,28 @@ function Mappings() //{{{ function(count) { vimperator.buffer.zoomIn(count > 1 ? count : 1); }, { short_help: "Zoom in current web page by 25%", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zI"], function(count) { vimperator.buffer.zoomIn((count > 1 ? count : 1) * 4); }, { short_help: "Zoom in current web page by 100%", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zo", "-"], function(count) { vimperator.buffer.zoomOut(count > 1 ? count : 1); }, { short_help: "Zoom out current web page by 25%", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zO"], function(count) { vimperator.buffer.zoomOut((count > 1 ? count : 1) * 4); }, { short_help: "Zoom out current web page by 100%", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zz"], @@ -697,7 +697,7 @@ function Mappings() //{{{ { short_help: "Set zoom value of the web page", help: "Zoom value can be between 1 and 2000%. If it is omitted, zoom is reset to 100%.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["ZQ"], @@ -735,7 +735,7 @@ function Mappings() //{{{ { short_help: "Goto the top of the document", help: "When used with [count] like in 35gg, it scrolls to 35% of the document.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["G", ""], @@ -743,7 +743,7 @@ function Mappings() //{{{ { short_help: "Goto the end of the document", help: "When used with [count] like in 35G, it scrolls to 35% of the document.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["h", ""], @@ -752,7 +752,7 @@ function Mappings() //{{{ short_help: "Scroll document to the left", help: "Count is supported: 10h will move 10 times as much to the left.
" + "If the document cannot scroll more, a beep is emitted (unless 'beep' is turned off).", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["j", "", ""], @@ -761,7 +761,7 @@ function Mappings() //{{{ short_help: "Scroll document down", help: "Count is supported: 10j will move 10 times as much down.
" + "If the document cannot scroll more, a beep is emitted (unless 'beep' is turned off).", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["k", "", ""], @@ -770,7 +770,7 @@ function Mappings() //{{{ short_help: "Scroll document up", help: "Count is supported: 10k will move 10 times as much up.
" + "If the document cannot scroll more, a beep is emitted (unless 'beep' is turned off).", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); function scrollByScrollSize(count, direction) @@ -795,7 +795,7 @@ function Mappings() //{{{ short_help: "Scroll window downwards in the buffer", help: "The number of lines is set by the 'scroll' option which defaults to half a page. " + "If [count] is given 'scroll' is first set to this value.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], @@ -804,7 +804,7 @@ function Mappings() //{{{ short_help: "Scroll window upwards in the buffer", help: "The number of lines is set by the 'scroll' option which defaults to half a page. " + "If [count] is given 'scroll' is first set to this value.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["l", ""], @@ -813,7 +813,7 @@ function Mappings() //{{{ short_help: "Scroll document to the right", help: "Count is supported: 10l will move 10 times as much to the right.
" + "If the document cannot scroll more, a beep is emitted (unless 'beep' is turned off).", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["", "", ""], @@ -821,7 +821,7 @@ function Mappings() //{{{ { short_help: "Scroll up a full page", help: "Scroll window [count] pages Backwards (upwards) in the buffer.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["", "", ""], @@ -829,7 +829,7 @@ function Mappings() //{{{ { short_help: "Scroll down a full page", help: "Scroll window [count] pages Forwards (downwards) in the buffer.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); @@ -839,7 +839,7 @@ function Mappings() //{{{ { short_help: "Go to an older position in the jump list", help: "The jump list is just the browser history for now.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], @@ -847,7 +847,7 @@ function Mappings() //{{{ { short_help: "Go to a newer position in the jump list", help: "The jump list is just the browser history for now.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["H", "", ""], @@ -855,7 +855,7 @@ function Mappings() //{{{ { short_help: "Go back in the browser history", help: "Count is supported: 3H goes back 3 steps.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["L", "", ""], @@ -863,7 +863,7 @@ function Mappings() //{{{ { short_help: "Go forward in the browser history", help: "Count is supported: 3L goes forward 3 steps.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); function isDirectory(url) @@ -903,7 +903,7 @@ function Mappings() //{{{ { short_help: "Go to parent directory", help: "Count is supported: 2gu on http://www.example.com/dir1/dir2/file.htm would open http://www.example.com/dir1/.", - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gU", ""], @@ -1076,7 +1076,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1084,7 +1084,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1106,7 +1106,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, ["", ""], @@ -1114,7 +1114,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1122,7 +1122,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1130,7 +1130,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1138,7 +1138,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1146,7 +1146,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); @@ -1172,7 +1172,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1180,7 +1180,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1188,7 +1188,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], @@ -1196,7 +1196,7 @@ function Mappings() //{{{ { cancel_mode: false, always_active: true, - flags: Mappings.flags.COUNT + flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], diff --git a/content/vimperator.js b/content/vimperator.js index b2559661..564f6006 100644 --- a/content/vimperator.js +++ b/content/vimperator.js @@ -702,7 +702,7 @@ const vimperator = (function() //{{{ vimperator.log("Loading module buffer window...", 3); vimperator.bufferwindow = new vimperator.InformationList("vimperator-bufferwindow", { incremental_fill: false, max_items: 10 }); vimperator.log("Loading module mappings...", 3); - vimperator.mappings = new Mappings(); + vimperator.mappings = new vimperator.Mappings(); vimperator.log("Loading module statusline...", 3); vimperator.statusline = new vimperator.StatusLine(); vimperator.log("Loading module buffer...", 3);