Using Emacs for Web Development? (Php/mysql/javascript/css/html

时间:2022-12-05 11:53:43

I'm a Web developer. I had been using a variety of editors and ide-s for web development(php, javascript,html,css) six months before I decided to learn a true editor and started using emacs. I learned all the basics, used the starter kit, practiced using buffer, windows etc..

我是一名Web开发人员。在我决定学习真正的编辑器并开始使用emacs之前六个月,我一直在使用各种编辑器和ide-s进行Web开发(php,javascript,html,css)。我学习了所有的基础知识,使用了入门套件,使用缓冲区,窗户等练习。

I got a grip in 2 months. A month ago I started learning about vim and I found a lot of plugins to achieve the things I want. I'm finding to achieve the same effect in emacs you have to do a lot(for php/js/css/html editing).

我在2个月内抓紧了。一个月前我开始学习vim,我找到了很多插件来实现我想要的东西。我发现你必须在emacs中实现相同的效果(对于php / js / css / html编辑)。

Here are the list of things I'm finding hard. Note: These things are related when I'm editing php/html/css/js.

以下列出了我难以找到的事情。注意:当我编辑php / html / css / js时,这些事情是相关的。

  • syntax hightlighting(php/smarty). -- the php major mode is too old and it always highlights html/smarty inside the php code incorrectly.

    语法高亮显示(php / smarty)。 - php主模式太旧了,它总是突出显示PHP代码中的html / smarty错误。

  • I love ido-mode but i couldn't find how to define a project and fuzzy match files inside the predefined directory

    我喜欢ido-mode但我找不到如何在预定义目录中定义项目和模糊匹配文件

  • I can setup nerdtree plugin to get a quick overview pane on the left with the files I'm working on with vim. But configuring speedbar and source code browser in emacs is bit difficult.

    我可以设置nerdtree插件来获得左边的快速概览窗格,其中包含我正在使用的文件。但是在emacs中配置speedbar和源代码浏览器有点困难。

  • Context aware completion I really don't know how to do that. I have seen something like that in clojure mode where it shows the definition of a method in the messages area.

    上下文感知完成我真的不知道该怎么做。我在clojure模式中看到类似的东西,它显示了消息区域中方法的定义。

  • Tags-generation: The tags generated with excrebant-ctags does not always work with php. In vim it is easy I can open a file containing the definition right under the cursor.

    标签生成:使用excrebant-ctags生成的标签并不总是与php一起使用。在vim中我很容易打开一个包含光标下正确定义的文件。

  • Manual lookup I want to lookup the manual for a particular word under the cursor without opening the browser (in the messages area(mini-buffer)).

    手动查找我想在不打开浏览器的情况下在光标下查找特定单词的手册(在消息区域(迷你缓冲区)中)。


I love ido mode and switching b/w files in tramp,buffers,local files using ido-mode.

我喜欢ido模式并使用ido-mode在tramp,buffers和本地文件中切换b / w文件。

Can anyone point me in the right direction? Do you use emacs for same kind of editing I do? What is your work flow?.

谁能指出我正确的方向?你使用emacs进行同样的编辑吗?你的工作流程是什么?

4 个解决方案

#1


6  

nxthml-mode is the ultimate mode for web development.

nxthml-mode是Web开发的终极模式。

You can easily define a project in terms of its VCS or .dir-locals.el with find-file-in-project.

您可以使用find-file-in-project轻松地根据其VCS或.dir-locals.el定义项目。

Fuzzy matching is called flex matching in ido. You can enable it with:

模糊匹配在ido中称为flex匹配。您可以启用它:

(setq ido-enable-flex-matching t)

I've never had any problems with ctags, manual lookup is trivial to implement...

我从来没有遇到任何ctags问题,手动查找很容易实现...

#2


0  

Manual lookup I want to lookup the manual for a particular word
under the cursor without opening the browser. (in the messages area (mini-buffer))

手动查找我想在不打开浏览器的情况下查找光标下特定单词的手册。 (在消息区域(迷你缓冲区))

It sounds like you are after eldoc-mode support for PHP? (enable it on a lisp file to see example)

这听起来像是在支持PHP的eldoc模式之后? (在lisp文件上启用它以查看示例)

;; Major modes for other languages may use ElDoc by defining an
;; appropriate function as the buffer-local value of
;; `eldoc-documentation-function'.

;;其他语言的主要模式可以通过定义;;使用ElDoc。适当的函数作为缓冲区局部值;; `eldoc的文档功能”。

A search for eldoc-documentation-function and PHP turns up this: http://www.emacswiki.org/emacs/php-doc.el

搜索eldoc-documentation-function和PHP就是这样:http://www.emacswiki.org/emacs/php-doc.el

#3


0  

I like Emacs for small projects and quick editing.

我喜欢Emacs的小项目和快速编辑。

There are things like C-x ( to make a repeat-macro, delete-matching-lines, describe-function (...), apropos, the quick C-x 2 to split window, the warnings (text was edited elsewhere do you really want...) and the quick Lisp fix in .emacs that make me having an Emacs open at all times.

有些东西,比如Cx(制作一个重复宏,删除匹配行,描述函数(...),apropos,快速Cx 2分割窗口,警告(文本在别处编辑,你真的想要。 ..)和.emacs中的快速Lisp修复,让我始终打开Emacs。

But for bigger projects, when you want to hover a keyword and have its definition, the call hierarchy, the updated syntax highlighting etc... Emacs is not enough for me. I use Eclipse (which is slow and not perfect anyway for C C++).

但是对于更大的项目,当你想悬停一个关键字并拥有它的定义,调用层次结构,更新的语法突出显示等...... Emacs对我来说还不够。我使用Eclipse(对于C C ++来说,它很慢而且不完美)。

#4


0  

  • syntax hightlighting(php/smarty). -- the php major mode is too old and it always highlights html/smarty inside the php code incorrectly.
  • 语法高亮显示(php / smarty)。 - php主模式太旧了,它总是突出显示PHP代码中的html / smarty错误。

The simplest and best way to manage mixed languages in one single buffer is to clone the window showing it with C-x 4 c and use different major modes for each window showing this single buffer, for example, one window with the php-mode, one window with the nxhtml-mode to correctly highlight the HTML syntax.

在一个缓冲区中管理混合语言的最简单和最好的方法是使用Cx 4 c克隆显示它的窗口,并为显示此单个缓冲区的每个窗口使用不同的主要模式,例如,一个带有php模式的窗口,一个窗口使用nxhtml-mode正确突出显示HTML语法。

#1


6  

nxthml-mode is the ultimate mode for web development.

nxthml-mode是Web开发的终极模式。

You can easily define a project in terms of its VCS or .dir-locals.el with find-file-in-project.

您可以使用find-file-in-project轻松地根据其VCS或.dir-locals.el定义项目。

Fuzzy matching is called flex matching in ido. You can enable it with:

模糊匹配在ido中称为flex匹配。您可以启用它:

(setq ido-enable-flex-matching t)

I've never had any problems with ctags, manual lookup is trivial to implement...

我从来没有遇到任何ctags问题,手动查找很容易实现...

#2


0  

Manual lookup I want to lookup the manual for a particular word
under the cursor without opening the browser. (in the messages area (mini-buffer))

手动查找我想在不打开浏览器的情况下查找光标下特定单词的手册。 (在消息区域(迷你缓冲区))

It sounds like you are after eldoc-mode support for PHP? (enable it on a lisp file to see example)

这听起来像是在支持PHP的eldoc模式之后? (在lisp文件上启用它以查看示例)

;; Major modes for other languages may use ElDoc by defining an
;; appropriate function as the buffer-local value of
;; `eldoc-documentation-function'.

;;其他语言的主要模式可以通过定义;;使用ElDoc。适当的函数作为缓冲区局部值;; `eldoc的文档功能”。

A search for eldoc-documentation-function and PHP turns up this: http://www.emacswiki.org/emacs/php-doc.el

搜索eldoc-documentation-function和PHP就是这样:http://www.emacswiki.org/emacs/php-doc.el

#3


0  

I like Emacs for small projects and quick editing.

我喜欢Emacs的小项目和快速编辑。

There are things like C-x ( to make a repeat-macro, delete-matching-lines, describe-function (...), apropos, the quick C-x 2 to split window, the warnings (text was edited elsewhere do you really want...) and the quick Lisp fix in .emacs that make me having an Emacs open at all times.

有些东西,比如Cx(制作一个重复宏,删除匹配行,描述函数(...),apropos,快速Cx 2分割窗口,警告(文本在别处编辑,你真的想要。 ..)和.emacs中的快速Lisp修复,让我始终打开Emacs。

But for bigger projects, when you want to hover a keyword and have its definition, the call hierarchy, the updated syntax highlighting etc... Emacs is not enough for me. I use Eclipse (which is slow and not perfect anyway for C C++).

但是对于更大的项目,当你想悬停一个关键字并拥有它的定义,调用层次结构,更新的语法突出显示等...... Emacs对我来说还不够。我使用Eclipse(对于C C ++来说,它很慢而且不完美)。

#4


0  

  • syntax hightlighting(php/smarty). -- the php major mode is too old and it always highlights html/smarty inside the php code incorrectly.
  • 语法高亮显示(php / smarty)。 - php主模式太旧了,它总是突出显示PHP代码中的html / smarty错误。

The simplest and best way to manage mixed languages in one single buffer is to clone the window showing it with C-x 4 c and use different major modes for each window showing this single buffer, for example, one window with the php-mode, one window with the nxhtml-mode to correctly highlight the HTML syntax.

在一个缓冲区中管理混合语言的最简单和最好的方法是使用Cx 4 c克隆显示它的窗口,并为显示此单个缓冲区的每个窗口使用不同的主要模式,例如,一个带有php模式的窗口,一个窗口使用nxhtml-mode正确突出显示HTML语法。