2016-03-22 10 views

cevap

0

BufNew çalışması gerekir bulamadık:

Sadece yeni bir tampon oluşturduktan sonra. Ayrıca bir arabellek yeniden adlandırıldıktan sonra da kullanılır. Arabellek arabellek listesine eklendiğinde BufAdd da tetiklenir. Bu bana bir hata verir ve ben :e1 ne zaman geçerli tampon olduğu gibi bırakır

autocmd BufNew [1]* throw 'Forbidden file name: ' . expand('<afile>') 

.

0

Sadece parmakla yazılmış komutlarınızı otomatik olarak düzeltmiyorsunuz? http://vim.wikia.com/wiki/Replace_a_builtin_command_using_cabbrev:

" command to define abbreviation that only affects first typed word in the 
" command line 
command! -nargs=+ CommandCabbr call CommandCabbr(<f-args>) 

" helper function to create command-line abbreviations 
function! CommandCabbr(abbreviation, expansion) 
    if exists('*getcmdpos') 
    if exists('*getcmdtype') 
     " only expand when on COMMAND line and at first position 
     execute "cabbrev ".a:abbreviation. 
      \' <c-r>=getcmdpos() == 1 && getcmdtype() == ":" ? "'. 
      \escape(a:expansion,'"\').'" : "'. 
      \escape(a:abbreviation,'"\').'"<CR>' 
    else 
     " can't test command line, but only expand at first position 
     execute "cabbrev ".a:abbreviation. 
      \' <c-r>=getcmdpos() == 1 ? "'. 
      \escape(a:expansion,'"\').'" : "'. 
      \escape(a:abbreviation,'"\').'"<CR>' 
    endif 
    else 
    " fall back to always expanding :-(
    execute "cabbrev ".a:abbreviation." ".a:expansion 
    endif 
endfunction 

CommandCabbr w1  w! 
CommandCabbr [email protected] w! 
CommandCabbr [email protected]! w! 
CommandCabbr w!~ w! 
CommandCabbr w~! w! 
CommandCabbr [email protected]  w! 
CommandCabbr w~  w! 
" etc. 
İlgili konular