Giter VIP home page Giter VIP logo

Comments (6)

alvan avatar alvan commented on May 18, 2024

Hi @jackkinsella
Do you have any suggestion for this feature?
Currently you can use :CloseTagDisableBuffer to temporarily disable the completion function.

from vim-closetag.

jackkinsella avatar jackkinsella commented on May 18, 2024

I guess the approach would be to define a g:closetag_emptyTags setting that can be used within .vimrc, the contents of which then gets appended to the internal b:closetag_emptyTags.

I've never done any vim scripting before, so I wouldn't be able to do this without diving in pretty deep. But if I get a spare Saturday I might give it a shot.

from vim-closetag.

alvan avatar alvan commented on May 18, 2024

Hi @jackkinsella
The problem is, per your requirement, the b:closetag_emptyTags depends on the filetype you are editing like jsx, so it won't be a good idea that just add a global variable to define it.
And also, I am not sure if you can define a full list of all empty tags for jsx or not.
Because from your demo code, I saw you are typing <any> tag.

from vim-closetag.

jackkinsella avatar jackkinsella commented on May 18, 2024

I realised that my first message was a bit vague so I'll just clarify for anyone else reading the thread: I meant that in JSX/flow you sometimes literally type <any> and <*> i.e. both "any" and "*" are the actual tag names that need to be input, as opposed to placeholders/regexes for patterns of tags.

But, clarification aside, you are right @alvan, there are other tags necessary and adding them all one-by-one could be tedious.

Perhaps another, more general solution would be some keyword shortcut that closes the first tag without adding a second parallel closing tag. For example, imagine I have typed
<any| where | represents my cursor position. It would be cool if I could type some shortcut (e.g. <c->> if possible ) to end up with <any>.

from vim-closetag.

alvan avatar alvan commented on May 18, 2024

@jackkinsella
I've added a new shortcut for this let g:closetag_close_shortcut = '<leader>>',
you can try it and feel free to config it by yourself.

from vim-closetag.

jackkinsella avatar jackkinsella commented on May 18, 2024

Works perfectly! Thanks a million. I'll update the readme for you and make a pull-request.

from vim-closetag.

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.