Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NotificationsYou must be signed in to change notification settings

cohama/lexima.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testAsk DeepWiki

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 inputany character on any context.

SCREEN SHOTS

Screen Shot

REQUIREMENTS

  • Vim 8.1+ or Neovim 0.4.3+

DEFAULT RULES

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

Basic Rules

Ifg:lexima_enable_basic_rules is1, the following rules are enabled.(default value:1)

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

and much more... (Seeg:lexima#default_rules atautoload/lexima.vim)

New Line Rules

Ifg:lexima_enable_newline_rules is1, the following rules are enabled.(default value:1)

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

Same as() and[].

Endwise Rules

Ifg:lexima_enable_endwise_rules is1, 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 asmodule,class,while and so on.

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

CUSTOMIZATION

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

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

You will get

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

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

SETTING EXAMPLES

Same as default( rule but except before a word.

calllexima#add_rule({'at':'\%#\w','char':'(','input':'('})
Before  Input  After----------------------------|bar    (      (|bar

DOT REPEATABLE

If you typefoo("bar, you get

foo("bar")

and once you type0., you finally get

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors30


[8]ページ先頭

©2009-2025 Movatter.jp