I recently copy-pasted a bunch of .vimrc settings from somewhere, and now I have this weird behaviour on text copy paste:
Ctrl + C
Shift + Insert
I thought it would be autoindent
but it is not.
What should I remove from my .vimrc to stop this behaviour and enable normal copy paste?
The fault 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 <C-w>v<C-w>l
syntax on
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set noerrorbells
before pasting, to avoid such behavior you should :set paste
before pasting and :set nopaste
after.
This is because the paste emulate the typing. It's even worst when you paste indented text.
This doesn't surface if you use the vim's yanking (internal "copy-paste").
The r
in set formatoptions=qrn1
is supposed to cause this kind of behaviour. But paste
mode is more suited to, well pasting. Enter paste
mode by giving set paste
and leave it by giving set nopaste
. help paste
has information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With