MacVim中的第二条线由tabstop w.r.t第一条线关闭
我每天用MacVim记下一些笔记。第二行在日期后缩进8个空格(tabstop),如下所示MacVim中的第二条线由tabstop w.r.t第一条线关闭,vim,macvim,Vim,Macvim,我每天用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 s
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
“执行病原体#感染()
叫病原体#传染()
语法
文件类型插件缩进
“映射
“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]”)
自动缩进
设置incsearch“增量搜索”
高亮显示
显示行号
设置textwidth=74
设置标尺“显示光标位置的线和列”。当有
“房间,文本的相对位置显示为w.r.t开始
“文件
设置timeoutlen=4000“4秒超时,而不是默认的1秒超时
“涉及多个键的操作,如tmux&
“屏幕
设置鼠标=允许鼠标操作。目前不工作。
将cindent设置为适用于c sntax。查看:帮助c缩进
设置tabstop=8“制表符长度为4个空格
“设置移位宽度”
设置expandtab“将选项卡替换为4个空格
每当Vim启动时,“autocmd VimCenter*NERDTree”加载NERDTree
设置runtimepath^=~/.vim/bundle/ctrlp.vim“在vim启动时加载CTRL-P插件
默认情况下“设置不兼容”
有人能告诉我怎么解决这个问题吗 您既有
:设置自动缩进
,也有更高版本的:设置cindent
。后者覆盖前者,并对您抱怨的行为负责,因为它错误地将文本:
解释为标签
如果您只想为某些文件类型启用一个选项,请改用:setlocal cindent
,并将相应的:setlocal
命令放入~/.vim/after/ftplugin/.vim
,其中
是实际的文件类型(例如c
)。(这要求您在上有:filetype plugin;使用after目录可以覆盖由$VIMRUNTIME/ftplugin/.vim
完成的任何默认文件类型设置)
或者,您可以直接在~/.vimrc
中定义:autocmd FileType setlocal cindent
,但一旦您进行了许多自定义,这往往会变得很麻烦。谢谢,它起到了作用。我从.vimrc
中删除了设置cindent
,并将其放入$VIMRUNTIME/ftplugin/c.vim
中。这解决了问题。现有的$VIMRUNTIME/ftplugin/c.vim
(与vim一起提供)?!这是一个坏主意,在下一次Vim更新时,您将丢失更改。使用after/
目录,如我的答案中所示!我用了你的答案。我的评论有错误。我忘了在
之后添加。