Code Monkey home page Code Monkey logo

smart-parentheses's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=3210

Actually most types of brackets are supported, as long it works with %. This script aims to provide some useful tricks of ParEdit but be less restrictive and more geared towards C-style programming rather than Lisp. It has less than 5% of ParEdit probably, if you want something more similar, look for slimev.

This makes the open brackets (, [, and < introduce a balanced pair. If there is already an unbalance, the script determines if adding a closing bracket makes matters better or worse. In the latter case, the closing bracket is not added.

Typing the close bracket checks if the next non-whitespace character is already that same symbol. If it is, the script just zaps all white-space until the existing symbol and moves past it. If there is no closing symbol, a new closing bracket is introduced. (Note that is much less restrictive than ParEdit but also much less safe).

For { a special case exists: typing a second { in a row introduces extra newlines for C-style programming rather than a nested pair of curly brackets. Also, } doesn't remove all white-space like the other brackets do. Again, this is convenient for programming.

In normal mode, you can type a number N and then an opening bracket, and the script will put brackets around the following N words, similar to what you can do in ParEdit.

smart-parentheses's People

Contributors

nielsadb avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

voldyman

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.