According to this documentation
:'<,'>YcmCompleter Format
will format the selected text. I am struggling to map this to shortcut key <S-F2>
.
I have tried all of the following after having visually line selected the lines:
Attempt1: vmap <S-F2> :YcmCompleter Format<CR>
Attempt2: nmap <S-F2> :YcmCompleter Format<CR>
Attempt3:
function! YCMFormat()
silent execute ":'<,'>YcmCompleter Format"
endfunction
vnoremap <S-F2> :call YCMFormat()<CR>
Attempt4:
function! YCMFormat()
silent execute ":'<,'>YcmCompleter Format"
endfunction
nnoremap <S-F2> :call YCMFormat()<CR>
None of the above work. After hitting these keys, the focus shifts to the bottom command line which displays:
Entering Ex mode. Type "visual" to go to Normal mode.
:
Is there a way to correctly assign <S-F2>
to format the visually selected lines?
vmap <Leader>ft :YcmCompleter Format<CR>
works like a charm !