A universal file navigator for Vim with interactive filtering capabilities.
Mista provides a powerful way to navigate any text file by extracting results into a dedicated buffer, then interactively filtering and jumping back to the source.
/moves your cursor through matches, one by one.- Mista shows all matches at once in a results buffer → you can keep/reject with filters, travel history (undo/redo of filters), and jump to the source lines when ready.
TL;DR: Search becomes a navigable view with memory.
- Universal file support: Works with any text file, not just Markdown
- Multiple extraction modes: View all lines, search by keyword, or extract Markdown headers
- Interactive filtering: Keep/Reject with full history navigation (back/forward)
- Smart navigation: Jump directly to source locations from the result buffer
- Customizable keymaps: Define buffer-local mappings via a dictionary
- Event hooks: Run custom functions before/after operations
- State persistence: Remembers filter state and cursor position when toggling
- Markdown-aware: Header extraction and helpful highlighting for Markdown
Install the plugin using your preferred plugin manager:
Example with vim-plug:
" vim-plug
Plug 'kis9a/vim-mista'- Add key mappings to your
.vimrc:
nnoremap <Leader>M :Mista!<CR> " Toggle Mista
nnoremap <Leader>m1 :Mista #<CR> " Show level 1 headers
nnoremap <Leader>m2 :Mista ##<CR> " Show level 2 headers
nnoremap <Leader>ms :Mista " Search (type keyword after)- Open any file:
:edit README.md " Markdown file
:edit script.py " Python file
:edit config.json " JSON file
" Works with any text file!-
Try these commands:
<Leader>M- Toggle Mista navigator (works with any file)<Leader>m1- Show headers in sidebar (Markdown only):Mista TODO- Search for "TODO" items (all file types):Mista function- Search for "function" in code files
-
In the Mista buffer, use:
<CR>- Jump to sourcemk- Keep filtermr- Reject filtermq- Close buffermh- Show help
| Command | Description |
|---|---|
:Mista[!] [arg] |
Open Mista buffer. Without arg: show all lines. With #/##/etc: show headers. With text: search. With !: toggle |
:MistaJump |
Jump to the source location of the current line |
:MistaClose |
Close the Mista buffer |
:MistaKeep {keyword} |
Keep only lines containing the keyword |
:MistaReject {keyword} |
Reject lines containing the keyword |
:MistaFilterUndo |
Undo filter operation |
:MistaFilterRedo |
Redo filter operation |
:MistaGoNext |
Navigate to next match in source buffer |
:MistaGoPrev |
Navigate to previous match in source buffer |
:MistaRedraw |
Redraw the current buffer |
:MistaConfig {key} [{value}] |
Get or set configuration values |
:MistaInfo |
Display debug information |
:MistaHelp |
Show help for buffer mappings in Mista buffer |
" Show all lines in a new tab (works with any file)
:Mista
" Show only level 2 headers in sidebar (Markdown only)
:Mista ##
" Search for lines containing "TODO" (all file types)
:Mista TODO
" Search for function definitions in code files
:Mista function
" Search for class definitions
:Mista class
" Toggle Mista buffer
:Mista!Add these to your .vimrc to customize Mista:
" Supported filetypes (default: all)
" Empty array = all filetypes supported
let g:mista#filetypes = []
" Or restrict to specific filetypes
let g:mista#filetypes = ['markdown', 'vim', 'python', 'javascript']
" Sidebar width when opening headers/search results
let g:mista#sidebar_width = 40
" Conceal line numbers at end of lines
let g:mista#conceal_number = 1
" Case sensitivity for searches
let g:mista#case_sensitive = 0
" Center screen after jumping
let g:mista#jump_center = 1
" Recognized header levels
let g:mista#header_levels = range(1, 10)
" Direction for opening sidebar
let g:mista#open_direction = 'leftabove'Inside a Mista buffer, these mappings are available:
| Key | Action |
|---|---|
<CR> |
Jump to source location |
mq |
Close Mista buffer |
mu |
Undo filter operation |
mU |
Redo filter operation |
mk |
Keep filter (prompts for keyword) |
mr |
Reject filter (prompts for keyword) |
mh |
Show help for Mista buffer mappings |
You can override specific mappings while keeping others:
" Override specific buffer mappings
let g:mista#buffer_keymaps = {
\ '<CR>': {'mode': 'n', 'rhs': ':echo "preview"<CR>', 'opts': '<silent>'},
\ 'K': {'mode': 'n', 'rhs': ':MistaKeep ', 'opts': ''},
\ 'R': {'mode': 'n', 'rhs': ':MistaReject ', 'opts': ''},
\ 'q': {'mode': 'n', 'rhs': ':MistaClose<CR>', 'opts': '<silent>'},
\ }
" Add your own global mapping to open Mista
nnoremap <Leader>M :Mista!<CR>Mista maintains a history of your filters, allowing you to navigate back and forth through different filter states:
- Apply multiple filters sequentially
- Use
mpto go back to previous states - Use
mnto go forward in history - New filters from a past state create a branch (forward history is truncated)
Execute custom functions at specific stages of Mista operations:
let g:mista#hooks = {
\ 'open': [
\ {
\ 'hook': 'echo "Opening Mista"',
\ 'stage': 'before',
\ 'priority': 10
\ },
\ {
\ 'hook': function('MyOpenHandler'),
\ 'stage': 'after',
\ 'priority': 20
\ }
\ ],
\ 'jump': [
\ {
\ 'hook': function('MyJumpHandler'),
\ 'stage': 'before',
\ 'priority': 10
\ }
\ ]
\ }Available events:
open,close: Buffer lifecyclejump: Navigation to sourcefilter_keep,filter_reject: Filtering operationshistory_prev,history_next: History navigation
" Open any code file
:edit main.py
" Search for all TODO comments
:Mista TODO
" Further filter to specific function
:MistaKeep process_data
" Jump to each item with <CR>
" Go back to previous filter with mp" Open a markdown file with review notes
:edit review.md
" Show all TODO headers
:Mista ##
:MistaKeep TODO
" Further filter to high priority items
:MistaKeep HIGH" Open documentation
:edit docs/api.md
" Show all level 2 headers (main sections)
:Mista ##
" Filter to configuration-related sections
:MistaKeep config
" Jump to section with <CR>" Open meeting notes
:edit meetings/2024.md
" Search for action items
:Mista action
" Filter by person
:MistaKeep @john
" Navigate through filtered results-
Header Overview: Use
:Mista ##for a quick document outline -
Progressive Filtering: Start broad, then narrow down with multiple filters
-
Case-Insensitive Search: Searches are case-insensitive by default. Set
g:mista#case_sensitive = 1to change this -
Combine with Other Plugins: Works great with markdown preview plugins for a complete markdown workflow
:Mista- View all lines:Mista keyword- Search for specific keywords- Keep/Reject filtering
- Filter history navigation
- State persistence
:Mista ##- Extract headers by level- Markdown syntax highlighting in results
- ATX-style headers support (
#symbols)
Note: Setext-style headers (underlined) are not yet supported
The plugin includes a comprehensive test suite using vim-themis:
# Install test framework
make init
# Run tests
make testContributions are welcome! Please ensure:
- All tests pass
- New features include tests
- Code follows the existing style
- Documentation is updated
This project is licensed under the MIT License - see the LICENSE file for details.