Skip to content

Commit

Permalink
Clarify funcobj and classobj: no default mappings (#1879)
Browse files Browse the repository at this point in the history
There are no default mappings provided by either funcobj-* or
classobj-*. Instead, there are Coc-recommended keys / modes to which
these pluggable mappings should be mapped.
  • Loading branch information
pappasam authored May 10, 2020
1 parent afbe238 commit 4d7d5e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,15 @@ nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Introduce function text object
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
" Introduce class/struct/interface text object
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Use <TAB> for selections ranges.
Expand Down
20 changes: 14 additions & 6 deletions doc/coc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -805,31 +805,39 @@ normal mode, `v_` works for visual mode.

<Plug>(coc-funcobj-i) *n_coc-funcobj-i* *v_coc-funcobj-i*

Select inside function, mapped to `if` by default.
Select inside function. Recommend mapping:
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)

Note: Requires 'textDocument.documentSymbol' support
from the language server.

<Plug>(coc-funcobj-a) *n_coc-funcobj-a* *v_coc-funcobj-a*

Select current function, mapped to `af` by default.
Select around function. Recommended mapping:
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)

Note: Requires 'textDocument.documentSymbol' support
from the language server.

<Plug>(coc-classobj-i) *n_coc-classobj-i* *v_coc-classobj-i*

Select inside class/struct/interface, mapped to `ic`
by default.
Select inside class/struct/interface. Recommended
mapping:
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)

Note: Requires 'textDocument.documentSymbol' support
from the language server.


<Plug>(coc-classobj-a) *n_coc-classobj-a* *v_coc-classobj-a*

Select current class/struct/interface, mapped to `ac`
by default.
Select around class/struct/interface. Recommended
mapping:
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)

Note: Requires 'textDocument.documentSymbol' support
from the language server.
Expand Down

0 comments on commit 4d7d5e2

Please sign in to comment.