An option to show the colon at the start of the command line box (#2064)

* Added an option to show the colon at the start of the command line box
This commit is contained in:
Gad Kadosh 2017-10-12 18:31:10 +02:00 committed by Sean Kelly
parent bee6ac6088
commit 68137e91eb
4 changed files with 25 additions and 4 deletions

View File

@ -165,6 +165,10 @@ We have removed this option, due to it making VSCodeVim's performance suffer imm
* etc.
* Type: Boolean (Default: `true`)
#### `"vim.cmdLineInitialColon"`
* Set this to have VSCodeVim mimick Vim, showing the ':' colon character in the Vim command line when it is called.
* Type: Boolean (Default: `false`)
#### `"vim.handleKeys"`
* Allows user to select certain modifier keybindings and delegate them back to VSCode so that VSCodeVim does not process them.
* Complete list of keys that can be delegated back to VSCode can be found in our [package.json](https://github.com/VSCodeVim/Vim/blob/master/package.json#L44). Each key that has a vim.use<C-...> in the when argument can be delegated back to vscode by doing "<C-...>":false.

View File

@ -541,11 +541,16 @@
"vim.substituteGlobalFlag": {
"type": "boolean",
"description": "Automatically apply the global flag, /g, to substitute commands. When set to true, use /g to mean only first match should be replaced.",
"default": "false"
"default": false
},
"vim.cursorStylePerMode": {
"type": "object",
"description": "Customize cursor style per mode"
},
"vim.cmdLineInitialColon": {
"type": "boolean",
"description": "When typing a command show the initial colon ':' character",
"default": false
}
}
}

View File

@ -16,14 +16,21 @@ export async function showCmdLine(
const options: vscode.InputBoxOptions = {
prompt: 'Vim command line',
value: initialText,
value: Configuration.cmdLineInitialColon ? ':' + initialText : initialText,
ignoreFocusOut: true,
valueSelection: [initialText.length, initialText.length],
valueSelection: [
Configuration.cmdLineInitialColon ? initialText.length + 1 : initialText.length,
Configuration.cmdLineInitialColon ? initialText.length + 1 : initialText.length,
],
};
try {
const cmdString = await vscode.window.showInputBox(options);
await runCmdLine(cmdString!, modeHandler);
const trimmedCmdString =
cmdString && Configuration.cmdLineInitialColon && cmdString[0] === ':'
? cmdString.slice(1)
: cmdString;
await runCmdLine(trimmedCmdString!, modeHandler);
return;
} catch (e) {
modeHandler.setStatusBarText(e.toString());

View File

@ -324,6 +324,11 @@ class ConfigurationClass {
visualblock: undefined,
replace: undefined,
};
/**
* When typing a command show the initial colon ':' character
*/
cmdLineInitialColon = false;
}
function overlapSetting(args: {