I have two functions, one using an
if statement and one using (or trying to use) a ternary expression:
nnoremap <expr> Z Toggle1() func Toggle1 () if g:colors_name == "OceanicNext" return ":colorscheme TextMate^M" else return ":colorscheme OceanicNext^M" endfunc nnoremap <expr> Q Toggle2() func Toggle2 () echom g:colors_name let cs = "TextMate" ? (g:colors_name == "OceanicNext") : "OceanicNext" let cmd_string = printf(":colorscheme %s^M", cs) return cmd_string endfunc
The first one works, but the second one only 'works' the first time I run it. What's the difference between the two, and what am I doing wrong in the second one?