I have the following lines in my .vimrc
let g = 0
inoremap <silent> <C-g> <C-o>:let g = !g<CR>
inoremap <expr> <C-_> <C-o>(g == 0 ? :undo : :redo)<CR>
I'm trying to emulate an emacs-like undo/redo feature in insert mode. I'm not sure how to escape or use colon-commands inside a ternary expression. Any help would be greatly appreciated.