Skip to content

History Jumper is a plugin for Neovim that allows you to quickly jump to previously opened files using just three keystrokes.

Notifications You must be signed in to change notification settings

zzhirong/history-jumper.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

History Jumper for Neovim

History Jumper is a plugin for Neovim that allows you to quickly jump to previously opened files using just three keystrokes. It is a great productivity tool for developers who work with multiple files simultaneously.

Installation

You can install History Jumper using your favorite plugin manager. Here's an example using lazy.nvim:

return {
    'zzhirong/history-jumper.nvim',
    config = function()
        require'history-jumper'.setup({
            prefix = '|',  -- Like a door to oldfiles
            change_dir = true, -- Will change to the dir of the file; if there is a git repository, then it will change the directory to the directory containing the .git
        })
    end
}

Make sure to also have fzf.vim installed. 2023-4-17 Update: remove dependencie of fzf.vim.

Custom Key Mapping

You can customize the key mapping for History Jumper by setting the prefix option in the configuration.

Usage

To jump to a previously opened file, input three keystrokes: prefix + the first letter of the last path portion + the first letter of the file name.

For example, to jump to history-jumper/lua/init.lua:

  1. The first key is prefix, which was assigned in the configuration (default is S).
  2. The last path portion is lua, so the second letter is l. Once you press the second letter, a floating window will appear with a list of candidates for selection. You can press <Esc> to abort the selection.
  3. The file name is init.lua, the first letter of the file name, which is i,
    1. If there is only one left with filename starts with i, then the third letter is i.
    2. If there are multiple files with names starting with i, this plugin will assign a number index next to the first one, so the third key may be a number.

So the final key to switch to history-jumper/lua/init.lua is Sli or sl[0-9].

About

History Jumper is a plugin for Neovim that allows you to quickly jump to previously opened files using just three keystrokes.

Resources

Stars

Watchers

Forks

Languages