This is a Neovim plugin for jumper, to quickly jump around files and folders. It allows to
- keep track of the opened files and visited folders, keeping jumper's database updated.
- jump with
:Zf <query>
/:Z <query>
to files / folders matching<query>
. - interactively find jumper's files and directories using either fzf-lua or Telescope as backend.
demo.mp4
- Install jumper's binary, following these instructions.
- Install
homerours/jumper.nvim
with your plugin manager. - (Optional, requires fzf-lua or Telescope) Define keymaps for the interactive pickers to jump to files and directories. For lua configuration, use
vim.keymap.set('n', '<c-y>', require("jumper.fzf-lua").jump_to_directory)
vim.keymap.set('n', '<c-u>', require("jumper.fzf-lua").jump_to_file)
vim.keymap.set('n', '<leader>fu', require("jumper.fzf-lua").find_in_files)
or for vimscript, use
nnoremap <c-y> <cmd>lua require("jumper.fzf-lua").jump_to_directory()<cr>
nnoremap <c-u> <cmd>lua require("jumper.fzf-lua").jump_to_file()<cr>
nnoremap <leader>fu <cmd>lua require("jumper.fzf-lua").find_in_files()<cr>
require("jumper.fzf-lua")
has to be replaced by require("telescope").extensions.jumper
if using Telescope's backend.
Using for instance Lazy.nvim, steps 2 and 3 can be achieved with
{
"homerours/jumper.nvim",
dependencies = {
'nvim-telescope/telescope.nvim', -- for Telescope backend
'ibhagwan/fzf-lua' -- alternatively, for fzf-lua backend
},
config = function()
-- If using Telescope as backend:
local jumper = require("telescope").extensions.jumper
-- or, if using fzf-lua as backend:
local jumper = require("jumper.fzf-lua")
-- Configure bindings to launch the pickers:
vim.keymap.set('n', '<c-y>', jumper.jump_to_directory)
vim.keymap.set('n', '<c-u>', jumper.jump_to_file)
vim.keymap.set('n', '<leader>fu', jumper.find_in_files)
end
}
Use the commands :Zf <query>
to open the file that matches best <query>
or :Z <query>
to change the current working directory.
Then, jumper provides 3 "pickers" in order to interactively find files and folders:
This allows to pick directories from jumper's database. By default, pressing enter
on a directory will open that directory in the default file explorer (netrw
, oil
...). This can be overriden using the on_enter
key of the options supplied to the finder:
jump_to_directory({on_enter = 'find_files'})
will launch a files' search in the selected directory.jump_to_directory({on_enter = 'change_cwd'})
will update the current working directory to the selected entry.
This allows to open files from jumper's database.
This allows to "live-grep" the files of jumper's database.
Here is an example of configuration, using fzf-lua as backend:
{
"homerours/jumper.nvim",
dependencies = { "ibhagwan/fzf-lua" },
config = function()
local jumper = require("jumper.fzf-lua")
vim.keymap.set('n', '<c-y>', function() jumper.jump_to_directory({ on_enter = 'find_files'}) end)
vim.keymap.set('n', '<c-u>', jumper.jump_to_file)
vim.keymap.set('n', '<leader>fu', jumper.find_in_files)
-- Defaults should be good enough, one typically does not need the following:
require("jumper").setup({
jumper_max_results = 200, -- maximum number of results to show in Telescope. Default: 300
jumper_max_completion_results = 10, -- maximum number of results to show when completing :Z and :Zf commands. Default: 12
jumper_beta = 0.9, -- "beta" used for ranking (default: 1.0)
jumper_syntax = "fuzzy", -- default = "extended"
jumper_home_tilde = true, -- substitute $HOME with ~/ in the results (default: true)
jumper_relative = false, -- outputs relative pathes (default: false)
jumper_case_sensitivity = "insensitive",
-- By default, jumper records files and directories' visits in the files $__JUMPER_FILES and $__JUMPER_FOLDERS (which are ~/.jfiles and ~/.jfolders by default)
-- You can still provide other files to use here:
jumper_files = '/path/to/a/very/custom/file_database',
jumper_directories = '/path/to/a/very/custom/directory_database',
})
end
}
Big thanks to @ibhagwan, developer of fzf-lua who has been super helpful in answering my questions about his plugin. Credits to z and telescope-z