vimrc

开启以下功能会造成复制代码或文件时发生错位

set smartindent
"智能对齐
set tabstop=8
"设置tab宽度
set tabstop=4
"tab个数
set smarttab
"自动tab
set expandtab
"将tab键自动转换为空格
set shiftwidth=4
"设置自动对齐空格数
set softtabstop=4
"设置退格键时可以删除4个空格
filetype indent on
"针对不同的文件采取不同的缩进方式
filetype plugin indent on
"启动智能补全

使用以下俩行执行可临时关闭上述特效

set paste
"粘贴模式
set nopaste
"取消模式

一些很有趣的 vimrc 配置

"显示红竖
set colorcolumn=80
"持久撤销功能
set undofile
set undodir=~/.vim/undodir
"设置编码方式
set encoding=utf-8
"自动判断编码时 依次尝试以下编码
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
"允许插件
filetype plugin on
"检测文件类型
filetype on

原文地址:https://www.cnblogs.com/itxdm/p/vimrc.html