Vim PHP Tab 跳转到语句后的下一个空行
我在使用 macvim 编辑 PHP 文件时遇到一个奇怪的问题。当我按 Tab 时,它不会给我一个制表符或一系列空格,而是在任何一系列语句之后跳到一个空行。它将对整个文件执行此操作,直到到达末尾。例如,在下面的代码片段中,如果我将光标放在“$products”前面并按下制表符,则不会插入制表符或空格,并且光标将落在其下方的空行上
public function index()
{
// get a distinct list of product names
$products = $this->license_model->get_all_product_names();
// get all records and fields from the view
$records = $this->license_model->get_all_records();
// assign objects to the array to pass to the view
$data = array(
'products' => $products,
'records' => $records
);
// load the view
$this->load->view('home.php', $data);
}
:如果选中 $data 数组上方的注释,光标将移动到下一个注释“加载视图”上方的行。
使用vim命令>>但是,会按预期缩进该行。问题似乎仅与 *.php 文件有关。在 *.java 文件中按 Tab 键可以正常工作。
我有什么想法可以解决这个问题吗?
谢谢
I'm having an odd problem with editing PHP files with macvim. When I press tab, instead of giving me a tab or series of spaces, it instead jumps down to a blank line after any series of statements. It will do this through the entire file until it reaches the end. For example, in the following snippet, if I have my cursor in front of "$products" and pressed tab, no tab or space would be inserted, and the cursor would land on the empty line below it:
public function index()
{
// get a distinct list of product names
$products = $this->license_model->get_all_product_names();
// get all records and fields from the view
$records = $this->license_model->get_all_records();
// assign objects to the array to pass to the view
$data = array(
'products' => $products,
'records' => $records
);
// load the view
$this->load->view('home.php', $data);
}
If I was to try and tab the comment above the $data array, the cursor would move to the line just above the next comment "load the view".
Using the vim command >> will indent the line as expected, however. The problem only seems to be with *.php files. Tabbing in say a *.java file works as normal.
Any ideas how I can fix this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来好像某些东西已将插入模式下的
或
映射到某些东西。通过发出以下命令查看为
定义了哪些映射:这应该输出当前设置的所有映射以及哪个文件设置了这些映射(以便您可以删除它们)。
Sounds like something has mapped
<Tab>
or<C-i>
in insert mode to something. See what maps are defined for<Tab>
by issuing:This should output any mappings that are currently set up and which file set these mappings (so you may remove them).