自從第一天使用Vim 3年以來,這個避風港一直在困擾着我。每當我試着通過轉移到縮進一行 + 當行的第一個字符用「#」,它不能在所有的工作,無論文件類型(.PHP,.TXT等開始> )。因爲#用於在PHP評論,我還用它裝飾的文本文件類似:當該行的第一個字符是一個尖銳的#字符時,Vim編輯器縮進問題
# This is a comment ### 1. Instruction one # ------------ this is an sample --------------
我用Vim 7.2在Ubuntu具有以下.vimrc
設置
syntax on
set t_Co=256
set incsearch
set hlsearch
set number
set nowrap
set nowrapscan
set ignorecase
set et
set sw=4
set smarttab
set smartindent
set autoindent
set textwidth=0
set noequalalways
set formatoptions=1
set lbr
set vb
set foldmethod=marker
謝謝!
這並不能解決我的問題。我有'nosmartindent'和'filetype indent on',但仍然vim不讓我縮進以'#'開頭的行。當我在行中輸入'#'作爲第一個字符時,它也會將光標移動到第一列。任何線索? – 2013-04-15 11:16:31
@MichaelHärtl默認情況下,我有你完全相同的問題。默認情況下,Rmd具有這種惱人的行爲,切換此行爲的正確咒語是:':set nocindent'將其關閉,':set cindent'將它關閉在此處定義如下:http://vim.wikia.com/wiki/Restoring_indent_after_typing_hash – 2017-04-15 07:59:17