带有 etag 的 Emacs - 请参阅 EmacsWiki on Tags - 因为 Emacs 的默认模式适用于所有语言我关心:R、C++、C、shell、Perl、Python、SQL,...可能还有您想要的。 Exuberant Ctags 将这一点推广到更多语言和编辑器,包括 vi 系列。
Emacs with etags -- see eg EmacsWiki on Tags -- as Emacs' default modes work for all languages I care about: R, C++, C, shell, Perl, Python, SQL, ... and probably also the ones you are after. The Exuberant Ctags generalise this to more languages and editors, including the vi family.
好吧,你在说什么类型的代码? C++/java/php/ruby/python 我强烈推荐 netbeans,特别是最新的 dev 版本, 另外,KDevelop for kde 4.2(来自 svn)非常好,php/C# 支持非常实验性,但如果你不介意随机崩溃,它真的很好。 如果您不介意安装 java 来运行 Netbeans,那么 Netbeans 是迄今为止 Linux 上最稳定的 php/java/c++ IDE。
Well, what kinda code are you talking about? C++/java/php/ruby/python I highly recommend netbeans, specially the latest dev builds, also KDevelop for kde 4.2 (from svn) is really nice, the php/C# support is very experimental but if you don't mind the random crash its really good. Netbeans is by far the most stable IDE for php/java/c++ on linux if you don't mind installing java to run it.
I'm a big fan of IntelliJ. Its slogan says it all: "Develop with pleasure". Of course, this assumes you are using Java. Although it does have supported plugins for several other languages including Python.
Take a look at Kscope. It provides a right click menu to give you the definitions, references, calling function, called functions etc... for any set of source files written in C. It is reliable and fast when used on big project.
I use it for source navigation, but for the editing part, I feel more comfortable with geany. It is not limited to C, and provides a good auto-completion feature, that will provide the prototype of a function as you type it. Still has some rough edges, but the Kscope + Geany combo is my favourite combo for now, when it comes to writing C.
I'm using gvim (Vim's GUI version) for most Perl and C/C++ programming. For navigation I find NERDTree, ctags, ack and possibly some custom scripts written in Perl or whatever. I have placed my Vim/gvim configuration on my site. As one can see there, I have "so $VIMRUNTIME/mswin.vim" there which makes Vim much more similar to Windows editor, and more familiar to people coming from it. Many hard-core vim experts don't recommend using it, but I still do.
There are many other plugins over at Vim's homepage which may prove useful.
(global-set-key (quote[f3]) (quote set-fg-suffix))
(global-set-key (quote[f4]) (quote fg))
(defun mkpath (list)
"Return a string which is the concatenation of the list."
(let ( (result "") )
(while list
(setq result (concat result (car list)))
(setq result (concat result "/"))
(setq list (cdr list))
)
result ; Since this is the final evaluation, it's the returned from the function.
)
)
(defun find-best-root (anchor-file &optional empty-on-failure)
"Examines the parent directories of the current buffer. Looks for a parent that contains the
file passed in the anchor-file argument. This is the directory I want."
(if (not buffer-file-name)
;; Certain buffer (e.g., *scratch*) return nil from buffer-file-name. In that case,
;; set the best path to "/" since that's the only path which can be counted on.
(if (eq nil empty-on-failure)
"/"
""
)
(let ((path-depth (safe-length (split-string (file-name-directory buffer-file-name) "/" 1)))
(best-root (if (eq nil empty-on-failure)
(file-name-directory buffer-file-name)
""))
(exclude-from-path 1))
(while (<= exclude-from-path (+ path-depth 1))
(setq path-as-list (butlast (split-string (file-name-directory buffer-file-name) "/") exclude-from-path))
(setq potential-root (mkpath path-as-list))
(message (concat "Checking in " potential-root))
(if (file-exists-p (concat potential-root anchor-file))
(progn (setq best-root potential-root)
(setq exclude-from-path (+ path-depth 2)) ;; Break from the loop.
(message (concat "Found " anchor-file)))
(setq exclude-from-path (+ exclude-from-path 1)))
)
best-root
)
)
)
(if (eq system-type 'gnu/linux)
(progn (setq marker-file "makefile")
(setq find-filters (concat " -type d "
"-path \"*/build\" -prune -o "
"-path \"*/.git\" -prune -o "
"-path \"*/ext\" -prune -o "
"-path \"*/pycommon\" -prune -o "
"\"(\" "
"\! -iname \"BROWSE\" "
"-and \! -iname \"FILES\" "
"-and \! -iname \"TAGS\" "
"-and \! -iname \"*.a\" "
"-and \! -iname \"*.bin\" "
"-and \! -iname \"*.cs\" "
"-and \! -iname \"*.css\" "
"-and \! -iname \"*.d\" "
"-and \! -iname \"*.dat\" "
"-and \! -iname \"*.html\" "
"-and \! -iname \"*.ico\" "
"-and \! -iname \"*.jar\" "
"-and \! -iname \"*.json\" "
"-and \! -iname \"*.o\" "
"-and \! -iname \"*.pdf\" "
"-and \! -iname \"*.php\" "
"-and \! -iname \"*.png\" "
"-and \! -iname \"*.pyc\" "
"-and \! -iname \"*.so\" "
"-and \! -iname \"*.sql\" "
"-and \! -iname \"*.txt\" "
"-and \! -iname \"*.xml\" "
"\")\" "
"-print0 | xargs -0 grep -nHi -e "))
))
(setq custom-find-grep-path-suffix "")
(defun set-fg-suffix (suffix)
"Set an optional suffix for the search. This is useful for more fine grained searching."
(interactive "sEnter Search Suffix: ")
(if (string= "" suffix)
(message "The optional search suffix is now empty.")
(message (concat "The optional search suffix is now '" suffix "'."))
)
(setq custom-find-grep-path-suffix suffix)
)
(defun fg ()
"A custom find grep that dynamically sets the search path based on the buffer.
Regular Expression Examples:
-E \"struct.*hash\" When using special characters, enclose regexp in quotes.
-E \"^text$\" ^ Matches beginning of line, $ matches end of line.
-E \"main\\(.*\\)\" .* Matches everything, parenthesis require escaping."
(interactive)
(let ((fg-tt-filters find-filters ))
(setq my-find-grep-command "find \"")
(setq my-find-grep-command (concat my-find-grep-command (find-best-root marker-file)))
(setq my-find-grep-command (concat my-find-grep-command custom-find-grep-path-suffix))
(setq my-find-grep-command (concat my-find-grep-command "\""))
(setq my-find-grep-command (concat my-find-grep-command fg-tt-filters))
(grep-apply-setting 'grep-find-command my-find-grep-command)
(call-interactively 'find-grep)
)
)
I use many of the items listed: doxygen, etags, etc. However, in most cases I've found a well tuned find-grep run from emacs can be very effective at searching large code bases. Still working on setting up CEDET and sematic.
Here's some lisp code I wrote for a particular source tree and the mappings to these functions in my .emacs. The code builds a large find-grep command which starts at the root of the source tree I'm working inside of. It traverses up the file system looking for some file which indicates the top of the source tree (makefile in my case). I tuned it until it could complete the search in a few seconds (I actually wrote a python script to help me identify large binary file types which were slowing my search down).
(global-set-key (quote[f3]) (quote set-fg-suffix))
(global-set-key (quote[f4]) (quote fg))
(defun mkpath (list)
"Return a string which is the concatenation of the list."
(let ( (result "") )
(while list
(setq result (concat result (car list)))
(setq result (concat result "/"))
(setq list (cdr list))
)
result ; Since this is the final evaluation, it's the returned from the function.
)
)
(defun find-best-root (anchor-file &optional empty-on-failure)
"Examines the parent directories of the current buffer. Looks for a parent that contains the
file passed in the anchor-file argument. This is the directory I want."
(if (not buffer-file-name)
;; Certain buffer (e.g., *scratch*) return nil from buffer-file-name. In that case,
;; set the best path to "/" since that's the only path which can be counted on.
(if (eq nil empty-on-failure)
"/"
""
)
(let ((path-depth (safe-length (split-string (file-name-directory buffer-file-name) "/" 1)))
(best-root (if (eq nil empty-on-failure)
(file-name-directory buffer-file-name)
""))
(exclude-from-path 1))
(while (<= exclude-from-path (+ path-depth 1))
(setq path-as-list (butlast (split-string (file-name-directory buffer-file-name) "/") exclude-from-path))
(setq potential-root (mkpath path-as-list))
(message (concat "Checking in " potential-root))
(if (file-exists-p (concat potential-root anchor-file))
(progn (setq best-root potential-root)
(setq exclude-from-path (+ path-depth 2)) ;; Break from the loop.
(message (concat "Found " anchor-file)))
(setq exclude-from-path (+ exclude-from-path 1)))
)
best-root
)
)
)
(if (eq system-type 'gnu/linux)
(progn (setq marker-file "makefile")
(setq find-filters (concat " -type d "
"-path \"*/build\" -prune -o "
"-path \"*/.git\" -prune -o "
"-path \"*/ext\" -prune -o "
"-path \"*/pycommon\" -prune -o "
"\"(\" "
"\! -iname \"BROWSE\" "
"-and \! -iname \"FILES\" "
"-and \! -iname \"TAGS\" "
"-and \! -iname \"*.a\" "
"-and \! -iname \"*.bin\" "
"-and \! -iname \"*.cs\" "
"-and \! -iname \"*.css\" "
"-and \! -iname \"*.d\" "
"-and \! -iname \"*.dat\" "
"-and \! -iname \"*.html\" "
"-and \! -iname \"*.ico\" "
"-and \! -iname \"*.jar\" "
"-and \! -iname \"*.json\" "
"-and \! -iname \"*.o\" "
"-and \! -iname \"*.pdf\" "
"-and \! -iname \"*.php\" "
"-and \! -iname \"*.png\" "
"-and \! -iname \"*.pyc\" "
"-and \! -iname \"*.so\" "
"-and \! -iname \"*.sql\" "
"-and \! -iname \"*.txt\" "
"-and \! -iname \"*.xml\" "
"\")\" "
"-print0 | xargs -0 grep -nHi -e "))
))
(setq custom-find-grep-path-suffix "")
(defun set-fg-suffix (suffix)
"Set an optional suffix for the search. This is useful for more fine grained searching."
(interactive "sEnter Search Suffix: ")
(if (string= "" suffix)
(message "The optional search suffix is now empty.")
(message (concat "The optional search suffix is now '" suffix "'."))
)
(setq custom-find-grep-path-suffix suffix)
)
(defun fg ()
"A custom find grep that dynamically sets the search path based on the buffer.
Regular Expression Examples:
-E \"struct.*hash\" When using special characters, enclose regexp in quotes.
-E \"^text$\" ^ Matches beginning of line, $ matches end of line.
-E \"main\\(.*\\)\" .* Matches everything, parenthesis require escaping."
(interactive)
(let ((fg-tt-filters find-filters ))
(setq my-find-grep-command "find \"")
(setq my-find-grep-command (concat my-find-grep-command (find-best-root marker-file)))
(setq my-find-grep-command (concat my-find-grep-command custom-find-grep-path-suffix))
(setq my-find-grep-command (concat my-find-grep-command "\""))
(setq my-find-grep-command (concat my-find-grep-command fg-tt-filters))
(grep-apply-setting 'grep-find-command my-find-grep-command)
(call-interactively 'find-grep)
)
)
发布评论
评论(12)
带有 etag 的 Emacs - 请参阅 EmacsWiki on Tags - 因为 Emacs 的默认模式适用于所有语言我关心:R、C++、C、shell、Perl、Python、SQL,...可能还有您想要的。 Exuberant Ctags 将这一点推广到更多语言和编辑器,包括 vi 系列。
Emacs with etags -- see eg EmacsWiki on Tags -- as Emacs' default modes work for all languages I care about: R, C++, C, shell, Perl, Python, SQL, ... and probably also the ones you are after. The Exuberant Ctags generalise this to more languages and editors, including the vi family.
对于 vim 爱好者(比如我):vim + ctags 做得很好。 grep 也是你最好的朋友。
For vim lovers (like me): vim + ctags does great job. Also grep is your best friend.
好吧,你在说什么类型的代码?
C++/java/php/ruby/python 我强烈推荐 netbeans,特别是最新的 dev 版本,
另外,KDevelop for kde 4.2(来自 svn)非常好,php/C# 支持非常实验性,但如果你不介意随机崩溃,它真的很好。
如果您不介意安装 java 来运行 Netbeans,那么 Netbeans 是迄今为止 Linux 上最稳定的 php/java/c++ IDE。
Well, what kinda code are you talking about?
C++/java/php/ruby/python I highly recommend netbeans, specially the latest dev builds,
also KDevelop for kde 4.2 (from svn) is really nice, the php/C# support is very experimental but if you don't mind the random crash its really good.
Netbeans is by far the most stable IDE for php/java/c++ on linux if you don't mind installing java to run it.
对于文件中的 grep,
ack
比实际的 grep 更好。为了在文件之间导航,在后台运行 kwrite 的 bash 别名以及文件名的 bash 补全就足够了我。
For grepping in files,
ack
is better than actual grep.For navigating between files, bash alias that runs kwrite on background together with bash completion for file names is enough for me.
您可以使用 MonoDevelop for c++。 这将与您在 Windows / VS.Net 中获得的体验非常相似。
You can use MonoDevelop for c++. It will be a very similar experience as you've had with Windows / VS.Net.
我是 IntelliJ 的忠实粉丝。 它的口号说明了一切:“快乐地发展”。 当然,这假设您使用的是 Java。 尽管它确实支持包括 Python 在内的几种其他语言的插件。
I'm a big fan of IntelliJ. Its slogan says it all: "Develop with pleasure". Of course, this assumes you are using Java. Although it does have supported plugins for several other languages including Python.
当我需要理解别人的代码时,我经常使用 Doxygen。 我在编写自己的代码时将 Vim 与 CTag 结合使用。
I often use Doxygen when I need to understand code from someone else. I use Vim with CTags while writing my own code.
看看 Kscope。 它提供了一个右键菜单,为您提供任何用 C 编写的源文件集的定义、引用、调用函数、被调用函数等。在大型项目中使用时它可靠且快速。
我用它来进行源代码导航,但对于编辑部分,我觉得 geany 更舒服。 它不限于 C,并且提供了良好的自动完成功能,该功能将在您键入函数时提供函数的原型。 虽然仍有一些粗糙的地方,但在编写 C 语言时,Kscope + Geany 组合是我目前最喜欢的组合。
Take a look at Kscope. It provides a right click menu to give you the definitions, references, calling function, called functions etc... for any set of source files written in C. It is reliable and fast when used on big project.
I use it for source navigation, but for the editing part, I feel more comfortable with geany. It is not limited to C, and provides a good auto-completion feature, that will provide the prototype of a function as you type it. Still has some rough edges, but the Kscope + Geany combo is my favourite combo for now, when it comes to writing C.
我使用 Eclipse 并大量使用搜索功能(对于 C,主要是文本搜索)。
我还启用了工具提示,它可以显示文档或函数的开头。
标记出现次数也有助于在文件中查找内容。
我通常会用 TODO 注释来标记我工作的地方。 这些在侧边栏中可见,因此在那里导航相对容易。
我还启用行号,以便与错误消息等相关联。
我认为不可能在 Eclipse 的两个不同窗口中编辑同一个文件(但我很高兴被证明是错误的)。
I use Eclipse and make heavy use of the search function (for C mostly text search).
I also have tooltips enabled, which can show the documentation or beginning of a function.
Mark occurrences is also helpful to find stuff within a file.
I typically mark places where I work with TODO comments. These are visible in the sidebar, so it is relatively easy to navigate there.
I also enable line numbers, for correlating with error messages and such.
I don't think it is possible to edit the same file in two different windows in Eclipse (but I would be happy to be proven wrong).
我使用 gvim(Vim 的 GUI 版本)进行大多数 Perl 和 C/C++ 编程。 对于导航,我找到 NERDTree、ctags、ack 以及可能一些用 Perl 或其他语言编写的自定义脚本。 我已将 我的 Vim/gvim 配置放在我的网站上。 正如人们所看到的,我在那里添加了“so $VIMRUNTIME/mswin.vim”,这使得 Vim 与 Windows 编辑器更加相似,并且对于使用它的人来说更加熟悉。 许多铁杆 vim 专家不建议使用它,但我仍然这样做。
Vim 主页 上还有许多其他插件,它们可能很有用。
I'm using gvim (Vim's GUI version) for most Perl and C/C++ programming. For navigation I find NERDTree, ctags, ack and possibly some custom scripts written in Perl or whatever. I have placed my Vim/gvim configuration on my site. As one can see there, I have "so $VIMRUNTIME/mswin.vim" there which makes Vim much more similar to Windows editor, and more familiar to people coming from it. Many hard-core vim experts don't recommend using it, but I still do.
There are many other plugins over at Vim's homepage which may prove useful.
我使用了列出的许多项目:doxygen、etags 等。但是,在大多数情况下,我发现从 emacs 运行的经过良好调整的 find-grep 在搜索大型代码库时非常有效。 仍在致力于建立 CEDET 和 Sematic。
这是我为特定源代码树编写的一些 lisp 代码以及到 .emacs 中这些函数的映射。 该代码构建了一个大型 find-grep 命令,该命令从我正在其中工作的源代码树的根部开始。 它遍历文件系统寻找一些指示源树顶部的文件(在我的例子中是 makefile)。 我对其进行了调整,直到它可以在几秒钟内完成搜索(我实际上编写了一个 python 脚本来帮助我识别大型二进制文件类型,这些文件类型会减慢我的搜索速度)。
I use many of the items listed: doxygen, etags, etc. However, in most cases I've found a well tuned find-grep run from emacs can be very effective at searching large code bases. Still working on setting up CEDET and sematic.
Here's some lisp code I wrote for a particular source tree and the mappings to these functions in my .emacs. The code builds a large find-grep command which starts at the root of the source tree I'm working inside of. It traverses up the file system looking for some file which indicates the top of the source tree (makefile in my case). I tuned it until it could complete the search in a few seconds (I actually wrote a python script to help me identify large binary file types which were slowing my search down).
Spacemacs 与 projectile 集成是一个不错的选择。
人们可以使用 ack、grp、ag 等实用程序搜索项目文件。
(ag 比 ack 或 grep 更好)
Spacemacs integrated with projectile is a nice choice.
One can search a project files using utilities such as ack, grp, ag.
(ag is better than ack or grep)