Friday, July 16, 2021

vim 編輯的成對編輯

用習慣了 vim-sexp-mappings-for-regular-people 裡的幾種快速編輯方式,比方說:

dsf:   splice (delete surroundings of form)
cseb: surround element in parentheses
cse]:  surround element in brackets
cse}:  surround element in braces

後來,我遇到想要把一串字母加上 double quotes 或是 single quotes 的情況,也想下類似的指令來操作。這時候,我才發現,原來我一直都少安裝一個很重要的插件 vim-surround 。vim-surround 提供的重要操作有:

ds"     delete surrounding double quote
cs)]    change surrounding parentheses to brackets
cs'"    change surrounding single quote to double qutoe
csw"   surround word with double quote


vim-surround 的文件