Answer the question
In order to leave comments, you need to log in
How to fix the problem of pasting python/bash code into vim from clipboard into a window running tmux?
Working on Windows 10, Kitty 0.74.2.3 with remote Ubuntu 20.04
VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)
Included patches: 1-2269
tmux 3.0a
(this behavior is generally independent of neither from software versions nor from the name of the distribution kit, I just give an example on which the behavior described below is now 100% reproduced).
So, an paste operation from the buffer is often required, for example, the source code of a bash script or a small function in python. Vim itself highlights the syntax - based on the file extension, and this is where the "magic happens", if I paste from clipboard into Vim without TMUX, then everything is fine:
vim /tmp/test.py
, if inside the TMUX session, then the indents are moving apart:
vim /tmp/test.py
There are two workarounds that I use so far, the first is to use Nano to insert the source code or change the extension to txt for example (or not use tmux is the third, very bad way):
vim /tmp/test.txt
I.e. the problem is clearly in the "syntax highlighting in vim + tmux" combination - and when pasted into the buffer - the indents increase, the source code is corrupted, and moreover, if you forget, and the piece of code is quite large - the console can seriously freeze for several minutes.
Can you please tell me if there is an opportunity to change something in tmux / vim to eliminate such an unpleasant behavior?
Thank you.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question