mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(key) add ability to toggle global vim config on the time of session
This commit is contained in:
parent
4b51f363ae
commit
301bfa3234
1 changed files with 8 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue