Initial work on new keyconfig

This commit is contained in:
Florian Bruhin 2017-06-16 12:33:13 +02:00
parent e4278a69ac
commit 67afc06d79
4 changed files with 345 additions and 393 deletions

View File

@ -177,7 +177,7 @@ def init(parent=None):
newconfig.init(parent)
val = newconfig.val
instance = newconfig.instance
_init_key_config(parent)
# _init_key_config(parent)
_init_misc()

View File

@ -77,398 +77,6 @@ MONOSPACE = (' xos4 Terminus, Terminus, Monospace, '
'monospace, Fixed, Consolas, Terminal')
KEY_FIRST_COMMENT = """
# vim: ft=conf
#
# In this config file, qutebrowser's key bindings are configured.
# The format looks like this:
#
# [keymode]
#
# command
# keychain
# keychain2
# ...
#
# All blank lines and lines starting with '#' are ignored.
# Inline-comments are not permitted.
#
# keymode is a comma separated list of modes in which the key binding should be
# active. If keymode starts with !, the key binding is active in all modes
# except the listed modes.
#
# For special keys (can't be part of a keychain), enclose them in `<`...`>`.
# For modifiers, you can use either `-` or `+` as delimiters, and these names:
#
# * Control: `Control`, `Ctrl`
# * Meta: `Meta`, `Windows`, `Mod4`
# * Alt: `Alt`, `Mod1`
# * Shift: `Shift`
#
# For simple keys (no `<>`-signs), a capital letter means the key is pressed
# with Shift. For special keys (with `<>`-signs), you need to explicitly add
# `Shift-` to match a key pressed with shift.
#
# Note that default keybindings are always bound, and need to be explicitly
# unbound if you wish to remove them:
#
# <unbound>
# keychain
# keychain2
# ...
"""
KEY_SECTION_DESC = {
'all': "Keybindings active in all modes.",
'normal': "Keybindings for normal mode.",
'insert': (
"Keybindings for insert mode.\n"
"Since normal keypresses are passed through, only special keys are "
"supported in this mode.\n"
"Useful hidden commands to map in this section:\n\n"
" * `open-editor`: Open a texteditor with the focused field.\n"
" * `paste-primary`: Paste primary selection at cursor position."),
'hint': (
"Keybindings for hint mode.\n"
"Since normal keypresses are passed through, only special keys are "
"supported in this mode.\n"
"Useful hidden commands to map in this section:\n\n"
" * `follow-hint`: Follow the currently selected hint."),
'passthrough': (
"Keybindings for passthrough mode.\n"
"Since normal keypresses are passed through, only special keys are "
"supported in this mode."),
'command': (
"Keybindings for command mode.\n"
"Since normal keypresses are passed through, only special keys are "
"supported in this mode.\n"
"Useful hidden commands to map in this section:\n\n"
" * `command-history-prev`: Switch to previous command in history.\n"
" * `command-history-next`: Switch to next command in history.\n"
" * `completion-item-focus`: Select another item in completion.\n"
" * `command-accept`: Execute the command currently in the "
"commandline."),
'prompt': (
"Keybindings for prompts in the status line.\n"
"You can bind normal keys in this mode, but they will be only active "
"when a yes/no-prompt is asked. For other prompt modes, you can only "
"bind special keys.\n"
"Useful hidden commands to map in this section:\n\n"
" * `prompt-accept`: Confirm the entered value.\n"
" * `prompt-accept yes`: Answer yes to a yes/no question.\n"
" * `prompt-accept no`: Answer no to a yes/no question."),
'caret': (
""),
}
# Keys which are similar to Return and should be bound by default where Return
# is bound.
RETURN_KEYS = ['<Return>', '<Ctrl-M>', '<Ctrl-J>', '<Shift-Return>', '<Enter>',
'<Shift-Enter>']
KEY_DATA = collections.OrderedDict([
('!normal', collections.OrderedDict([
('leave-mode', ['<Escape>', '<Ctrl-[>']),
])),
('normal', collections.OrderedDict([
('clear-keychain ;; search ;; fullscreen --leave',
['<Escape>', '<Ctrl-[>']),
('set-cmd-text -s :open', ['o']),
('set-cmd-text :open {url:pretty}', ['go']),
('set-cmd-text -s :open -t', ['O']),
('set-cmd-text :open -t -i {url:pretty}', ['gO']),
('set-cmd-text -s :open -b', ['xo']),
('set-cmd-text :open -b -i {url:pretty}', ['xO']),
('set-cmd-text -s :open -w', ['wo']),
('set-cmd-text :open -w {url:pretty}', ['wO']),
('set-cmd-text /', ['/']),
('set-cmd-text ?', ['?']),
('set-cmd-text :', [':']),
('open -t', ['ga', '<Ctrl-T>']),
('open -w', ['<Ctrl-N>']),
('tab-close', ['d', '<Ctrl-W>']),
('tab-close -o', ['D']),
('tab-only', ['co']),
('tab-focus', ['T']),
('tab-move', ['gm']),
('tab-move -', ['gl']),
('tab-move +', ['gr']),
('tab-next', ['J', '<Ctrl-PgDown>']),
('tab-prev', ['K', '<Ctrl-PgUp>']),
('tab-clone', ['gC']),
('reload', ['r', '<F5>']),
('reload -f', ['R', '<Ctrl-F5>']),
('back', ['H', '<back>']),
('back -t', ['th']),
('back -w', ['wh']),
('forward', ['L', '<forward>']),
('forward -t', ['tl']),
('forward -w', ['wl']),
('fullscreen', ['<F11>']),
('hint', ['f']),
('hint all tab', ['F']),
('hint all window', ['wf']),
('hint all tab-bg', [';b']),
('hint all tab-fg', [';f']),
('hint all hover', [';h']),
('hint images', [';i']),
('hint images tab', [';I']),
('hint links fill :open {hint-url}', [';o']),
('hint links fill :open -t -i {hint-url}', [';O']),
('hint links yank', [';y']),
('hint links yank-primary', [';Y']),
('hint --rapid links tab-bg', [';r']),
('hint --rapid links window', [';R']),
('hint links download', [';d']),
('hint inputs', [';t']),
('scroll left', ['h']),
('scroll down', ['j']),
('scroll up', ['k']),
('scroll right', ['l']),
('undo', ['u', '<Ctrl-Shift-T>']),
('scroll-perc 0', ['gg']),
('scroll-perc', ['G']),
('search-next', ['n']),
('search-prev', ['N']),
('enter-mode insert', ['i']),
('enter-mode caret', ['v']),
('enter-mode set_mark', ['`']),
('enter-mode jump_mark', ["'"]),
('yank', ['yy']),
('yank -s', ['yY']),
('yank title', ['yt']),
('yank title -s', ['yT']),
('yank domain', ['yd']),
('yank domain -s', ['yD']),
('yank pretty-url', ['yp']),
('yank pretty-url -s', ['yP']),
('open -- {clipboard}', ['pp']),
('open -- {primary}', ['pP']),
('open -t -- {clipboard}', ['Pp']),
('open -t -- {primary}', ['PP']),
('open -w -- {clipboard}', ['wp']),
('open -w -- {primary}', ['wP']),
('quickmark-save', ['m']),
('set-cmd-text -s :quickmark-load', ['b']),
('set-cmd-text -s :quickmark-load -t', ['B']),
('set-cmd-text -s :quickmark-load -w', ['wb']),
('bookmark-add', ['M']),
('set-cmd-text -s :bookmark-load', ['gb']),
('set-cmd-text -s :bookmark-load -t', ['gB']),
('set-cmd-text -s :bookmark-load -w', ['wB']),
('save', ['sf']),
('set-cmd-text -s :set', ['ss']),
('set-cmd-text -s :set -t', ['sl']),
('set-cmd-text -s :bind', ['sk']),
('zoom-out', ['-']),
('zoom-in', ['+']),
('zoom', ['=']),
('navigate prev', ['[[']),
('navigate next', [']]']),
('navigate prev -t', ['{{']),
('navigate next -t', ['}}']),
('navigate up', ['gu']),
('navigate up -t', ['gU']),
('navigate increment', ['<Ctrl-A>']),
('navigate decrement', ['<Ctrl-X>']),
('inspector', ['wi']),
('download', ['gd']),
('download-cancel', ['ad']),
('download-clear', ['cd']),
('view-source', ['gf']),
('set-cmd-text -s :buffer', ['gt']),
('tab-focus last', ['<Ctrl-Tab>', '<Ctrl-6>', '<Ctrl-^>']),
('enter-mode passthrough', ['<Ctrl-V>']),
('quit', ['<Ctrl-Q>', 'ZQ']),
('wq', ['ZZ']),
('scroll-page 0 1', ['<Ctrl-F>']),
('scroll-page 0 -1', ['<Ctrl-B>']),
('scroll-page 0 0.5', ['<Ctrl-D>']),
('scroll-page 0 -0.5', ['<Ctrl-U>']),
('tab-focus 1', ['<Alt-1>', 'g0', 'g^']),
('tab-focus 2', ['<Alt-2>']),
('tab-focus 3', ['<Alt-3>']),
('tab-focus 4', ['<Alt-4>']),
('tab-focus 5', ['<Alt-5>']),
('tab-focus 6', ['<Alt-6>']),
('tab-focus 7', ['<Alt-7>']),
('tab-focus 8', ['<Alt-8>']),
('tab-focus -1', ['<Alt-9>', 'g$']),
('home', ['<Ctrl-h>']),
('stop', ['<Ctrl-s>']),
('print', ['<Ctrl-Alt-p>']),
('open qute://settings', ['Ss']),
('follow-selected', RETURN_KEYS),
('follow-selected -t', ['<Ctrl-Return>', '<Ctrl-Enter>']),
('repeat-command', ['.']),
('tab-pin', ['<Ctrl-p>']),
('record-macro', ['q']),
('run-macro', ['@']),
])),
('insert', collections.OrderedDict([
('open-editor', ['<Ctrl-E>']),
('insert-text {primary}', ['<Shift-Ins>']),
])),
('hint', collections.OrderedDict([
('follow-hint', RETURN_KEYS),
('hint --rapid links tab-bg', ['<Ctrl-R>']),
('hint links', ['<Ctrl-F>']),
('hint all tab-bg', ['<Ctrl-B>']),
])),
('passthrough', {}),
('command', collections.OrderedDict([
('command-history-prev', ['<Ctrl-P>']),
('command-history-next', ['<Ctrl-N>']),
('completion-item-focus prev', ['<Shift-Tab>', '<Up>']),
('completion-item-focus next', ['<Tab>', '<Down>']),
('completion-item-focus next-category', ['<Ctrl-Tab>']),
('completion-item-focus prev-category', ['<Ctrl-Shift-Tab>']),
('completion-item-del', ['<Ctrl-D>']),
('command-accept', RETURN_KEYS),
])),
('prompt', collections.OrderedDict([
('prompt-accept', RETURN_KEYS),
('prompt-accept yes', ['y']),
('prompt-accept no', ['n']),
('prompt-open-download', ['<Ctrl-X>']),
('prompt-item-focus prev', ['<Shift-Tab>', '<Up>']),
('prompt-item-focus next', ['<Tab>', '<Down>']),
])),
('command,prompt', collections.OrderedDict([
('rl-backward-char', ['<Ctrl-B>']),
('rl-forward-char', ['<Ctrl-F>']),
('rl-backward-word', ['<Alt-B>']),
('rl-forward-word', ['<Alt-F>']),
('rl-beginning-of-line', ['<Ctrl-A>']),
('rl-end-of-line', ['<Ctrl-E>']),
('rl-unix-line-discard', ['<Ctrl-U>']),
('rl-kill-line', ['<Ctrl-K>']),
('rl-kill-word', ['<Alt-D>']),
('rl-unix-word-rubout', ['<Ctrl-W>']),
('rl-backward-kill-word', ['<Alt-Backspace>']),
('rl-yank', ['<Ctrl-Y>']),
('rl-delete-char', ['<Ctrl-?>']),
('rl-backward-delete-char', ['<Ctrl-H>']),
])),
('caret', collections.OrderedDict([
('toggle-selection', ['v', '<Space>']),
('drop-selection', ['<Ctrl-Space>']),
('enter-mode normal', ['c']),
('move-to-next-line', ['j']),
('move-to-prev-line', ['k']),
('move-to-next-char', ['l']),
('move-to-prev-char', ['h']),
('move-to-end-of-word', ['e']),
('move-to-next-word', ['w']),
('move-to-prev-word', ['b']),
('move-to-start-of-next-block', [']']),
('move-to-start-of-prev-block', ['[']),
('move-to-end-of-next-block', ['}']),
('move-to-end-of-prev-block', ['{']),
('move-to-start-of-line', ['0']),
('move-to-end-of-line', ['$']),
('move-to-start-of-document', ['gg']),
('move-to-end-of-document', ['G']),
('yank selection -s', ['Y']),
('yank selection', ['y'] + RETURN_KEYS),
('scroll left', ['H']),
('scroll down', ['J']),
('scroll up', ['K']),
('scroll right', ['L']),
])),
])
# A list of (regex, replacement) tuples of changed key commands.
CHANGED_KEY_COMMANDS = [
(re.compile(r'^open -([twb]) about:blank$'), r'open -\1'),
(re.compile(r'^download-page$'), r'download'),
(re.compile(r'^cancel-download$'), r'download-cancel'),
(re.compile(r"""^search (''|"")$"""),
r'clear-keychain ;; search ;; fullscreen --leave'),
(re.compile(r'^search$'),
r'clear-keychain ;; search ;; fullscreen --leave'),
(re.compile(r'^clear-keychain ;; search$'),
r'clear-keychain ;; search ;; fullscreen --leave'),
(re.compile(r"""^set-cmd-text ['"](.*) ['"]$"""), r'set-cmd-text -s \1'),
(re.compile(r"""^set-cmd-text ['"](.*)['"]$"""), r'set-cmd-text \1'),
(re.compile(r"^hint links rapid$"), r'hint --rapid links tab-bg'),
(re.compile(r"^hint links rapid-win$"), r'hint --rapid links window'),
(re.compile(r'^scroll -50 0$'), r'scroll left'),
(re.compile(r'^scroll 0 50$'), r'scroll down'),
(re.compile(r'^scroll 0 -50$'), r'scroll up'),
(re.compile(r'^scroll 50 0$'), r'scroll right'),
(re.compile(r'^scroll ([-\d]+ [-\d]+)$'), r'scroll-px \1'),
(re.compile(r'^search *;; *clear-keychain$'),
r'clear-keychain ;; search ;; fullscreen --leave'),
(re.compile(r'^clear-keychain *;; *leave-mode$'), r'leave-mode'),
(re.compile(r'^download-remove --all$'), r'download-clear'),
(re.compile(r'^hint links fill "([^"]*)"$'), r'hint links fill \1'),
(re.compile(r'^yank -t(\S+)'), r'yank title -\1'),
(re.compile(r'^yank -t'), r'yank title'),
(re.compile(r'^yank -d(\S+)'), r'yank domain -\1'),
(re.compile(r'^yank -d'), r'yank domain'),
(re.compile(r'^yank -p(\S+)'), r'yank pretty-url -\1'),
(re.compile(r'^yank -p'), r'yank pretty-url'),
(re.compile(r'^yank-selected -p'), r'yank selection -s'),
(re.compile(r'^yank-selected'), r'yank selection'),
(re.compile(r'^paste$'), r'open -- {clipboard}'),
(re.compile(r'^paste -s$'), r'open -- {primary}'),
(re.compile(r'^paste -([twb])$'), r'open -\1 -- {clipboard}'),
(re.compile(r'^paste -([twb])s$'), r'open -\1 -- {primary}'),
(re.compile(r'^paste -s([twb])$'), r'open -\1 -- {primary}'),
(re.compile(r'^completion-item-next'), r'completion-item-focus next'),
(re.compile(r'^completion-item-prev'), r'completion-item-focus prev'),
(re.compile(r'^open {clipboard}$'), r'open -- {clipboard}'),
(re.compile(r'^open -([twb]) {clipboard}$'), r'open -\1 -- {clipboard}'),
(re.compile(r'^open {primary}$'), r'open -- {primary}'),
(re.compile(r'^open -([twb]) {primary}$'), r'open -\1 -- {primary}'),
(re.compile(r'^paste-primary$'), r'insert-text {primary}'),
(re.compile(r'^set-cmd-text -s :search$'), r'set-cmd-text /'),
(re.compile(r'^set-cmd-text -s :search -r$'), r'set-cmd-text ?'),
(re.compile(r'^set-cmd-text -s :$'), r'set-cmd-text :'),
(re.compile(r'^set-cmd-text -s :set keybind$'), r'set-cmd-text -s :bind'),
(re.compile(r'^prompt-yes$'), r'prompt-accept yes'),
(re.compile(r'^prompt-no$'), r'prompt-accept no'),
(re.compile(r'^tab-close -l$'), r'tab-close --prev'),
(re.compile(r'^tab-close --left$'), r'tab-close --prev'),
(re.compile(r'^tab-close -r$'), r'tab-close --next'),
(re.compile(r'^tab-close --right$'), r'tab-close --next'),
(re.compile(r'^tab-only -l$'), r'tab-only --prev'),
(re.compile(r'^tab-only --left$'), r'tab-only --prev'),
(re.compile(r'^tab-only -r$'), r'tab-only --next'),
(re.compile(r'^tab-only --right$'), r'tab-only --next'),
]
Option = collections.namedtuple('Option', ['name', 'typ', 'default',
'backends', 'description'])

