简体   繁体   English

emacs php模式下的对象缩进

[英]Object indentation in emacs php-mode

I would like to have this indentation like Zend does on objects: 我希望像Zend在对象上那样具有这种缩进:

$this->getResponse()
     ->appendBody('Hello World');

But what I have now is: 但是我现在所拥有的是:

$this->getResponse()
  ->appendBody('Hello World');

and I don't have any idea how I can do in this way. 而且我不知道该怎么做。 Thanks. 谢谢。

php-mode is a fairly primitive mode that doesn't quite get the semantics of PHP. php-mode是一个相当原始的模式,无法完全理解PHP的语义。 It's based on cc-mode so you can tweak its indentation settings by tweaking cc-mode's settings. 它基于cc-mode,因此您可以通过调整cc-mode的设置来调整其缩进设置。 There is an overview of the settings here , but cc-mode has a lot more that you can play with. 目前的设置的概述在这里 ,但CC-的模式有很多种,你可以玩。 Take a look at this question as well. 看看这个问题

Recent releases of php-mode (available via MELPA) can do what you want; php-mode的最新版本(可通过MELPA获得)可以满足您的需求; simply set php-lineup-cascaded-calls to t in your emacs configuration. 只需在emacs配置中将php-lineup-cascaded-callst

(setq php-lineup-cascaded-calls t)

Or use the customization interface Mx customize-group RET php RET . 或使用自定义界面Mx customize-group RET php RET

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM