Skip to content

Commit

Permalink
improve <Plug> mapping's name
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Feb 14, 2014
1 parent 1f6bf46 commit 5b7cddc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Select various C and C++ block with only one mapping

![screenshot](http://gifzo.net/BAZJOHOJXsM.gif)

`<Plug>(select-next-extent)` mapping selects the extent in below order.
`<Plug>(clang-select-next-extent)` mapping selects the extent in below order.

1. the most inner element at the cursor
2. expression
Expand All @@ -13,14 +13,14 @@ Select various C and C++ block with only one mapping
6. rotate to 1.

As default mapping, `<C-t>` is provided in C and C++ source.
If you want to assign your favorite key to `<Plug>(select-next-extent)`, please add setting like following.
If you want to assign your favorite key to `<Plug>(clang-select-next-extent)`, please add setting like following.

```vim
let g:clang_extent_selector_use_default_mapping = 0
" Map to <Leader><Leader>
augroup clang-extent-selector-mappings
autocmd!
autocmd FileType c,cpp map <buffer><Leader><Leader> <Plug>(select-next-extent)
autocmd FileType c,cpp map <buffer><Leader><Leader> <Plug>(clang-select-next-extent)
augroup END
```

Expand Down
15 changes: 15 additions & 0 deletions plugin/clang_extent_selector.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if exists('g:loaded_clang_extent_selector')
finish
endif

noremap <silent><Plug>(clang-select-next-extent) :<C-u>call clang_extent_selector#execute()<CR>
augroup plugin-clang-extent-selector
autocmd!
augroup END

if get(g:, 'clang_extent_selector_use_default_mapping', 1)
autocmd plugin-clang-extent-selector FileType c,cpp map <buffer><C-t> <Plug>(clang-select-next-extent)
endif

let g:loaded_clang_extent_selector = 1

0 comments on commit 5b7cddc

Please sign in to comment.