Giter Club home page Giter Club logo

Comments (14)

shawnaxsom avatar shawnaxsom commented on June 21, 2024 2

This seems to work for me:

let g:multi_cursor_quit_key=''
nnoremap :call multiple_cursors#quit()

As found on the README, on the bottom of this section:

https://github.com/terryma/vim-multiple-cursors#mapping

from vim-multiple-cursors.

jiripospisil avatar jiripospisil commented on June 21, 2024

+1

from vim-multiple-cursors.

terryma avatar terryma commented on June 21, 2024

Pressing C-c in multicursor's visual mode works as expected. Every virtual cursor will go back to normal mode, this is consistent with Vim's behavior.

Pressing C-c in multicursor's normal mode breaks with the default setting like you described above. If you want C-c to quit multicursor's normal mode and go back to Vim's normal mode and clears all virtual cursors, you can map the g:multi_cursor_quit_key to <C-c>. This of course isn't ideal since <Esc> will no longer work to quit multicursor mode. It sounds like what you want is the ability to assign multiple keys to quit multicursor mode. Would that address your issue? Something like

let g:multi_cursor_quit_keys='<Esc>,<C-c>'

from vim-multiple-cursors.

d11wtq avatar d11wtq commented on June 21, 2024

Seems like that might be a sensible default, if it were possible? ;) Usually C-c just aborts whatever operation you're in the middle of, so if that's using multi-cursors, I'd expect it go back into "normal" (actual normal) mode. Allowing multiple key bindings would work well too though, yes. I could technically map C-c to <ESC> locally, but that causes other problems.

from vim-multiple-cursors.

faceleg avatar faceleg commented on June 21, 2024

+1 for making this default, I came here after googling for this same issue.

from vim-multiple-cursors.

cpcloud avatar cpcloud commented on June 21, 2024

with @faceleg and @d11wtq on this one, came here after googling as well <esc> is too far away to use for quitting :) also <c-n> <esc> does not clear the cursors.

from vim-multiple-cursors.

jarodtaylor avatar jarodtaylor commented on June 21, 2024

Still a no go on this?

from vim-multiple-cursors.

oryband avatar oryband commented on June 21, 2024

👍 Any fix coming up for this?

from vim-multiple-cursors.

Kache avatar Kache commented on June 21, 2024

@terryma, As I understand it, there is a subtle difference between ctrl-c and esc:

ctrl-c can be used for "go back to normal mode", but is a variation more akin to "abort": e.g. http://stackoverflow.com/questions/5030164/whats-the-difference-between-ctrlc-and-ctrl, :help CTRL-C, and :help i_CTRL-C.

It's esc and its equivalent, ctrl-], that's "go back to normal mode": e.g. :help i_CTRL-[, help c_Esc, :help mode-switching, :help escape.

I actually found myself in this issues section because I discovered ctrl-] didn't work, for which I've created issue #82

from vim-multiple-cursors.

tony avatar tony commented on June 21, 2024

This is an issue that is getting in my way. I don't understand the inner technicalities, but:

I use <ctrl-c> as a way to get out of insert mode. Frankly, I'd like it to be a way to get out of any special mode.

I also see this was filed as an "enhancement". While this may or may not require refactoring, it does run contrary to the behavior that an end-user would expect.

Would it help if the function to quit out of highlighting was made public? I tried giving it a shot in #126.

from vim-multiple-cursors.

faceleg avatar faceleg commented on June 21, 2024

While the PR you submitted does seem to let me quit multi cursor mode with <C-c>, it leaves the editor with the previous selections still visible.

from vim-multiple-cursors.

tony avatar tony commented on June 21, 2024

I also notice this same problem. The behavior in my PR is flawed and it should probably be reverted. I have tried various approaches but could not find a way to clear previous selections.

from vim-multiple-cursors.

faceleg avatar faceleg commented on June 21, 2024

In vanilla, how does esc trigger the desired behaviour?

According to Vim's documentation, Ctrl+C does not check for abbreviations and does not trigger the InsertLeave autocommand event while Ctrl+[ does.

From http://stackoverflow.com/a/80761/187954

Can one trigger autocommands manually? i.e. could we just add a InsertLeave firing to the public function you added?

Maybe with :do? http://vimdoc.sourceforge.net/htmldoc/autocmd.html#autocmd-execute

from vim-multiple-cursors.

Aadniz avatar Aadniz commented on June 21, 2024

multiple_cursors#quit() doesn't appear to be a callable function My bad, wrong git page

from vim-multiple-cursors.

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.