I cam across the below code at enter link description here and what it does is toggle the words in a visual selection from UPPER CASE, then to lower case, then to Title Case. I am trying to change this functionality into toggling the words from Title Case to lower case, then to UPPER CASE. The problem is I have no idea what ==#
means here. Can someone please provide an answer as to what ==#
is.
function! TwiddleCase(str)
if a:str ==# toupper(a:str)
let result = tolower(a:str)
elseif a:str ==# tolower(a:str)
let result = substitute(a:str,'\(\<\w\+\>\)', '\u\1', 'g')
else
let result = toupper(a:str)
endif
return result
endfunction
vnoremap ~ y:call setreg('', TwiddleCase(@"), getregtype(''))<CR>gv""Pgv
:help ==#
. – romainl Aug 23 '17 at 14:53