From 67afc06d795bd600d563bc2ddc0f95b5763cb3c7 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 16 Jun 2017 12:33:13 +0200 Subject: [PATCH] Initial work on new keyconfig --- qutebrowser/config/config.py | 2 +- qutebrowser/config/configdata.py | 392 ------------------------------ qutebrowser/config/configdata.yml | 338 ++++++++++++++++++++++++++ qutebrowser/misc/utilcmds.py | 6 + 4 files changed, 345 insertions(+), 393 deletions(-) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 56f97f762..81fb33b52 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -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() diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index a040893a0..035afa77d 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -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: -# -# -# 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 = ['', '', '', '', '', - ''] - - -KEY_DATA = collections.OrderedDict([ - ('!normal', collections.OrderedDict([ - ('leave-mode', ['', '']), - ])), - - ('normal', collections.OrderedDict([ - ('clear-keychain ;; search ;; fullscreen --leave', - ['', '']), - ('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', '']), - ('open -w', ['']), - ('tab-close', ['d', '']), - ('tab-close -o', ['D']), - ('tab-only', ['co']), - ('tab-focus', ['T']), - ('tab-move', ['gm']), - ('tab-move -', ['gl']), - ('tab-move +', ['gr']), - ('tab-next', ['J', '']), - ('tab-prev', ['K', '']), - ('tab-clone', ['gC']), - ('reload', ['r', '']), - ('reload -f', ['R', '']), - ('back', ['H', '']), - ('back -t', ['th']), - ('back -w', ['wh']), - ('forward', ['L', '']), - ('forward -t', ['tl']), - ('forward -w', ['wl']), - ('fullscreen', ['']), - ('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', '']), - ('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', ['']), - ('navigate decrement', ['']), - ('inspector', ['wi']), - ('download', ['gd']), - ('download-cancel', ['ad']), - ('download-clear', ['cd']), - ('view-source', ['gf']), - ('set-cmd-text -s :buffer', ['gt']), - ('tab-focus last', ['', '', '']), - ('enter-mode passthrough', ['']), - ('quit', ['', 'ZQ']), - ('wq', ['ZZ']), - ('scroll-page 0 1', ['']), - ('scroll-page 0 -1', ['']), - ('scroll-page 0 0.5', ['']), - ('scroll-page 0 -0.5', ['']), - ('tab-focus 1', ['', 'g0', 'g^']), - ('tab-focus 2', ['']), - ('tab-focus 3', ['']), - ('tab-focus 4', ['']), - ('tab-focus 5', ['']), - ('tab-focus 6', ['']), - ('tab-focus 7', ['']), - ('tab-focus 8', ['']), - ('tab-focus -1', ['', 'g$']), - ('home', ['']), - ('stop', ['']), - ('print', ['']), - ('open qute://settings', ['Ss']), - ('follow-selected', RETURN_KEYS), - ('follow-selected -t', ['', '']), - ('repeat-command', ['.']), - ('tab-pin', ['']), - ('record-macro', ['q']), - ('run-macro', ['@']), - ])), - - ('insert', collections.OrderedDict([ - ('open-editor', ['']), - ('insert-text {primary}', ['']), - ])), - - ('hint', collections.OrderedDict([ - ('follow-hint', RETURN_KEYS), - ('hint --rapid links tab-bg', ['']), - ('hint links', ['']), - ('hint all tab-bg', ['']), - ])), - - ('passthrough', {}), - - ('command', collections.OrderedDict([ - ('command-history-prev', ['']), - ('command-history-next', ['']), - ('completion-item-focus prev', ['', '']), - ('completion-item-focus next', ['', '']), - ('completion-item-focus next-category', ['']), - ('completion-item-focus prev-category', ['']), - ('completion-item-del', ['']), - ('command-accept', RETURN_KEYS), - ])), - - ('prompt', collections.OrderedDict([ - ('prompt-accept', RETURN_KEYS), - ('prompt-accept yes', ['y']), - ('prompt-accept no', ['n']), - ('prompt-open-download', ['']), - ('prompt-item-focus prev', ['', '']), - ('prompt-item-focus next', ['', '']), - ])), - - ('command,prompt', collections.OrderedDict([ - ('rl-backward-char', ['']), - ('rl-forward-char', ['']), - ('rl-backward-word', ['']), - ('rl-forward-word', ['']), - ('rl-beginning-of-line', ['']), - ('rl-end-of-line', ['']), - ('rl-unix-line-discard', ['']), - ('rl-kill-line', ['']), - ('rl-kill-word', ['']), - ('rl-unix-word-rubout', ['']), - ('rl-backward-kill-word', ['']), - ('rl-yank', ['']), - ('rl-delete-char', ['']), - ('rl-backward-delete-char', ['']), - ])), - - ('caret', collections.OrderedDict([ - ('toggle-selection', ['v', '']), - ('drop-selection', ['']), - ('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']) diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 96bdaf78e..4262b46de 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -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: + : + : + : + : + : + : + : + : + : + 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: + : 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 + : open -t + : open -w + d: tab-close + : tab-close + D: tab-close -o + co: tab-only + T: tab-focus + gm: tab-move + gl: tab-move - + gr: tab-move + + J: tab-next + : tab-next + K: tab-prev + : tab-prev + gC: tab-clone + r: reload + : reload + R: reload -f + : reload -f + H: back + : back + th: back -t + wh: back -w + L: forward + : forward + tl: forward -t + wl: forward -w + : 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 + : 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 + : navigate increment + : navigate decrement + wi: inspector + gd: download + ad: download-cancel + cd: download-clear + gf: view-source + gt: set-cmd-text -s :buffer + : tab-focus last + : tab-focus last + : enter-mode passthrough + : quit + ZQ: quit + ZZ: wq + : scroll-page 0 1 + : scroll-page 0 -1 + : scroll-page 0 0.5 + : scroll-page 0 -0.5 + : tab-focus 1 + g0: tab-focus 1 + g^: tab-focus 1 + : tab-focus 2 + : tab-focus 3 + : tab-focus 4 + : tab-focus 5 + : tab-focus 6 + : tab-focus 7 + : tab-focus 8 + : tab-focus -1 + g$: tab-focus -1 + : home + : stop + : print + Ss: open qute://settings + : follow-selected + : follow-selected -t + .: repeat-command + : tab-pin + q: record-macro + "@": run-macro + insert: + : open-editor + : insert-text {primary} + : leave-mode + hint: + : follow-hint + : hint --rapid links tab-bg + : hint links + : hint all tab-bg + : leave-mode + passthrough: + : leave-mode + command: + # FIXME:conf what to do about up/down? + : command-history-prev + : command-history-next + : completion-item-focus prev + : completion-item-focus prev + : completion-item-focus next + : completion-item-focus next + : completion-item-focus next-category + : completion-item-focus prev-category + : completion-item-del + : command-accept + : rl-backward-char + : rl-forward-char + : rl-backward-word + : rl-forward-word + : rl-beginning-of-line + : rl-end-of-line + : rl-unix-line-discard + : rl-kill-line + : rl-kill-word + : rl-unix-word-rubout + : rl-backward-kill-word + : rl-yank + : rl-delete-char + : rl-backward-delete-char + : leave-mode + prompt: + : prompt-accept + y: prompt-accept yes + n: prompt-accept no + : prompt-open-download + : prompt-item-focus prev + : prompt-item-focus prev + : prompt-item-focus next + : prompt-item-focus next + : rl-backward-char + : rl-forward-char + : rl-backward-word + : rl-forward-word + : rl-beginning-of-line + : rl-end-of-line + : rl-unix-line-discard + : rl-kill-line + : rl-kill-word + : rl-unix-word-rubout + : rl-backward-kill-word + : rl-yank + : rl-delete-char + : rl-backward-delete-char + : leave-mode + caret: + v: toggle-selection + : toggle-selection + : 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 + : yank selection + H: scroll left + J: scroll down + K: scroll up + L: scroll right + : 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 `` 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 `` to leave the mode. It might be useful to bind `` + 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. diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 74c68890e..cf49264ea 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -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