I love having a hotkey to format all of the code I'm using. I'd prefer having it on the lower case "f" button. I tried imitating the code given in the default config (the one which creates a new "Format" command) to bind it to "f", but it doesn't work. Here's the relevant except from my .vimrc:
" Formatting selected code.
"original code commented out
"xmap <leader>f <Plug>(coc-format-selected)
"nmap <leader>f <Plug>(coc-format-selected)
"these bindings do not work
xmap <leader>f :call CocActionAsync('format')
nmap <leader>f :call CocActionAsync('format')
nnoremap <leader>f :call CocActionAsync('format')
"This does however work.... strangely:
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')
As a side note, what counts as "selected" for neoclide? I tried using visual selection, but that doesn't seem to work. Here's the link to the original config: https://github.com/neoclide/coc.nvim#example-vim-configuration
Many thanks!