1

私はvim undoで多くの問題を抱えています。~/.vimrc に 'set 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>
4

3 に答える 3

7

私は個人的に永続的な元に戻す機能が好きです。ただし、設定によって undofile の場所を変更できます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病原体はすでにランタイムパスに追加されているはずなので、必要ありません。

@romainlが言うようfiletype plugin onに、冗長です。

于 2013-08-27T15:45:30.627 に答える
3

から:help 'undofile':

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

そう…</p>

  1. set noundofileデフォルトではオフになっているため、その必要はありません。

  2. これらのファイルはすべて自分で削除する必要があります。

于 2013-08-27T15:13:13.580 に答える