]> git.gir.st - VimFx.git/blob - extension/lib/commands.coffee
Move `Command` into its own file
[VimFx.git] / extension / lib / commands.coffee
1 ###
2 # Copyright Anton Khodakivskiy 2012, 2013, 2014.
3 # Copyright Simon Lydell 2013, 2014.
4 # Copyright Wang Zhuochun 2013, 2014.
5 #
6 # This file is part of VimFx.
7 #
8 # VimFx is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # VimFx is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with VimFx. If not, see <http://www.gnu.org/licenses/>.
20 ###
21
22 notation = require('vim-like-key-notation')
23 Command = require('./command')
24 { Marker } = require('./marker')
25 utils = require('./utils')
26 help = require('./help')
27 { getPref } = require('./prefs')
28
29 { isProperLink, isTextInputElement, isContentEditable } = utils
30
31 { classes: Cc, interfaces: Ci, utils: Cu } = Components
32
33 XULDocument = Ci.nsIDOMXULDocument
34
35 # “Selecting an element” means “focusing and selecting the text, if any, of an
36 # element”.
37
38 # Select the Address Bar.
39 command_focus = (vim) ->
40 # This function works even if the Address Bar has been removed.
41 vim.rootWindow.focusAndSelectUrlBar()
42
43 # Select the Search Bar.
44 command_focus_search = (vim) ->
45 # The `.webSearch()` method opens a search engine in a tab if the Search Bar
46 # has been removed. Therefore we first check if it exists.
47 if vim.rootWindow.BrowserSearch.searchBar
48 vim.rootWindow.BrowserSearch.webSearch()
49
50 helper_paste = (vim) ->
51 url = vim.rootWindow.readFromClipboard()
52 postData = null
53 if not utils.isURL(url) and submission = utils.browserSearchSubmission(url)
54 url = submission.uri.spec
55 { postData } = submission
56 return {url, postData}
57
58 # Go to or search for the contents of the system clipboard.
59 command_paste = (vim) ->
60 { url, postData } = helper_paste(vim)
61 vim.rootWindow.gBrowser.loadURIWithFlags(url, null, null, null, postData)
62
63 # Go to or search for the contents of the system clipboard in a new tab.
64 command_paste_tab = (vim) ->
65 { url, postData } = helper_paste(vim)
66 vim.rootWindow.gBrowser.selectedTab =
67 vim.rootWindow.gBrowser.addTab(url, null, null, postData, null, false)
68
69 # Copy the current URL to the system clipboard.
70 command_yank = (vim) ->
71 utils.writeToClipboard(vim.window.location.href)
72
73 # Reload the current tab, possibly from cache.
74 command_reload = (vim) ->
75 vim.rootWindow.BrowserReload()
76
77 # Reload the current tab, skipping cache.
78 command_reload_force = (vim) ->
79 vim.rootWindow.BrowserReloadSkipCache()
80
81 # Reload all tabs, possibly from cache.
82 command_reload_all = (vim) ->
83 vim.rootWindow.gBrowser.reloadAllTabs()
84
85 # Reload all tabs, skipping cache.
86 command_reload_all_force = (vim) ->
87 for tab in vim.rootWindow.gBrowser.visibleTabs
88 window = tab.linkedBrowser.contentWindow
89 window.location.reload(true)
90
91 # Stop loading the current tab.
92 command_stop = (vim) ->
93 vim.window.stop()
94
95 # Stop loading all tabs.
96 command_stop_all = (vim) ->
97 for tab in vim.rootWindow.gBrowser.visibleTabs
98 window = tab.linkedBrowser.contentWindow
99 window.stop()
100
101 # Scroll to the top of the page.
102 command_scroll_to_top = (vim) ->
103 vim.rootWindow.goDoCommand('cmd_scrollTop')
104
105 # Scroll to the bottom of the page.
106 command_scroll_to_bottom = (vim) ->
107 vim.rootWindow.goDoCommand('cmd_scrollBottom')
108
109 # Scroll down a bit.
110 command_scroll_down = (vim, event, count) ->
111 step = getPref('scroll_step_lines') * count
112 utils.simulateWheel(vim.window, 0, +step, utils.WHEEL_MODE_LINE)
113
114 # Scroll up a bit.
115 command_scroll_up = (vim, event, count) ->
116 step = getPref('scroll_step_lines') * count
117 utils.simulateWheel(vim.window, 0, -step, utils.WHEEL_MODE_LINE)
118
119 # Scroll left a bit.
120 command_scroll_left = (vim, event, count) ->
121 step = getPref('scroll_step_lines') * count
122 utils.simulateWheel(vim.window, -step, 0, utils.WHEEL_MODE_LINE)
123
124 # Scroll right a bit.
125 command_scroll_right = (vim, event, count) ->
126 step = getPref('scroll_step_lines') * count
127 utils.simulateWheel(vim.window, +step, 0, utils.WHEEL_MODE_LINE)
128
129 # Scroll down half a page.
130 command_scroll_half_page_down = (vim, event, count) ->
131 utils.simulateWheel(vim.window, 0, +0.5 * count, utils.WHEEL_MODE_PAGE)
132
133 # Scroll up half a page.
134 command_scroll_half_page_up = (vim, event, count) ->
135 utils.simulateWheel(vim.window, 0, -0.5 * count, utils.WHEEL_MODE_PAGE)
136
137 # Scroll down full a page.
138 command_scroll_page_down = (vim, event, count) ->
139 utils.simulateWheel(vim.window, 0, +1 * count, utils.WHEEL_MODE_PAGE)
140
141 # Scroll up full a page.
142 command_scroll_page_up = (vim, event, count) ->
143 utils.simulateWheel(vim.window, 0, -1 * count, utils.WHEEL_MODE_PAGE)
144
145 # Open a new tab and select the Address Bar.
146 command_open_tab = (vim) ->
147 vim.rootWindow.BrowserOpenTab()
148
149 absoluteTabIndex = (relativeIndex, gBrowser) ->
150 tabs = gBrowser.visibleTabs
151 { selectedTab } = gBrowser
152
153 currentIndex = tabs.indexOf(selectedTab)
154 absoluteIndex = currentIndex + relativeIndex
155 numTabs = tabs.length
156
157 wrap = (Math.abs(relativeIndex) == 1)
158 if wrap
159 absoluteIndex %%= numTabs
160 else
161 absoluteIndex = Math.max(0, absoluteIndex)
162 absoluteIndex = Math.min(absoluteIndex, numTabs - 1)
163
164 return absoluteIndex
165
166 helper_switch_tab = (direction, vim, event, count) ->
167 { gBrowser } = vim.rootWindow
168 gBrowser.selectTabAtIndex(absoluteTabIndex(direction * count, gBrowser))
169
170 # Switch to the previous tab.
171 command_tab_prev = helper_switch_tab.bind(undefined, -1)
172
173 # Switch to the next tab.
174 command_tab_next = helper_switch_tab.bind(undefined, +1)
175
176 helper_move_tab = (direction, vim, event, count) ->
177 { gBrowser } = vim.rootWindow
178 { selectedTab } = gBrowser
179 { pinned } = selectedTab
180
181 index = absoluteTabIndex(direction * count, gBrowser)
182
183 if index < gBrowser._numPinnedTabs
184 gBrowser.pinTab(selectedTab) unless pinned
185 else
186 gBrowser.unpinTab(selectedTab) if pinned
187
188 gBrowser.moveTabTo(selectedTab, index)
189
190 # Move the current tab backward.
191 command_tab_move_left = helper_move_tab.bind(undefined, -1)
192
193 # Move the current tab forward.
194 command_tab_move_right = helper_move_tab.bind(undefined, +1)
195
196 # Load the home page.
197 command_home = (vim) ->
198 vim.rootWindow.BrowserHome()
199
200 # Switch to the first tab.
201 command_tab_first = (vim) ->
202 vim.rootWindow.gBrowser.selectTabAtIndex(0)
203
204 # Switch to the first non-pinned tab.
205 command_tab_first_non_pinned = (vim) ->
206 firstNonPinned = vim.rootWindow.gBrowser._numPinnedTabs
207 vim.rootWindow.gBrowser.selectTabAtIndex(firstNonPinned)
208
209 # Switch to the last tab.
210 command_tab_last = (vim) ->
211 vim.rootWindow.gBrowser.selectTabAtIndex(-1)
212
213 # Toggle Pin Tab.
214 command_toggle_pin_tab = (vim) ->
215 currentTab = vim.rootWindow.gBrowser.selectedTab
216
217 if currentTab.pinned
218 vim.rootWindow.gBrowser.unpinTab(currentTab)
219 else
220 vim.rootWindow.gBrowser.pinTab(currentTab)
221
222 # Duplicate current tab.
223 command_duplicate_tab = (vim) ->
224 { gBrowser } = vim.rootWindow
225 gBrowser.duplicateTab(gBrowser.selectedTab)
226
227 # Close all tabs from current to the end.
228 command_close_tabs_to_end = (vim) ->
229 { gBrowser } = vim.rootWindow
230 gBrowser.removeTabsToTheEndFrom(gBrowser.selectedTab)
231
232 # Close all tabs except the current.
233 command_close_other_tabs = (vim) ->
234 { gBrowser } = vim.rootWindow
235 gBrowser.removeAllTabsBut(gBrowser.selectedTab)
236
237 # Close current tab.
238 command_close_tab = (vim, event, count) ->
239 { gBrowser } = vim.rootWindow
240 return if gBrowser.selectedTab.pinned
241 currentIndex = gBrowser.visibleTabs.indexOf(gBrowser.selectedTab)
242 for tab in gBrowser.visibleTabs[currentIndex...(currentIndex + count)]
243 gBrowser.removeTab(tab)
244
245 # Restore last closed tab.
246 command_restore_tab = (vim, event, count) ->
247 vim.rootWindow.undoCloseTab() for [1..count]
248
249 # Combine links with the same href.
250 combine = (hrefs, marker) ->
251 if marker.type == 'link'
252 { href } = marker.element
253 if href of hrefs
254 parent = hrefs[href]
255 marker.parent = parent
256 parent.weight += marker.weight
257 parent.numChildren++
258 else
259 hrefs[href] = marker
260 return marker
261
262 # Follow links, focus text inputs and click buttons with hint markers.
263 command_follow = (vim, event, count) ->
264 hrefs = {}
265 filter = (element, getElementShape) ->
266 document = element.ownerDocument
267 isXUL = (document instanceof XULDocument)
268 semantic = true
269 switch
270 when isProperLink(element)
271 type = 'link'
272 when isTextInputElement(element) or isContentEditable(element)
273 type = 'text'
274 when element.tabIndex > -1 and
275 not (isXUL and element.nodeName.endsWith('box'))
276 type = 'clickable'
277 unless isXUL or element.nodeName in ['A', 'INPUT', 'BUTTON']
278 semantic = false
279 when element != vim.state.largestScrollableElement and
280 vim.state.scrollableElements.has(element)
281 type = 'scrollable'
282 when element.hasAttribute('onclick') or
283 element.hasAttribute('onmousedown') or
284 element.hasAttribute('onmouseup') or
285 element.hasAttribute('oncommand') or
286 element.getAttribute('role') in ['link', 'button'] or
287 # Twitter special-case.
288 element.classList.contains('js-new-tweets-bar') or
289 # Feedly special-case.
290 element.hasAttribute('data-app-action') or
291 element.hasAttribute('data-uri') or
292 element.hasAttribute('data-page-action')
293 type = 'clickable'
294 semantic = false
295 # Putting markers on `<label>` elements is generally redundant, because
296 # its `<input>` gets one. However, some sites hide the actual `<input>`
297 # but keeps the `<label>` to click, either for styling purposes or to keep
298 # the `<input>` hidden until it is used. In those cases we should add a
299 # marker for the `<label>`.
300 when element.nodeName == 'LABEL'
301 if element.htmlFor
302 input = document.getElementById(element.htmlFor)
303 if input and not getElementShape(input)
304 type = 'clickable'
305 # Elements that have “button” somewhere in the class might be clickable,
306 # unless they contain a real link or button in which case they likely are
307 # “button-wrapper”s. (`<SVG element>.className` is not a string!)
308 when not isXUL and typeof element.className == 'string' and
309 element.className.toLowerCase().contains('button')
310 unless element.querySelector('a, button')
311 type = 'clickable'
312 semantic = false
313 # When viewing an image it should get a marker to toggle zoom.
314 when document.body?.childElementCount == 1 and
315 element.nodeName == 'IMG' and
316 (element.classList.contains('overflowing') or
317 element.classList.contains('shrinkToFit'))
318 type = 'clickable'
319 return unless type
320 return unless shape = getElementShape(element)
321 return combine(hrefs, new Marker(element, shape, {semantic, type}))
322
323 callback = (marker) ->
324 { element } = marker
325 element.focus()
326 last = (count == 1)
327 if not last and marker.type == 'link'
328 utils.openTab(vim.rootWindow, element.href, {
329 inBackground: true
330 relatedToCurrent: true
331 })
332 else
333 if element.target == '_blank'
334 targetReset = element.target
335 element.target = ''
336 utils.simulateClick(element)
337 element.target = targetReset if targetReset
338 count--
339 return (not last and marker.type != 'text')
340
341 vim.enterMode('hints', filter, callback)
342
343 # Like command_follow but multiple times.
344 command_follow_multiple = (vim, event) ->
345 command_follow(vim, event, Infinity)
346
347 # Follow links in a new background tab with hint markers.
348 command_follow_in_tab = (vim, event, count, inBackground = true) ->
349 hrefs = {}
350 filter = (element, getElementShape) ->
351 return unless isProperLink(element)
352 return unless shape = getElementShape(element)
353 return combine(hrefs, new Marker(element, shape, {semantic: true}))
354
355 callback = (marker) ->
356 last = (count == 1)
357 utils.openTab(vim.rootWindow, marker.element.href, {
358 inBackground: if last then inBackground else true
359 relatedToCurrent: true
360 })
361 count--
362 return not last
363
364 vim.enterMode('hints', filter, callback)
365
366 # Follow links in a new foreground tab with hint markers.
367 command_follow_in_focused_tab = (vim, event, count) ->
368 command_follow_in_tab(vim, event, count, false)
369
370 # Copy the URL or text of a markable element to the system clipboard.
371 command_marker_yank = (vim) ->
372 hrefs = {}
373 filter = (element, getElementShape) ->
374 type = switch
375 when isProperLink(element) then 'link'
376 when isTextInputElement(element) then 'textInput'
377 when isContentEditable(element) then 'contenteditable'
378 return unless type
379 return unless shape = getElementShape(element)
380 return combine(hrefs, new Marker(element, shape, {semantic: true, type}))
381
382 callback = (marker) ->
383 { element } = marker
384 text = switch marker.type
385 when 'link' then element.href
386 when 'textInput' then element.value
387 when 'contenteditable' then element.textContent
388 utils.writeToClipboard(text)
389
390 vim.enterMode('hints', filter, callback)
391
392 # Focus element with hint markers.
393 command_marker_focus = (vim) ->
394 filter = (element, getElementShape) ->
395 type = switch
396 when element.tabIndex > -1
397 'focusable'
398 when element != vim.state.largestScrollableElement and
399 vim.state.scrollableElements.has(element)
400 'scrollable'
401 return unless type
402 return unless shape = getElementShape(element)
403 return new Marker(element, shape, {semantic: true, type})
404
405 callback = (marker) ->
406 { element } = marker
407 element.focus()
408 element.select?()
409
410 vim.enterMode('hints', filter, callback)
411
412 # Search for the prev/next patterns in the following attributes of the element.
413 # `rel` should be kept as the first attribute, since the standard way of marking
414 # up prev/next links (`rel="prev"` and `rel="next"`) should be favored. Even
415 # though some of these attributes only allow a fixed set of keywords, we
416 # pattern-match them anyways since lots of sites don’t follow the spec and use
417 # the attributes arbitrarily.
418 attrs = ['rel', 'role', 'data-tooltip', 'aria-label']
419 helper_follow_pattern = (type, vim) ->
420 { document } = vim.window
421
422 # If there’s a `<link rel=prev/next>` element we use that.
423 for link in document.head.getElementsByTagName('link')
424 # Also support `rel=previous`, just like Google.
425 if type == link.rel.toLowerCase().replace(/^previous$/, 'prev')
426 vim.rootWindow.gBrowser.loadURI(link.href)
427 return
428
429 # Otherwise we look for a link or button on the page that seems to go to the
430 # previous or next page.
431 candidates = document.querySelectorAll('a, button')
432 patterns = utils.splitListString(getPref("#{ type }_patterns"))
433 if matchingLink = utils.getBestPatternMatch(patterns, attrs, candidates)
434 utils.simulateClick(matchingLink)
435
436 # Follow previous page.
437 command_follow_prev = helper_follow_pattern.bind(undefined, 'prev')
438
439 # Follow next page.
440 command_follow_next = helper_follow_pattern.bind(undefined, 'next')
441
442 # Go up one level in the URL hierarchy.
443 command_go_up_path = (vim, event, count) ->
444 { pathname } = vim.window.location
445 vim.window.location.pathname = pathname.replace(
446 /// (?: /[^/]+ ){1,#{ count }} /?$ ///, ''
447 )
448
449 # Go up to root of the URL hierarchy.
450 command_go_to_root = (vim) ->
451 vim.window.location.href = vim.window.location.origin
452
453 helper_go_history = (num, vim, event, count) ->
454 { index } = vim.rootWindow.getWebNavigation().sessionHistory
455 { history } = vim.window
456 num *= count
457 num = Math.max(num, -index)
458 num = Math.min(num, history.length - 1 - index)
459 return if num == 0
460 history.go(num)
461
462 # Go back in history.
463 command_back = helper_go_history.bind(undefined, -1)
464
465 # Go forward in history.
466 command_forward = helper_go_history.bind(undefined, +1)
467
468 findStorage = {lastSearchString: ''}
469
470 helper_find = (highlight, vim) ->
471 findBar = vim.rootWindow.gBrowser.getFindBar()
472
473 findBar.onFindCommand()
474 findBar._findField.focus()
475 findBar._findField.select()
476
477 return unless highlightButton = findBar.getElement('highlight')
478 if highlightButton.checked != highlight
479 highlightButton.click()
480
481 # Open the find bar, making sure that hightlighting is off.
482 command_find = helper_find.bind(undefined, false)
483
484 # Open the find bar, making sure that hightlighting is on.
485 command_find_hl = helper_find.bind(undefined, true)
486
487 helper_find_again = (direction, vim) ->
488 findBar = vim.rootWindow.gBrowser.getFindBar()
489 if findStorage.lastSearchString.length > 0
490 findBar._findField.value = findStorage.lastSearchString
491 findBar.onFindAgainCommand(direction)
492
493 # Search for the last pattern.
494 command_find_next = helper_find_again.bind(undefined, false)
495
496 # Search for the last pattern backwards.
497 command_find_prev = helper_find_again.bind(undefined, true)
498
499 # Enter insert mode.
500 command_insert_mode = (vim) ->
501 vim.enterMode('insert')
502
503 # Quote next keypress (pass it through to the page).
504 command_quote = (vim, event, count) ->
505 vim.enterMode('insert', count)
506
507 # Display the Help Dialog.
508 command_help = (vim) ->
509 help.injectHelp(vim.window.document, require('./modes'))
510
511 # Open and select the Developer Toolbar.
512 command_dev = (vim) ->
513 vim.rootWindow.DeveloperToolbar.show(true) # focus
514
515 command_Esc = (vim, event) ->
516 utils.blurActiveElement(vim.window)
517
518 # Blur active XUL control.
519 callback = -> event.originalTarget?.ownerDocument?.activeElement?.blur()
520 vim.window.setTimeout(callback, 0)
521
522 help.removeHelp(vim.window.document)
523
524 vim.rootWindow.DeveloperToolbar.hide()
525
526 vim.rootWindow.gBrowser.getFindBar().close()
527
528 vim.rootWindow.TabView.hide()
529
530 { document } = vim.window
531 if document.exitFullscreen
532 document.exitFullscreen()
533 else
534 document.mozCancelFullScreen()
535
536
537 # coffeelint: disable=max_line_length
538 commands = [
539 new Command('urls', 'focus', command_focus, [['o']])
540 new Command('urls', 'focus_search', command_focus_search, [['O']])
541 new Command('urls', 'paste', command_paste, [['p']])
542 new Command('urls', 'paste_tab', command_paste_tab, [['P']])
543 new Command('urls', 'marker_yank', command_marker_yank, [['y', 'f']])
544 new Command('urls', 'marker_focus', command_marker_focus, [['v', 'f']])
545 new Command('urls', 'yank', command_yank, [['y', 'y']])
546 new Command('urls', 'reload', command_reload, [['r']])
547 new Command('urls', 'reload_force', command_reload_force, [['R']])
548 new Command('urls', 'reload_all', command_reload_all, [['a', 'r']])
549 new Command('urls', 'reload_all_force', command_reload_all_force, [['a', 'R']])
550 new Command('urls', 'stop', command_stop, [['s']])
551 new Command('urls', 'stop_all', command_stop_all, [['a', 's']])
552
553 new Command('nav', 'scroll_to_top', command_scroll_to_top , [['g', 'g']])
554 new Command('nav', 'scroll_to_bottom', command_scroll_to_bottom, [['G']])
555 new Command('nav', 'scroll_down', command_scroll_down, [['j']])
556 new Command('nav', 'scroll_up', command_scroll_up, [['k']])
557 new Command('nav', 'scroll_left', command_scroll_left, [['h']])
558 new Command('nav', 'scroll_right', command_scroll_right , [['l']])
559 new Command('nav', 'scroll_half_page_down', command_scroll_half_page_down, [['d']])
560 new Command('nav', 'scroll_half_page_up', command_scroll_half_page_up, [['u']])
561 new Command('nav', 'scroll_page_down', command_scroll_page_down, [['<space>']])
562 new Command('nav', 'scroll_page_up', command_scroll_page_up, [['<s-space>']])
563
564 new Command('tabs', 'open_tab', command_open_tab, [['t']])
565 new Command('tabs', 'tab_prev', command_tab_prev, [['J'], ['g', 'T']])
566 new Command('tabs', 'tab_next', command_tab_next, [['K'], ['g', 't']])
567 new Command('tabs', 'tab_move_left', command_tab_move_left, [['g', 'J']])
568 new Command('tabs', 'tab_move_right', command_tab_move_right, [['g', 'K']])
569 new Command('tabs', 'home', command_home, [['g', 'h']])
570 new Command('tabs', 'tab_first', command_tab_first, [['g', 'H'], ['g', '0']])
571 new Command('tabs', 'tab_first_non_pinned', command_tab_first_non_pinned, [['g', '^']])
572 new Command('tabs', 'tab_last', command_tab_last, [['g', 'L'], ['g', '$']])
573 new Command('tabs', 'toggle_pin_tab', command_toggle_pin_tab, [['g', 'p']])
574 new Command('tabs', 'duplicate_tab', command_duplicate_tab, [['y', 't']])
575 new Command('tabs', 'close_tabs_to_end', command_close_tabs_to_end, [['g', 'x', '$']])
576 new Command('tabs', 'close_other_tabs', command_close_other_tabs, [['g', 'x', 'a']])
577 new Command('tabs', 'close_tab', command_close_tab, [['x']])
578 new Command('tabs', 'restore_tab', command_restore_tab, [['X']])
579
580 new Command('browse', 'follow', command_follow, [['f']])
581 new Command('browse', 'follow_in_tab', command_follow_in_tab, [['F']])
582 new Command('browse', 'follow_in_focused_tab', command_follow_in_focused_tab, [['g', 'f']])
583 new Command('browse', 'follow_multiple', command_follow_multiple, [['a', 'f']])
584 new Command('browse', 'follow_previous', command_follow_prev, [['[']])
585 new Command('browse', 'follow_next', command_follow_next, [[']']])
586 new Command('browse', 'go_up_path', command_go_up_path, [['g', 'u']])
587 new Command('browse', 'go_to_root', command_go_to_root, [['g', 'U']])
588 new Command('browse', 'back', command_back, [['H']])
589 new Command('browse', 'forward', command_forward, [['L']])
590
591 new Command('misc', 'find', command_find, [['/']])
592 new Command('misc', 'find_hl', command_find_hl, [['a', '/']])
593 new Command('misc', 'find_next', command_find_next, [['n']])
594 new Command('misc', 'find_prev', command_find_prev, [['N']])
595 new Command('misc', 'insert_mode', command_insert_mode, [['i']])
596 new Command('misc', 'quote', command_quote, [['I']])
597 new Command('misc', 'help', command_help, [['?']])
598 new Command('misc', 'dev', command_dev, [[':']])
599
600 escapeCommand =
601 new Command('misc', 'Esc', command_Esc, [['<escape>']])
602 ]
603 # coffeelint: enable=max_line_length
604
605 exports.commands = commands
606 exports.escapeCommand = escapeCommand
607 exports.findStorage = findStorage
Imprint / Impressum