Git Product home page Git Product logo

pear-tree's Introduction

Pear Tree

A painless, powerful Vim auto-pair plugin.

Purpose

Pear Tree automatically pairs parentheses, quotes, HTML tags, and many other text items based on a simple-to-define set of rules. It also provides pair-wise deletion, newline expansion, and other typical auto-pair features without interfering with Vim's undo or dot-repeat functionality.

Installation

Follow the instructions provided by your plugin manager. Using vim-plug, you would place the following in your vimrc and run :PlugInstall

Plug 'tmsvg/pear-tree'

You can also install Pear Tree manually by placing the files in their appropriate locations in your Vim directory. Remember to run :helptags if you choose this method.

Features

Multi-Character Pair Support

Pear Tree is not limited to pairing single characters like ( with ), { with }, and so on. If you would like to pair, say, /* with */ or <!-- with -->, simply add them to your g:pear_tree_pairs and it will work just as well.

Wildcard Support

A powerful feature of Pear Tree is its support for wildcard string matching. This is particularly useful for HTML tags, wherein there can be strings of some arbitrary length between the < and > characters (e.g. <body>, <ul>, <p class="Foo">).

Dot-Repeatability

Pear Tree allows brace expansion without breaking Vim's dot-repeat or undo functionality. Consider this example:

1  int foo();|
2
3  int bar();

