Object indentation in emacs php-mode
I would like to have this indentation like Zend do开发者_如何学Pythones 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 M-x customize-group RET php RET
.
精彩评论