From 301bfa3234c33334b42d413e0d174b92377d5f72 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 17 Jan 2021 15:07:09 +0200 Subject: [PATCH] feature(key) add ability to toggle global vim config on the time of session --- client/key/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/key/index.js b/client/key/index.js index e93d936a..be70378a 100644 --- a/client/key/index.js +++ b/client/key/index.js @@ -17,9 +17,14 @@ const {createBinder} = require('./binder'); const fullstore = require('fullstore'); const Chars = fullstore(); -const isVimEnabled = fullstore(false); -const toggleVim = (keyCode) => keyCode === KEY.ESC && isVimEnabled(!isVimEnabled()); +const toggleVim = (keyCode) => { + const {_config, config} = CloudCmd; + + if (keyCode === KEY.ESC) { + _config('vim', !config('vim')); + } +} Chars([]); @@ -72,7 +77,7 @@ async function listener(event) { return; toggleVim(keyCode); - const isVim = isVimEnabled() || CloudCmd.config('vim'); + const isVim = CloudCmd.config('vim'); if (!isVim && !isNumpad && !alt && !ctrl && !meta && (isBetween || symbol)) return setCurrentByChar(char, Chars);