vim-backtrack helps you quickly jump back to your recent files in Vim or Neovim. With a single command, you’ll see your most recently opened files (up to 50—user configurable). Just press a number to open one instantly. No fuss, no extra setup.
- Instantly access your most recent files with
:Backtrack
(default 10, configurable up to 50). - Clean, numbered list - just press the number next to the file to navigate
- Choose how the list appears: in a split, a vertical split, or right in your current window (user configurable).
- Alternate split behavior for specific filetypes (user configurable).
- Only shows files that still exist on disk.
- Designed to be fast, simple, and out of your way.
Add this to your favorite plugin manager:
Plug 'josstei/vim-backtrack'
For init.vim
or init.lua
(vim-plug example):
Plug 'josstei/vim-backtrack'
Or with lazy.nvim:
{
'josstei/vim-backtrack'
}
Or clone it directly:
git clone https://github.com/josstei/vim-backtrack ~/.vim/pack/plugins/start/vim-backtrack
Just run:
:Backtrack
Or add it as a key map
" Normal mode: show recent files on <leader> b keypress
nnoremap <leader>b :Backtrack<CR>
You’ll get a list of recent files (up to your configured maximum). Each is labeled [01]
, [02]
, etc.
Press the matching number (in normal mode) and you’re back in your file.
Set the maximum number of files (up to 50, default 10):
let g:backtrack_max_count = 25
Set the split command for the file list buffer:
Value | What it does |
---|---|
'' |
Uses your current window |
split (default) |
Opens in a horizontal split |
vsplit |
Opens in a vertical split |
botright split |
Bottom horizontal split |
botright vsplit |
Bottom right vertical split |
topleft split |
Top horizontal split |
topleft vsplit |
Top left vertical split |
aboveleft split |
Above current window split |
aboveleft vsplit |
Above left vertical split |
belowright split |
Below current window split |
belowright vsplit |
Below right vertical split |
Example:
let g:backtrack_split = 'vsplit'
To use a different split for certain filetypes:
let g:backtrack_alternate_split_types = ['markdown', 'help']
let g:backtrack_alternate_split = 'belowright split'
When Backtrack is opened from a buffer with one of those filetypes, the alternate split will be used.
- Grabs your recent files from Vim’s own file history
- Only shows files that still exist on disk
- Cleans up after itself—no clutter left behind
- Local number mappings make file selection quick and efficient
:Backtrack
Press 3
to open the file labeled [03]
—done!
Contributions are welcome!
Feel free to open issues or pull requests for improvements or bug fixes.