All Projects → terryma → Vim Expand Region

terryma / Vim Expand Region

Licence: mit
Vim plugin that allows you to visually select increasingly larger regions of text using the same key combination.

Labels

Projects that are alternatives of or similar to Vim Expand Region

Vimpeg
A PEG parser for Vim
Stars: ✭ 16 (-98.27%)
Mutual labels:  viml
Markmywords
Arbitrary bookmarks for your files and Vim docs
Stars: ✭ 19 (-97.94%)
Mutual labels:  viml
Insertlessly
Waste no more time entering insert mode just to insert enters!
Stars: ✭ 22 (-97.62%)
Mutual labels:  viml
Vim Diff Toggle
🛠 Vim plugin to speed up editing diff files
Stars: ✭ 17 (-98.16%)
Mutual labels:  viml
Dotfiles
My dot files
Stars: ✭ 18 (-98.05%)
Mutual labels:  viml
Vim lib
Stars: ✭ 22 (-97.62%)
Mutual labels:  viml
Easytags.vim
Automated tag file generation and syntax highlighting of tags in Vim
Stars: ✭ 15 (-98.38%)
Mutual labels:  viml
Rvm.vim
This functionality has been rolled into tpope's vim-rvm
Stars: ✭ 23 (-97.51%)
Mutual labels:  viml
Funcoo.vim
Functional Object Oriented VimL
Stars: ✭ 18 (-98.05%)
Mutual labels:  viml
Scala Vim Support
Unofficial mirror of Scala Vim support - With a few fixes added.
Stars: ✭ 22 (-97.62%)
Mutual labels:  viml
Vim Stim
StIm - Star Improved
Stars: ✭ 18 (-98.05%)
Mutual labels:  viml
Gist.vim
Create gists from Vim
Stars: ✭ 18 (-98.05%)
Mutual labels:  viml
Learnviml
A suggested path for learning Vim's scripting language, VimL
Stars: ✭ 22 (-97.62%)
Mutual labels:  viml
Vim Nosecompiler
Vim Compiler file for the nose framework
Stars: ✭ 16 (-98.27%)
Mutual labels:  viml
Cheatsheets
personal cheatsheets on various technologies
Stars: ✭ 23 (-97.51%)
Mutual labels:  viml
Rainbow parentheses.vim
Better Rainbow Parentheses
Stars: ✭ 892 (-3.46%)
Mutual labels:  viml
Vim Session
Extended session management for Vim (:mksession on steroids)
Stars: ✭ 907 (-1.84%)
Mutual labels:  viml
Vim Htmlbars Inline Syntax
Highlight hbs tagged template literals
Stars: ✭ 24 (-97.4%)
Mutual labels:  viml
Ag.vim
Use ag, the_silver_searcher (better than ack, which is better than grep)
Stars: ✭ 23 (-97.51%)
Mutual labels:  viml
Stupid Easymotion
A dumbed down version of EasyMotion that aids navigation on the current line
Stars: ✭ 22 (-97.62%)
Mutual labels:  viml

vim-expand-region

About

vim-expand-region is a Vim plugin that allows you to visually select increasingly larger regions of text using the same key combination. It is similar to features from other editors:

vim-expand-region

Installation

Install using Pathogen, Vundle, Neobundle, or your favorite Vim package manager.

Quick Start

Press + to expand the visual selection and _ to shrink it.

Mapping

Customize the key mapping if you don't like the default.

map K <Plug>(expand_region_expand)
map J <Plug>(expand_region_shrink)

Setting

Customize selected regions

The plugin uses your own text objects to determine the expansion. You can customize the text objects the plugin knows about with g:expand_region_text_objects.

" 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,
      \ })

Customize selection mode

By default, after an expansion, the plugin leaves you in visual mode. If your selectmode(h: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

Bitdeli Badge

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].