I can hold alt then click and drag in a line to create a line of cursors. However, I'd rather do this with a keyboard shortcut (e.g. alt + up creates a new cursor on the line above the current one). I don't see anything about cursor duplication in the Keyboard Shortcuts file or the command palette - does this mean there is no way to set up a shortcut for this? If not, what command do I need to bind to do it?
Does Ctrl+Alt+Click work? Just a quick tip, I do not think simply using the keyboard is possible to do what you want to achieve.
#3992 Support keymaps in notebook cells
#1362 Support Vim Editing Mode in Cells
Relevant sources:
Multi-cursor editing in Jupyter Lab
Related
I am using both MacVim and console Vim.
My shell is ZSH and the terminal is iTerm2.
What I am trying to achieve:
when I'm dealing with the GUI, in other window, sometimes I want a quick copy paste from a VIM window.
I can use the mouse to select the text, but:
cmd-c doesn't copy
ctrl-c doesn't copy
ctrl-shift-c doesn't copy
right button context menu copies sometimes but not always and I don't know why. I don't know if it's related to the mode I'm in, etc it's just not reliable. At this stage, the menu that appears in the console is not VIM's, since it doesn't have one, but iTerm2, so things get very confusing.
when using MacVim, the menu shows me to use cmd-c to copy, but whether I do it, or using the context menu it sometimes works and, more than often, it doesn't.
Reading from forums, I've tried to do:
:setmouse=a
but, when I press return it doesn't even acknowledge the line.
So, my simple question is: how can I do quickie copies from a mouse selection in VIM to paste it in another window without have to do anything else that would slow me down?
The command is
set mouse=a
but you need clipboard interfaces. See :help "*
I would visually select (with or without mouse) and use "*y, or :yank * if it can be done linewise (sometimes the range is easier to type, like :%y*).
Alternately, disable mouse-reporting (Cmd-R on mac) and use the native copy-paste.
I got "additional" functionality either from vim or some plugin. Recently I updated vim to 8.0.216 and updated all my plugins. The "additional" functionality I get is when I search for string in a file with / and paste, for example "term", the resulted pasted text become <PasteStart>term<PasteEnd>.
How can I disable this annoying functionality?
I tried to disable all my plugins and removed .vimrc completely, but the wrapping is still there. Is this something new build to vim?
Edit:
I use iTerm2. Tried in buit-in terminal - its the same.
I saw somewhere this is related with tmux. Removed tmux and loaded fresh console. Same.
I am using oh-my-zsh if this could be related.
Edit2
I use shortcut commands for both copy and paste.
I have found three possible workarounds:
1, Use iTerm's Paste special and uncheck the Bracketed paste mode. Unfortunately, that's 3 extra clicks.
2, Use the Bracketed paste plugin, or add the relevant commands to your .vimrc:
execute "set <f28>=\<Esc>[200~"
execute "set <f29>=\<Esc>[201~"
cmap <f28> <nop>
cmap <f29> <nop
3, Create an alternate shortcut to paste with Bracketed paste mode disable:
Go to prefs>keys
Click the +
Select the keyboard shortcut field and press ⌘⌥v
For Action, select Paste…
Select the desired options. E.g. Disable Bracketed paste mode.
Press ok
Source of alternative shorcut.
NOTE: You could simply re-bind the Command + V.
The answer is: update your Vim.
Apparently it's a bug and updating Vim (to 8.0.0237) has solved it for me.
I am trying to paste a string I copied from a webpage in vim. I know that the string is copied in the system clipboard. My vim returns 1 when I run the :echo has('clipboard') command, so I typed :set paste, then positioned the cursor to the desired spot and hit "*p, but this doesn't seem to paste my whole selection. I copied to the clipboard Vader(father figure) but it only pastes Vader. Or is it pasting this because the word behind the cursor is Vader? And finally, what is the easiest way to paste something in vim from the system's clipboard?
I mention that I am using Ubuntu 14.04 (if this has any relevance).
I always use Ctrl+Shift+v in Insert mode, when pasting from system clipboard after doing set paste. Never had any problems doing so.
Otherwise you can use the vim-unimpaired plugin by tim pope and use the yo key mapping set by the plugin to paste. Using yo automatically sets the paste option and after you paste and leave Insert mode, it automatically toggles the set paste option.
Have this line in your .vimrc
set pastetoggle=<F2>
So whenever you press F2 in insert mode you can paste normally with no problems.
For more information refer here.
You only need to set paste if you intend to paste while in insert mode using the middle mouse button or any shortcut your terminal provides.
Now, it is possible that the register you're looking for is quote+. To confirm that just run :registers in order to view the contents of all registers.
I would also advise you to read the following help section :help x11-selection.
I'm currently using the system clipboard in vim as default register in combination with a clipboard manager like Diodon or Klipper (for KDE).
Add this to your vim configuration ~/.vimrc
" Use the system clipboard for yank / delete / paste operations
if has('unnamedplus')
set clipboard=unnamed,unnamedplus
endif
With this configuration vim copy/paste operations (in both directions) behave just like in any other graphical editor (the if has ('unnamedplus') assure that this behaviour is enabled only if vim is compiled with the +clipboard option otherwise behaves as default).
Note: on Windows and MacOS using unnamed or unnamedplus is equivalent.
On Linux are two different entities:
unnamed register is the selection buffer (try to select something with the mouse and then center click or click both sx and dx mouse buttons in another place).
unnamedplus register is actually the system clipboard
Issue is what the title says. Earlier I used to copy text from text files open in vim simply by selecting text and doing Ctrl + C. But now it puts me into visual mode, thus not allowing to copy the text. Its really annoying. Anybody knows any fix for this.
Thanks.
You probably have the mouse mode active. You can turn it off with:
:set mouse=
And turn it back on with
:set mouse=a
If you are using iTerm, you can leave mouse mode on all the time if you want, and hold Option when you want to select without using visual mode. I am not aware of a way to do that in OS X Terminal.
Update (from Younes in comments): For Terminal.app on El Capitan, press the Fn key to bypass the mouse mode. See this question for more.
I can't make it working, move line up or down doesn't work. When I reset keyboard for VS and applay scheme for Resharper it ask me for this :
and if I take first selection , then alt + up switch me between methods, if I use second selection then this combination does not effects.
Alt+Up is not a ReSharper shortcut to move a line. It most likely belongs to the Productivity Power Tools extension, that has a feature to move one or more (selected) lines.
Personally, I don't like this feature in PPT, since it will just move the line(s), regardless of their scope, causing compilation errors. I much rather use ReSharper's feature of moving blocks of code up or down, by pressing Ctrl + Shift + Alt + ↑/↓ or ←/→ - when on the beginning of the line, it will move the entire line or block of code, but can also be used to move entire methods, change the order of parameters, etc.
I ended up resetting my Resharper shortcuts. Then when prompted with the dialog, chose Use Visual Studio Commands for the Alt+Up & Alt+Down shortcut.
You could also set this manually in Tools > Options > Environment > Keyboard. Search for "MoveSelectedLines" and then assign Alt+Up/Down to the appropriate command.
On my machine with Resharper 2016.1 it makes a difference on what position the cursor is located:
cursor located from 1st to last character on the line: the shortcuts work as described by Igal Tabachnik
cursor located on white spaces before 1st characters of the line the shortcuts are ignored.
Regards
Bernhard