Skip to content

Commit

Permalink
An option to show the colon at the start of the command line box (#2064)
Browse files Browse the repository at this point in the history
* Added an option to show the colon at the start of the command line box
  • Loading branch information
gadkadosh authored and xconverge committed Oct 12, 2017
1 parent bee6ac6 commit 68137e9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
13 changes: 10 additions & 3 deletions src/cmd_line/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
5 changes: 5 additions & 0 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ class ConfigurationClass {
visualblock: undefined,
replace: undefined,
};

/**
* When typing a command show the initial colon ':' character
*/
cmdLineInitialColon = false;
}

function overlapSetting(args: {
Expand Down

0 comments on commit 68137e9

Please sign in to comment.