GithubHelp home page GithubHelp logo

Comments (9)

thomasahle avatar thomasahle commented on June 3, 2024

A workaround appears to be adding an extra surround for searching:

let g:operator#surround#blocks = {
\ '-' : [
\  {'block': ['\langle', '\rangle'], 'motionwise': ['char', 'line', 'block'], 'keys': ['<','>']},
\  {'block': ['\\langle', '\\rangle'], 'motionwise': ['char', 'line', 'block'], 'keys': []},
\ ] }

from vim-operator-surround.

rhysd avatar rhysd commented on June 3, 2024

Hi.

Strings in block are used as regular expression here. So backslash must be escaped with extra backslash. I think below works.

let g:operator#surround#blocks = {
\ '-' : [
\   {'block': ['\\langle', '\\rangle'], 'motionwise': ['char', 'line', 'block'], 'keys': ['<', '>']},
\ ] }

from vim-operator-surround.

rhysd avatar rhysd commented on June 3, 2024

['\\langle\>', '\\rangle\>'] may be better as you mentioned.

from vim-operator-surround.

thomasahle avatar thomasahle commented on June 3, 2024

The problem with this one seems to be when inserting the brackets. Here it is not used as a regular expression, but inserted verbatim, right?

from vim-operator-surround.

rhysd avatar rhysd commented on June 3, 2024

Ah, I understood. That's true. I'll consider how to resolve this issue..

from vim-operator-surround.

thomasahle avatar thomasahle commented on June 3, 2024

I think, if searching could be made non regular expression, that would solve it. Likely it's not really needed if this hasnthasn't been a problem before.

from vim-operator-surround.

rhysd avatar rhysd commented on June 3, 2024

Exactly the solution resolves this issue. However, it breaks other block definitions which rely on regular expression.
I think it is good to enable to define inserted block text explicitly as below.

let g:operator#surround#blocks = {
\ '-' : [
\   {
\     'block': ['\\langle', '\\rangle'],
\     'block_text': ['\langle', '\rangle'],
\     'motionwise': ['char', 'line', 'block'],
\     'keys': ['<', '>']},
\ ] }

What do you think?

from vim-operator-surround.

thomasahle avatar thomasahle commented on June 3, 2024

That would certainly work :-)
I guess I just can't imagine any cases where you'd want to insert a regular
expression verbatim as a bracket.

On Fri, Oct 9, 2015, 11:03 AM Linda_pp [email protected] wrote:

Exactly the solution resolves this issue. However, it breaks other block
definitions which rely on regular expression.
I think it is good to enable to define inserted block explicitly as below.

let g:operator#surround#blocks = {\ '-' : [\ {\ 'block': ['\langle', '\rangle'],

\ 'block_text': ['\langle', '\rangle'],

\ 'motionwise': ['char', 'line', 'block'],\ 'keys': ['<', '>']},\ ] }

What do you think?


Reply to this email directly or view it on GitHub
#25 (comment)
.

from vim-operator-surround.

rhysd avatar rhysd commented on June 3, 2024

e.g. HTML tag

from vim-operator-surround.

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.