簡體   English   中英

Vim自動縮進在8.0.1097中不起作用

[英]Vim autoindent does not work in 8.0.1097

我在vim 8.0.1097和vim 7.4上具有相同的vim設置,但自動縮進行為有所不同:

在vim 8中:

if [ "$u" != "root" ]
    then
        a
        b
        c
        fi

在Vim 7中,它可以正常工作。

Vim 8 :set顯示:

--- Options ---
  autoindent          commentstring=#%s   hidden              incsearch           matchtime=2         scrolloff=7         smartcase           tabstop=4           ttymouse=xterm      t_vb=
  background=dark     expandtab           history=700         laststatus=2        modified            shiftwidth=4        smarttab            textwidth=79        viminfo=%,'20,"50
  cindent             filetype=sh         hlsearch            lazyredraw          ruler               showmatch         noswapfile            timeoutlen=500      wildmenu
  cmdheight=2         helplang=en         ignorecase          linebreak           scroll=31           showtabline=2       syntax=sh           ttyfast           nowritebackup
  backspace=eol,start,indent
  completeopt=menuone,longest,preview
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,latin1
  fileformats=unix,dos,mac
  grepprg=grep -nH $*
  guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block,a:blinkon0
  indentexpr=GetShIndent()
  indentkeys=0{,0},!^F,o,O,e,0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,0=end,),0=;;,0=;&,0=fin,0=fil,0=fip,0=fir,0=fix
  runtimepath=~/.vim,~/.vim/bundle/ctrlp,~/.vim/bundle/indentLine,~/.vim/bundle/javacomplete,~/.vim/bundle/jedi-vim,~/.vim/bundle/nerdcommenter,~/.vim/bundle/nerdtree,~/.vim/bundle/supertab,~/.vim/bundle/syntastic,~/.vim/bundle/vim-fugit
ive,~/.vim/bundle/vim-repeat,~/.vim/bundle/vim-surround,~/.vim/bundle/vim-tmux-navigator,~/.vim/bundle/vim-trailing-whitespace,/usr/share/vim/vimfiles,/usr/share/vim/vim80,/usr/share/vim/vimfiles/after,~/.vim/bundle/jedi-vim/after,~/.vim
/bundle/indentLine/after,~/.vim/after
  statusline= %{HasPaste()}%F%m%r%h %w  CWD: %r%{getcwd()}%h   Line: %l Column: %c
  switchbuf=useopen,usetab,newtab
  whichwrap=b,s,<,>,h,l
  wildignore=*.o,*~,*.pyc

vim 7.4 :set顯示:

--- Options ---
  autoindent          commentstring=#%s   filetype=sh         hlsearch            lazyredraw          scroll=31           showtabline=2       syntax=sh           ttyfast           nowritebackup
  background=dark     cscopetag           helplang=en         ignorecase          linebreak           scrolloff=7         smartcase           tabstop=4           ttymouse=xterm      t_vb=
  cindent             cscopeverbose       hidden              incsearch           matchtime=2         shiftwidth=4        smarttab            textwidth=79        viminfo=%,'20,"50
  cmdheight=2         expandtab           history=700         laststatus=2        ruler               showmatch         noswapfile            timeoutlen=500      wildmenu
  backspace=eol,start,indent
  completeopt=menuone,longest,preview
  cscopeprg=/usr/bin/cscope
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,latin1
  fileformats=unix,dos,mac
  grepprg=grep -nH $*
  guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block,a:blinkon0
  indentexpr=GetShIndent()
  indentkeys=0{,0},!^F,o,O,e,0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,),0=;;,0=;&,0=fin,0=fil,0=fip,0=fir,0=fix
  iskeyword=@,48-57,_,192-255,.
  runtimepath=~/.vim,~/.vim/bundle/ctrlp,~/.vim/bundle/indentLine,~/.vim/bundle/javacomplete,~/.vim/bundle/jedi-vim,~/.vim/bundle/nerdcommenter,~/.vim/bundle/nerdtree,~/.vim/bundle/supertab,~/.vim/bundle/syntastic,~/.vim/bundle/vim-fugit
ive,~/.vim/bundle/vim-repeat,~/.vim/bundle/vim-surround,~/.vim/bundle/vim-tmux-navigator,~/.vim/bundle/vim-trailing-whitespace,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,~/.vim/bundle/jedi-vim/after,~/.vim
/bundle/indentLine/after,~/.vim/after
  statusline= %{HasPaste()}%F%m%r%h %w  CWD: %r%{getcwd()}%h   Line: %l Column: %c
  switchbuf=useopen,usetab,newtab
  whichwrap=b,s,<,>,h,l
  wildignore=*.o,*~,*.pyc

