]> git.gir.st - VimFx.git/blob - extension/lib/defaults.coffee
Let `gL` deal with unvisited tabs instead of unread ones
[VimFx.git] / extension / lib / defaults.coffee
1 ###
2 # Copyright Simon Lydell 2015, 2016.
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 # coffeelint: disable=colon_assignment_spacing
21 # coffeelint: disable=no_implicit_braces
22
23 # This file defines all VimFx’s options in an easy-to-read way.
24
25 shortcuts =
26 'normal':
27 'location':
28 'o': 'focus_location_bar'
29 'O': 'focus_search_bar'
30 'p': 'paste_and_go'
31 'P': 'paste_and_go_in_tab'
32 'yy': 'copy_current_url'
33 'gu': 'go_up_path'
34 'gU': 'go_to_root'
35 'gh': 'go_home'
36 'H': 'history_back'
37 'L': 'history_forward'
38 'gH': 'history_list'
39 'r': 'reload'
40 'R': 'reload_force'
41 'ar': 'reload_all'
42 'aR': 'reload_all_force'
43 's': 'stop'
44 'as': 'stop_all'
45
46 'scrolling':
47 'h': 'scroll_left'
48 'l': 'scroll_right'
49 'j': 'scroll_down'
50 'k': 'scroll_up'
51 '<space>': 'scroll_page_down'
52 '<s-space>': 'scroll_page_up'
53 'd': 'scroll_half_page_down'
54 'u': 'scroll_half_page_up'
55 'gg': 'scroll_to_top'
56 'G': 'scroll_to_bottom'
57 '0 ^': 'scroll_to_left'
58 '$': 'scroll_to_right'
59 'm': 'mark_scroll_position'
60 '`': 'scroll_to_mark'
61
62 'tabs':
63 't': 'tab_new'
64 'yt': 'tab_duplicate'
65 'J gT': 'tab_select_previous'
66 'K gt': 'tab_select_next'
67 'gl': 'tab_select_most_recent'
68 'gL': 'tab_select_oldest_unvisited'
69 'gJ': 'tab_move_backward'
70 'gK': 'tab_move_forward'
71 'gw': 'tab_move_to_window'
72 'g0': 'tab_select_first'
73 'g^': 'tab_select_first_non_pinned'
74 'g$': 'tab_select_last'
75 'gp': 'tab_toggle_pinned'
76 'x': 'tab_close'
77 'X': 'tab_restore'
78 'gX': 'tab_restore_list'
79 'gx$': 'tab_close_to_end'
80 'gxa': 'tab_close_other'
81
82 'browsing':
83 'f': 'follow'
84 'F': 'follow_in_tab'
85 'gf': 'follow_in_focused_tab'
86 'gF': 'follow_in_window'
87 'af': 'follow_multiple'
88 'yf': 'follow_copy'
89 'zf': 'follow_focus'
90 'zF': 'click_browser_element'
91 '[': 'follow_previous'
92 ']': 'follow_next'
93 'gi': 'focus_text_input'
94
95 'find':
96 '/': 'find'
97 'a/': 'find_highlight_all'
98 'g/': 'find_links_only'
99 'n': 'find_next'
100 'N': 'find_previous'
101
102 'misc':
103 'w': 'window_new'
104 'W': 'window_new_private'
105 'i': 'enter_mode_ignore'
106 'I': 'quote'
107 'gr': 'enter_reader_view'
108 'zr': 'reload_config_file'
109 '?': 'help'
110 ':': 'dev'
111 '<force><escape>': 'esc'
112
113 'hints':
114 '':
115 '<escape>': 'exit'
116 '<space>': 'rotate_markers_forward'
117 '<s-space>': 'rotate_markers_backward'
118 '<backspace>': 'delete_hint_char'
119 '<enter>': 'increase_count'
120
121 'ignore':
122 '':
123 '<s-escape>': 'exit'
124 '<s-f1>': 'unquote'
125
126 'find':
127 '':
128 '<escape> <enter>': 'exit'
129
130 options =
131 'hint_chars': 'fjdkslaghrueiwovncm'
132 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
133 'next_patterns': 'next › » ▶ → >> > more older'
134 'black_list': ''
135 'prevent_autofocus': false
136 'ignore_keyboard_layout': false
137 'timeout': 2000
138
139 advanced_options =
140 'notifications_enabled': true
141 'notify_entered_keys': true
142 'prevent_target_blank': true
143 'counts_enabled': true
144 'ignore_ctrl_alt': (Services.appinfo.OS == 'WINNT')
145 'prevent_autofocus_modes': 'normal'
146 'config_file_directory': ''
147 'hints_timeout': 200
148 'hints_sleep': 15
149 'smoothScroll.lines.spring-constant': '1000'
150 'smoothScroll.pages.spring-constant': '2500'
151 'smoothScroll.other.spring-constant': '2500'
152 'scroll.full_page_adjustment': 40
153 'scroll.half_page_adjustment': 20
154 'scroll.last_position_mark': '`'
155 'pattern_selector': ':-moz-any(
156 a, button, input[type="button"]
157 ):not([role="menu"]):not([role="tab"])'
158 'pattern_attrs': 'rel role data-tooltip aria-label'
159 'hints_toggle_in_tab': '<c-'
160 'hints_toggle_in_background': '<a-'
161 'activatable_element_keys': '<enter>'
162 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
163 <arrowright> <space> <enter>'
164 'focus_previous_key': '<s-tab>'
165 'focus_next_key': '<tab>'
166 'options.key.quote': '<c-q>'
167 'options.key.insert_default': '<c-d>'
168 'options.key.reset_default': '<c-r>'
169
170 parsed_options =
171 'translations': {}
172 'categories': {} # Will be filled in below.
173
174
175
176 # The above easy-to-read data is transformed in to easy-to-consume (for
177 # computers) formats below.
178
179 # coffeelint: enable=colon_assignment_spacing
180 # coffeelint: enable=no_implicit_braces
181
182 translate = require('./l10n')
183 utils = require('./utils')
184
185 addCategory = (category, order) ->
186 uncategorized = (category == '')
187 categoryName = if uncategorized then '' else translate("category.#{category}")
188 parsed_options.categories[category] = {
189 name: categoryName
190 order: if uncategorized then 0 else order
191 }
192
193 shortcut_prefs = {}
194 categoryMap = {}
195 mode_order = {}
196 command_order = {}
197
198 createCounter = -> new utils.Counter({step: 100})
199 modeCounter = createCounter()
200 categoryCounter = createCounter()
201
202 for modeName, modeCategories of shortcuts
203 mode_order[modeName] = modeCounter.tick()
204 for categoryName, modeShortcuts of modeCategories
205 addCategory(categoryName, categoryCounter.tick())
206 commandIndex = createCounter()
207 for shortcut, commandName of modeShortcuts
208 pref = "mode.#{modeName}.#{commandName}"
209 shortcut_prefs[pref] = shortcut
210 command_order[pref] = commandIndex.tick()
211 categoryMap[pref] = categoryName
212
213 # All options, excluding shortcut customizations.
214 all_options = Object.assign({}, options, advanced_options, parsed_options)
215 # All things that are saved in Firefox’s prefs system.
216 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
217
218 module.exports = {
219 options
220 advanced_options
221 parsed_options
222 all_options
223 shortcut_prefs
224 all_prefs
225 categoryMap
226 mode_order
227 command_order
228 BRANCH: 'extensions.VimFx.'
229 }
Imprint / Impressum