Code Monkey home page Code Monkey logo

vim-expand-region's Introduction

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

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
let g:expand_region_text_objects = {
  'iw'  :0,
  'iW'  :1,
  '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'. Not included in Vim by default. See https://github.com/kana/vim-textobj-line
  'ip'  :0,
  'ie'  :0  " 'entire file'. Not included in Vim by default. See https://github.com/kana/vim-textobj-entire
}

Replace it completely or extend the default by putting the following in your vimrc:

" Extend the text object dictionary (NOTE: Remove comments in dictionary before sourcing)
call expand_region#custom_text_objects({
      \ "\/\\n\\n\<CR>": 1, " If you're really crazy, you could supply search patterns. They're also text objects.
      \ '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'. Not included in Vim by default. See https://github.com/kana/vim-textobj-indent
      \ 'ai'  :0, " 'around indent'. Not included in Vim by default. See https://github.com/kana/vim-textobj-indent
      \})

vim-expand-region's People

Contributors

terryma avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.