Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keystrokes for the example gifs #39

Closed
terryma opened this issue Apr 25, 2013 · 10 comments
Closed

Keystrokes for the example gifs #39

terryma opened this issue Apr 25, 2013 · 10 comments

Comments

@terryma
Copy link
Owner

terryma commented Apr 25, 2013

Example 1

  • jump to p with fp
  • select the word under cursor with <C-n>
  • do that two more times for the other two occurrences in the function
  • press c to change
  • type the replacement
  • press <Esc> to quit back to regular Vim

Example 2

  • select the line with V
  • go to the end of the file with G
  • press <C-n> to add a cursor at the beginning of every line and move to normal mode
  • press I to insert at the beginning of the line
  • type ", move to end of line with <C-e>, type another " followed by ,
  • move every cursor down one line with <C-j>(this is a custom mapping of mine in Insert mode)
  • hit <BS>, now all the words are on the same line
  • the rest is just normal Vim

Example 3

  • press dt" to delete everything until the first quote
  • press L to go to end of line (my custom mapping, default $)
  • pree r, to replace the ] with ,
  • go back to the beginning of the line with H (custom, default ^), press f, to find the first comma
  • press v to select , in visual mode, and mash on <C-n> until the last occurrence
  • press c followed by <CR> to break the line into multiple lines
  • move every cursor up one line with <C-k> (again my custom mapping)
  • delete the left quote with C-g<BS> (custom mapping to move cursor in insert mode)
  • go to end of line and delete right quote with C-e<BS>

Example 4

  • press jV to visually select the second line
  • press Gk to select all but the last line
  • type : followed by the MultipleCursorsFind command
  • press o to toggle the cursor for each visual selection
  • press p to paste the content of the + register (I have clipboard=unnamedplus in my vimrc) to each virtual cursor
@pablox-cl
Copy link

In example 2:

move to end of line with <C-e>

How is that? i_CTRL-E, inserts the character below the cursor... :(


Ah, never mind. I found it :P → https://github.com/terryma/dotfiles/blob/master/.vimrc#L763

@faceleg
Copy link
Collaborator

faceleg commented Dec 7, 2014

Wow that's obscure - do you think this is worth adding to the docs?

@AndrewRayCode
Copy link

" Ctrl-e: Go to end of line
inoremap <c-e> <esc>A 

How does that mapping even work, since you can't hit esc without cancelling the multiple cursors?

  1. please include the images in this ticket. 2. don't be disingenuous about the usefulness of your plugin if you have to have undocumented, unmentioned custom keybindings to complete the basic usage examples

@balta2ar
Copy link
Contributor

@delvarworld Put this into your ~/.vimrc and Esc won't be canceling the multiple cursors:

let g:multi_cursor_exit_from_insert_mode = 0

@caneta
Copy link

caneta commented Aug 31, 2015

Trying to follow example 2 but it simply does not work...please avoid using custom mappings or at least explain them!

@kovpack
Copy link

kovpack commented Sep 4, 2015

Yeap, second example does not work. At least I did not managed to make it work for me.

@eapache
Copy link
Collaborator

eapache commented Sep 6, 2015

The following revised keystrokes work for me for the second example if you don't use the special mappings that Terry has:

  • select the line with V
  • go to the end of the file with G
  • press to add a cursor at the beginning of every line and move to normal mode
  • press I to insert at the beginning of the line
  • type " move to end of line with + A, type another " followed by ,
  • move to the beginning of the line with + I
  • hit , now all the words are on the same line
  • the rest is just normal Vim

@kovpack
Copy link

kovpack commented Sep 6, 2015

@eapache For me that does not simply work. Do you have let g:multi_cursor_exit_from_insert_mode = 0? Actually, everything works accept of hit , now all the words are on the same line. Can not put all to the same line whatever I tried. However, when pressing delete key when cursors are at the end of lines, that makes number of lines twice smaller (so appends each second line - not every line - to the previous one, stripping ends of lines randomly).

@eapache
Copy link
Collaborator

eapache commented Sep 6, 2015

Do you have let g:multi_cursor_exit_from_insert_mode = 0

Yes I do, I'd forgotten I even had that in my vimrc. I'm wondering if it should be the default, it seems very useful and I can't think of a reason it could cause problems?

@faceleg
Copy link
Collaborator

faceleg commented Jan 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants