Which .vimrc installation causes this weird copy-paste work?

I recently copied the copied .vimrc settings somewhere, and now I have this weird behavior when pasting text:

  • alt text

  • Ctrl + C

  • Shift + Insert

  • alt text

I thought it would be autoindent , but it is not.

What should be removed from my .vimrc to stop this behavior and enable a plain copy?


The error is somewhere in this part of my .vimrc:

 command -range=% -nargs=* Tidy <line1>,<line2>! \perltidy -your -preferred -default -options <args> vmap <tab> >gv vmap <s-tab> <gv nmap <tab> I<tab><esc> nmap <s-tab> ^i<bs><esc> let perl_include_pod = 1 let perl_extended_vars = 1 let perl_sync_dist = 250 filetype off set nocompatible set modelines=0 set tabstop=4 set softtabstop=4 set shiftwidth=4 set expandtab set ic set ai set nu command -range Cm <line1>,<line2>s/^/#/ command -range Uc <line1>,<line2>s/^#// set encoding=utf-8 set scrolloff=3 set autoindent set showmode set showcmd set hidden set wildmenu set wildmode=list:longest set visualbell set ttyfast set ruler set backspace=indent,eol,start set laststatus=2 let mapleader = "," nnoremap <leader>1 yypVr- nnoremap <leader>2 yypVr= set ignorecase set smartcase set gdefault set incsearch set showmatch set hlsearch set wrap set textwidth=79 set formatoptions=qrn1 nnoremap j gj nnoremap k gk nnoremap ; : nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR> nnoremap <leader>w <Cw>v<Cw>l syntax on set backup set backupdir=~/.vim/backup set directory=~/.vim/tmp set noerrorbells 
+4
source share
3 answers

before pasting, to avoid this behavior, you should :set paste before :set nopaste and :set nopaste after.

This is because the paste emulates typing. It is even worse if you insert indents.

This does not work if you use vim yanking (internal copy-paste).

+18
source

It is assumed that r in set formatoptions=qrn1 causes this behavior. But paste mode is more suitable when pasting well. Enter paste mode by specifying set paste and leave it by specifying set nopaste . help paste has information.

+3
source

In fact, you don’t even think about :set paste , since you can use the <Cr><Co>+ command in paste mode to make a raw paste from the clipboard.

+3
source

All Articles