Skip to content
t9md edited this page Mar 20, 2018 · 3 revisions

Normal keymap addition

Operators

  • g / is mapped to toggle-line-comments

    • So you can toggle comment for paragraph by g / i p or g / p.
  • g C is mapped to camel-case

    • You can convert to CamelCase for dash-case-ed word by g C c.
  • g - is mapped to dash-case

    • You can convert to dash-case for CamelCase-ed word by g - c.
  • g space is mapped to compact-spaces

    • You can convert to (a  b  c) to (a b c) by g space i (.
  • g | is mapped to trim-string

    • You can convert to " abc " to "abc" by g | i ".

TextObject

  • subword text-object have default keymap, you can change subword by c i d.
    • i d: inner-subword
    • a d: a-subword
  • cmd-a is mapped to inner-entire in operator-pending and visual-mode for macOS user.
    • So macOS user can use cmd-a as shorthand of i e(inner-entire).
    • E.g. Change all occurrence in text by c o cmd-a instead of c o i e

Operator-pending-mode specific shorthand keymaps

Prerequisite

  • In operator-pending-mode, next command must be text-object or motion
  • So all operator command in operator-pending-mode is INVALID.
  • This mean, we can safely use operator command's keymap in operator-pending-mode as shorthand keymap of text-object or motion.
  • But using these keymap for motion is meaningless since motion is single-key, but text-object key is two keystroke(e.g. i w).
  • So I pre-defined short-hand keymap for text-object which was work for me.

What was defined

  • c as shorthand of inner-smart-word, but c c is not affected.
    • You can yank word by y c instead of y i w. ( change by c c if you enabled it in setting )
    • To make c c works for change inner-smart-word, set keymapCCToChangeInnerSmartWord to true( false by default )
    • smart-word is similar to word but it's include - char.
  • C as shorthand of inner-whole-word
    • You can yank whole-word by y C instead of y i W. ( change by c C )
  • d as shorthand of inner-subword, but d d is not affected.
    • You can yank subword by y d instead of y i d. ( change by c d )
  • p as shorthand of inner-paragraph
    • You can yank paragraph by y p instead of y i p. ( change by c p )

Conditional keymap enabled by setting.

Prerequisite

  • Several configuration option each is 1-to-1 mapped to keymap.
  • When set to true, corresponding keymap is defined.
  • This is just as helper to define complex keymap via checkbox.
  • For me, I enabled all of these setting and I want strongly recommend you to evaluate these setting at least once.
  • These keymaps are picked from my local keymap which was realy work well for a log time.
  • Here is new setting, all false by default. Effect(good and bad) of these keymap is explained in vmp's setting-view.

What was defined

  • keymapCCToChangeInnerSmartWord
    • Can: c c to change inner-smart-word
    • Conflicts: c c( change-current-line ) keystroke which is equivalent to S or c i l etc.
  • keymapUnderscoreToReplaceWithRegister
    • Can: _ i ( to replace inner-parenthesis with register's value
    • Can: _ i ; to replace inner-any-pair if you enabled keymapSemicolonToInnerAnyPairInOperatorPendingMode
    • Conflicts: _( move-to-first-character-of-line-and-down ) motion. Who use this??
  • keymapSemicolonToInnerAnyPairInOperatorPendingMode
    • Can: c ; to change inner-any-pair, Conflicts with original ;( repeat-find ) motion.
    • Conflicts: ;( repeat-find ).
  • keymapSemicolonToInnerAnyPairInVisualMode
    • Can: v ; to select inner-any-pair, Conflicts with original ;( repeat-find ) motion.
      L
    • Conflicts: ;( repeat-find ).
  • keymapBackslashToInnerCommentOrParagraphWhenToggleLineCommentsIsPending
    • Can: g / / to comment-in already commented region, g / / to comment-out paragraph.
    • Conflicts: /( search ) motion only when g / is pending. you no longe can g / with search.