2015-09-24 45 views
2

我創造了這個Vim命令:選項卡完成我的vim的命令不工作

command! -complete=file E vsplit | wincmd l | e 

當我通過這個

:E <Tab> 

它工作正常使用它。但是,當我要比較完整的主目錄路徑,它顯示^我爲每個標籤擊:

:E ~/<TAB> 
# shows as: 
:E ~/^I 

爲:e命令選項卡完成的作品好。

回答

2

你需要指定幾個參數:

command! -complete=file -nargs=? E vsplit | wincmd l | e <args> 

:h :command-nargs

但是您要重新創建已存在:vsplit命令,並使用'splitright'設置。將set splitright放在您的vimrc中,現在您可以直接使用:vsplit

:set splitright 
:vsp foo.txt 

如果你不喜歡設定'splitright'那麼你可以使用:rightbelow。例如:

:rightb vsp foo.txt 

如需更多幫助,請參見:

:h 'splitright' 
:h :vsp 
:h :command-nargs 
:h :rightbelow