diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e35d0a..934d1ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Changelog * Update Vimari interface to allow users access to their configuration. * Remove `closeTabReverse` action. * Normal mode now isolates keybindings from the underlying website, this means that to interact with the underlying website you need to enter insert mode. -* You can enter insert mode by pressing i and exit the mode by pressing esc. +* You can enter insert mode by pressing i and exit the mode by pressing esc. Activating either mode will display the HUD. * In insert mode Vimari keybindings are disabled (except for esc which brings you back to normal mode) allowing you to interact with the underlying website. * Add `goToFirstInput` action on g i by default (by [isundaylee](https://github.com/isundaylee)). diff --git a/Vimari Extension/js/injected.js b/Vimari Extension/js/injected.js index edd6a05..b1283ac 100644 --- a/Vimari Extension/js/injected.js +++ b/Vimari Extension/js/injected.js @@ -184,15 +184,26 @@ function enterNormalMode() { // Clear link hints (if any) deactivateLinkHintsMode(); + + if (insertMode === false) { + return // We are already in normal mode. + } + // Re-enable if in insert mode insertMode = false; + HUD.showForDuration('Normal Mode', hudDuration); + Mousetrap.bind('i', enterInsertMode); } // Calling it 'insert mode', but it's really just a user-triggered // off switch for the actions. function enterInsertMode() { - insertMode = true; + if (insertMode === true) { + return // We are already in insert mode. + } + insertMode = true; + HUD.showForDuration('Insert Mode', hudDuration); Mousetrap.unbind('i'); }