MacVim的第二行由tabstop和第一行关闭

我使用MacVim每天记下一些笔记。 第二行是在日期之后缩进8个空格(tabstop),如下所示。

Dec 15th (Sun):
        John got a minor injury while playing. Wanted to take him to a 
        doctor but it was late Sunday night. Only ER was open 
        during those hours which cost us a lot for a small issue.

我不想在第二行添加额外空间。 我希望它看起来像:

Dec 15th (Sun):
John got a minor injury while playing. Wanted to take him to a doctor 
but it was late Sunday night. Only ER was open during those hours which 
cost us a lot for a small issue.

如果完全停止,则不会发生此问题. 在第一行结尾。 到目前为止,这发生在(a)第一行结束时冒号(如本例中)(b)第二行是第一行的延续。

我的.vimrc文件:

"execute pathogen#infect()
call pathogen#infect() 

syntax on 
filetype plugin indent on 

"mappings 
"nmap  a=strftime("%Y-%m-%d %a %I:%M %p")
"imap  =strftime("%Y-%m-%d %a %I:%M %p")

nmap  a=strftime("[%I:%M%p]")
imap  =strftime("[%I:%M%p]")

set autoindent
set incsearch   " incremental search  
set hlsearch
set nu
set textwidth=74
set ruler       " show line & column # of cursor position. When there is
                " room, relative position of the text is shown w.r.t start
                " of file 

set timeoutlen=4000  " 4 sec timeout instead of default 1 sec for
                     " operations involving multiple keys such as tmux &
                     " screen

set mouse=a          " Allow mouse operations. Currently not working. 
set cindent          " Appropriate for c sntax. Look :help C-indenting   
set tabstop=8        " tab is 4 spaces long 
"set shiftwidth       " 
set expandtab        " replace tabs with 4 spaces 

"autocmd vimenter * NERDTree    " Load NERDTree whenever Vim starts 

set runtimepath^=~/.vim/bundle/ctrlp.vim " load CTRL-P plugin when Vim starts 

"set nocompatible      " by default

有人能让我知道如何解决这个问题吗?


你有两个:set autoindent ,后来:set cindent 。 后者覆盖前者,并对你所抱怨的行为负责,因为它错误地解释了text:作为标签。

如果您只想为某些文件类型启用选项,请使用:setlocal cindent ,并将相应的:setlocal命令放入~/.vim/after/ftplugin/<filetype>.vim ,其中<filetype>是实际的文件类型(例如c )。 (这要求你有:filetype plugin on ;使用after目录允许你覆盖由$VIMRUNTIME/ftplugin/<filetype>.vim完成的任何默认文件类型设置。)

或者,您可以直接在~/.vimrc定义一个:autocmd FileType <filetype> setlocal cindent ,但是一旦您有很多自定义设置,这往往会变得不便。

链接地址: http://www.djcxy.com/p/49523.html

上一篇: Second line in MacVim is off by tabstop w.r.t first line

下一篇: change status line colours in .vimrc?