2013-08-27 43 views
1

我在vim撤消方面遇到了很多麻煩。我在〜/ .vimrc中設置了'nofofile',並附上了我工作目錄的屏幕截圖,這讓所有.un〜文件都變得非常煩人。這裏謝謝你的幫助!哪裏可以找到vim撤消設置以及如何關閉它們?

screen shot of a dir

下面是我的.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> 
+0

'當'undofile'關閉時,撤消文件不會被刪除.'你可以手動刪除這些un〜文件,並測試它們是否仍然由vim生成。 – Kent

+0

您不需要'filetype plugin on',因爲它已經由上面的行完成了。 – romainl

+1

我有點困惑,爲什麼只要用簡單的'ls'命令就可以看到這些文件。 Unix系統通常隱藏名稱以'。'開頭的文件,至少使用默認設置。 – Ben

回答

7

我個人喜歡持久性撤消功能。但是,您可以通過設置undodir來更改無菌文件的位置。

set undofile 
set undodir=$HOME/.vim/vimundo 

如果你這樣做,你必須確保$HOME/.vim/vimundo存在先通過運行

mkdir -p $HOME/.vim/vimundo 

(你仍然需要刪除舊的,但至少他們不再被塞滿了工作目錄)


如果需要,還可以對備份文件進行同樣的操作。 (:h backupdir


關於您的vimrc的其他說明。

exec pathogen#infect() 
... 
set runtimepath^=~/.vim/bundle/ctrlp.vim 

不應該需要的set runtimepath^=~/.vim/bundle/ctrlp.vim因爲病原體它應該已經追加到runtimepath。

而@romainl說filetype plugin on是多餘的。

+0

你的意見關於undofile非常感謝,重新設置ctrlp.vim嗯,不那麼肯定,在http://kien.github.io/ctrlp.vim/#installation指示鏡像我安裝它的方式,我錯過了什麼? – John

+0

@John如果你遵循那些指令ctrlp。vim是一個文件夾(顯然這是...我的錯誤)。那麼這條線是毫無意義的,因爲病原體已經將它添加到您的運行時路徑中。 (嘗試刪除該行並查看它是否仍然有效)(您也可以通過執行':set runtimepath'來查看它是否在運行時路徑中) – FDinoff

+0

儘管我喜歡該插件,但指令中的第2步完全是無意義的。 – romainl

3

:help 'undofile'

boolean (default off) 
[…] 
When 'undofile' is turned off the undo file is NOT deleted. 

所以......

  1. 你不需要set noundofile,因爲它默認是關閉的,所以你需要自己刪除所有這些文件。

  2. 你需要自己刪除所有這些文件。

相關問題