diff options
author | Josh Rahm <rahm@google.com> | 2022-08-24 11:23:08 -0600 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-08-24 11:26:05 -0600 |
commit | 808365207f49b6c6aba766ffbaa6336a9410a860 (patch) | |
tree | 7b06b20b2901544e77869f927fff7c5f3c2047b0 | |
parent | 0d83f507cef5f59d4b8afeed9633978394f2331a (diff) | |
download | fieldmarshal.vim-808365207f49b6c6aba766ffbaa6336a9410a860.tar.gz fieldmarshal.vim-808365207f49b6c6aba766ffbaa6336a9410a860.tar.bz2 fieldmarshal.vim-808365207f49b6c6aba766ffbaa6336a9410a860.zip |
Consolidate some logic in casefmt.vim
-rw-r--r-- | plugin/casefmt.vim | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/plugin/casefmt.vim b/plugin/casefmt.vim index ed85fb3..4824092 100644 --- a/plugin/casefmt.vim +++ b/plugin/casefmt.vim @@ -82,18 +82,12 @@ endfunction " tries to be smart about detecting the current case format and converting it " properly. function! s:to_snake(s) abort - if a:s =~ '^[A-Z_]*$' || a:s =~ '_' - " This is in constant case or is already in some flavor of snake_case. - " return whatever it is, but to lower. - return tolower(a:s) - endif - if a:s =~ '[a-z][A-Z]' " a:s has a camel case boundary in it. return tolower(substitute(a:s, '\%([a-zA-Z]\)\zs\ze\([A-Z0-9]\)', '_', "g")) endif - return a:s + return tolower(a:s) endfunction function s:to_upper_snake(s) abort |