Type <BS> {

1  int foo() {|}
2
3  int bar();

Type <CR>:

1  int foo() {
2      |
3
4
5  int bar();

Note that the closing pair disappears after pressing <CR>. This is required to not break dot-repeat, but it will be automatically restored later.

Next, type return 1; and leave insert mode:

1  int foo() {
2      return 1;
3  }
4
5  int bar();

Finally, move to line 5 and use the . command:

1  int foo() {
2      return 1;
3  }
4
5  int bar() {
6      return 1;
7  }|

Many implementations of this feature cause the . command to only repeat return 1; instead of the entire typing sequence.

However, if you would prefer expansion to behave like other plugins and text editors, you can prevent Pear Tree from erasing the closing string by setting g:pear_tree_repeatable_expand to 0.

Smart Pairing

Pear Tree includes options to intelligently decide when an opening string should be closed, when typing a closing character should move the cursor past an existing closer, and when both characters in a pair should be deleted when pressing backspace. If these options are enabled, Pear Tree will examine the balance of existing pairs to decide what action should be taken. It will choose the action that makes nearby pairs properly balanced, as summarized in the following table:

Before After (smart pairing) After (no smart pairing)
Opener foo(bar|)) foo(bar(|)) foo(bar(|)))
Closer foo(bar(|) foo(bar()|) foo(bar()|
Backspace foo((|) foo(|) foo(|

Smart pairs must be enabled manually.

Usage

Pear Tree's primary features are enabled automatically, but some useful options and mappings must be set manually. Please read :help pear-tree for useful information on how to define your own pairs, use wildcards, customize mappings, and more.

Defaults

Note: The following code is only here to summarize the available options and show what Pear Tree sets them to by default. You only need to copy it to your config if you intend to change values of the variables or key mappings.

" Default rules for matching:
let g:pear_tree_pairs = {
            \ '(': {'closer': ')'},
            \ '[': {'closer': ']'},
            \ '{': {'closer': '}'},
            \ "'": {'closer': "'"},
            \ '"': {'closer': '"'}
            \ }
" See pear-tree/after/ftplugin/ for filetype-specific matching rules

" Pear Tree is enabled for all filetypes by default:
let g:pear_tree_ft_disabled = []

" Pair expansion is dot-repeatable by default:
let g:pear_tree_repeatable_expand = 1

" Smart pairs are disabled by default:
let g:pear_tree_smart_openers = 0
let g:pear_tree_smart_closers = 0
let g:pear_tree_smart_backspace = 0

" If enabled, smart pair functions timeout after 60ms:
let g:pear_tree_timeout = 60

" Automatically map <BS>, <CR>, and <Esc>
let g:pear_tree_map_special_keys = 1

" Default mappings:
imap <BS> <Plug>(PearTreeBackspace)
imap <CR> <Plug>(PearTreeExpand)
imap <Esc> <Plug>(PearTreeFinishExpansion)
" Pear Tree also makes <Plug> mappings for each opening and closing string.
"     :help <Plug>(PearTreeOpener)
"     :help <Plug>(PearTreeCloser)

" Not mapped by default:
" <Plug>(PearTreeSpace)
" <Plug>(PearTreeJump)
" <Plug>(PearTreeExpandOne)
" <Plug>(PearTreeJNR)

License

MIT

pear-tree's People

Contributors

gitusp avatar hallettj avatar lemusp avatar tmsvg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pear-tree's Issues

Disable smart openers in certain contexts (if the text before matches a certain regexp)

Example (with | as cursor position):

"foo.|

Then inserting " results in:

"foo."|"

pear-tree doesn't recognize, that this double quote is intented to close the previous one. An automatically closed double quote directly after a punctuation character most often is not what you want.

Possible solutions:

  • Make handling of double quotes smarter about opening and closing quotation marks.
  • Disable smart quotes if the text before the cursor matches '[.!?]$'. (could be filetype specific)

Otherwise an excellent plugin. Thank you very much.

Regards

Thank you for this!

I really was about to give up on Auto Pairing - tried quite a few but up to now all in my way more than helpful, guess I was 'holding it wrong'.

Yours is doing it right pretty much all the time, such an amazing experience!

Thanks again!

Undocumented bad interaction with vim-paste-easy

I've had to disable roxma/vim-paste-easy because, with both it and pear-tree installed, if I type both an opener and a closer in less than a second (eg. function_with_no_arguments() or results = []), I wind up with a doubled closer.

I don't know enough about Vim's architecture and VimL to know which side should be responsible for fixing it, but I'd advise at least mentioning it in the README in case anyone else trips over it, experiments with the smart pairing options (which have no effect), and then concludes that pear-tree is broken without investigating further.

Breaks other plugins that map <CR> in insert mode

...specifically, endwise.vim, a vital plugin for languages like ruby and viml that use end (and its variants) to close code blocks.

A quickfix is to change:

imap <buffer> <CR> <Plug>(PearTreeExpand)

to

exec "imap <buffer> <CR> ".maparg("<CR>", "i")."<Plug>(PearTreeExpand)"

...though this adds an extra blank line, for example, typing def foo<CR>hi! produces:

def foo

  hi!
end

...so this isn't a full solution.

This plugin, along with its great config, is the only one of its type that actually does what I want so I'm pretty invested in resolving this! I'd be happy to take it on myself I wanted to file an issue first to get your thoughts and see if you'd even be amenable to a PR.

Unwanted angular bracket completion

I use a lot of C++ and I do not want bracket completion for angular brackets, namely '<' and '>'. Is there any way to disable this? I couldn't find any.
Thanks in advance.

doesn't work with non-english keymaps

If you activate

set keymap=russian-jcukenmac

and try to write a word хорошо you end up with the [орошо

хъХЪэЭ letters are affected, instead of russian letter I get:

х [
Х {
ъ ]
Ъ }
э '
Э "

Insert spaces before closing characters

It would be really cool if pear-tree inserted spaces like auto-pairs does.

Example from jiangmiao/auto-pairs:

Insert spaces before closing characters, only for [], (), {}

input: {|} (press <SPACE> at |)
output: { | }

input: {|} (press <SPACE>foo} at |)
output: { foo }|

input: '|' (press <SPACE> at |)
output: ' |'

`not_at` doesn't always work with wildcard pattern

I'm trying to configure pear-tree to use a <*> opener with .tsx files, so I need to support JSX tags as well as Typescript notation.

In particular, I need to support typescript generics, so something like below should not be expanded:

useHook<AppState>( ...someArgs)

And something like below should be expanded:

return <div></div>

Currently my setting looks like:

let g:pear_tree_pairs = {
      \ '<*>': { 'closer': '</*>',
      \          'not_if': ['br', 'hr', 'img', 'input', 'link', 'meta',
      \                  'area', 'base', 'col', 'command', 'embed',
      \                  'keygen', 'param', 'source', 'track', 'wbr'],
      \          'not_like': '{[^}]*$\|/$',
      \          'until': '[^a-zA-Z0-9-._]',
      \          'not_at': ['[^> ]<[^>]*'],
      \          'not_in': ['String']
      \        }
      \ }

I'm using 'not_at': ['[^> ]<[^>]*'] to detect whether the tag fits in the right place - basically searching for whether the opener is preceded by a non-space or angle bracket. However, this doesn't work when typing something like test<T> because at l:text_before_opener is determined by length of opener.

let l:text_before_opener = l:text_before_cursor[:-l:len]

Does it make sense to have this be determined by the full match?

Using wildcards with braces

So, I'm trying to add the following mapping (for ReasonML's interpolated strings, that look something like {bleh| this |bleh}):

" ~/.vim/ftplugin/reason.vim
let b:pear_tree_pairs = extend(deepcopy(g:pear_tree_pairs), {
    \ '{*|': {'closer': '|*}'}
\ }, 'keep')

However, only { is getting paired — and I don't see a <Plug>(PearTreeOpener_|) mapping. Is this a bug, or am I mis-reading the docs?

Disappearing closing character on new line

After a pair has been inserted and nothing but a newline is entered, pushing the closing character down a line, the closing character disappears until insert mode is exited. The issue does not seem to happen when anything is entered between the pair. I've tried disabling all other plugins and settings but the issue still remains.
pear_tree_bug

My .vimrc:

set omnifunc=syntaxcomplete#Complete
set completeopt+=menuone,noselect,noinsert
set nocompatible
set autoindent
" set cursorline " This is nice but makes vim slow in some case
set synmaxcol=90 " Limit syntax highlighting to amount of columns (you might want to disable this if you're on a fast system
set colorcolumn=90
set nofoldenable
set foldmethod=syntax
set history=100
set hlsearch
set incsearch
set ignorecase
set laststatus=2
set nospell
set noerrorbells
set noswapfile
set number relativenumber
set numberwidth=1
set tabstop=2
set showmatch
set shiftwidth=2
set timeoutlen=1000 ttimeoutlen=0 "This makes visual blocks fast
set updatetime=100
set viminfo+=n~/.vim/.viminfo "Different folder for viminfo file (disable if not on linux)

let mapleader="§"
" Latex support
let g:tex_flavor="latex"

" Keybindings
"""""""""""""""""""""""""""""""
" Resource .vimrc
nnoremap <silent> <Leader>up :source ~/.vimrc<CR>

" NERDTree
nnoremap <silent> <Leader>e :NERDTreeToggle<CR>

" ALE
nnoremap <silent> <Leader>al :ALELint<CR>
nnoremap <silent> <Leader>af :ALEFix<CR>

" Next marker
nnoremap <silent> <Leader>n /<+++><CR>cf>
inoremap <silent> <Leader>n <Esc>/<+++><CR>cf>
" Previous marker
nnoremap <silent> <Leader>N ?<+++><CR>cf>
inoremap <silent> <Leader>N <Esc>?<+++><CR>cf>
" Place marker
inoremap <silent> <Leader>m <+++>
nnoremap <silent> <Leader>m i<+++>
" Used to finish tab completion when enter is pressed
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Bind popup navigation to ctrl-j and ctrl-k
inoremap <expr> <C-j> ((pumvisible())?("\<C-n>"):("j"))
inoremap <expr> <C-k> ((pumvisible())?("\<C-p>"):("k"))
" Cancel search
nnoremap <CR> :noh<CR><CR>
" Tags
nnoremap <Leader>tp :ptag<CR>
nnoremap <Leader>tc :pclose<CR>
"""""""""""""""""""""""""""""
"
" Colors
colorscheme onedark

call plug#begin('~/.vim/plugged')

Plug 'ctrlpvim/ctrlp.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'w0rp/ale'
Plug 'tpope/vim-fugitive'
Plug 'sheerun/vim-polyglot'
Plug 'ap/vim-css-color'
Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle' }
Plug 'vim-scripts/AutoComplPop'
Plug 'tpope/vim-surround'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-commentary'
Plug 'wincent/terminus'
Plug 'mattn/emmet-vim'
Plug 'rust-lang/rust.vim'
Plug 'janko/vim-test'
Plug 'christoomey/vim-tmux-runner'
Plug 'qnighy/lalrpop.vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'tpope/vim-repeat'
Plug 'mileszs/ack.vim'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'Yggdroot/indentLine'

call plug#end()

command! Conf :sp ~/.vimrc

autocmd BufEnter * syntax on
autocmd BufEnter *.tsx set filetype=typescript.vim
filetype plugin on

Jump to Matching Dollar Sign Pair

let b:pear_tree_pairs = {
            \ '(': {'closer': ')'},
            \ '[': {'closer': ']'},
            \ '{': {'closer': '}'},
            \ "``": {'closer': "''"},
            \ '$': {'closer': '$'}
            \ }

Pear-tree is able to successfully enter the matching pair, but imap <C-l> <Plug>(PearTreeJump) does not work with the dollar sign.

Background info: Used for LaTeX equations

Possible for PearTreeJump to search beyond current line

Currently the (PearJumpTree) command invokes pear_tree#GetSurroudingPair() to get positions to jump past, and it works as long as the pairs are located on the same line/ cursor is within an actual pair.

Was wondering if it would be possible to modify (or add a new) command so that if #GetSurroundPair() is empty, it could then search for the next closer and jump past it.

Ex:

foo() {
    ThisAllWorks("as Expected"); | [cursor]  //Will jump the \" and \) correctly, 
             //however will not jump out to the closing \}
}   // <-Here->

Setting b:pear_tree_pairs for html.twig with `<*>`

I'm trying to do this, which doesn't work

aug test
  au!
  au FileType html.twig let b:pear_tree_pairs = {
        \ '<*>': {
        \   'closer': '</*>',
        \   'not_if': ['br', 'hr', 'img', 'input', 'link', 'meta', 'area', 'base', 'col', 'command', 'embed', 'keygen', 'param', 'source', 'track', 'wbr'],
        \ }
        \}
aug END

I tried this & still the <*> expansion doesn't work but everything else works

aug test
  au!
  au FileType html.twig let b:pear_tree_pairs = extend(deepcopy(g:pear_tree_pairs), {
        \ '<*>': {
        \   'closer': '</*>',
        \   'not_if': ['br', 'hr', 'img', 'input', 'link', 'meta', 'area', 'base', 'col', 'command', 'embed', 'keygen', 'param', 'source', 'track', 'wbr'],
        \ }
        \}, 'keep')
aug END

If I set it globally it works thought

Error when smart enabled and using /** */

I got an error when writing JSdoc for javascript.jsx filetype.
so when I type the second * in /**, this error happened.

Error detected while processing function pear_tree#insert_mode#TerminateOpener[36]..pear_tree#GetRule:
line    2:
E712: Argument of get() must be a List or Dictionary

Support for VimL quotes

At the moment, pear-tree makes writing VimL really annoying — it tries to pair the initial quote of a Vim comment. Some sort of heuristic may be a good plan here!

unexpected <CR> expansion

(defun f (x)
  ""|)

<CR>
I get:

(defun f (x)
  ""
  |
  )

expected:

(defun f (x)
  ""
  |)

this doesn't expand that way:

foo(bar()|)

gives (as expected):

foo(bar()
|)

there's some fishy interaction with the quotes

How to disable the <CR> mapping ?

Hi there,

Is there a way to disable the mapping which remove the closing character and restore it automatically when quitting insert mode.

I use jk as and it doesn't work.

with <CR> and <ESC>

func main() {
    //Do something

}

with <CR> and jk

fun main() {
    // quitting insert mode with jk doesnt' fill automatically the closing character

Is it possible to disable closing a tag when it ends with `/>`?

Hi,

I added '<*>': {'closer': ‘</*>’, ‘not_if’: [‘br’, …]} to g:pear_tree_pairs to enable auto-close for HTML tags, and it worked fine.
But I noticed, in JSX, there are tags that can take both form <Foo></Foo> and <Foo />, so that I can not simply add Foo to not_if condition.

I thought it would be nice to disable auto-closing when an opener ends with />. But I could not find a way to configure such a condition.
Could you tell me whether there is a way to achieve the above condition?

Anyway, thank you for publishing such a great plugin! I think this is the most sophisticated auto-close plugin.

autocmds break executing of macros

Executing a macro where <esc>f<something> happens goes into insert mode.

For instance let's say we have (^ denotes where the cursor is):

foo("bar")
     ^

Executing a macro ciwfoo^[f)i, 1^[ makes:

foo("foo"))i, 1

instead of

foo("foo", 1)

After some fair amount of debugging the issue seems to be going away after removing the plugin which makes me think the autocmds for InsertEnter or CursorMovedI cause this.

UTF-8 quotation marks do not trigger auto-pairing

If I have, for instance, this configuration:

let b:pear_tree_pairs = { '': {'closer': ''},  '': {'closer': ''} }

And then I type (U+201C) in insert mode (by pressing AltGr+v in my Brazilian keyboard) the corresponding (U+201D) is not inserted. Same for (U+2018) and (U+2019) pairs.

Add backtick support for JS template literals

Javascript has the concept of template literals that let you run functions on backtick strings before the argument and literals are joined. This is a popular pattern, especially with libraries like Styled Components.

pear-tree fails to detect the initial backtick as opening the string (presumably because it's attached to the word to the left). For example:

const Row = styled.div`
  display: flex;
`

In this case, the initial backtick attached to the div wouldn't generate the matching pair. Also, when manually typing the closing backtick, pear-tree detects it as the start of an expression and generates a second backtick on the third line.

Would it be possible to support this functionality?

Thanks!

Argument of count() must be a List or Dictionary

Error detected while processing function pear_tree#insert_mode#TerminateOpener[10]..pear_tree#insert_mode#CloseSimpleOpener[1]..129_ShouldCloseSimpleOpener:
line 23:
E712: Argument of count() must be a List or Dictionary

I just installed this to try it, this is the default behavior I'm getting trying to type any type of opener ( e.g.
{, [, etc) inside a quote.

Seemingly I should be able to do this by default without error, and then configure as needed for higher orders in the future, what do I do here?

Undefined variable: b:traverser

Hi,

I frequently encounter this errors:

Error detected while processing function pear_tree#insert_mode#OnInsertCharPre[1]..<SNR>201_CorrectTraverser:
line    2:
E121: Undefined variable: b:traverser
Error detected while processing function pear_tree#insert_mode#OnInsertCharPre[1]..<SNR>201_CorrectTraverser:
line    2:
E121: Undefined variable: b:traverser
Error detected while processing function pear_tree#insert_mode#OnInsertCharPre[1]..<SNR>201_CorrectTraverser:
line    2:
E121: Undefined variable: b:traverser
Error detected while processing function pear_tree#insert_mode#OnInsertCharPre[1]..<SNR>201_CorrectTraverser:
line    2:
E121: Undefined variable: b:traverser
Error detected while processing function pear_tree#insert_mode#OnInsertCharPre[1]..<SNR>201_CorrectTraverser:
line    2:
E121: Undefined variable: b:traverser

Unfortunately I cannot consistently reproduce this error. It seems to me that the variable creation is delayed, because if I exit and reenter INSERT mode, the variable b:traverser is defined.

Move cursor outside of pair after exiting Insert mode

Consider an example: Insert mode, cursor is at |

...other party is focused on a single issue (usually bEV|)
                                                        ^

After pressing Esc, it would be handy to have:

...other party is focused on a single issue (usually bEV)|
                                                         ^

Or, maybe even attempt telepathy and add space that is likely to follow:

...other party is focused on a single issue (usually bEV) |
                                                          ^

What do you think?

Bug reporting

I want to mention that this is the first module that does auto-pairing right. I've been using and searching for a good auto-pairing plugin for ~5 years and I discovered this one last week. Before this module I used auto-pairs which is the most popular one, looking at the amount of starts, but I do think this module is definitely underrated. The logic of closing is exactly what I have been looking for and finally somebody did it right! Thanks again for this module and I really want to contribute to the module! Is there a global list of TODOs that has to be done or do you also have plannings for the feature? Maybe I could help out n_n


Something different: I did found a scenario that might not have been noticed by people yet, but when I have this scenario in HTML (where | indicates the cursor):

<div class="|>

I do expect the result to be:

<div class="|">

Do you think this is fixable at core level? I really hope so. I know this doesn't work right now as expected because pear-tree doesn't insert when typing something when there are characters on the right of cursor.

Smart pairs are fooled by pairs that live inside strings

I have pear tree configured for smart pairs, and while having a pair inside a string, trying to press '(' and ')' inserts another closing pair:
image

Expected behavior - pear tree skips the enclosing pair, ignoring the opening pair inside the string.

no closer is inserted for class*| as the opener

Title is not very accurate because I wanted to avoid using a "clickbaity" title. The problem is that the closer is not inserted for an opener which ends with a pattern similar to ass*|.

To reproduce, compare the behaviour of:

let b:pear_tree_pairs = extend(deepcopy(g:pear_tree_pairs), {
            \ 'ass*|': {'closer': ' end'}
            \ }, 'keep')

with

let b:pear_tree_pairs = extend(deepcopy(g:pear_tree_pairs), {
            \ 'bss*|': {'closer': ' end'}
            \ }, 'keep')

Support for hyphenated tags

Fantastic plugin!

Just wondering whether it's possible to make it work with hyphenated tags? At the moment the plugin only uses the text before the first hyphen in the closing tag.

Example of current behaviour:

<todo-item></todo>

Desired behaviour:

<todo-item></todo-item>

Thanks!

<Plug>(PearTreeJump) should skip whitespace

Using <Plug>(PearTreeSpace) often leads to the cursor being one space away from the closing string. It would be good if <Plug>(PearTreeJump) ignored this space and just moved past the closing string:

{% foo| %} -> {% foo %}|

Overlapping pairs handled strangely

I ran into issues when configuring comment pairs for Haskell. Overlapping pairs were handled strangely.

Configuration:

let g:pear_tree_pairs = {
            \ '{': {'closer': '}'},
            \ '{-': {'closer': '-}'},
            \ '{-#': {'closer': '#-}'}
            \ }

Expected behavior:

input: {
output: {|}

input: {|}
(press - at |)
output: {-|-}

input: {-|-}
(press # at |)
output: {-#|#-}

Actual behavior:

input: {
output: {|}

input: {|}
(press - at |)
output: {-|-}

input: {-|-}
(press # at |)
output: {-#|#-}-}

/* and <!-- are not closed

The readme says:

If you would like to pair, say, /* with */ or , it works just as well.

However, if I type either /* or <!--, nothing is inserted after it. Pairing other things, like (, {, ", etc work as expected. I am using Vim 8.1.

pear-tree wont delete auto created closing bracket after expansion

After expanding a bracket by pressing enter (like {), if i input a closing bracket, it wont remove the bracket auto created by the plugin.
I set g:pear_tree_repeatable_expand to 0 since that feature is a bit broken for my use cases.

I use neovim 4.3, but im pretty sure this bug happens on vim too.

How to reproduce:

  1. Download pear-tree.
  2. In your init.vim put let g:pear_tree_repeatable_expand=0
  3. Open neovim and type {<cr>}.

expected result:
{
}

actual result:
{
}
}

Very annoying when i want to keep typing without leaving insert mode.

Plugin not working

I installed the plugin using vim-plug in neovim on my Debian system. My neovim version is v0.3.4. The autopairing is just not working at all. Please help. Thanks in advance.

Detect comments for smart openers and smart closers

I've noticed that the smart openers and smart closers don't quite work when there is an unpaired paren or bracket within a comment. For example:

// :( <- miscellaneous unpaired paren inside a comment

test(|)

I'd expect if I were to press ), that the cursor would then move to

test()|

Is it possible to ignore comments when deciding whether to use the smart closers or not?

Pairing support in command line

Hi, first of all, this plugin is amazing.

I'm wondering whether it would be possible to extend it with support for pairing in command line mode. It might be useful when inputting strings or parentheses for function arguments.

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.