More than 5 years have passed since last update.

vmp: the most ambitious vim emulator

Last updated at Posted at 2017-11-04
1 / 22

I'm t9md

t9md__t9md_.png Presentation1.png

  • My editor history: Vim > Emacs > Vim > Atom
  • Emacs's limitless extensibility plant never give up sprit to me and it also made me editor addict.
  • Vim plugins: choosewin, qickhl, smalls, textmanip, vim-chef, and more
  • Atom packages: vim-mode-plus, narrow, quick-highlight, cursor-history, and more..(over 30 pkgs!).

Are you familiar with this endless editor tuning loop?.

  • Frustration > Yes I can improve it > Ya I did it!! Oh, I found another frustration point > oh, I've spent too much hours!.

What is the vim-mode-plus(VMP)?

  • It's Atom editor package which provides vim keybinding and plus more.
  • This is fork of vim-mode created by GitHub :octocat:, they now deprecated it in favor of vmp.
Version Date Event
v0.0.0 2015-08-01 fork GitHub's vim-mode
v0.1.1 2015-09-28 1st public
v1.13.0 2017-10-27 185th release in 818 days (2 years + 3 months)

AVG. 1 release / 4.5 days !!

I'm still keeping high pace release cycle as first year of vmp.

Who use vmp?

Some says vmp is the best vim emulator.
IMO, maybe it's because of precise cursor placement.(e.g. cursor placement after undo or redo operation).

What I will talk today

Part1. Understand editing in Vim

  • What is editing in Vim
  • How it's implemented and executed
  • What is Motion, TextObject and Operator

Part2. vmp's unique features

  • UX improvement
  • Cursor placement
  • One key TextObject
  • Occurrence

Part1. Understand editing in Vim

What is editing in Vim?


Why can your j keystroke move-down cursors


Operation's life in stack on operationStack


Motion, TextObject, Operator

Motion: j, k, {, g g...

  • Move cursor from here to there.
  • When used as TARGET, select here-to-there.

TextObject: i p, i w, a W...

  • Select text range, always used as TARGET.
  • Select same range as long as cursor is within that range
    • i w select same word as long as cursor is within that word.

Operator: d, c, y...

  • Mutate TARGET
  • Always require TARGET. "I will wait until I get target!".


Editing is to transform text by mutation.

You build mutation instruction through keystroke.

Each keystroke invoke one of Operator, Motion or TextObject.

Formula: Mutation = Operator + Target(= Motion or TextObject)

Part2. VMP's unique features

:camera_with_flash: DEMO session

demo file I used in talk

  • Select operator
  • TransformString operators
  • Edge motion
  • Occurrence
  • Persistent selection
  • Practical use of occurrence etc...

Flash target :flashlight:

  • :bulb: vmp flashes an operator's target and also flashes changes on undo, redo.
  • When you type y i p, it flashes i p range with CSS keyframe animation.
  • With flash, you can be more confident for your operation.


UI feedback on surround

  • :bulb: Surround is difficult for me.
  • Because I have to type many keystrokes without mistake, without any UI feedback.
    • y s i w (: surround(y s) inner-word(i w) with (.
  • vmp gives proper UI feedback to make surround easy to use, easy to understand

    • Select target immediately after target was provide(i w) and before you input final surround-char.
    • When change-surround, it shows char will be change at hover indicator.
  • This GIF is after you type c s " and before you input final '

Tunable f behavior and flash find-char.

  • :bulb: f is difficult. Where to stop next?.
  • With flashing finding-char, you can predict where to stop next.
  • :bulb: I like all vim-seek, clever-f and vim-sneak, I want all of it's goodness.
    • Make it configurable to find across lines, number of chars to find, auto confirm by timeout, reuse f as ;...
    • You can tune vmp's f as you like.


Eliminate unwanted cursor move

  • :bulb: What if cursor is not moved after y i p?
    • In pure-Vim, cursor is moved to start of paragraph.
  • IMO, moving cursor after operator is unwanted side-effect.
  • :gift: vmp introduces various stayOnXXX configuration and all have enabled by default.
    • In pure-Vim, stayOnVerticalMotion + stayOnDelete is doable by :set startofline=false

stayOnXXX configurations

  • Keep cursor positions after operator y i p, d d, g U i p..
    • stayOnTransformString, stayOnYank, stayOnDelete, stayOnOccurrence
  • Keep column when selecting TextObject v i p, v i i..
    • stayOnSelectTextObject
  • keep column on vertical motion g g, G...
    • stayOnVerticalMotion

One-key for VIP(Very ImPortant) TextObject

  • :gift: You can type y p instead of y i p. How many times have you ever typed i p in your life!?
  • :tada: Why? Some keys are freely available in operator-pending-mode.
  • :question: Since Operator is waiting for Target(Motion or TextObject) only. Remember Operator + Target rule?.
  • :mag_right: So Operator + Operator keystroke(y d, d p...) makes no sense, OK to re-map.
    • :warning: One exception, same-operator-twice(d d, y y...) keystrokes have special meaning.



  • :bulb: Noticed patterns in coding. I'm repeating same operation on same keyword again and again.
  • :gift: With occurrence, you can bulk apply operator to all occurrences of keyword within target.
  • You can edit more declaratively than imperatively, also can reduces need of . repeat.


Occurrence: How it works

occurrence slide-picture.jpg

Occurrence is not difficult, technically it's marker edit
  • Mark keyword under cursor then edit as in normal way.
  • You can mark keyword by either of following way
    • operator-modifier: o(word) and O(subword).(e.g. d o p, c O z)
    • preset-occurrence command: g o and g O. I'm remapping to m and M locally.
  1. Mark keyword by g o or g O(subword)
  2. Select visually
  3. c to change, I to insert at start A to append to end of occurrence.

:beginner: Advice to improve vim-skill

  • :mortar_board: Understand this formula. Editing = Operator + Target(Motion or TextObject).

    • :loudspeaker: Install Operator + Target mental model into your brain by shouting loudly while typing.
    • y("Operator"!!) i p("Target!!")
  • :chart_with_upwards_trend: Pick and master from high-return Motion, TextObject first.

    • Motion: g g, G, [, ](VMP only)
    • TextObjet: i p, i w, i z(VMP only), i ,(VMP only)
  • :rice: Use it in daily editing.

  • :musical_keyboard: Repeat, repeat, repeat! Till your finger moves without THINKING.

    • Vim: y i p, y i p, y i p... c i p, c i p... d i p...
    • Vim: y i ,, y i ,, y i ,... c i ,, c i ,... d i ,...
    • vmp shorthand: y p, y p, y p... c p, c p... d p...
    • vmp shorthand: y ,, y ,, y ,... c ,, c ,... d ,...
  • :syringe: Gradually increase TextObject, Motion of daily use.

:wave:: VMP is the most ambitious vim emulator in the world(IMO!).

  • :gift: Bundled so many non-default Motion, TextObject, Operator.
  • :gift: Introduces new editing concept: e.g. occurrence, persistent-selection.
  • :heart: UX improvement to make Vim easy to use, easy to understand.
  • :bomb: vmp is NOT aiming to become a perfect Vim emulator(no interest!).
  • :ghost: My mental stance is just borrowing favorite Vim features.
  • :bulb: Motivation is to experiment what-if ideas with hackable editor(Atom!).
  • :skull: Ideas comes from frustration I encounter in daily vmp-dev. Endless feedback loop!
  • I'm really SERIOUS for vmp, but vmp is NOT STRICT.
This GIF is now removed "show operator representing emoji" feature. You see how vmp is NOT strict?


:bow: Thank you!!! :bow:


Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up