在哪里找到vim撤消设置以及如何关闭它们?

Joh*_*ohn 1 vim

我在使用vim时遇到了很多麻烦.我在我的〜/ .vimrc中设置了'noundofile'并附加了我工作目录的屏幕截图,所有的.un~文件到处都是超级烦人的.这里有点帮助谢谢!

屏幕截图的目录

下面是我的.vimrc

set nocompatible
exec pathogen#infect()
filetype plugin indent on
filetype plugin on
"syntax enable
syntax on
set background=light
set noundofile
let g:solarized_termtrans = 1
colorscheme solarized
set number
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
vnoremap < <gv
vnoremap > >gv
set runtimepath^=~/.vim/bundle/ctrlp.vim
autocmd FileType ruby set ft=ruby.rails
autocmd Filetype ruby setlocal ts=2 sts=2 sw=2
set nobackup      " no backup files
set nowritebackup " only in case you don't want a backup file while editing
set noswapfile    " no swap files
set clipboard=unnamed " use Mac clipboard for yank/paste/etc.
" expand %% to file dir
cnoremap %% <C-R>=expand('%:h').'/'<cr> 

set autoindent    " always set autoindenting on
set copyindent    " copy the previous indentation on autoindenting
set shiftround    " use multiple of shiftwidth when indenting with '<' and '>'
set smarttab      " insert tabs on the start of a line according to
                  "    shiftwidth, not tabstop
set ts=2 sts=2 sw=2 expandtab "set two spaces by default

autocmd Filetype javascript setlocal et ts=2 sts=2 sw=2
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS

autocmd Filetype html setlocal et ts=2 sts=2 sw=2
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags

autocmd Filetype css setlocal et ts=2 sts=2 sw=2
autocmd FileType css set omnifunc=csscomplete#CompleteCSS


au BufRead,BufNewFile *.hamlc set ft=haml

" Vim-pasta Settings
let g:pasta_disabled_filetypes = ['python', 'coffee', 'yaml']


" Indent Guide Settings
autocmd FileType html,css,ruby,eruby,javascript,php,xml,haml call indent_guides#enable()
set mouse=a
imap <C-l> <Space>=><Space>
"Make hashrocket with control-l
nmap <silent> <Leader>q :NERDTreeToggle<CR>
Run Code Online (Sandbox Code Playgroud)

FDi*_*off 7

我个人喜欢持久的撤消功能.但是,您可以通过设置更改undofiles所在的位置undodir.

set undofile
set undodir=$HOME/.vim/vimundo
Run Code Online (Sandbox Code Playgroud)

如果这样做,您必须$HOME/.vim/vimundo首先通过运行确保存在

mkdir -p $HOME/.vim/vimundo
Run Code Online (Sandbox Code Playgroud)

(你仍然需要删除旧的,但至少他们不再混乱工作目录)


如果需要,您也可以对备份文件执行相同操作.(:h backupdir)


关于你的vimrc的其他说明.

exec pathogen#infect()
...
set runtimepath^=~/.vim/bundle/ctrlp.vim
Run Code Online (Sandbox Code Playgroud)

set runtimepath^=~/.vim/bundle/ctrlp.vim不应该需要的,因为病原体它应该已经追加到runtimepath.

正如@romainl所说的那样filetype plugin on多余.