Is there a good Vi(m) command for transposing arguments in a function call? Bonus points for Emacs

前端 未结 5 1142
北荒
北荒 2021-02-14 05:09

For example if I have some code like:

foo = bar(\"abc\", \"def\", true, callback);

Is there a nice command to move true to the 1st or 2nd posit

5条回答
  •  遇见更好的自我
    2021-02-14 05:36

    Transposing previous (Ctrl-t p) and next (Ctrl-t n) argument ... add the following into your .vimrc file:

    map p ?,\\|(wd/,\\|)?,\\|("_dw?,\\|(a, ?,P/,w
    map n ?,\\|(wv/,d"_dw/\\,\\|)i, "?,?,\\|(w
    

提交回复
热议问题