]> git.gir.st - VimFx.git/blob - extension/lib/defaults.coffee
Move Text Input mode into Normal mode
[VimFx.git] / extension / lib / defaults.coffee
1 ###
2 # Copyright Simon Lydell 2015.
3 #
4 # This file is part of VimFx.
5 #
6 # VimFx is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # VimFx is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with VimFx. If not, see <http://www.gnu.org/licenses/>.
18 ###
19
20 shortcuts =
21 'normal':
22 'location':
23 'o': 'focus_location_bar'
24 'O': 'focus_search_bar'
25 'p': 'paste_and_go'
26 'P': 'paste_and_go_in_tab'
27 'yy': 'copy_current_url'
28 'gu': 'go_up_path'
29 'gU': 'go_to_root'
30 'gh': 'go_home'
31 'H': 'history_back'
32 'L': 'history_forward'
33 'r': 'reload'
34 'R': 'reload_force'
35 'ar': 'reload_all'
36 'aR': 'reload_all_force'
37 's': 'stop'
38 'as': 'stop_all'
39
40 'scrolling':
41 'h': 'scroll_left'
42 'l': 'scroll_right'
43 'j': 'scroll_down'
44 'k': 'scroll_up'
45 '<space>': 'scroll_page_down'
46 '<s-space>': 'scroll_page_up'
47 'd': 'scroll_half_page_down'
48 'u': 'scroll_half_page_up'
49 'gg': 'scroll_to_top'
50 'G': 'scroll_to_bottom'
51 '0 ^': 'scroll_to_left'
52 '$': 'scroll_to_right'
53
54 'tabs':
55 't': 'tab_new'
56 'yt': 'tab_duplicate'
57 'J gT': 'tab_select_previous'
58 'K gt': 'tab_select_next'
59 'gJ': 'tab_move_backward'
60 'gK': 'tab_move_forward'
61 'g0': 'tab_select_first'
62 'g^': 'tab_select_first_non_pinned'
63 'g$': 'tab_select_last'
64 'gp': 'tab_toggle_pinned'
65 'x': 'tab_close'
66 'X': 'tab_restore'
67 'gx$': 'tab_close_to_end'
68 'gxa': 'tab_close_other'
69
70 'browsing':
71 'f': 'follow'
72 'F': 'follow_in_tab'
73 'gf': 'follow_in_focused_tab'
74 'af': 'follow_multiple'
75 'yf': 'follow_copy'
76 'vf': 'follow_focus'
77 '[': 'follow_previous'
78 ']': 'follow_next'
79 'gi': 'focus_text_input'
80 '<force><tab>': 'focus_next'
81 '<force><s-tab>': 'focus_previous'
82
83 'find':
84 '/': 'find'
85 'a/': 'find_highlight_all'
86 'n': 'find_next'
87 'N': 'find_previous'
88
89 'misc':
90 'i': 'enter_mode_insert'
91 'I': 'quote'
92 '?': 'help'
93 ':': 'dev'
94 '<force><escape>': 'esc'
95
96 'hints':
97 '':
98 '<escape>': 'exit'
99 '<space>': 'rotate_markers_forward'
100 '<s-space>': 'rotate_markers_backward'
101 '<backspace>': 'delete_hint_char'
102
103 'insert':
104 '':
105 '<s-escape>': 'exit'
106
107 'find':
108 '':
109 '<escape> <enter>': 'exit'
110
111 options =
112 'hint_chars': 'fjdkslaghrueiwovncm'
113 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
114 'next_patterns': 'next › » ▶ → >> > more older'
115 'black_list': ''
116 'prevent_autofocus': true
117 'ignore_keyboard_layout': false
118 'timeout': 2000
119
120 advanced_options =
121 'prevent_target_blank': true
122 'autofocus_limit': 100
123 'prevent_autofocus_modes': 'normal'
124 'hints_timeout': 200
125 'smoothScroll.lines.spring-constant': '1000'
126 'smoothScroll.pages.spring-constant': '2500'
127 'smoothScroll.other.spring-constant': '2500'
128 'pattern_selector': 'a, button'
129 'pattern_attrs': 'rel role data-tooltip aria-label'
130 'activatable_element_keys': '<enter>'
131 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
132 <arrowright> <space> <enter>'
133 'options.key.quote': '<c-q>'
134 'options.key.insert_default': '<c-d>'
135 'options.key.reset_default': '<c-r>'
136
137 parsed_options =
138 'translations': {}
139 'categories': {} # Will be filled in below.
140
141
142
143 translate = require('./l10n')
144 utils = require('./utils')
145
146 addCategory = (category, order) ->
147 uncategorized = (category == '')
148 categoryName =
149 if uncategorized
150 -> ''
151 else
152 translate.bind(null, "category.#{ category }")
153 parsed_options.categories[category] = {
154 name: categoryName
155 order: if uncategorized then 0 else order
156 }
157
158 shortcut_prefs = {}
159 categoryMap = {}
160 mode_order = {}
161 command_order = {}
162
163 createCounter = -> new utils.Counter({step: 100})
164 modeCounter = createCounter()
165 categoryCounter = createCounter()
166
167 for modeName, modeCategories of shortcuts
168 mode_order[modeName] = modeCounter.tick()
169 for categoryName, modeShortcuts of modeCategories
170 addCategory(categoryName, categoryCounter.tick())
171 commandIndex = createCounter()
172 for shortcut, commandName of modeShortcuts
173 pref = "mode.#{ modeName }.#{ commandName }"
174 shortcut_prefs[pref] = shortcut
175 command_order[pref] = commandIndex.tick()
176 categoryMap[pref] = categoryName
177
178 # All options, excluding shortcut customizations.
179 all_options = Object.assign({}, options, advanced_options, parsed_options)
180 # All things that are saved in Firefox’s prefs system.
181 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
182
183 module.exports = {
184 options
185 advanced_options
186 parsed_options
187 all_options
188 shortcut_prefs
189 all_prefs
190 categoryMap
191 mode_order
192 command_order
193 BRANCH: 'extensions.VimFx.'
194 }
Imprint / Impressum