https://github.com/kg8m/vim-fzf-tjump
A Vim plugin to execute `:tjump` and select tag candidate with preview by fzf
https://github.com/kg8m/vim-fzf-tjump
ctags fzf preview tjump vim vim-plugin
Last synced: 5 months ago
JSON representation
A Vim plugin to execute `:tjump` and select tag candidate with preview by fzf
- Host: GitHub
- URL: https://github.com/kg8m/vim-fzf-tjump
- Owner: kg8m
- License: mit
- Created: 2020-03-12T15:01:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-13T15:05:45.000Z (over 1 year ago)
- Last Synced: 2025-09-13T15:51:10.999Z (10 months ago)
- Topics: ctags, fzf, preview, tjump, vim, vim-plugin
- Language: Vim Script
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vim-fzf-tjump
**vim-fzf-tjump** is a Vim plugin designed as an alternative to Vim’s built-in `:tjump` command. It leverages fzf to filter tag candidates interactively, allowing you to quickly jump to the desired tag with ease.
https://user-images.githubusercontent.com/694547/119252206-e4796d00-bbe5-11eb-8e3e-6a99765a33e0.mp4
## Features
- **Interactive Filtering**: Use fzf to filter tag candidates in real-time.
- **Code Preview**: Preview the code of the selected tag before jumping.
- **Efficient Navigation**: Automatically jump directly if only one matching tag is found.
## Functions
### `fzf_tjump#jump()`
```vim
" Call without any arguments
call fzf_tjump#jump()
" Call with a tag name
call fzf_tjump#jump(some_tag_name)
" Call with a tag name and an exit callback
call fzf_tjump#jump(some_tag_name, { "exit": { status -> execute(...) } })
```
Displays tag candidates that match the given tag name and jumps to the selected tag. If only one matching tag is found, it jumps directly.
- **Arguments**:
- If no argument is provided or the given tag name is an empty string, the current word (``) is used as the tag name.
- You can specify an `exit` option for the exit callback. The callback is called when the fzf window is closed.
- **Preview**: Shows a code preview of the selected tag.
## Commands
### `:Tjump`
A wrapper for the `fzf_tjump#jump()` function.
- Respects the `g:fzf_command_prefix` setting. For example, the command name becomes `:FzfTjump` if you configure as following:
```vim
let g:fzf_command_prefix = "Fzf"
```
## Mappings
vim-fzf-tjump adds no default mappings. You can add your own mappings as needed.
### Mapping example
```vim
" Press `g]` in normal mode to call `fzf_tjump#jump`.
" Press `g]` in visual mode to call `fzf_tjump#jump` with the selected word.
map g] (fzf-tjump)
```
## Configuration
For more information on available configuration options, execute:
```vim
:h vim-fzf-tjump-variables
```
## Installation
If you use [dein.vim](https://github.com/Shougo/dein.vim):
```vim
call dein#add("kg8m/vim-fzf-tjump")
```
## Requirements
- [fzf](https://github.com/junegunn/fzf) 0.22+
- fzf 0.22 supports preview window option for setting the initial scroll offset
- [fzf.vim](https://github.com/junegunn/fzf.vim)
- Tag file with line numbers of tag definitions
- You can probably create it by `ctags --fields=n` command
- Newer Vim
- Linux or Mac