Browse Source

vim: add x for exemption key

Le Tan 7 years ago
parent
commit
68dd95591d
2 changed files with 8 additions and 1 deletions
  1. 2 1
      src/resources/vnote.ini
  2. 6 0
      src/utils/vvim.cpp

+ 2 - 1
src/resources/vnote.ini

@@ -187,7 +187,8 @@ enable_backup_file=true
 ; Skipped keys in Vim mode
 ; c: Ctrl+C
 ; v: Ctrl+V
-vim_exemption_keys=cv
+; x: Ctrl+X
+vim_exemption_keys=cvx
 
 ; Path of the flash page, related to the configuration folder
 ; Could be absolute path

+ 6 - 0
src/utils/vvim.cpp

@@ -1628,6 +1628,12 @@ bool VVim::handleKeyPressEvent(int key, int modifiers, int *p_autoIndentPos)
             processCommand(m_tokens);
             setMode(VimMode::Normal);
             break;
+        } else if (VUtils::isControlModifierForVim(modifiers)) {
+            if (g_config->getVimExemptionKeys().contains('x')) {
+                // Let it be handled outside.
+                resetState();
+                goto exit;
+            }
         }
 
         break;