mirror of
https://github.com/amix/vimrc
synced 2024-12-19 08:23:09 +00:00
126 lines
5.6 KiB
Text
126 lines
5.6 KiB
Text
*vim-expand-region.txt* Incremental visual selection
|
|
|
|
__ _
|
|
___ _ ______ ____ _____ ____/ / ________ ____ _(_)___ ____
|
|
/ _ \| |/_/ __ \/ __ `/ __ \/ __ / / ___/ _ \/ __ `/ / __ \/ __ \
|
|
/ __/> </ /_/ / /_/ / / / / /_/ / / / / __/ /_/ / / /_/ / / / /
|
|
\___/_/|_/ .___/\__,_/_/ /_/\__,_/ /_/ \___/\__, /_/\____/_/ /_/
|
|
/_/ /____/
|
|
|
|
Reference Manual~
|
|
|
|
|
|
==============================================================================
|
|
|
|
CONTENTS *expand-region-contents*
|
|
1.Intro...................................|expand-region-intro|
|
|
2.Usage...................................|expand-region-usage|
|
|
3.Mappings................................|expand-region-mappings|
|
|
4.Global Options..........................|expand-region-global-options|
|
|
5.About...................................|expand-region-about|
|
|
|
|
==============================================================================
|
|
1. Intro *expand-region-intro*
|
|
|
|
*vim-expand-regions* brings the incremental visual selection feature from
|
|
other text editors into Vim.
|
|
|
|
Emac's 'expand-region': https://github.com/magnars/expand-region.el
|
|
IntellJ's 'syntax aware selection':
|
|
http://www.jetbrains.com/idea/documentation/tips/#tips_code_editing
|
|
Eclipse's 'select enclosing element':
|
|
http://stackoverflow.com/questions/4264047/intellij-ctrlw-equivalent-shortcut-in-eclipse
|
|
|
|
==============================================================================
|
|
2. Usage *expand-region-usage*
|
|
|
|
Press '+' to expand the visual selection and '_' to shrink it.
|
|
|
|
==============================================================================
|
|
2. Mappings *expand-region-mappings*
|
|
|
|
Customize the key mappings if you don't like the default. >
|
|
|
|
map K <Plug>(expand_region_expand)
|
|
map J <Plug>(expand_region_shrink)
|
|
<
|
|
|
|
==============================================================================
|
|
4. Global Options *expand-region-global-options*
|
|
|
|
*expand_region_text_objects*
|
|
Default: See below
|
|
Dictionary containing the text objects the plugin uses to search for the
|
|
available regions to expand/shrink to. The value corresponding to each plugin
|
|
indicates whether text object is recursive. A recursive text object is
|
|
continually expanded until the region no longer gets larger. >
|
|
|
|
" Default settings. (NOTE: Remove comments in dictionary before sourcing)
|
|
let g:expand_region_text_objects = {
|
|
\ 'iw' :0,
|
|
\ 'iW' :0,
|
|
\ 'i"' :0,
|
|
\ 'i''' :0,
|
|
\ 'i]' :1, " Support nesting of square brackets
|
|
\ 'ib' :1, " Support nesting of parentheses
|
|
\ 'iB' :1, " Support nesting of braces
|
|
\ 'il' :0, " 'inside line'. Available through https://github.com/kana/vim-textobj-line
|
|
\ 'ip' :0,
|
|
\ 'ie' :0, " 'entire file'. Available through https://github.com/kana/vim-textobj-entire
|
|
\ }
|
|
<
|
|
|
|
You can extend the global default dictionary by calling
|
|
'expand_region#custom_text_objects'. >
|
|
|
|
" Extend the global default (NOTE: Remove comments in dictionary before sourcing)
|
|
call expand_region#custom_text_objects({
|
|
\ "\/\\n\\n\<CR>": 1, " Motions are supported as well. Here's a search motion that finds a blank line
|
|
\ 'a]' :1, " Support nesting of 'around' brackets
|
|
\ 'ab' :1, " Support nesting of 'around' parentheses
|
|
\ 'aB' :1, " Support nesting of 'around' braces
|
|
\ 'ii' :0, " 'inside indent'. Available through https://github.com/kana/vim-textobj-indent
|
|
\ 'ai' :0, " 'around indent'. Available through https://github.com/kana/vim-textobj-indent
|
|
\ })
|
|
<
|
|
|
|
You can further customize the text objects dictionary on a per filetype basis
|
|
by defining global variables like 'g:expand_region_text_objects_{ft}'. >
|
|
|
|
" Use the following setting for ruby. (NOTE: Remove comments in dictionary before sourcing)
|
|
let g:expand_region_text_objects_ruby = {
|
|
\ 'im' :0, " 'inner method'. Available through https://github.com/vim-ruby/vim-ruby
|
|
\ 'am' :0, " 'around method'. Available through https://github.com/vim-ruby/vim-ruby
|
|
\ }
|
|
<
|
|
|
|
Note that this completely replaces the default dictionary. To extend the
|
|
default on a per filetype basis, you can call
|
|
'expand_region#custom_text_objects' by passing in the filetype in the first
|
|
argument: >
|
|
|
|
" Use the global default + the following for ruby
|
|
call expand_region#custom_text_objects('ruby', {
|
|
\ 'im' :0,
|
|
\ 'am' :0,
|
|
\ })
|
|
<
|
|
*expand_region_use_select_mode*
|
|
Default: 0
|
|
By default, after an expansion, the plugin leaves you in visual mode. If your
|
|
'selectmode' contains "cmd", then the plugin will respect that setting and
|
|
leave you in select mode. If you don't have 'selectmode' set, but would
|
|
like to default the expansion in select mode, you can use the global setting
|
|
below: >
|
|
|
|
let g:expand_region_use_select_mode = 1
|
|
<
|
|
|
|
==============================================================================
|
|
5. About *expand-region-about*
|
|
==============================================================================
|
|
|
|
Find the latest version of the plugin here:
|
|
http://github.com/terryma/vim-expand-region
|
|
|
|
vim:tw=78:sw=4:ft=help:norl:
|