Converting from camelcase to _ in emacs

前端 未结 7 1964

Is there an emacs function to convert a camel-cased word to underscore? Something, like:

longVariableName

M-x to-underscore

7条回答
  •  别那么骄傲
    2021-02-05 03:33

    (progn (replace-regexp "\\([A-Z]\\)" "_\\1" nil (region-beginning) (region-end))
           (downcase-region (region-beginning) (region-end)))
    

提交回复
热议问题