Giter Site home page Giter Site logo

Comments (22)

junegunn avatar junegunn commented on August 16, 2024

Thanks, I can reproduce the problem. I've just realized that i_CTRL-O does not work in that mode at all. Duh, is it an expected behavior?

from vim-peekaboo.

blueyed avatar blueyed commented on August 16, 2024

I don't know.. the help for v_b_I is rather short:

Visual-block Insert v_b_I
With a blockwise selection, I{string} will insert {string} at the start
of block on every line of the block, provided that the line extends into the
block. Thus lines that are short will remain unmodified. TABs are split to
retain visual columns.
See v_b_I_example.

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

Hmm, with Vim behaving this way, I have no idea how to fix it 😕

from vim-peekaboo.

blueyed avatar blueyed commented on August 16, 2024

Maybe it could be disabled / skipped in this case?
It would need to hook into InsertEnter maybe and/or look at mode() and visualmode(), doing nothing if it's CTRL-V.

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

visualmode() only tells what the previous visual mode was. So if we

  1. Enter blockwise-visual mode
  2. Esc
  3. Do something in normal mode
  4. Enter ordinary insert mode (i, a)

then, visualmode() will still return CTRL-V, and we can't use it to determine whether we should temporarily disable CTRL-R or not.

from vim-peekaboo.

blueyed avatar blueyed commented on August 16, 2024

I see. But using mode(1) should do?
I could imagine using a <expr> mapping instead of the current one, if that's possible, and it would check mode(1) against CTRL-V.

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

Hmm, do you mean checking mode(1) on InsertEnter?

from vim-peekaboo.

blueyed avatar blueyed commented on August 16, 2024

No, with the insert mapping (which needs to be turned into a <expr> mapping the probably).
It would skip any action (and return "") if mode(1) is CTRL-V.

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

Then, wouldn't it return i? e.g. inoremap <expr> xxx mode(1)

from vim-peekaboo.

blueyed avatar blueyed commented on August 16, 2024

Yes, it returns i then.. :/

It seems to be required to hook into InsertEnter/InsertLeave then, as outlined in Raimondi/delimitMate#138 (comment).

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

But doing so still has the same problem I mentioned above (C-V, normal, insert), visualmode() is not a perfect way to determine if we're in blockwise-insert mode.

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

Maybe we could fix this by changing the current mapping to <expr> mapping and not using <c-o>, I'll check if it's viable.

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

No it's not 💩

Error detected while processing function peekaboo#peek..<SNR>32_init:
line   13:
E523: Not allowed here: vertical botright 30new

from vim-peekaboo.

blueyed avatar blueyed commented on August 16, 2024

There would be visualmode(1) which clears the current mode after getting it (which might have side effects, if others rely on it). But without being able to use <expr> it does not help much, does it?

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

Oh, I wasn't aware of visualmode(1), but I don't think we should use it because of its global side-effect.

But without being able to use it does not help much, does it?

You're right.

By the way, I'm starting to wonder if this (not allowing <c-o> is vbi) can be a bug of vim itself. If that's the case, I mean if this is a known issue of Vim, we probably shouldn't try too hard to find a complicated workaround for it and just let the users know about it and suggest them to iunmap if it severely hinders their workflow.

from vim-peekaboo.

nick-s-b avatar nick-s-b commented on August 16, 2024

Thank you for this thread. I finally understand why nmap <F3> a<C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR><Esc> doesn't work on my setup (I have peekaboo installed).

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

@nick-s-b No, it's unrelated. Your problem is easily fixed by using non-recursive map.

nnoremap <F3> a<C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR><Esc>

See: https://github.com/junegunn/vim-peekaboo#peekaboo-conflicts-with-my-maps-and-abbrevs

from vim-peekaboo.

nick-s-b avatar nick-s-b commented on August 16, 2024

Thank you so much junegunn! Works perfectly now!

from vim-peekaboo.

seletskiy avatar seletskiy commented on August 16, 2024

@junegunn: I guess, you can workaround that issue by mapping I in the visual-mode and keep tracking state changes to determine whether vim in the CTRL-V I mode or just I, like I've done in the following commit: reconquest/vim-pythonx@8884830

from vim-peekaboo.

junegunn avatar junegunn commented on August 16, 2024

@seletskiy Thanks, maybe it's the only option. But unfortunately once this plugin defines the mapping it will no longer be compatible with the plugins that also define the same mapping, right? That is not ideal :(

from vim-peekaboo.

seletskiy avatar seletskiy commented on August 16, 2024

@junegunn: If you feel particularly hacky, you can try to save/restore user-mapping back and forth. Or just print warning, if mappings are clashing and write concise howto in the readme about how to use vim-peekaboo mapping for I with other plugins. User always can do something like that:

vnoremap <expr> I peekaboo#WorkaroundBlockWiseInsert() && doMyPreviousIActions()

Much better, I guess, than having plugin completely broken in the block-wise insert.

from vim-peekaboo.

josefson avatar josefson commented on August 16, 2024

Did anybody find a workaround this issue?

from vim-peekaboo.

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.