All Questions
Tagged with paste or cut-copy-paste
55 questions with no upvoted or accepted answers
7
votes
2
answers
835
views
How to exit insert mode if pressing escape merely types "^["?
I have neovim 0.4.2 running in a session of kiTTY 0.17.4 on OSX. I have pasted a long url while in insert mode.
After doing this, every time I type BKSPC vim adds ^? to my document. Every time I type ...
6
votes
0
answers
198
views
How to copy text to X primary selection only when visual mode is started with the mouse?
At the moment, if I use Visual mode, whenever I select a block of text using the keyboard it ends up on my X primary selection (ie the clipboard that is filled using the mouse). Even if I just select ...
5
votes
0
answers
533
views
How to copy to system clipboard using Mosh + Tmux?
I've set vim.opt.clipboard = "unnamedplus" to copy to/paste from the system clipboard. However, I noticed that the behavior differs whether I'm using nvim in my local machine, a remote ...
4
votes
0
answers
254
views
Pasting from vim to an ipython terminal
I have an open ipython terminal open, and I'd like to paste the visual selection to it, with prepending "%cpaste" and appending "--"
This is what I came up with
function! ...
4
votes
0
answers
1k
views
"^[[201~" character being pasted at the end of file
I'm trying to copy-paste by hand this file, but whenever I paste the contents in vim the last line shows this weird character at the end of the line ^[[201~.
My guess is that it's one of those wrong ...
4
votes
0
answers
1k
views
Vim adding blank line after each line when pasting from clipboard
When I copy-paste multiple lines from clipboard into my vim, it inserts a blank line after every line. But when I copy in into a text editor first and then copy-paste it into vim, the blank lines are ...
4
votes
0
answers
1k
views
Cursor position after pasting
I believe the default behaviour in vi(m) for pasting (p) or (P) was to leave the cursor at the current position as before pasting, and in order to paste a register and have the cursor be at the end of ...
3
votes
0
answers
252
views
Store the current filename in a given register
When I exchange with colleagues about the code, when I refer to given functions, I like to also mention the file.
Since this exchange does not usually take place within vim, I usually copy them out ...
3
votes
0
answers
290
views
While copying a file in netrw, why should I be in the directory where the file is located?
In netrw, I want to copy a file /dir/subdir1/file.txt to /dir/subdir2. For that, I do the following:
I mark the file /dir/subdir1/file.txt
I navigate up directory and mark /dir/subdir2/ as target
...
3
votes
0
answers
193
views
how to delete a paragraph respecting the folds?
I have a file (filetype=javascript), this is how it looks without folds:
and with folds:
I can move with the { and } motions skipping the empty lines inside the folds (thanks to these question and ...
2
votes
0
answers
150
views
How to paste line but preserve the cursor position?
I want to achieve following. Imagine I have a line of code, say:
std::cout << "STEP #0" << "\r\n";
Now I want to paste it somewhere else, but I want to stay cursor in ...
2
votes
0
answers
788
views
Copy all text in Vi and then paste it to another application on another system
I connect to Linux server via SSH using Putty terminal.
I open a file with Vim and press ggVGy in order to select all text and copy it.
But when I try to paste the copied text to Windows Notepad, it ...
1
vote
1
answer
85
views
Problems using Vim to yank to clipboard
I can't seem to yank to clipboard within Vim on Ubuntu (Windows Subsystem for Linux). I am pressing "+y and it's giving me the regular X lines yanked, instead of X lines yanked into "+ to ...
1
vote
0
answers
69
views
Pasting into vim over ssh repeats or drops 6 characters at random
When I SSH into a remote Ubuntu container on a particular system and open vim, I cannot paste consistently. Say I copy the string abcdefghijklmnopqrstuvwxyz to my clipboard. If I open vim, enter ...
1
vote
0
answers
179
views
How to override neovim paste implementation?
I wanted to add some handler that is triggered whenever a paste happened. From what I know, there is no such a thing like autocmd for paste action. I have look into some possible solution such as ...
1
vote
0
answers
155
views
The most lazy way to call the vim-copied content into bash
Setting in my .vimrc:
set clipboard=unnamedplus
Supporting in my vim:
vim --version | grep clipboard
+clipboard +jumplist +popupwin +user_commands
+ex_extra -...
1
vote
0
answers
91
views
Delete javascript backtick string
In Javascript you can write multiline strings like this:
s=`hello
world`
I would like to delete/yank the inside of the string by pressing di` etc., however that doesn't work. What do I have to add to ...
1
vote
0
answers
340
views
Copy text from terminal and paste to Vim while preserving text color
Is there a way to copy colored text from terminal and paste it as colored into vim?
I am on MacOS, using iTerm2 Build 3.4.4beta3, and the following Vim version:
% vim --version
VIM - Vi IMproved 8.2 (...
1
vote
0
answers
167
views
How to bind <C-U> to <Cmd><BS> in vimrc?
I understand that <C-W> is backward-kill-word and I have bound this to shiftBS and it works.
But now I want to bind <C-U> to cmdBS. Is this possible? If so, how can I do this?
1
vote
0
answers
43
views
losing random chars when pasting (insert mode + :set paste are set)
When pasting a huge text (10,000 lines, around 500KB) in vim (yes, I'm using insert mode and :set paste), I lose random characters every few lines. I thought it could be a plugin, so I tried starting ...
1
vote
0
answers
92
views
Preview previously yanked text before put
I know that previous yanks are kept in numbered yank registers, a preview available with :registers. However this requires to keep a mental model which yank went where, with these numbers ever ...
1
vote
0
answers
231
views
Update OS enviroment variables from inside VIM
I use vim inside tmux over an ssh session and I often run into the issue where the $DISPLAY variable gets changed, screwing up my copy-paste.
When I log in, $DISPLAY gets assigned to something new: ...
1
vote
0
answers
490
views
Disable paste mode entirely
I get what paste mode does for you, but I have never found it particularly useful. I would like to completely deactivate it. I don't see an option to do so when looking at :help paste. However, I ...
1
vote
0
answers
42
views
Yanking a visual block with word wrap enabled is shifted
Say I have a file with the following contents (on a single line):
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed augue ligula, venenatis et orci non, convallis congue nunc. Nam eleifend ...
1
vote
0
answers
572
views
linux: yank to clipboard, cut to primary
I'm using neovim. I want to map the 0 register to the system clipboard and the unnamed register to the system primary (mouse middle click). Is it possible? I can map the unnamed register to primary ...
0
votes
0
answers
22
views
Paste clipboard linewise if it has new lines, or characterwise if it does not
I would like to remap all paste commands to take these special actions before pasting the system clipboard "+ register:
if the register is not "+, paste according to default behaviour
...
0
votes
0
answers
35
views
Errors when copying and pasting text using gVim under Windows 11
I have a reoccurring problem when using Ctrl c and Ctrl v between two files opened in gVim Version 9.1.
When I copy a portion of text from file 1 and then paste it in file 2 I get various "extra&...
0
votes
0
answers
19
views
Multiline graphical table to seperate lines
I have a (very large) variable width table, something like this:
1
-----------------
2 | 3 | 4 |
| | ---- | ...
0
votes
1
answer
74
views
Vim visual block copy don't paste in KDE konsole
Selecting by visual line mode and copying (V and y) in vim in rxvt-unicode or in gnome-terminal and pasting in another tab of that terminal with Shift + Insert works well.
But trying to do the same ...
0
votes
1
answer
56
views
Yank across multiple lines with single line breaks
I can use the following to yank text inside of quotes across multiple lines, separate that text by a single new line, and be able to paste it characterwise.
let @q = '' | *g/^/exe 'norm! "Qyi&...
0
votes
0
answers
80
views
Behavior of copy/paste with system register + has suddenly changed
(Vim version and system info follows at bottom)
Never had any problems copying to the system register with "+y before, nor pasting from that register into another application or into a terminal. ...
0
votes
1
answer
1k
views
Pasting from system clipboard adds an unwanted new line
On windows, using neovim, with clipboard=unnamedplus , when I paste from the system clipboard using p or :put , it will always paste in a newline , even if the content of the clipboard has no newline. ...
0
votes
0
answers
52
views
Why does <esc> on empty, indented line, jump to beginning?
I'm trying to do something very simple, enter normal mode and ALWAYS be able to somehow put the normal mode cursor where it was in insert mode, whether through a mark, or otherwise.
I'm doing this ...
0
votes
0
answers
335
views
Copy to android system clipboard in nvim from termux
I use Neovim on termux on android 11
I commonly use :y to yank/copy text to nvim clipboard
Then paste it to another files
Recently I've tried using helix-editor(hx) looks and feels so similar to ...
0
votes
0
answers
150
views
How to search for yanked text in a macro?
How do I search for yanked text in a macro properly?
I tried the following:
qq (start a macro)
yi" (yank text inbetween ", let's say the yanked text is foo)
/
press ctrl + r
" (I ...
0
votes
0
answers
61
views
What's controlling Vim paste behaviour?
What's controlling Vim paste behaviour via Vim over ssh using putty with right-click paste set to Linux host?
To start we have:
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 27 2023 00:00:00)
...
0
votes
1
answer
504
views
Neovim saving yanked text to file with TextYankPost
I'm trying to write some functionality in neovim to make it possible to yank + paste between neovim instances. The approach is to intercept yanked text and write it to a temporary file, then remap ...
0
votes
2
answers
52
views
Copy text from all folds, excluding titles
How do I copy all lines from all folds, excluding the fold titles?
0
votes
0
answers
84
views
Yank paste not working after trying to map clipboard to register
I tried making clipboard work with yank paste. And now for some reason normal V+y and p doesn't work as intended anymore.
for example:
{
pb.push(to_string(pb.top()).size());
pb.pop();
}
...
0
votes
0
answers
591
views
Pasting via vim doesn't paste whole text and gets stuck in the insert paste mode
For a while now, I've been dealing with a problem where when pasting a large amount of text, such as the code in this gist, into a file via vim, only part of the copied text gets pasted, then stops ...
0
votes
1
answer
116
views
somehow paste to random location ... tell vim to always ignore any roller actions from mouse middle roller button
I have been using vi or vim for many years however recently ( past year or two ) when I paste some highlighted text vim seems to paste highlighted text ( more often than not ) to random location in ...
0
votes
3
answers
1k
views
Vim copy/paste from clipboard while keeping indentation
I am using Putty on Windows to connect to a Linux server.
On the Linux server I am using Vim to edit code files.
I am using my mouse to select an area to copy and then right click to paste the copied ...
0
votes
2
answers
459
views
Output of paste into Vim truncated
I am having issues with pasting text from the clipboard into Vim (v7.4) on an HPC cluster using Centos, which I have logged into using MTPuTTY. I still get the same error when I'm logging in via ...
0
votes
0
answers
206
views
How to paste append and verical aligment multiple lines text in vim?
Is there any convenient way to format text block-1 to block-2 by vim?
block-1
#include <stdio.h>
#include "math.h"
#include <iostream>
#include <fstream>
#include <...
0
votes
0
answers
420
views
Yanking to system clipboard does not work
I'm on Ubuntu 20.04.3 LTS, I have +clipboard and +xterm_clipboard in my vim --version, and I have set set clipboard=unnamedplus in my .vimrc.
For some reason, yanking still does not copy to the system ...
0
votes
0
answers
35
views
Creating vimrc kills my plugin
I have the following ~/.vim/filetype.vim:
augroup filetypedetect
au BufRead,BufNewFile *?Script.sml let maplocalleader = "h" | source /home/gergely/HOL/tools/vim/hol.vim
" recognise ...
0
votes
0
answers
334
views
Why does PASTE mode mess up my text sometimes?
If I go to this web page on my MacOS, hit Command+A to highlight all the text, Command+C to copy it, open vim, enter insert mode, and paste with Command+V, it looks like:
If I do exactly the same ...