Use Scopes in IdeaVim Plugin Development
masterIdeaVim plugins use a structured scope system to manage access to functionality.
VimInitApi: The starting scope used during initialization. It provides init-safe methods for registering mappings, text objects, variables, and operator functions.VimApi: The full API available at runtime within callbacks, providing access to general Vim functionality and editor access.- Specialized Scopes: Developers can access more specific scopes (like
EditorScopeorMappingScope) from within the API to perform targeted tasks.
editor {
// Now in EditorScope
change {
// Make changes to the document
withPrimaryCaret {
insertText(offset, "New text")
}
}
}
mappings {
// Now in MappingScope
nnoremap("<Plug>OpenURL") {
// Action implementation
}
nmap("gx", "<Plug>OpenURL")
}