View File

@ -1800,3 +1800,341 @@ fonts.web.size.minimum_logical:
minval: 0
maxval: maxint
desc: The minimum logical font size that is applied when zooming out.
## keybindings
bindings.key_mappings:
default:
<Ctrl-[>: <Escape>
<Ctrl-6>: <Ctrl-^>
<Ctrl-M>: <Return>
<Ctrl-J>: <Return>
<Shift-Return>: <Return>
<Enter>: <Return>
<Shift-Enter>: <Return>
<Ctrl-Enter>: <Ctrl-Return>
<Ctrl-[>: <Escape>
type:
name: Dict
keytype: String
valtype: String
desc: >-
This setting can be used to map keys to other keys.
When the key used as dictionary-key is pressed, the binding for the key used
as dictionary-value is invoked instead.
This is useful for global remappings of keys, for example to map Ctrl-[ to
Escape.
bindings.commands:
default:
normal:
<Escape>: clear-keychain ;; search ;; fullscreen --leave
o: set-cmd-text -s :open
go: set-cmd-text :open {url:pretty}
O: set-cmd-text -s :open -t
gO: set-cmd-text :open -t -i {url:pretty}
xo: set-cmd-text -s :open -b
xO: set-cmd-text :open -b -i {url:pretty}
wo: set-cmd-text -s :open -w
wO: set-cmd-text :open -w {url:pretty}
/: set-cmd-text /
?: set-cmd-text ?
":": "set-cmd-text :"
ga: open -t
<Ctrl-T>: open -t
<Ctrl-N>: open -w
d: tab-close
<Ctrl-W>: tab-close
D: tab-close -o
co: tab-only
T: tab-focus
gm: tab-move
gl: tab-move -
gr: tab-move +
J: tab-next
<Ctrl-PgDown>: tab-next
K: tab-prev
<Ctrl-PgUp>: tab-prev
gC: tab-clone
r: reload
<F5>: reload
R: reload -f
<Ctrl-F5>: reload -f
H: back
<back>: back
th: back -t
wh: back -w
L: forward
<forward>: forward
tl: forward -t
wl: forward -w
<F11>: fullscreen
f: hint
F: hint all tab
wf: hint all window
;b: hint all tab-bg
;f: hint all tab-fg
;h: hint all hover
;i: hint images
;I: hint images tab
;o: hint links fill :open {hint-url}
;O: hint links fill :open -t -i {hint-url}
;y: hint links yank
;Y: hint links yank-primary
;r: hint --rapid links tab-bg
;R: hint --rapid links window
;d: hint links download
;t: hint inputs
h: scroll left
j: scroll down
k: scroll up
l: scroll right
u: undo
<Ctrl-Shift-T>: undo
gg: scroll-perc 0
G: scroll-perc
n: search-next
N: search-prev
i: enter-mode insert
v: enter-mode caret
"`": enter-mode set_mark
"'": enter-mode jump_mark
yy: yank
yY: yank -s
yt: yank title
yT: yank title -s
yd: yank domain
yD: yank domain -s
yp: yank pretty-url
yP: yank pretty-url -s
pp: open -- {clipboard}
pP: open -- {primary}
Pp: open -t -- {clipboard}
PP: open -t -- {primary}
wp: open -w -- {clipboard}
wP: open -w -- {primary}
m: quickmark-save
b: set-cmd-text -s :quickmark-load
B: set-cmd-text -s :quickmark-load -t
wb: set-cmd-text -s :quickmark-load -w
M: bookmark-add
gb: set-cmd-text -s :bookmark-load
gB: set-cmd-text -s :bookmark-load -t
wB: set-cmd-text -s :bookmark-load -w
sf: save
ss: set-cmd-text -s :set
sl: set-cmd-text -s :set -t
sk: set-cmd-text -s :bind
-: zoom-out
+: zoom-in
=: zoom
"[[": navigate prev
"]]": navigate next
"{{": navigate prev -t
"}}": navigate next -t
gu: navigate up
gU: navigate up -t
<Ctrl-A>: navigate increment
<Ctrl-X>: navigate decrement
wi: inspector
gd: download
ad: download-cancel
cd: download-clear
gf: view-source
gt: set-cmd-text -s :buffer
<Ctrl-Tab>: tab-focus last
<Ctrl-^>: tab-focus last
<Ctrl-V>: enter-mode passthrough
<Ctrl-Q>: quit
ZQ: quit
ZZ: wq
<Ctrl-F>: scroll-page 0 1
<Ctrl-B>: scroll-page 0 -1
<Ctrl-D>: scroll-page 0 0.5
<Ctrl-U>: scroll-page 0 -0.5
<Alt-1>: tab-focus 1
g0: tab-focus 1
g^: tab-focus 1
<Alt-2>: tab-focus 2
<Alt-3>: tab-focus 3
<Alt-4>: tab-focus 4
<Alt-5>: tab-focus 5
<Alt-6>: tab-focus 6
<Alt-7>: tab-focus 7
<Alt-8>: tab-focus 8
<Alt-9>: tab-focus -1
g$: tab-focus -1
<Ctrl-h>: home
<Ctrl-s>: stop
<Ctrl-Alt-p>: print
Ss: open qute://settings
<Return>: follow-selected
<Ctrl-Return>: follow-selected -t
.: repeat-command
<Ctrl-p>: tab-pin
q: record-macro
"@": run-macro
insert:
<Ctrl-E>: open-editor
<Shift-Ins>: insert-text {primary}
<Escape>: leave-mode
hint:
<Return>: follow-hint
<Ctrl-R>: hint --rapid links tab-bg
<Ctrl-F>: hint links
<Ctrl-B>: hint all tab-bg
<Escape>: leave-mode
passthrough:
<Escape>: leave-mode
command:
# FIXME:conf what to do about up/down?
<Ctrl-P>: command-history-prev
<Ctrl-N>: command-history-next
<Shift-Tab>: completion-item-focus prev
<Up>: completion-item-focus prev
<Tab>: completion-item-focus next
<Down>: completion-item-focus next
<Ctrl-Tab>: completion-item-focus next-category
<Ctrl-Shift-Tab>: completion-item-focus prev-category
<Ctrl-D>: completion-item-del
<Return>: command-accept
<Ctrl-B>: rl-backward-char
<Ctrl-F>: rl-forward-char
<Alt-B>: rl-backward-word
<Alt-F>: rl-forward-word
<Ctrl-A>: rl-beginning-of-line
<Ctrl-E>: rl-end-of-line
<Ctrl-U>: rl-unix-line-discard
<Ctrl-K>: rl-kill-line
<Alt-D>: rl-kill-word
<Ctrl-W>: rl-unix-word-rubout
<Alt-Backspace>: rl-backward-kill-word
<Ctrl-Y>: rl-yank
<Ctrl-?>: rl-delete-char
<Ctrl-H>: rl-backward-delete-char
<Escape>: leave-mode
prompt:
<Return>: prompt-accept
y: prompt-accept yes
n: prompt-accept no
<Ctrl-X>: prompt-open-download
<Shift-Tab>: prompt-item-focus prev
<Up>: prompt-item-focus prev
<Tab>: prompt-item-focus next
<Down>: prompt-item-focus next
<Ctrl-B>: rl-backward-char
<Ctrl-F>: rl-forward-char
<Alt-B>: rl-backward-word
<Alt-F>: rl-forward-word
<Ctrl-A>: rl-beginning-of-line
<Ctrl-E>: rl-end-of-line
<Ctrl-U>: rl-unix-line-discard
<Ctrl-K>: rl-kill-line
<Alt-D>: rl-kill-word
<Ctrl-W>: rl-unix-word-rubout
<Alt-Backspace>: rl-backward-kill-word
<Ctrl-Y>: rl-yank
<Ctrl-?>: rl-delete-char
<Ctrl-H>: rl-backward-delete-char
<Escape>: leave-mode
caret:
v: toggle-selection
<Space>: toggle-selection
<Ctrl-Space>: drop-selection
c: enter-mode normal
j: move-to-next-line
k: move-to-prev-line
l: move-to-next-char
h: move-to-prev-char
e: move-to-end-of-word
w: move-to-next-word
b: move-to-prev-word
"]": move-to-start-of-next-block
"[": move-to-start-of-prev-block
"}": move-to-end-of-next-block
"{": move-to-end-of-prev-block
0: move-to-start-of-line
$: move-to-end-of-line
gg: move-to-start-of-document
G: move-to-end-of-document
Y: yank selection -s
y: yank selection
<Return>: yank selection
H: scroll left
J: scroll down
K: scroll up
L: scroll right
<Escape>: leave-mode
type:
name: Dict
keytype: String # section name
fixed_keys: ['normal', 'insert', 'hint', 'passthrough', 'command',
'prompt', 'caret']
valtype:
name: Dict
keytype: String # key
valtype: Command
desc: >-
Keybindings mapping keys to commands in different modes.
This setting is a dictionary containing mode names and dictionaries mapping
keys to commands:
`{mode: {key: command}}`
If you want to map a key to another key, check the `bindings.key_mappings`
setting instead.
For special keys (can't be part of a keychain), enclose them in `<`...`>`.
For modifiers, you can use either `-` or `+` as delimiters, and these names:
* Control: `Control`, `Ctrl`
* Meta: `Meta`, `Windows`, `Mod4`
* Alt: `Alt`, `Mod1`
* Shift: `Shift`
For simple keys (no `<>`-signs), a capital letter means the key is pressed
with Shift. For special keys (with `<>`-signs), you need to explicitly add
`Shift-` to match a key pressed with shift.
To completely unbind a default binding, bind it to the `nop` command.
Note that some commands which are only useful for bindings (but not used
interactively) are hidden from the command completion. See `:help` for a
full list of available commands.
The following modes are available:
* normal: The default mode, where most commands are invoked.
* insert: Entered when an input field is focused on a website, or by
pressing `i` in normal mode. Passes through almost all keypresses to the
website, but has some bindings like `<Ctrl-e>` to open an external editor.
Note that single keys can't be bound in this mode.
* hint: Entered when `f` is pressed to select links with the keyboard. Note
that single keys can't be bound in this mode.
* passthrough: Similar to insert mode, but passes through all keypresses
except `<Escape>` to leave the mode. It might be useful to bind `<Escape>`
to some other key in this mode if you want to be able to send an Escape
key to the website as well. Note that single keys can't be bound in this
mode.
* command: Entered when pressing the `:` key in order to enter a command.
Note that single keys can't be bound in this mode.
* prompt: Entered when there's a prompt to display, like for download
locations or when invoked from JavaScript.
You can bind normal keys in this mode, but they will be only active when a
yes/no-prompt is asked. For other prompt modes, you can only bind special
keys.
* caret: Entered when pressing the `v` mode, used to select text using the
keyboard.

View File

@ -325,3 +325,9 @@ def window_only(current_win_id):
if win_id != current_win_id:
window.close()
@cmdutils.register(hide=True)
def nop():
"""Do nothing."""
return