Skip to content

Instantly share code, notes, and snippets.

@sgur
Last active December 25, 2015 13:49
Show Gist options
  • Save sgur/6986646 to your computer and use it in GitHub Desktop.
Save sgur/6986646 to your computer and use it in GitHub Desktop.
Visual選択後のrでの変換での不具合を直す
" (A) plugin/niceblock.vimにならって2行で書く
vnoremap <expr> <SID>(niceblock-r) niceblock#force_blockwise('r')
xmap r <SID>(niceblock-r)
" (B) 1行にまとめた書き方
xnoremap <expr> r niceblock#force_blockwise('r')
@tyru
Copy link

tyru commented Jul 27, 2014

(A)の書き方だと以下の2つの問題があります。

  1. <Plug>(niceblock-r) の定義を上書きしてしまう
    • .vimrcだけで使う(プラグイン作って公開とかしない限りは)<Plug>ではなく<SID>を使うべき
  2. xmap <expr> r<expr>は要らない

@sgur
Copy link
Author

sgur commented Jul 28, 2014

ありがとうございます。更新しました。
(B)の方でしか使ってないのバレバレですね。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment