简体   繁体   中英

Object indentation in emacs php-mode

I would like to have this indentation like Zend does on objects:

$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. It's based on cc-mode so you can tweak its indentation settings by tweaking cc-mode's settings. There is an overview of the settings here , but cc-mode has a lot more that you can play with. Take a look at this question as well.

Recent releases of php-mode (available via MELPA) can do what you want; simply set php-lineup-cascaded-calls to t in your emacs configuration.

(setq php-lineup-cascaded-calls t)

Or use the customization interface Mx customize-group RET php RET .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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