下面是我的.vimrc,我希望expandtab可以处理所有提到的文件类型,除了显式禁用的make之外。et过去用作非文件类型的set命令,但是检测文件类型很重要。
" vundle Config
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-syntastic/syntastic'
Plugin 'Shougo/vimproc'
" All of your Plugins must be added before the following line
call vundle#end()
filetype on
filetype plugin on
filetype indent on
" Remove whitespace
autocmd BufWritePre * %s/\s\+$//e
autocmd FileType cpp,html,css set et paste tabstop=4 shiftwidth=4 backspace=2 matchpairs+=<:>
autocmd FileType haskell,go,js,erlang,vim,tex set et paste tabstop=4 shiftwidth=4 backspace=2
autocmd FileType make set noexpandtab paste shiftwidth=8 softtabstop=0
syntax on我所观察到的是,有些选项已经设定,有些则没有。扩展标签是我无法具体工作的。以下是:set在打开.vimrc文件(filetype=vim)时的输出。
backspace=2 filetype=vim keywordprg=:help paste shiftwidth=4 tabstop=4 ttymouse=sgr
commentstring="%s helplang=en laststatus=2 scroll=21 syntax=vim ttyfast发布于 2018-09-28 16:36:43
啊,这是个棘手的问题。看看:help 'paste'
当“粘贴”选项被打开时(也是在它已经打开时):
注意如何引入该选项:
如果您想从一个窗口剪切或复制一些文本并将其粘贴到Vim中,这是非常有用的。
此选项仅用于在粘贴到终端时临时启用。通常通过在'pastetoggle'选项中配置的密钥。(GVIM不需要它,它可以检测粘贴。如果启用了X选择和剪贴板,还可以使用*和+寄存器。)
补充意见
:filetype命令可以浓缩成一个filetype plugin indent on。:autocmds上,您将消除某些插件破坏它们的风险,您也可以安全地重新加载您的~/.vimrc,而无需定义重复项:augroup myCustomizations
autocmd!
autocmd ...
augroup ENDhttps://stackoverflow.com/questions/52558676
复制相似问题