The command p pastes below the cursor and P pastes above the cursor. What's the command to paste in the line where cursor is?
相关问题
- Emacs shell: save commit message
- How to change the first two uppercase characters o
- Insert text into current buffer from function
- Hot reload on save
- Substituting zero-width match in vim script
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- Auto-save in VIM as you type
- How can I use gcc's -I command to add recursiv
- NSMenuItem KeyEquivalent “ ”(space) bug
- Vim: overloaded mapping for multiple modes
- How to use relative line numbering universally in
- emacs terminal mode: how to copy and paste efficie
- How to copy the value of a vim option to a registe
(I know this thread is old, just leaving this and hope this may help someone)
Inspired by @wbg's comment above regarding deleting the line feed, I added these to my mappings:
nnoremap <leader>p :let @"=substitute(@", '\n\+$', '', '')<CR>p
inoremap <leader>p <esc>:let @"=substitute(@", '\n\+$', '', '')<CR>pa
This is useful when I have a file with some SQLs (line by line) and I have to yank into the code.
To paste in insert mode you just press Control+R. Then enter the register, e.g. Shift++.
To paste in command mode, you press P, however you've to make sure your line doesn't have a new line character (e.g. yanked by
0v$hy
), otherwise it'll appear above the cursor.The same for visual mode, see: How to paste a line in a vertical selection block? at Vim SE
The Edit menu in gvim lists the following:
Paste = "+gP
Put Before = [p
Put After = ]p
If you're running vim in Windows, you can do the following to get Ctrl+C and Ctrl+V to work as expected:
I needed to "cast" register contents into a certain (characterwise / linewise / blockwise) mode so often, I wrote the UnconditionalPaste plugin for it. It provides
gcp
,glp
, etc. alternatives to the built-in paste commands that force a certain mode (and by now several more variations on this theme, like pasting with joined by commas or queried characters).With it, you can just use
gcp
/gcP
to paste after / before the cursor position, regardless of how you've yanked the text.I'm not sure there is one. I tried to find documentation and ran across the following three documents:
Unfortunately, all three only have the two commands that you list. Particularly, the third link states that
The commands to paste are p and P...
divide the line into 2 wherever you want to insert
paste the section between them
merge the 3 lines with j as described here (Delete newline in Vim)
works, but tedious, and had to think about, look it up => vi and emacs are garbage software