Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
vim中为php设置的注释不正确_Php_Vim - Fatal编程技术网

vim中为php设置的注释不正确

vim中为php设置的注释不正确,php,vim,Php,Vim,我的vim用于在php中自动继续注释。例如: /* | <- cursor here /*|php.vim文件应位于$VIMRUNTIME中的ftplugin文件夹中 在vim的7.2版中,注释行是该文件中的第74行 那个文件被删除或移动了吗?找到了。我有一个funky.vim/indent/php.vim文件,不知怎么搞砸了 删除了它,我想要的功能被返回。谢谢你 使用7.3版(patchset 754)的默认设置,我观察到了与您原始帖子中相同的错误: /**<ENTER>

我的vim用于在php中自动继续注释。例如:

/* |  <- cursor here

/*|php.vim
文件应位于
$VIMRUNTIME
中的
ftplugin
文件夹中

在vim的7.2版中,注释行是该文件中的第74行


那个文件被删除或移动了吗?

找到了。我有一个funky.vim/indent/php.vim文件,不知怎么搞砸了


删除了它,我想要的功能被返回。谢谢你

使用7.3版(patchset 754)的默认设置,我观察到了与您原始帖子中相同的错误:

/**<ENTER>
万岁

注意。 请注意,如果在.vimrc:

这会导致在
$VIMRUNTIME/ftplugin/php.vim
之前处理
$VIMRUNTIME/indent/php.vim

indent/php.vim
文件将重置
'comments'
,但
ftplugin/php.vim
不会重置


用餐顺序:
indent/php.vim
获取源代码和
注释
正确设置:

setlocal comments=s1:/*,mb:*,ex:*/,://,:#
然后
ftplugin/php.vim
获取源代码。它再次通过以下方式获得
ftplugin/html.vim

这导致正在处理和设置
ftplugin/html.vim

setlocal commentstring=<!--%s-->
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->

修正: 上的文件类型缩进插件 ”“或者 文件类型插件缩进 “或按正确顺序: 上的文件类型插件 文件类型缩进
附言 在任何情况下,插件都应该在缩进之前处理


要检查包含/处理的顺序,请查看
:scriptnames

否,它仍然存在。维护者:Dan Sharp URL:您的personal.vim/ftplugin中是否有可能覆盖注释的文件?或者您的.vim/filetype.vim?正如您所说的“使用默认设置”可能不是这样,但确定这不是由于缩进和插件的顺序错误?参考我自己的答案。虽然Lekensteyn提供了一个解决问题的方法,但这个回答似乎确定了根本原因。当我在vimrc中使用文件类型插件缩进在上生成一行时,当我加载PHP缓冲区而不必手动劫持注释值时,我的注释值是正确的。
/**
 * <cursor>
/**
<cursor>
au FileType php setlocal comments=s1:/*,mb:*,ex:*/,://,:#
au FileType php setlocal formatoptions+=cro
filetype indent on
filetype plugin on
setlocal comments=s1:/*,mb:*,ex:*/,://,:#
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
setlocal commentstring=<!--%s-->
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
setlocal commentstring=/*%s*/