From 808365207f49b6c6aba766ffbaa6336a9410a860 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 24 Aug 2022 11:23:08 -0600 Subject: Consolidate some logic in casefmt.vim --- plugin/casefmt.vim | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'plugin') 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 -- cgit