在 emacs 和 vim 中我最怀念的 IDE 功能是代码导航和查找用法。这两个编辑器都具有以下相似的功能:
据我了解,这两个系统都非常不精确。如果我们有同名的相似标识符,则标签和作用域可能会将它们混淆。有没有更好的替代方案,它们到底有多精确?
最佳答案
我在 Emacs 中使用 cscope 和语义。对我来说就足够了。
在 cscope 中,我经常使用的两个函数是 cscope-find-global-definition 和 cscope-find-this-symbol。前面的函数是相当精确的。
C-c s s Find symbol.
C-c s d Find global definition.
至于语义(动态索引,不需要生成TAGS)。
(global-set-key [f8] 'semantic-ia-fast-jump) ;; jump to definition.
(global-set-key [S-f8] ;; jump back
(lambda ()
(interactive)
(if (ring-empty-p (oref semantic-mru-bookmark-ring ring))
(error "Semantic Bookmark ring is currently empty"))
(let* ((ring (oref semantic-mru-bookmark-ring ring))
(alist (semantic-mrub-ring-to-assoc-list ring))
(first (cdr (car alist))))
(if (semantic-equivalent-tag-p (oref first tag)
(semantic-current-tag))
(setq first (cdr (car (cdr alist)))))
(semantic-mrub-switch-tags first))))
关于vim - vim 和 emacs 中的代码导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13440613/