vim-mode-plus for Atom editor vimconf-2016

# I'm t9md

<p>
<img width="80" alt="t9md__t9md_.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/8658e72b-629d-7d1b-49dc-9950f59409cd.png">

<img width="400" alt="Presentation1.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/b2fdbbe1-425b-0d53-6d7b-015122067b87.png">
</p>

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

**What makes me editor addict :syringe: is difficulties and limitless enhanceability of Emacs.**

---

## What is the [vim-mode-plus](https://github.com/t9md/atom-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](https://github.com/atom/vim-mode) was updated yesterday(2016.11.04)<sub>

> 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](https://javascriptair.com/episodes/2016-08-03/)


---

## What I did from when I forked

- :art: Refactoring
  - Rewrote every lines of codes. Greatly reduced complexity.
- :gift: Add lot's of new features:
  - incremental-search
  - visual-block-mode
  - surround
  - any-pair text-object
  - occurrence operator-modifier
  - persistent-selection
- :bow: Off course, thanks to great vim-mode
  - Sincerely, I feel I couldn't do anything without original vim-mode.  
- [Gifs](https://github.com/t9md/atom-vim-mode-plus/wiki/GIFs)

---

## History of commit graphs

[graphs](https://github.com/t9md/atom-vim-mode-plus/graphs)

<img width="1306" alt="Contributors_to_t9md_atom-vim-mode-plus.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/04ed2610-bea1-25d7-049c-75b97944e592.png">

---

## High speed tutorial from beginner to expert in 7 steps

[High speed tour from beginner to expert in 7 steps](https://github.com/t9md/atom-vim-mode-plus/wiki/AdvancedTopicTutorial#high-speed-tour-from-beginner-to-expert-in-7-steps)

[[Vim/vim-mode-plus for Atom] 秒速で初心者からエキスパートになる。 たった７ステップで。](http://qiita.com/t9md/items/1c2f27684703847de2be)

---

## 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 :scissors:, Yank :clipboard:, CamelCase :camel:)
- 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?

<img alt="Photo_04-11-2016__4_15_25_jpg.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/b1645553-8fe7-b3d2-8540-29e17b973422.png">
<img alt="Photo_04-11-2016__4_15_25_jpg.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/492a5fd3-03dd-0c85-9168-4e1d994dcc12.png">
<img alt="Photo_04-11-2016__4_15_25_jpg.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/27324a88-fe0e-6da0-952a-023c7944f00c.png">

---

### Operator is complete?

<img alt="Photo_04-11-2016__4_15_37_jpg.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/4209d108-cae7-34e0-d0df-93d9f2b00863.png">
<img alt="Photo_04-11-2016__4_15_37_jpg.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/46c68e8d-0811-5177-a56e-428dbcc1b34c.png">
<img alt="Photo_04-11-2016__4_15_37_jpg.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/a63a6ffd-53a2-5229-7aaa-476e792d19af.png">

```coffeescript
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!

<img alt="Photo_04-11-2016__4_18_44_jpg.png" src="https://qiita-image-store.s3.amazonaws.com/0/30758/8f0bd765-7a36-3f4a-37c7-b5b6c00e79f8.png">

### OperationStack code

```coffeescript
    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](https://github.com/t9md/atom-vim-mode-plus/wiki/YouDontKnowVimModePlus)

- Maximize current pane
- Incremental search
- `flashOnOperate` and `flashOnUndoRedo` :sparkles:
- StayOn family(`stayOnTransformString`, `stayOnYank`, `stayOnDelete`) :sparkles:
- 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** :gun:.

![stayOnOperate](https://qiita-image-store.s3.amazonaws.com/0/30758/8d935ae8-e301-9554-0535-03e921ce2447.gif)

- But cursor movement convinces user the success of an operator.
- Just dont-move-cursor is not enough, `flashOnOperate` :flashlight: 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 :dash: than repeating operator.

#### Repeat(`.`) delete-surround

![vimconf-2.gif](https://qiita-image-store.s3.amazonaws.com/0/30758/987b7d39-a51e-4253-a64d-62de0e27f7ad.gif)

#### delete-surround with multiple cursor

![vimconf-3.gif](https://qiita-image-store.s3.amazonaws.com/0/30758/90c65398-b28d-8e52-ef6e-bc698dc648eb.gif)

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

![vimconf-4.gif](https://qiita-image-store.s3.amazonaws.com/0/30758/375fe073-3fa4-4c41-5a08-dc80594c2527.gif)

---

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

- :rotating_light: :warning: vim-mode-plus is not trying to be complete-Vim
  - **Impossible** and no motivation for that.
  - Atom is NOT Vim.

- :rocket: 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?

- :thought_balloon: :moyai: :zzz: 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.

---

## :tada: :tada: Thanks!! :tada: :tada:

#### 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.