Skip to content
t9md edited this page Aug 27, 2016 · 37 revisions

Hide indent-guide on last buffer row.

vim-mode-plus prevents move cursor on Atom's last buffer row.
When you have enabled editor.showIndentGuide, it shows indent-guide on last buffer row where vmp don't allow to move.

This is very counter intuitive.

By setting following style on you styles.less you can hide indent-guide on last buffer row.

atom-text-editor::shadow div.lines div:last-child .line:last-child {
  .indent-guide {
    box-shadow: none;
  }
}

Change style depending on operation mode.

Set following code in your styles.less and modify it as you want.

.cursor-line-background(@mode, @color) {
  atom-text-editor.vim-mode-plus.@{mode}.is-focused::shadow {
    & .lines .line.cursor-line {
      background-color: @color
    }
  }
}
.cursor-line-background(normal-mode, fadeout(gray, 80%));
.cursor-line-background(insert-mode, fadeout(green, 80%));
.cursor-line-background(operator-pending-mode, fadeout(yellow, 80%));

Define command for multiple keystroke.

Backgraund:

#265 #266

Use keystroke

How can I use ctrl-w to close pane?

ctrl-w is used as prefix key for many commands and Atom keymap currently not providing easy way to disable prefixed key in bulk. So, you have to

  1. Disable each keymap by mapping it to unset!.
  2. Then map ctrl-w to core:close which close pane.

For step1, you have to find all the keymaps which use ctrl-w as prefix by observing key-binding-resolver(cmd-.).
You can use disable-keybindings to make this process easier.

Here is example when you don't use disable-keybindings package with vim-mode-plus v0.44.1.

'atom-text-editor.vim-mode-plus:not(.insert-mode)':
  # Disable all the keymap defined in keymaps/vim-mode-plus.cson in this scope
  'ctrl-w ctrl-h': 'unset!'
  'ctrl-w h': 'unset!'
  'ctrl-w left': 'unset!'
  'ctrl-w ctrl-l': 'unset!'
  'ctrl-w l': 'unset!'
  'ctrl-w right': 'unset!'
  'ctrl-w ctrl-k': 'unset!'
  'ctrl-w k': 'unset!'
  'ctrl-w up': 'unset!'
  'ctrl-w ctrl-j': 'unset!'
  'ctrl-w j': 'unset!'
  'ctrl-w down': 'unset!'
  'ctrl-w ctrl-w': 'unset!'
  'ctrl-w w': 'unset!'
  'ctrl-w ctrl-p': 'unset!'
  'ctrl-w p': 'unset!'
  'ctrl-w ctrl-c': 'unset!'
  'ctrl-w c': 'unset!'
  'ctrl-w ctrl-v': 'unset!'
  'ctrl-w v': 'unset!'
  'ctrl-w ctrl-s': 'unset!'
  'ctrl-w s': 'unset!'
  'ctrl-w ctrl-q': 'unset!'
  'ctrl-w z': 'unset!'
  'ctrl-w q': 'unset!'

  'ctrl-w': 'core:close'

Escape from insert-mode by typing jk quickly.

Esc is a little far from home position, and ctrl-[ is difficult to type.

'atom-text-editor.vim-mode-plus.insert-mode':
  'j k': 'vim-mode-plus:activate-normal-mode' # jk to escape

Clear multiple selection when escaped from insert mode

In vim-mode-plus, visual-block mode is achieved by using multiple-cursor(=or selection).
When you enter insert mode from visual-block mode then escaped from insert mode, multiple cursors created in visual-block mode is not cleared.
This behavior diff against pure Vim is by intention, by keeping multiple cursor, you can continue multi-cursor operation in normal mode.

If you don't want this default behavior, paste following code snippet in your init.coffee.
It clear multiple cursor at the timing you exit from insert mode.

consumeService = (packageName, providerName, fn) ->
  disposable = atom.packages.onDidActivatePackage (pack) ->
    return unless pack.name is packageName
    service = pack.mainModule[providerName]()
    fn(service)
    disposable.dispose()

consumeService 'vim-mode-plus', 'provideVimModePlus', (service) ->
  {observeVimStates} = service

  observeVimStates (vimState) ->
    vimState.modeManager.onDidDeactivateMode ({mode}) ->
      if mode is 'insert'
        vimState.editor.clearSelections()
Clone this wiki locally