Git Product home page Git Product logo

lexima.vim's Introduction

lexima.vim

Build Status

Auto close parentheses and repeat by dot dot dot...

Basically, you can automatically close pairs such as (), {}, "", ... But in advance, you can also customize the rule to automatically input any character on any context.

Screen Shots

Screen Shot

DEFAULT RULES

lexima.vim provides some default rules to input pairs. (the cursor position is represented by |)

Basic Rules

If g:lexima_enable_basic_rules is 1, the following rules are enabled. (default value: 1)

Before        Input         After
------------------------------------
|             (             (|)
------------------------------------
|             "             "|"
------------------------------------
""|           "             """|"""
------------------------------------
''|           '             '''|'''
------------------------------------
\|            [             \[|
------------------------------------
\|            "             \"|
------------------------------------
\|            '             \'|
------------------------------------
I|            'm            I'm|
------------------------------------
(|)           )             ()|
------------------------------------
'|'           '             ''|
------------------------------------
(|)           <BS>          |
------------------------------------
'|'           <BS>          |
------------------------------------

and much more... (See g:lexima#default_rules at autoload/lexima.vim)

New Line Rules

If g:lexima_enable_newline_rules is 1, the following rules are enabled. (default value: 1)

Before        Input         After
------------------------------------
{|}           <CR>          {
                                |
                            }
------------------------------------
{|            <CR>          {
                                |
                            }
------------------------------------

Same as () and [].

Endwise Rules

If g:lexima_enable_endwise_rules is 1, the following rules are enabled. (default value: 1)

For example, in ruby filetype

Before        Input         After
--------------------------------------
if x == 42|   <CR>          if x == 42
                                |
                            end
--------------------------------------
def foo()|    <CR>          def foo()
                                |
                            end
--------------------------------------
bar.each do|  <CR>          bar.each do
                                |
                            end
--------------------------------------

and same as module, class, while and so on.

In vim filetype, function, if, while ... rules are available. And also you can use in sh (zsh) such as if, case.

CUSTOMIZATION

lexima.vim provides highly customizable interface. You can define your own rule by using lexima#add_rule().

" Please add below in your vimrc
call lexima#add_rule({'char': '$', 'input_after': '$', 'filetype': 'latex'})
call lexima#add_rule({'char': '$', 'at': '\%#\$', 'leave': 1, 'filetype': 'latex'})
call lexima#add_rule({'char': '<BS>', 'at': '\$\%#\$', 'delete': 1, 'filetype': 'latex'})

You will get

Before  Input   After
---------------------
|       $       $|$
---------------------
$|$     $       $$|
---------------------
$|$     <BS>    |
---------------------

These rules are enabled at only latex filetype. For more information, please see :help lexima-customization

DOT REPEATABLE

If you type foo("bar, you get

foo("bar")

and once you type 0., you finally get

foo("bar")foo("bar")

lexima.vim's People

Contributors

aiya000 avatar akinsho avatar blueyed avatar cohama avatar crazymaster avatar creasty avatar daveyarwood avatar emilyst avatar hrsh7th avatar k-takata avatar mopp avatar mrshu avatar pasela avatar perrin4869 avatar ryym avatar tarohi24 avatar thalesmello avatar thinca avatar ujihisa avatar vheon avatar yuntan 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.