I want to insert text say ; after the cursor in Vim visual mode.
Jan
Feb
Mar
Ctrl + V --> jj --> Shift + i results in
Ja;n
Fe;b
Ma;r
Just like i inserts before the cursor and a inserts after the cursor in normal mode, Shift+a inserts after the cursor in visual block mode.
Related
gVim 8.0
When I press Ctrl+V in insert mode (or in Ctrl+: mode) I got this v-like symbols inserted instead of my current clipboard text.
Why does it happen? How do I get it back to normal?
Thank you.
CTRL-V means "Insert next non-digit literally." I.e. if you press Ctrl-V twice vim inserts "CTRL-V" into the text and displays it as "^V".
To paste a buffer switch to normal mode and use p or P. You can temporary switch to normal mode with Ctrl-O; e.g. Ctrl-Op.
The problem was caused by the omission of this line: source $VIMRUNTIME/mswin.vim from _vimrc file.
If you are on insert mode use Ctrl-r + .
Looking at :h registers you will see that + means clipboard register and Ctrl-r helps us to insert any register on insert mode.
In normal mode you can just type: "+p
As being said Ctrl-v on insert mode is used to insert special chars. To learn more :h i_Ctrl-v
*i_CTRL-V*
CTRL-V Insert next non-digit literally. For special keys, the
terminal code is inserted. It's also possible to enter the
decimal, octal or hexadecimal value of a character
|i_CTRL-V_digit|.
The characters typed right after CTRL-V are not considered for
mapping.
Note: When CTRL-V is mapped (e.g., to paste text) you can
often use CTRL-Q instead |i_CTRL-Q|.
In vim I would like to create a key map for gp in normal mode so that it switches to insert mode and simulate the shift+insert key press and goes back to normal mode.
here is what I tried:
nmap gp i<S-Insert><esc>
All it does is insert the text <S-Insert> instead of pressing executing shift+insert.
I've looked at Paste in insert mode? but the I can't get the contents of what I'm pasting from a buffer.
You have to enter the control characters directly. You do this by pressing <C-V><Wanted Character> in insert mode.
For more on this see i_CTRL-V.
I'm trying to map ALT+m to Esc in Vim, to exit insert mode. I've tried with:
map <A-m> <Esc>
but it is not working as expected (i.e. it exits insert mode, but the next key pressed is ignored). That's because, apart from exiting insert mode, m gets "pressed" or executed as well (i.e. if i remap ALT+j to Esc instead, then apart from exiting insert mode, it will jump to the next line).
Is there any way to map ALT+m to Esc in insert mode without having other side-effects? (avoiding to execute m after exiting insert mode)
Using Fedora 21 (GNU/Linux distribution), with GNOME Terminal 3.14.3 and VIM - Vi IMproved 7.4.
inoremap <Esc>m <Esc>
Is there a method in OS X such that Vim will enter insert mode automatically and copy text, instead of having to enter insert mode first and press command + V?
Or more generically, how to map command keys in Vim in OS X? I use command line Vim, not MacVim.
Add this to your vimrc:
nnoremap <c-v> p:startinsert!<cr>
This will insert your clipboard content and place the cursor after the inserted text and change to insert mode.
But why you want insert mode altogether? Just press p in normal mode!
I want to change the shortcut for visual block from Ctrl-v to something else. The issue is I am using a text expansion program on my base OS that is using the Ctrl-V shortcut for paste into my VNC session. If I change my paste shortcut in my VNC OS then my text expansion doesn't work.
Currently if I press Ctrl-v in vim then it pastes text, and if I press Ctrl-q then nothing happens. What is the easiest way to get my visual block functionality back without losing my text expansion, likely by changing the shortcut for visual block?
You can remap it. I use line-wise visual mode more often than “character-wise,” so I have this in my ~/.vimrc:
nnoremap v V
nnoremap V v
You could do something similar with Ctrl-v:
nnoremap v <c-v> " remap `v` to `Ctrl-v`