區別是:

     --- Options ---
-      autoindent          commentstring=#%s   hidden              incsearch           matchtime=2         scrolloff=7         smartcase           tabstop=4           ttymouse=xterm      t_vb=
-      background=dark     expandtab           history=700         laststatus=2        modified            shiftwidth=4        smarttab            textwidth=79        viminfo=%,'20,"50
-      cindent             filetype=sh         hlsearch            lazyredraw          ruler               showmatch         noswapfile            timeoutlen=500      wildmenu
-      cmdheight=2         helplang=en         ignorecase          linebreak           scroll=31           showtabline=2       syntax=sh           ttyfast           nowritebackup
+      autoindent          commentstring=#%s   filetype=sh         hlsearch            lazyredraw          scroll=31           showtabline=2       syntax=sh           ttyfast           nowritebackup
+      background=dark     cscopetag           helplang=en         ignorecase          linebreak           scrolloff=7         smartcase           tabstop=4           ttymouse=xterm      t_vb=
+      cindent             cscopeverbose       hidden              incsearch           matchtime=2         shiftwidth=4        smarttab            textwidth=79        viminfo=%,'20,"50
+      cmdheight=2         expandtab           history=700         laststatus=2        ruler               showmatch         noswapfile            timeoutlen=500      wildmenu
       backspace=eol,start,indent
       completeopt=menuone,longest,preview
+      cscopeprg=/usr/bin/cscope
       fileencoding=utf-8
       fileencodings=ucs-bom,utf-8,latin1
       fileformats=unix,dos,mac
       grepprg=grep -nH $*
       guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block,a:blinkon0
       indentexpr=GetShIndent()
-      indentkeys=0{,0},!^F,o,O,e,0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,0=end,),0=;;,0=;&,0=fin,0=fil,0=fip,0=fir,0=fix
+      indentkeys=0{,0},!^F,o,O,e,0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,),0=;;,0=;&,0=fin,0=fil,0=fip,0=fir,0=fix
+      iskeyword=@,48-57,_,192-255,.
       runtimepath=~/.vim,~/.vim/bundle/ctrlp,~/.vim/bundle/indentLine,~/.vim/bundle/javacomplete,~/.vim/bundle/jedi-vim,~/.vim/bundle/nerdcommenter,~/.vim/bundle/nerdtree,~/.vim/bundle/supertab,~/.vim/bundle/syntastic,~/.vim/bundle/vim-fugit
-    ive,~/.vim/bundle/vim-repeat,~/.vim/bundle/vim-surround,~/.vim/bundle/vim-tmux-navigator,~/.vim/bundle/vim-trailing-whitespace,/usr/share/vim/vimfiles,/usr/share/vim/vim80,/usr/share/vim/vimfiles/after,~/.vim/bundle/jedi-vim/after,~/.vim
+    ive,~/.vim/bundle/vim-repeat,~/.vim/bundle/vim-surround,~/.vim/bundle/vim-tmux-navigator,~/.vim/bundle/vim-trailing-whitespace,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,~/.vim/bundle/jedi-vim/after,~/.vim
     /bundle/indentLine/after,~/.vim/after
       statusline= %{HasPaste()}%F%m%r%h %w  CWD: %r%{getcwd()}%h   Line: %l Column: %c
       switchbuf=useopen,usetab,newtab

前4個差異實際上只是順序不同,項目數是相同的。 我試圖手動設置cscopeprg以匹配vim 7.4的值,這沒有什么區別。

我不明白我的vim配置可能會導致這種行為。

我的插件列表(全部為最新): ctrlp indentLine javacomplete jedi-vim nerdcommenter nerdtree supertab syntastic vim-fugitive vim-repeat vim-surround vim-tmux-navigator vim-trailing-whitespace

我還嘗試刪除了所有插件,而vim 8仍然出現故障。

使用降級方法,我將vim重新安裝到8.0.662和8.0.1030,打字過程中的縮進效果很好。 我認為較新版本的vim有一個錯誤。

這種行為確實是由於8.0.1041版本中引入的Vim中的錯誤 ,此錯誤已在8.0.1154版本中修復 您應該能夠通過從上游升級到最新版本來解決此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM