Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/pechorin/any-jump.vim

Jump to any definition and references πŸ‘ IDE madness without overhead πŸš€
https://github.com/pechorin/any-jump.vim

definitions ide nvim references ui vim viml

Last synced: about 1 month ago
JSON representation

Jump to any definition and references πŸ‘ IDE madness without overhead πŸš€

Lists

README

        

# any-jump.vim

**β€” IDE madness without overhead for 40+ languages**

_Vim code inspection plugin for finding definitionsβš’ and references/usagesπŸ”¬._

Any-jump can be used with any language, but definitions search only available for supported languages. This is not a problem in general, so use any-jump freely on any code project.

Based on syntax rules for 40 languages and **fast regexp engines** like ripgrep and ag.




On screen: jumping through source code of Discourse project

## Requirements

- `nvim 0.4+` or `vim 8.2`
- `ripgrep 11.0.0+` or `ag`
- _some languages requires rg with PCRE2 support_

## Installation

via vim-plug:

```viml
Plug 'pechorin/any-jump.vim'
```

## Usage

In normal or visual mode.

Just place you cursor on any variable/class/constant/name/symbol and press `j` or execute `:AnyJump` in normal mode.
You can also use visual mode to select proper keyword (j also works in visual mode)

With `:AnyJumpArg myKeyword` command you can manually write what you want to be searched for.

## Searches

- **keyword definitions**: find files where keyword defined

- **keyword references/usages**: find files where keyword used and referenced

## Keybindings

Default global mappings for normal and visual modes:

```viml
" Normal mode: Jump to definition under cursor
nnoremap j :AnyJump

" Visual mode: jump to selected text in visual mode
xnoremap j :AnyJumpVisual

" Normal mode: open previous opened file (after jump)
nnoremap ab :AnyJumpBack

" Normal mode: open last closed search window again
nnoremap al :AnyJumpLastResults
```

Disabling default any-jump keybindings:

```viml
let g:any_jump_disable_default_keybindings = 1
```

Mappings for popup search window

```
o/ open
s open in split
v open in vsplit
t open in new tab
p/ preview
q/x exit
r references
b back to first result
T group by file
a load next N results
A load all results
L toggle results lists ui style
```

## Settings

```viml
" Show line numbers in search results
let g:any_jump_list_numbers = 0

" Auto search references
let g:any_jump_references_enabled = 1

" Auto group results by filename
let g:any_jump_grouping_enabled = 0

" Amount of preview lines for each search result
let g:any_jump_preview_lines_count = 5

" Max search results, other results can be opened via [a]
let g:any_jump_max_search_results = 10

" Preferred search engine: rg or ag
let g:any_jump_search_prefered_engine = 'rg'

" Search results list styles:
" - 'filename_first'
" - 'filename_last'
let g:any_jump_results_ui_style = 'filename_first'

" Any-jump window size & position options
let g:any_jump_window_width_ratio = 0.6
let g:any_jump_window_height_ratio = 0.6
let g:any_jump_window_top_offset = 4

" Show / hide Help section
let g:any_jump_show_help_section = 1

" Customize any-jump colors with extending default color scheme:
" let g:any_jump_colors = { "help": "Comment" }

" Or override all default colors
let g:any_jump_colors = {
\"plain_text": "Comment",
\"preview": "Comment",
\"preview_keyword": "Operator",
\"heading_text": "Function",
\"heading_keyword": "Identifier",
\"group_text": "Comment",
\"group_name": "Function",
\"more_button": "Operator",
\"more_explain": "Comment",
\"result_line_number": "Comment",
\"result_text": "Statement",
\"result_path": "String",
\"help": "Comment"
\}

" Disable default any-jump keybindings (default: 0)
let g:any_jump_disable_default_keybindings = 1

" Remove comments line from search results (default: 1)
let g:any_jump_remove_comments_from_results = 1

" Custom ignore files
" default is: ['*.tmp', '*.temp']
let g:any_jump_ignored_files = ['*.tmp', '*.temp']

" Search references only for current file type
" (default: false, so will find keyword in all filetypes)
let g:any_jump_references_only_for_current_filetype = 0

" Disable search engine ignore vcs untracked files
" (default: false, search engine will ignore vcs untracked files)
let g:any_jump_disable_vcs_ignore = 0

" Custom ignore files
" default is: ['*.tmp', '*.temp']
let g:any_jump_ignored_files' = ['*.tmp', '*.temp']

" Vertically center the screen after jumping
" (default: false)
let g:any_jump_center_screen_after_jump = v:false
```

## Theme configuration

There are default theme configuration based on standard Vim highlight groups,
you can override any setting:

```
let g:any_jump_colors = {
\"plain_text": "Comment",
\"preview": "Comment",
\"preview_keyword": "Operator",
\"heading_text": "Function",
\"heading_keyword": "Identifier",
\"group_text": "Comment",
\"group_name": "Function",
\"more_button": "Operator",
\"more_explain": "Comment",
\"result_line_number": "Comment",
\"result_text": "Statement",
\"result_path": "String",
\"help": "Comment"
\}
```

### Background settings

You can set non-theme background by set Pmenu hl group like this:

```
hi Pmenu guibg=#1b1b1b ctermbg=Black
```

Where are also `PmenuSel`, `PmenuSbar`, `PmenuThumb` groups for configuring.

## Features

### open definitions and references/usages list

![screenshot](/usages.png)

### preview definition with `p` or `tab`

![screenshot](/preview.png)

### group results by file

![screenshot](/group_by_file.png)

### search results with line numbers

![screenshot](/with_ln.png)

### vim 8.2 inside terminal

![vim-support](https://user-images.githubusercontent.com/226270/75636019-104cb380-5c2c-11ea-9730-70db71bac35f.png)

## Supported languages

- apex
- c++
- clojure
- coffeescript
- commonlisp
- coq
- crystal
- csharp
- dart
- elisp
- elixir
- erlang
- faust
- fennel
- fortran
- fsharp
- go
- groovy
- haskell
- hcl
- java
- javascript
- julia
- kotlin
- lua
- matlab
- nim
- nix
- objc
- ocaml
- pascal
- perl
- php
- protobuf
- python
- r
- racket
- ruby
- rust
- scad
- scala
- scheme
- scss
- shell
- sml
- solidity
- sql
- swift
- systemverilog
- tcl
- tex
- typescript
- vala
- vhdl
- zig

## Original idea

Comes from dumb-jump.el emacs package

## Development

### Lang generator

You need ruby to run generator script which actually download language map, parse, extract data and then generate vim representation:

```bash
cd generator
bundle exec rake update
```

## Issues and contributions

Please open issue on any question / problem / feedback / idea.

Guaranteed contribution feedback: 3-5 days, but it's stable.

```
/~~||/~\\ /--- || ||/~\ /~\ |~~\
\__|| |\/ | \_/|| | ||__/
_/ \__| |
```