GithubHelp home page GithubHelp logo

szero / vim-quotebrace Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7 KB

Easy way to select text between brackets and quotes

License: ISC License

Vim Script 100.00%
vim selection plugin yanking brackets keybind vimrc quotes

vim-quotebrace's Introduction

vim-quotebrace

Select or yank text between all types of brackets and quotes with a single key combination.

Rationale

If we want to select or yank the text, lets say between double quotes for example, we have to enter normal mode and type vi" for selection and yi" for yanking. If we need to perfom same operations but on curly braces whe have to type vi{ or yi{. This can become quite hideous if our text is quotes/brackets-heavy. My plugin will detect bracket and quote pairs and select/yank between them with single key combination either from insert or normal mode.

Installation

Vundle or similar

  1. Add Plugin 'Szero/vim-quotebrace' to your vimrc file.
  2. Reload your vimrc with :so ~/.vimrc or restart
  3. Run :PluginInstall

dein (new plugin manager from the author of NeoBundle)

  1. Add call dein#add('Szero/vim-quotebrace.vim') to your vimrc file.
  2. Reload your vimrc with :so ~/.vimrc or restart
  3. Run :call dein#install()
cd ~/.vim/bundle
git clone https://github.com/Szero/vim-quotebrace.git

Usage

Keybindings

Default keybindings are:

<leader>s for selecting the text between brackets

<leader>x for selecting the text between brackets (including the brackets)

<leader>y for yanking the text between brackets

<leader>h for yanking the text between brackets (including the brackets)

Leader is special key user can bind and use it in his own keybinds.

If you don't have it bound already, I recommend binding it to , (comma) by adding this line to your vimrc:

let mapleader=","

Each keybind works from insert and normal mode.

Configuration

If you want to change the default keybindings, there are four variables you can add you your vimrc:

let g:QuoteBraceSelect = "your keybind"

let g:QuoteBraceSelectAll = "your keybind"

let g:QuoteBraceYank = "your keybind"

let g:QuoteBraceYankAll = "your keybind"

TODO

  • Add support for matching brackets/quotes pairs that span over multiple lines
  • By using searchpair() function there is no need for inveting algorithms

vim-quotebrace's People

Contributors

szero avatar

Watchers

 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.