Skip to content

VimConf2016Presentation

t9md edited this page Nov 16, 2016 · 7 revisions
  • This is a my presentation slide on VimConf 2016 held in Japan at 2016.11.05.
  • You can see same presentation in slide format via qiita.
  • If you understand Japanese language, presentation recording is on youtube.
  • One of the presenter and great pure Vim plugin creator @haya14busa wrote a report on medium.

I'm t9md

t9md__t9md_.png Presentation1.png

  1. Was normal Vim user
  2. Was advanced Emacs user.
  3. Was advanced Vim user
  • vim-chef, vim-xmpfilter, textmanip, choosewin, quickhl, smalls...
  1. Am Atom with vim-mode-plus user
  • vim-mode-plus, cursor-history, open-this, quick-highlight, project-folder...

What makes me editor addict 💉 is difficulties and limitless enhanceability of Emacs.


What is the vim-mode-plus?

Started by forking vim-mode maintained by GitHub :octocat:

  • Forked at 2015.08
  • Public release at 2015.09.28
  • Now 104 releases(!!) from initial release at 2016.11.04(about 1 release/4 days)
  • Now de facto vim keybinding in Atom?

vim-mode's README was updated yesterday(2016.11.04)

Current Status - DEPRECATED in favor of vim-mode-plus

  • It's honor to be used by really talented programmers(jordwalke, chenglou, rtfeldman).
  • Happy to be mentioned in JavaScriptAir 034

What I did from when I forked

  • 🎨 Refactoring
    • Rewrote every lines of codes. Greatly reduced complexity.
  • 🎁 Add lot's of new features:
    • incremental-search
    • visual-block-mode
    • surround
    • any-pair text-object
    • occurrence operator-modifier
    • persistent-selection
  • 🙇 Off course, thanks to great vim-mode
    • Sincerely, I feel I couldn't do anything without original vim-mode.
  • Gifs

History of commit graphs

graphs

Contributors_to_t9md_atom-vim-mode-plus.png

High speed tutorial from beginner to expert in 7 steps

High speed tour from beginner to expert in 7 steps

[Vim/vim-mode-plus for Atom] 秒速で初心者からエキスパートになる。 たった7ステップで。


Editing in the vim-world

The editing is transforming state of text by mutation. initial-text -> mutate -> final-text Mutating text with operator and target by telling vim to "do what on which target".

Subjects, Verbs and Objects basic operation unit

  • Subject is You.
  • Verb: is Operator
    • Specify what to do. The verb requires an object(=target).
    • Do mutation(Delete ✂️, Yank 📋, CamelCase 🐫)
  • Objects: is Target(Motion or TextObject)
    • Specify where, which to apply an operators on.
    • i w(inner-word text-object), j(from-here-to-next-line)

How operation-stack of vim-mode-plus is working.


Motion is complete?


Operator is complete?

class DeleteToLastCharacterOfLine extends Delete
  @extend()
  target: 'MoveToLastCharacterOfLine'
  execute: ->
    if @isMode('visual', 'blockwise')
      swrap.setReversedState(@editor, false)
    super

Operation life in operation-stack

execute operation when it's complete!

OperationStack code

    top = @peekTop()
    if top.isComplete()
      @execute(@stack.pop())
    else
      if @mode is 'normal' and top.isOperator()
        @modeManager.activate('operator-pending')

      # Temporary set while command is running
      if commandName = top.constructor.getCommandNameWithoutPrefix?()
        @addToClassList(commandName + "-pending")

vim-mode-plus original features

YouDontKnowVimModePlus

  • Maximize current pane
  • Incremental search
  • flashOnOperate and flashOnUndoRedo
  • StayOn family(stayOnTransformString, stayOnYank, stayOnDelete) ✨
  • Motions: MoveDownToEdge, MoveToNextNumber, MoveToNextString
  • TextObject: AnyPair, Indentation, Entire(All), Fold, Function, Comment
  • Operator: Lots of string transformer(Sort, CamelCase, SnakeCase, Surround, ToggleLineComments, ReplaceWithRegister etc..)
  • Operator: Meta string transformer (TransformStringBySelectList).
  • Narrowed selection. cmd-d(select-occurrence), ctrl-cmd-c(change-occurrence).
  • Super granular keymap scopes(e.g. mapping only effective when toggle-line-comments-pending)
  • Persistent-selection: works as like normal visual-selection but you can make selection persist.

Keep cursor position by operator.

  • Side-effect-less operator by stayOnYank, stayOnDelete and stayOnTransformString
  • In pure-Vim, y i p move cursor to start of yanked area.
  • I want cursor move only when I said so. Don't move unless I said so 🔫.

stayOnOperate

  • But cursor movement convinces user the success of an operator.
  • Just dont-move-cursor is not enough, flashOnOperate 🔦 compliment user's confidence.

Occurrence modifier, preset-occurrence, persistence-selection

  • As like you can force-wise of operator by d v j, o modifies operator's behavior to works on occurrences within target.
  • A preset-occurrence allows you to set occurrence preliminarily.
  • ctrl-o in incremntal-search allows you to set preset-occurrence by regex pattern
    • e.g. / ^ # * $ ctrl-o g U i e uppercases all lines starts with #.
  • Also a persistent-selection allows you to pre-specify a target of operator.

Sometimes, replacing single-char in bulk is faster 💨 than repeating operator.

Repeat(.) delete-surround

vimconf-2.gif

delete-surround with multiple cursor

vimconf-3.gif

preset-occurrence for single quote ' then apply delete operator.

vimconf-4.gif


So what am I doing in vim-mode-plus?

  • 🚨 ⚠️ vim-mode-plus is not trying to be complete-Vim

    • Impossible and no motivation for that.
    • Atom is NOT Vim.
  • 🚀 vim-mode-plus is aggressively evaluating how effective-editing-would-be.

    • How is it like when xxx is yyy.
    • Is zzz feature is really practically(not conceptually) useful?
  • 💭 🗿 💤 Thinking about Vim deeply further than I was pure-Vim user.

    • And always found pure-Vim's really careful and maniac decision for developer's intuitiveness/productivities.

🎉 🎉 Thanks!! 🎉 🎉

Vim!! You are great!

Atom! You are great!

Vim-mode! Without you, I don't think I could create vim-mode-plus from scratch.

Japanese Vim community! Love friendly atmosphere and lots of super aggressive/good plugin authors and contributers to core.