我不知道怎么人们通常浏览的大型项目有几个来源的文件在Linux的环境。我主要的工作C和python和有时,使用C++,C#和Java。

我想知道具体的编辑,插件等。我用程序上的窗口,以便编辑等vi和软件都不是真的在我的联赛中,但是如果你想如果这可能是真正有助于我了解这些编辑请建议以及任何具体的插件使用让你的生活更简单的管理大型项目与这些程序。

这里有几个场景:让我们说我的工作上一个特定功能的一个在文件F,突然之间我意识到,这一功能需要调功能B在文件G。我很快就需要为这一职能来确定的事情就像功能的参数,快看看的功能等。另一种情况将是工作上的两个不同的位置在同一时间,在文件和迅速交换这两者之间的位置。

我使用日食给我的项目管理和开发(蚀是自动完成的,是痛苦的缓慢)和geany编辑文件的独立,但似乎我不能真正得到这一水平的效率。

请分享你的代码管理和导航技术。

谢谢,

编辑:语言

有帮助吗?

解决方案

Emacs与etags - 请参阅例如标签上的EmacsWiki - 因为Emacs的默认模式有效对于我关心的所有语言:R,C ++,C,shell,Perl,Python,SQL,......也可能是你所追求的语言。 Exuberant Ctags 将此概括为更多语言和编辑,包括vi系列。

其他提示

对于 vim爱好者(和我一样):vim + ctags做得很好。 grep也是你最好的朋友。

嗯,这是什么样的代码你在说什么?C++/java/php/ruby/python我强烈推荐//需要将物品寄,特别是最新的 dev 建立, 还KDevelop kde4.2(从svn)是非常好的,php/C#支持是非常实验但是如果你不介意随机的崩溃,它真的很好。//需要将物品寄到目前为止是最稳定的IDE php/java/c++在linux上如果你不介意安装java运行。

对于文件中的grepping,ack优于实际的grep。

用于在文件之间导航,在后台运行 kwrite 的bash别名以及文件名的bash完成对我来说已经足够了。

您可以将MonoDevelop用于c ++。这将与您使用Windows / VS.Net时的体验非常相似。

我是 IntelliJ 的忠实粉丝。它的口号说明了一切:<!>“快乐地发展<!>”;当然,这假设您使用的是Java。虽然它确实支持包括Python在内的其他几种语言的插件。

当我需要了解其他人的代码时,我经常使用Doxygen。我在编写自己的代码时使用了Vim和CTags。

查看 Kscope 。它提供了一个右键菜单,为您提供了用C语言编写的任何源文件集的定义,引用,调用函数,调用函数等。在大项目中使用时,它是可靠且快速的。

我将它用于源导航,但对于编辑部分,我觉得使用 geany 更为舒服。它不仅限于C,并提供了良好的自动完成功能,可在您键入时提供函数的原型。仍然有一些粗糙的边缘,但Kscope + Geany组合是我现在最喜欢的组合,当谈到写作C.

我使用Eclipse并大量使用搜索功能(对于C主要是文本搜索)。

我还启用了工具提示,可以显示文档或函数的开头。

标记出现也有助于在文件中查找内容。

我通常标记我使用TODO评论的地方。这些在侧栏中可见,因此在那里导航相对容易。

我还启用行号,与错误消息等相关联。

我认为在Eclipse中的两个不同窗口中编辑同一个文件是不可能的(但我很乐意被证明是错误的)。

我正在使用gvim(Vim的GUI版本)进行大多数Perl和C / C ++编程。对于导航,我找到 NERDTree ,ctags, ack 以及可能用Perl或其他任何东西编写的一些自定义脚本。我在我的网站上放置了我的Vim / gvim配置。在那里可以看到,我有<!>“所以$ VIMRUNTIME / mswin.vim <!>”;这使得Vim与Windows编辑器更相似,而且对于来自它的人来说更为熟悉。许多硬核vim专家不建议使用它,但我仍然这样做。

Vim的主页上还有许多其他插件可能会有用。

我使用了许多列出的项目:doxygen,etags等。但是,在大多数情况下,我发现从emacs运行良好的find-grep运行可以非常有效地搜索大型代码库。仍在努力设置CEDET和sematic。

这是我为特定源代码树编写的一些lisp代码,以及我的.emacs中这些函数的映射。代码构建了一个大的find-grep命令,该命令从我正在使用的源代码树的根开始。它遍历文件系统,寻找一些指示源树顶部的文件(在我的情况下为makefile)。我调整它直到它可以在几秒钟内完成搜索(我实际上编写了一个python脚本来帮助我识别大型二进制文件类型,这些类型会减慢我的搜索速度。)

(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)
  )
)

projectile 集成的Spacemacs是一个不错的选择。

可以使用ack,grp, ag 等实用程序搜索项目文件。

(ag优于ack或grep)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top