Giter Site home page Giter Site logo

Comments (4)

LucHermitte avatar LucHermitte commented on June 10, 2024

Currently I support the exact contrary with -context option.

For instance, if you add in a rust ftplugin:

Brackets { } -context=string
Brackets { } -context=string -visual=0 -trigger=µ

then { will expand only within string context, and µ will expand into {<cursor>} within strings.

In other words, I have to implement what you're looking for.

I guess I will add a -context!= option

from lh-brackets.

alientechnology avatar alientechnology commented on June 10, 2024

Yeah, I see, but i don't get how to make it explain into {}<cursor> within string context, and into {<cursor>} in other contexts? When i add Brackets { } -context=string it looks like default Brackets { } stops to work. How can i look all contexts available for binding? Thanks.

from lh-brackets.

LucHermitte avatar LucHermitte commented on June 10, 2024

OK. I misunderstood what you were looking for. There is a very tricky (and undocumented) way then to achieve it.

" in case you reload your ft plugin, and if the default global insert-mode mapping for `{` is correct in your context
:silent! iunmap <buffer> {
:call lh#brackets#define_imap('{', [
  \ {'condition' : 'lh#syntax#name_at_mark(".") =~? "string"', 'action': '"{}"'},
  \ {'condition': 1, 'action':maparg('{', 'i')}],
  \ 1)

The first condition defines what to do within strings. The second conditions (which expresses the default action) executes the insert mode mapping already registered (here, the one :Brackets { } defines.

from lh-brackets.

LucHermitte avatar LucHermitte commented on June 10, 2024

Fixed by 2b14091

from lh-brackets.

Related Issues (20)

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.