atom-vim-mode-plus
atom-vim-mode-plus copied to clipboard
Add service to allow custom commands to hook in
debug info
{
"atom": "1.27.0",
"platform": "win32",
"release": "10.0.16299",
"vmpVersion": "1.32.0",
"vmpConfig": {
"automaticallyEscapeInsertModeOnActivePaneItemChange": true,
"keymapBackslashToInnerCommentOrParagraphWhenToggleLineCommentsIsPending": true,
"keymapCCToChangeInnerSmartWord": true,
"keymapPToPutWithAutoIndent": true,
"keymapUnderscoreToReplaceWithRegister": true,
"keymapYToYankToLastCharacterOfLine": true,
"showHoverSearchCounter": true,
"statusBarModeStringStyle": "long",
"useSmartcaseForSearch": true,
"useSmartcaseForSearchCurrentWord": true,
"wrapLeftRightMotion": true,
"blackholeRegisteredOperators": [],
"startInInsertModeScopes": [],
"charactersToAddSpaceOnSurround": [],
"highlightSearchExcludeScopes": [],
"flashOnOperateBlacklist": []
}
}
Check list
You have to check all before open issue.
- [x] Provide your environment info clipped by
Vim Mode Plus: Clip Debug Infocommand. - [x] Try with latest Atom and latest vim-mode-plus.
- [x] Pick descriptive and non-ambiguous subject
- [x] Express "what" you want(feature? config option?, behavior change?) in short sentence(not long!).
- [x] Contrast current behavior if you want to change current behavior, with sample text, operation(keystroke) and result.
- [x] Include real use case so that maintainer can understand "why" you need help.
- [x] Include Atom(
atom --version), vim-mode-plus version, and OS version(e.g. macOS Sierra 10.12.3). - [x] If keybinding issue, Read this.
What
I'd like for vim mode plus to provide a service that custom commands can hook into. Specifically, I'd like to be able to find out the current count from the OperationStack.
Why
I maintain the VMP macros package, and I have a request: https://github.com/calebmeyer/vim-mode-plus-macros/issues/5 to use VMPs count to replay macros more than once.
This would also allow for other packages to implement VMP commands and have them feel more native.
I think you can get count of current operation stack like this.
const vimState = service.getEditorState(editor)
const countOfCurrentOperationStack = vimState.operationStack.getCount()
For how to access service of vmp from your pkg, see vim-mode-plus-ex-mode as example and also read Atom's official documentation describing how service works.
[NOTE]
vimStateis core role of vmp.- When you open text-editor, corresponding vimState is created(this is one-to-one mapping).
- A vimState have it's own
operationStackinstance. - No instances are shared across vimState(text-editor) except
globalStateinstance.