dumb-jump 0,0 travis-ci

an Emacs "jump to definition" package

dumb-jump

Join the chat at https://gitter.im/jacktasia/dumb-jump Build Status Coverage Status MELPA MELPA Stable

Dumb Jump GIF

About

Dumb Jump is an Emacs "jump to definition" package with support for multiple programming languages that favors "just working". This means minimal -- and ideally zero -- configuration with absolutely no stored indexes (TAGS) or persistent background processes. Dumb Jump requires at least GNU Emacs 24.3.

How it works

Dumb Jump uses The Silver Searcher ag (and falls back to grep) to find potential definitions of a function or variable under point. It uses a set of regular expressions based on the file extension, or major-mode, of the current buffer. Currently the ag matches are run through a shared set of heuristic methods to find the best candidate to jump to. If it can't decide it will present the user with a list in a pop-menu.

Success Rate

For the currently supported languages it seems to do a good job of finding what you want. If you find a case where it does not work as expected do not hesitate to open an issue. It can be slow if it needs to use grep and/or a project is large. Although it can be sped up by installing ag and/or creating a .dumbjump file in your project's root directory with paths that should be excluded (see configuration).

Supported Languages

There is currently basic support for the following languages:

  • Emacs Lisp
  • Python
  • JavaScript
  • PHP
  • Ruby
  • Java
  • C#
  • C/C++
  • CoffeeScript
  • Perl
  • Go
  • Swift
  • Objective-C
  • Scala
  • Clojure
  • Haskell
  • Lua
  • Rust
  • Faust
  • R

If you have any issues with the existing languages, or you want support for another one, then please open an issue. PRs are also welcome. If you'd like to add a language these PRs for lua and rust are good examples.

Installing

The recommended way to install Dumb Jump is via package.el. It's available on MELPA: M-x package-install dumb-jump

Installing ag

Dumb Jump performs best with The Silver Searcher ag installed on your system. Please see their install instructions.

Usage

Basic

Adding (dumb-jump-mode) to your .emacs will enable the key bindings for two interactive Dumb Jump functions:

  • dumb-jump-go C-M g core functionality. Attempts to jump to the definition for the thing under point
  • dumb-jump-back C-M p jumps back to where you were when you jumped. These are chained so if you go down a rabbit hole you can get back out or where you want to be.
  • dumb-jump-quick-look C-M q like dumb-jump-go but shows tooltip with file, line, and context
  • dumb-jump-go-other-window exactly like dumb-jump-go but uses find-file-other-window instead of find-file

Configuration

Excluding project directories

Dumb Jump will automatically look for a project root. If it's not finding one then either put a .dumbjump file in your project root and optionally add excluded directories to make it faster.

Example .dumbjump
-tests
-node_modules
-build
-images
+../some-lib/src
+/usr/lib/src
.emacs options
  • (setq dumb-jump-default-project "~/code") to change default project if one is not found (defaults to ~)
  • (setq dumb-jump-quiet t) if Dumb Jump is too chatty.
  • To support more languages and/or definition types use add-to-list on dumb-jump-find-rules (see source code).
  • (add-hook 'dumb-jump-after-jump-hook 'some-function) to execute code after you jump
  • (setq dumb-jump-selector 'ivy) to use ivy instead of the default popup for multiple options.

Why?

I wanted "jump to definition" functionality to "just work" in emacs. I use IntelliJ for Java and this functionality is basically the only thing I miss when I switch back to emacs for work in other languages. There are certainly other packages that offer this type of functionality, but they all require significantly more configuration and are often limited to a particular language. An alternative may be worth setting up if you are in a specific project or language often (see alternatives).

Contributing

Feedback is very welcome via GitHub issues. I will consider supporting other languages either via issue request or PR. If submitting a PR then please add tests as well.

Running Tests

Requires Cask.

cd /path/to/dumb-jump
cask
make test

Alternatives

Here is a list of potential alternative packages for emacs:

Most of these were sourced from this emacs StackExchange answer.

Related Repositories

awesome-emacs

awesome-emacs

A community driven list of useful Emacs packages, libraries and others. ...

vim-notes

vim-notes

Easy note taking in Vim ...

omnisharp-emacs

omnisharp-emacs

Troll coworkers - use Emacs at work for csharp! ...

XCode4_beginning_of_line

XCode4_beginning_of_line

Xcode plugin to make HOME key jump to the first non-whitespace line of code ...

pytest.vim

pytest.vim

Runs your UnitTests with py.test displaying red/green bars and errors ...


Top Contributors

jacktasia meqif abend magnetophon AdrieanKhisbe purcell wamaral liangzan knu 10sr anuragpeshne xianbaum jonboiser gitter-badger wjlroe wbolster jordonbiondo p-baleine vzvu3k6k

Releases

-   v0.4.3 zip tar
-   v0.4.2 zip tar
-   v0.4.1 zip tar
-   v0.4.0 zip tar
-   v0.3.9 zip tar
-   v0.3.8 zip tar
-   v0.3.7 zip tar
-   v0.3.6 zip tar
-   v0.3.5 zip tar
-   v0.3.4 zip tar
-   v0.3.3 zip tar
-   v0.3.2 zip tar
-   v0.3.1 zip tar
-   v0.3.0 zip tar
-   v0.2.5 zip tar
-   v0.2.4 zip tar
-   v0.2.3 zip tar
-   v0.2.2 zip tar
-   v0.2.1 zip tar
-   v0.2 zip tar
-   v0.1 zip tar