- You only can extend selection area for up/down direction.
- When escaped from visual-mode, multi-cursor not cleared.
Created
May 30, 2015 18:03
-
-
Save t9md/736291fd22260b5c7de0 to your computer and use it in GitHub Desktop.
Dirty hack to emulate visual-block mode using multi cursor feature.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VimVisualBlock | |
constructor: -> | |
atom.commands.add 'atom-text-editor', | |
'user:visual-blockwise-j': (event) => @blockOperation(event, 'j') | |
'user:visual-blockwise-k': (event) => @blockOperation(event, 'k') | |
getVimService: -> | |
@vimService ?= atom.packages | |
.getActivePackage('vim-mode') | |
.mainModule.provideVimMode() | |
isVisualBlockMode: (editor) -> | |
{mode, submode} = @getVimService().getEditorState(editor) | |
(mode is 'visual') and (submode is 'blockwise') | |
blockOperation: (event, direction) -> | |
editor = atom.workspace.getActiveTextEditor() | |
if @isVisualBlockMode editor | |
switch direction | |
when 'j' then editor.addSelectionBelow() | |
when 'k' then editor.addSelectionAbove() | |
else | |
event.abortKeyBinding() | |
new VimVisualBlock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'atom-text-editor.vim-mode.visual-mode': | |
'j': 'user:visual-blockwise-j' | |
'k': 'user:visual-blockwise-k' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment