fix typo and comments

This commit is contained in:
rebornix 2016-08-12 00:24:56 +08:00
parent ba0eb0a976
commit df7574f90b
4 changed files with 23 additions and 7 deletions

View File

@ -21,6 +21,7 @@ We're super friendly people if you want to drop by and talk to us on our [Slack
* Incremental search with `/` and `?` that works like Vim (doesn't just open the search box!)
* Correct undo/redo state
* Marks
* Vim Options
## Roadmap
@ -89,6 +90,16 @@ Put the following in your `settings.json`:
and restart VSCode.
#### Vim option override sequence.
The way we load Vim options is slightly different from native Vim as there is some overlap between Code and Vim. The option loading sequence is as below.
1. `:set {option}` on the fly
2. [TODO] .vimrc.
2. `vim.{option}` from user settings or workspace settings.
3. VS Code configuration
4. VSCodeVim flavored Vim option default values
## Contributing
This project is maintained by a group of awesome [contributors](https://github.com/VSCodeVim/Vim/graphs/contributors) and contributions are extremely welcome :heart:. If you are having trouble thinking of how you can help, check out our [roadmap](ROADMAP.md).

View File

@ -63,18 +63,22 @@ export class SetOptionsCommand extends node.CommandBase {
}
async execute(): Promise<void> {
if (!this._arguments.name) {
throw new Error("Unknown option");
}
switch (this._arguments.operator) {
case SetOptionOperator.Set:
Configuration.getInstance()[this._arguments.name!] = true;
Configuration.getInstance()[this._arguments.name] = true;
break;
case SetOptionOperator.Reset:
Configuration.getInstance()[this._arguments.name!] = false;
Configuration.getInstance()[this._arguments.name] = false;
break;
case SetOptionOperator.Equal:
Configuration.getInstance()[this._arguments.name!] = this._arguments.value!;
Configuration.getInstance()[this._arguments.name] = this._arguments.value!;
break;
case SetOptionOperator.Invert:
Configuration.getInstance()[this._arguments.name!] = !Configuration.getInstance()[this._arguments.name!];
Configuration.getInstance()[this._arguments.name] = !Configuration.getInstance()[this._arguments.name];
break;
default:
break;

View File

@ -62,7 +62,7 @@ export class Configuration {
@overlapSetting({ codeName: "insertSpaces", default: false})
expandtab: boolean;
@overlapSetting({ codeName: "wordSepatators", default: "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?"})
@overlapSetting({ codeName: "wordSeparators", default: "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?"})
iskeyword: string;
}

View File

@ -166,6 +166,7 @@ export enum SearchDirection {
export class SearchState {
private static readonly MAX_SEARCH_RANGES = 1000;
private static specialCharactersRegex: RegExp = /[\-\[\]{}()*+?.,\\\^$|#\s]/g;
/**
* Every range in the document that matches the search string.
@ -207,7 +208,7 @@ export class SearchState {
/* Decide whether the search is case sensitive.
* If ignorecase is false, the search is case sensitive.
* If ignorecase is true, the search should be case insenstive.
* If ignorecase is true, the search should be case insensitive.
* If both ignorecase and smartcase are true, the search is case sensitive only when the search string contains UpperCase character.
*/
let ignorecase = Configuration.getInstance().ignorecase;
@ -216,7 +217,7 @@ export class SearchState {
ignorecase = false;
}
const regex = new RegExp(search.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), ignorecase ? 'gi' : 'g');
const regex = new RegExp(search.replace(SearchState.specialCharactersRegex, "\\$&"), ignorecase ? 'gi' : 'g');
outer:
for (let lineIdx = 0; lineIdx < TextEditor.getLineCount(); lineIdx++) {