amix / vimrc

The ultimate Vim configuration (vimrc)
MIT License
30.66k stars 7.3k forks source link

Vimrc with tmux breaks Ctrl+Shift+V paste in normal mode #763

Open Gotoro opened 6 days ago

Gotoro commented 6 days ago

As described, vimrc mangles the paste when using Ctrl+Shift+V in normal mode. It consumes sometimes first 2 characters, sometimes much more as in the first screenshot and breaks all newlines and tabulation. When using insert mode, the characters are not consumed but newlines still break.

Upper vim is started with default vimrc + tmux. Lower vim is started with vim -u NONE (to start it default) + tmux. This is from my machine. I'm using Arch + alacritty + zsh (with oh-my-zsh) + tmux + vim + vimrc here. image

As you can see, the lower sections pastes correctly, doesn't consume characters, the newlines and tabulation exists as it should.

Experimentally I've determined this to be the problem with filetypes.vim configuration https://github.com/amix/vimrc/blob/46294d589d15d2e7308cf76c58f2df49bbec31e8/vimrcs/filetypes.vim#L66

Setting this to xterm-256color for example fixes the problem. Perhaps setting other settings here may help, I'm not too knowledgeable of what this does, aside from something to do with colors.

Here it's set to xterm-256color image

To determine whether this is a problem with my configuration, I've created a simple docker container which starts an arch machine, with everything needed to run vim + vimrc + tmux. Dockerfile.txt

FROM archlinux:latest
# Arch bootstrap as per container instructions
RUN pacman-key --init && \
pacman -Syu --noconfirm 

# Install packages
RUN pacman -S git curl tmux vim --noconfirm  

# Make tmux run on bash start
RUN echo "tmux" >> ~/.bashrc

# Install vimrc
RUN git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime && \
sh ~/.vim_runtime/install_awesome_vimrc.sh

# Run bash 
CMD ["bash"]

This one is inside the mentioned docker container. It breaks too, with minimal configuration. image

And finally, changing this to xterm-256color inside of the container makes it work. image

I've tried this with other terminals (namely kitty, konsole, gnome terminal) and shells (bash is used in the docker container) as well, so I'm excluding them from being culprits for now.

Gotoro commented 6 days ago

Update: setting termguicolors when vim is compiled with it fixes the problem #764