Giter Club home page Giter Club logo

Comments (2)

AlexAegis avatar AlexAegis commented on August 26, 2024 1

coc-pairs behave like this, and I like this behavior. But yours can detect already matching pairs, and not match when not needed. And that's smart, not even vs-code does that!

from cobra.

doums avatar doums commented on August 26, 2024

edit: This behaviors is already implemented for quotes too, I did not remember. But it's based on the syntax highlight group currently active under the cursor position (the only simple way to implement this without to have code hundred of lines). If this group name contains the word "string" so it's considered as a string. If not the AutoClose function is called.

" manage quote {{{
function s:ManageQuote(quote)
  if s:IsString(line("."), col("."))
        \ && s:IsString(line("."), col(".") - 1)
        \ && getline(".")[col(".") - 1] == a:quote
        \ && !s:IsEscaped()
    return "\<Right>"
  endif
  return s:AutoClose(a:quote, a:quote)
endfunction
" }}}

Hi, this behaviors work only with brackets character because I use vim functions for that:
search()
searchpos()
searchpair()
searchpairpos()

And these functions don't work with quotes character (presumably because a pair of quote is composed by the two same characters). But maybe I can do something using "String" syntax highlight group. I will check that.

from cobra.

Related Issues (4)

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.