Emacs的PHP模式 [英] PHP mode for Emacs

查看:156
本文介绍了Emacs的PHP模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有麻烦我的php代码没有正确缩进...

I'm having trouble with my php code not indenting correctly...

我希望我的代码看起来像这样

I would like my code to look like this

if (foo)
{
    print "i am indented";
}

但它总是如下所示:

if (foo)
  {
    print "i am not indented correctly";
  }

我厌倦了类似的东西,并尝试将以下内容添加到我的.emacs,但是它根本不起作用。

I tired googling for similar things and tried adding the following to my .emacs, but it didn't work at all.

任何想法?

 (add-hook 'php-mode-hook
          (function (lambda ()
                      ;; GNU style
                      (setq php-indent-level 4
                            php-continued-statement-offset 4
                            php-continued-brace-offset 0
                            php-brace-offset 0
                            php-brace-imaginary-offset 0
                            php-label-offset -4))))


推荐答案

自定义c-default-style变量。将它添加到.emacs文件中:

Customize c-default-style variable. Add this to your .emacs file:

(setq c-default-style "bsd"
      c-basic-offset 4)

bsd风格的描述

这篇关于Emacs的PHP模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