Dumber Jump is an Emacs "jump to definition" package with support for 50+ programming languages that favors "just working". This means minimal -- and ideally zero -- configuration with absolutely no stored indexes (TAGS) or persistent background processes. Dumber Jump requires at least GNU Emacs 28.1
.
Dumber Jump is a fork from dumb-jump that removes as many configuration options as possible to go back to the roots of being a fairly config-free "dumb" jump. This version doesn't support other searchers, doesn't support alternative display methods, and only interfaces through xref.
Dumber Jump uses ripgrep rg
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. The 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.
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. Although it can be sped up by creating a .dumberjump
file in your project's root directory with paths that should be excluded (see configuration).
There is currently basic support for the following languages:
- Apex
- Bash
- C/C++
- C#
- Clojure
- CoffeeScript
- Common Lisp
- Coq
- Crystal
- Dart
- Elixir
- Emacs Lisp
- Erlang
- F#
- Faust
- Fennel
- Fortran
- Go
- Groovy
- Haskell
- Java
- JavaScript
- Julia
- Kotlin
- LaTeX
- Lua
- Matlab
- Nim
- Nix
- Objective-C
- OCaml
- OpenSCAD
- Org mode
- Pascal
- Perl
- PHP
- Protocol Buffers
- Python
- R
- Racket
- Ruby
- Rust
- Sass
- Scala
- Scheme
- SML
- Solidity
- SQL
- Swift
- SystemVerilog
- Tcl
- Terraform / HCL
- TypeScript
- Vala
- VHDL
- Zig
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.
The recommended way to install Dumber Jump is via package.el
. It's available on MELPA: M-x package-install dumber-jump
Dumber Jump requires ripgrep rg
(rg install instructions) installed on your system.
To enable the xref backend, evaluate
(add-hook 'xref-backend-functions #'dumber-jump-xref-activate)
or add it to your initialisation file. Using this, you can now use M-. (or gd when using Evil).
Dumber Jump will automatically look for a project root. If it's not finding one then either put a .dumberjump
file in your project root and optionally add excluded directories to make it faster.
Project root directory denoters: .dumberjump
, .projectile
.git
.hg
, and more. See dumber-jump-project-denoters
.
If you want to stop a directory from registering as the project root (and have Dumber Jump keep looking) add an empty .dumbjumpignore
file in that directory.
-tests
-node_modules
-build
-images
+../some-lib/src
+/usr/lib/src
(setq dumber-jump-default-project "~/code")
to change default project if one is not found (defaults to~
)(setq dumber-jump-quiet t)
if Dumber Jump is too chatty.- To support more languages and/or definition types customize
dumber-jump-find-rules
variable. (setq dumber-jump-rg-search-args "")
to set additional command line arguments when using rg for searching (defaults to"--pcre2"
).
If you have Hydra installed, the following is an example hydra for easily using Dumber-Jump and not needing to remember the bindings or function names:
(defhydra dumber-jump-hydra (:color blue :columns 3)
"Dumber Jump"
("j" dumber-jump-go "Go")
("o" dumber-jump-go-other-window "Other window")
("e" dumber-jump-go-prefer-external "Go external")
("x" dumber-jump-go-prefer-external-other-window "Go external other window")
("i" dumber-jump-go-prompt "Prompt")
("l" dumber-jump-quick-look "Quick look")
("b" dumber-jump-back "Back"))
It can be explicitly bound or used inside another hydra (if you already use something like Avy/Ace or similar for general "jumping").
- M-x
set-variable dumber-jump-debug t
- try to jump
- go to buffer
*Messages*
More details here. Thanks to @cweiske and @Glumanda99
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).
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.
Opening a PR will use CircleCI to run all the tests against all the supported emacs versions and search programs.
There are a lot of options for running the tests locally:
requires Cask using your local emacs
cd /path/to/dumber-jump
cask
make test
requires golang and Cask using your local emacs
cd /path/to/dumber-jump
cask
make test-concurrent
only requires docker and runs tests against emacs 26.1
cd /path/to/dumber-jump
cask
make test-in-docker
only requires docker and runs tests against all supported emacs versions
cd /path/to/dumber-jump
cask
make test-all-in-docker
Here is a list of potential alternative packages for emacs:
- Tags supports multiple languages
- GNU Global supports multiple languages
- Tern for JavaScript
- elpy for Python
- robe for Ruby
- dumb-jump the original that this project is forked from. See that project's readme for what this used to be like.
Most of these were sourced from this emacs StackExchange answer.