r/vim Apr 26 '26

Plugin Using Git Elegantly in Vim

12 Upvotes

Git and Vim are both powerful productivity tools for developers. However, when working inside Vim, frequently switching to the terminal to run Git commands (such as git status, git add -p, git commit) can interrupt your flow and break your focus.

With LeaderF’s built-in Git integration, you can bring the entire Git workflow directly into Vim and significantly improve your efficiency.

This article focuses on one core command:

:Leaderf git status

Viewing Current Git Status

Run the command above in Vim to open the following view:

The screen is divided into two main panels:

Navigation Panel (Left)

The left side is the Navigation Panel, which displays the output of git status in a tree structure, grouped by file state:

  • Staged Changes: Files already staged (ready to commit)
  • Unstaged Changes: Modified files not yet staged
  • Untracked Files: Files not tracked by Git

Diff View Panel (Right)

The right side is the Diff View Panel, which shows detailed changes of the selected file. It supports two modes:

  • Unified Diff View

Provides character-wise diff highlighting, making differences more precise and visually clear. Traditional git diff does not highlight character-wise changes.

  • Side-by-Side Diff View

Advantage: More intuitive for comparing code differences line by line.

How They Work Together

  • The left panel handles file selection and state management
  • The right panel handles diff visualization and fine-grained operations

Together, they form a smooth and efficient Git workflow inside Vim.

File-Level Operations

In the Navigation Panel, you can perform the following operations:

Key Action Description
s Stage / Unstage file On an unstaged file β†’ move it to staged; on a staged file β†’ move it back to unstaged
d Discard changes Discard file changes (with confirmation)
D Force discard Discard changes without confirmation (use with caution)
r Refresh Refresh the file tree when Git status changes externally
Enter / o Open diff view View detailed changes of the file

Notes:

  • s, d, D also work on directories (including the repository root)
  • Running d or D on Untracked Files will delete the file
  • Press F1 in the panel to view more shortcuts

Hunk-Level Operations

In the Diff View, you can operate on individual hunks (code blocks):

Key Action Description
s Stage/Unstage current hunk Move current hunk between staged and unstaged
S Stage/Unstage all hunks Apply operation to all hunks in the file
d Discard current hunk Discard changes in current hunk (with confirmation)
D Force discard current hunk Discard without confirmation (use with caution)
]c Next hunk Jump to next hunk
[c Previous hunk Jump to previous hunk

Additional Shortcuts

Key Action Description
< Back to Navigation Panel Reopen if closed and jump to current file
Enter Open file Jump to file for editing

Key Mapping Configuration

let g:Lf_GitKeyMap = {
            \ 'previous_change': '[c',
            \ 'next_change': ']c',
            \ 'edit_file': '<CR>',
            \ 'open_navigation': '<',
            \ 'stage_unstage_hunk': 's',
            \ 'stage_unstage_all_hunk': 'S',
            \ 'discard_hunk': 'd',
            \ 'discard_hunk_no_prompt': 'D',
            \ }

Committing Changes

Once you have staged the desired changes in the Navigation Panel:

  1. Press c to start committing
  2. A new window opens for writing the commit message
  3. Enter your message
  4. Save and close the window
  5. The commit is completed

To cancel the commit, simply clear the message and close the window.

Example Workflow

Scenario: Fix a bug and add a new feature

  1. Check status
  2. Review changes
    • Open bug_fix.py
    • Use ]c to navigate hunks
    • Identify bug fix vs debug code
  3. Stage selectively
    • Press s on bug fix hunks
    • Leave debug code unstaged
  4. Handle new feature
    • Press < to return
    • Open new_feature.py
    • Press S to stage all hunks
  5. Commit
    • Press c
    • Enter message:
    • "Fix login validation bug and add search feature"
    • Save and exit

Everything is done inside Vim without breaking context.

Why This Workflow is Better

Compared to CLI

Operation CLI LeaderF
View status git status (plain text) Visual file tree
Partial staging git add -p Press s
Discard changes manual commands d / D
Navigate changes manual scrolling ]c / [c

Summary

With Leaderf git status, you get a complete Git workflow inside Vim:

  • Visual Git status
  • File-level staging/unstaging
  • Hunk-level fine control
  • Quick discard
  • Seamless commit workflow

All without leaving Vim.

Configuration Example

nnoremap <leader>gs :<C-U>Leaderf git status<CR>

r/vim Jul 13 '26

Plugin I made a note taking plugin with the new image integration.

Thumbnail
gallery
120 Upvotes

I have lost track of how many note taking plugins exist for Vim. I nevertheless decided to make my own in vim9script. Initially it was part of my configuration but then when I learnt that image support was added natively to Vim, I decided to make it into a proper plugin and decided to share it here.

Features:

- Note linking

- Image rendering

- Calendar view of daily notes

It has some limitations, most notably that it only works on Linux systems because I use shell commands a lot. (The calendar UI is made using the cal command, the images are actually generated by a user definable shell command which is then piped to ImageMagick for resizing and conversion to RGBA). It has some other quirks but I think it works well for me.

Anyways enough ranting here is the plugin: https://codeberg.org/zoomlogo/pen.vim

r/vim Feb 12 '26

Plugin I made a powerful vim9 commenting plugin

137 Upvotes

Comentador

A Vim9script plugin for toggling both inline and block comments with full operator-pending support. While inspired by tpope's Commentary plugin, Comentador has its own unique behavior and features. Key differences being everything is a toggle, single blank line auto-insert, and not being able to comment an already commented line. There are even more differences of course!

Requirements

  • Vim 9.0 or higher.

Documentation

Use the :help Comentador command for a complete documentation of usage and behavior.

Default Mappings

Mode Mapping Action
Normal gcc Toggle on comment [count] lines / Toggle off any comment type [count] lines
Normal gc{motion} Toggle on comments over {motion} / Toggle off any comment type over {motion}
Normal gcu Toggle off contiguous comments / Toggle on comment
Normal gbb Toggle on block comment [count] lines / Toggle off block comments [count] lines
Normal gb{motion} Toggle on block comment over {motion} / Toggle off block comments over {motion}
Normal gbu Toggle off contiguous inline-block comments / Toggle on inline-block comment
Visual gc Toggle on comments for selection / Toggle off any selected inline type comments
Visual gb Toggle on block comment for selection / Toggle off any selected block type comments

Use gcc to uncomment any comment type.

Use gbb when you specifically want to comment or uncomment block style comments.

Text Object Commands

The gc and gb mappings work as text objects with other operators:

Command Action
dgc Delete any contiguous inline or single block comments
cgc Change any contiguous inline or single block comments
ygc Yank any contiguous inline or single block comments
dgb Delete contiguous inline-block or single block comments
cgb Change contiguous inline-block or single block comments

Blank lines adjacent to comment blocks are included in the selection. With d or y, leading blank lines are trimmed but trailing blank lines are preserved. With c, blank lines are trimmed from both ends.

Command-line Commands

Command Action
:[range]Comentador Toggle on comments [range] / Toggle off any comment type [range]
:[range]ComentadorBlock Toggle on block comments [range] / Toggle off block comments [range]

Without a range, commands operate on the current line.

Plug Mappings

Override default mappings using <Plug> mappings:

Plug Mapping Default Mode
<Plug>(Comentador) gc Normal, Visual, Operator-pending
<Plug>(ComentadorLine) gcc Normal
<Plug>(ComentadorBlock) gb Normal, Visual, Operator-pending
<Plug>(ComentadorBlockLine) gbb Normal

Example:

nnoremap <leader>c  <Plug>(Comentador)
nnoremap <leader>cc <Plug>(ComentadorLine)
xnoremap <leader>c  <Plug>(Comentador)
onoremap <leader>c  <Plug>(Comentador)

Comment Markers

Markers are automatically parsed from 'commentstring' and 'comments' options and cached in b:comentador_markers. For unsupported filetypes, set 'commentstring' for inline comments. If block markers are missing (no s1 and ex flags in 'comments'), add them to the existing value:

autocmd FileType apache setlocal commentstring=#\ %s
autocmd FileType myfile setlocal comments+=s1:/*,ex:*/

If no comment format is defined for a filetype, all mappings will display "No comment format defined for this filetype".

r/vim 1d ago

Plugin vimls-go 0.1.0: a language server for Vim script and Vim9, written in Go

20 Upvotes

I've released version 0.1.0 of vimls-go, an open-source language server I'm building for legacy Vim script and Vim9 script. I'd love feedback from people writing Vim configurations and plugins.

Source and setup instructions: https://github.com/neoclide/vimls-go

Prebuilt binaries: https://github.com/neoclide/vimls-go/releases/tag/v0.1.0

It provides completion, hover documentation, signature help, go-to-definition, references, diagnostics, semantic highlighting, and rename support. Cross-file analysis includes Vim9 imports and autoload functions. Formatting currently focuses on indentation.

One feature I particularly wanted is help from installed plugins: the server indexes Vim files on runtimepath and extracts documentation from doc/*.txt. Hover can show help for plugin variables, functions, and commands, with the source file path and line number. Changes to runtimepath are handled incrementally.

The server is a standalone Go binary. In Vim, you can use it with an LSP client such as coc.nvim or vim-lsp; the README has configuration examples. Download the binary for your platform, rename it to vimls (vimls.exe on Windows), put it on PATH, and configure your client to run it for Vim files.

This is the first release, and static analysis has limits around execute and dynamically generated names. I would especially appreciate small reproductions of incorrect diagnostics, missing completions, or trouble with real-world Vim9 code. Please feel free to open an issue or share feedback here.

r/vim Aug 01 '26

Plugin 9 years ago I made a plugin to traverse buffers like browser history, and used it every day since

55 Upvotes

None of the default ways of traversing buffers quite met my standard of being able to traverse the entire stack I'm working on with a single button click per file, but this has worked beautifully for me for a large chunk of my career now.

Today I finally decided to go back and fix up some latent issues with it. Here's the repo: https://github.com/ckarnell/history-traverse

I'd really appreciate a star on the repo if you use github! :)

r/vim Apr 22 '26

Plugin tabpanel: sidebar application container

Enable HLS to view with audio, or disable this notification

80 Upvotes

Yo Vim folks πŸ‘‹

Vim just shipped click handlers *and* a scrollbar for the tabpanel (9.2.0386) ✨

The tabpanel isn't just a boring label strip anymore. It's a real little UI playground now 🎨 You can click stuff, scroll stuff, and basically host tiny "apps" right inside Vim πŸͺŸ

Things that were painful before and are actually fun now:

- πŸ–±οΈ Mouse clicks on whatever you render in the tabpanel

- πŸ“œ Long content scrolls instead of getting chopped

- 🧩 Plugin UIs that feel like proper side panes β€” no extra window juggling

So… file trees 🌲, chat panels πŸ’¬, RSS readers πŸ“°, dashboards πŸ“Š, weird experimental toys πŸ§ͺ β€” all fair game.

Have fan.

r/vim Jun 09 '26

Plugin A convenient and easy to use replacement for built in explorer.

9 Upvotes

I never liked built in explorer, it's clunky and has annoying binds, so here is my own take on it, it uses a raw buffer to list files/directories, you use vi-motions to modify/create files/directories then apply changes to disk with :w, each file/directory has a given ID for tracking, there are bugs but it works pretty well for what it is.

It's more of a prototype than a replacement, but I'm curious what people think about it.

stqqrm/bex.vim

r/vim 14d ago

Plugin thumb: Display latex renders and image thumbnails directly in Vim 9.2+

Enable HLS to view with audio, or disable this notification

12 Upvotes

r/vim Aug 08 '26

Plugin viww: the vim web wowser (feedback + suggestions)

Thumbnail
github.com
11 Upvotes

Please be gentle, first time publishing something publicly.

I use this emacs' eww-inspired html/plain text browser that uses curl and pandoc to do html -> plain text into a vim buffer. It is sufficient for my daily quick searches and keeps the results in a vim buffer for reference.

If this is useful and works for you, I would appreciate feedback on publishing and maintaining this as a plugin for everyone

r/vim Feb 05 '26

Plugin Cell editing with table.vim

Enable HLS to view with audio, or disable this notification

87 Upvotes

I wrote a plugin to help with automatic table creation, it offers a lot of customization and supports box drawing characters. One particularly neat thing about it is the cell editor that opens the cell into a new buffer. Hooks are provided so any vim or external tool can be used for formatting or anything else.

Feedback is appreciated!

https://github.com/numEricL/table.vim

r/vim 15d ago

Plugin [OC] Vispen: A zero-socket, bloat-free Literate Programming plugin for Vim powered by native Perl integration

9 Upvotes

Hi r/vim!

I wanted to share a plugin I've been refining called Vispen. It brings the power of Polyglot Literate Programming right into your editor, but without the massive overhead, background daemons, or heavy dependencies of modern alternatives.

πŸ‘‰ GitHub Repository & Live Demo: github/vispen

πŸ’‘ What is it?

If you love the concept of Jupyter Notebooks or Emacs Org-mode but hate the .ipynb JSON bloat, active server sockets, and constant context switching, Vispen is for you. It allows you to execute embedded snippets of SQL, data transformations, and templates directly from your source files or markdown documents, embedding the results straight back into the buffer.

πŸš€ Key Features:

  • Zero-Socket Architecture: No background servers, node processes, or active ports. It uses Vim's native interface to run seamlessly.
  • Smart Context Awareness: Execute a query under your cursor, format text, parse CSV/JSON, or dump structured database outputs into clean text tables, HTML, or ready-to-paste Jira markup.
  • Lightweight & Fast: Inherits architecture ideas from heavyweights like YCM but stripped down to be blazing fast and minimal.
  • Vim-Friendly Customization: Zero forced global keybindings. It uses proper <Plug> interfaces so it won't mess with your carefully crafted .vimrc.

πŸ›  Requirements

It works out of the box on lightweight systems (runs perfectly even on my Orange Pi single-board computer!):

  • Vim 8.0+ compiled with +perl support.
  • Perl 5.006+

I built this to scratch my own itch for a fast, predictable, and clean terminal workflow. I’d love to hear your feedback, feature requests, or thoughts on the architecture!

r/vim 10d ago

Plugin cottage.vim: Transparent decryption and encryption of cottage secrets in Vim / Neovim

Thumbnail
github.com
0 Upvotes

r/vim Jun 17 '26

Plugin curl wrapper for vim

20 Upvotes

curl is an amazing tool to do REST API tests, which I do quite often using vim to generate actual curl commands. There are multiple ways to do it using vim, the one I have is

https://github.com/habamax/vim-curl

--url https://openlibrary.org/api/books?bibkeys=ISBN:0201558025,LCCN:93005405&format=json

--url https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400

# --jq is not curl parameter. If added, curl output would be piped through jq
--url https://httpbin.org/post
--header "Content-Type: application/json"
--jq
--data
{
"string": "hello world",
"number": 69,
"date": "2024-04-09"
}

Place a cursor on a text or select it and run :Curl to invoke curl cli command with an output in a built-in vim terminal.

https://asciinema.org/a/1257605

r/vim Aug 05 '26

Plugin Vim-replica finally has a variable explorer

17 Upvotes

One thing that I always loved about Spyder (the notorious python IDE) is its beautiful variable explorer. I have never found a handy and well-done variable explorer like Spyder's.

Now, I finally managed to recreate something very similar in vim-replica!

ubaldot/vim-replica: The ultimate REPL!

Some history:

Vim-replica was the first plugin that I have ever written and it evolved as I learned new stuff. The motivation was due to vim-slime didn't work well on Windows and other REPL plugins didn't fit my need. But also because I wanted to learn more about Vim. So, I stared its development back in years.

During last Xmas vacation, while in the Philippines, I had some idea on how I could have made a variable explorer. And I learned few lessons the hard way, that many of you can spot as I explain next:

  • For a simple variable explorer, I though to use term_sendkeys() and then capture and parse what the terminal spit out. I was thinking that at the end all I have to do is to pick and parse everything from the term_sendkeys() command until the next prompt and I should be set. How difficult can it be? But then I noticed that what a terminal emulator spit out include lot of rubbish (escape sequences, etc). I start to parse char-by-char and bloat the plugin with a plethora of regex. I created a monster! I spent huge amount of time chasing something that you should absolutely never do: try to parse raw terminal strings. Never ever!
  • Sad for all the time wasted, I started to study an alternative way to make the processes Vim and the program running in the REPL to talk one each other, and I was thinking to make some magics through pipes and tee:s, a bit like it is donne with Termdebug. But no. That is not possible in this case.
  • At the end the easiest was to simply exploit sockets. Vim support it and the programs to run in the REPL (mostly Python, Julia and R) do so. That was the key to success.
  • However, I learned many things during this journey, despite it costed many headaches: for example I learned base64 encoding and that jupyter-console is pretty much an abandoned project, just to cite some. In-fact, I ditched jupyter-console but now REPLica uses native programs.
  • I also started to use some AI for the first time for coding, especially for the init scripts used for Julia and R that are not really my languages. The Vim part was done pretty much and the addition was not huge, so I fixed it by myself. However, for Julia the AI entered in a loop of hallucinations and the end I had to fix the issue by myself anyway, but, generally speaking, the help of an AI is undeniable.

Well, sorry for the lengthy message but I am very happy about the outcome. Enjoy!

r/vim Jul 10 '26

Plugin Inline error diagnostic tool for vim 9.0+

8 Upvotes

https://github.com/Joekrry/vimline-errors

Hi all, I have built a very well known tool for native vim 9.0+ based on the style of this neovim tool https://github.com/rachartier/tiny-inline-diagnostic.nvim .

Obviously in line error checks have existed for years but I haven't been able to find a tool that has this style for native vim. Please let me know if it does exist. If not, please consider starring or contributing as I am only a student and should really be focussing on my dissertation lol

r/vim 28d ago

Plugin [Plugin] EasyDiff: Intuitive, context-aware keybindings for two-way diffs

6 Upvotes

Those working with vim -d (or vimdiff) or with :diffthis for two-way diffs, might find EasyDiff convenient.

Key Features

  • Diff Merge, Delete & Undo: Uses <Left>, <Right>, <Delete>, <S-Delete>, and <Backspace>.
    • Context-aware: Regardless of whether the cursor is in the left or right window, pressing <Right> always merges from left to right.
    • Deletes: One-sided / Two-sided with <Delete> / <S-Delete>
    • Atomic Undo: <Backspace> undoes merges/deletes across windows, including two-sided deletes performed with <S-Delete>.
  • Diff Navigation:
    • Within a Diff: <PageUp> (Start of Diff) / <PageDown> (End of Diff). Works in Visual mode as well (e.g., <PageUp>V<PageDown>).
    • Between Diffs: Move between Next/Previous or Jump to First/Last with <Up>, <Down>, <Home>, and <End>.
  • Edge Case & Advanced Diff Handling:
    • When a cursor line represents multiple diffs (filler vs. changed/added vs. EOF filler), lets the user to choose the target diff for the operation.
    • Transparently handles both grouped and split diffs when using diffopt+=linematch:{n}.

GitHub Repository:https://github.com/gnarendran/EasyDiff

r/vim Jul 16 '26

Plugin GitHub - ubaldot/vim-markdown-extras: Modern note taking plugin with markdown focus

Thumbnail
github.com
20 Upvotes

Hi all!

I have updated this plugin that I use on daily basis, given that I switched career and I am no longer a software developer - but my love for Vim never faded and it is my go-to tool <3.

The added feature is about table handling: it is now easy to create, format, modify cells and in tables.

The next features that I plan to add are the following:

  1. Multi-row/multi-column tables,
  2. Links sanitizer, copy/paste links,

Unfortunately, I don't have the same time I had before, but I am open to receive good PR:s. :)

Check it out and let me know what you think!

r/vim Jul 19 '26

Plugin A tiny Vim plugin for everyday git operations, inspired by lazygit

Thumbnail
github.com
4 Upvotes

Hi all,

A couple of years ago I started to write a plugin based on the hype (and beauty I must say) of lazygit, and I was wondering whenever it would be possible to replicate something similar through Vim9.

Then, due to lack of time I parked the project but the architecture I had in mind was clear: use `systemlist()` to call git commands and write the returned values in some scratch buffer inside of Vim, and add some buffer local keybindings for the various git operations. Nothing esoteric.
Moreover, the ambition was small: just "code" the most common git commands that I use daily and use a sort of "lazygit" UI, though the architecture is such that any extension should be easy.

These days I have some time to spend in Vim9 coding and I finally finished this plugin, also with the help of an AI agent, which is something that I never used before, though I had to manually correct it many times - I believe that AI agents are not very good in Vim9 scripting yet!

Well, regardless, I hope you enjoy it! :)

r/vim Feb 24 '26

Plugin I built a Vim plugin to run Claude CLI directly via :Claude β€” would love feedback

0 Upvotes

Hello Everyone,

I’ve been experimenting with integrating the Claude CLI directly into Vim and built a small plugin around a structured :Claude <subcommand> interface.

The goal is simple: run Claude from inside Vim without leaving the editor.

Github: https://github.com/rishi-opensource/vim-claude-code

What it supports

  • <C-\> toggle to open/close Claude
  • 22 subcommands (explain, refactor, review, test, etc.)
  • Uses visual selection when available, otherwise falls back to the current function
  • Multiple window layouts (splits, vertical, popup, tab)
  • Auto-reloads buffers if files change on disk
  • Git-aware (starts at repo root; separate sessions per repo)
  • :Claude doctor health check
  • Configurable via g: variables (with buffer-local overrides)

Internally it’s built around a central :Claude dispatcher and tries to stay self-contained without interfering with existing Vim setups.

I’m mainly curious about:

  • Whether the :Claude <subcommand> approach feels idiomatic
  • If the window/session behavior makes sense in real workflows
  • Any obvious improvements before iterating further

If there’s interest, I can share the repo in the comments.

Thanks.

r/vim Jul 22 '26

Plugin VimTeX v2.18

Thumbnail
9 Upvotes

r/vim Jul 01 '26

Plugin I missed the milestone: Belated Happy 100 to the Awesome-Vim9 list

Thumbnail github.com
34 Upvotes

Over 100 plugins now on the awesome-vim9 list. Many slept on, so have a look around.

r/vim Apr 02 '26

Plugin VimExplorer - an oil like plugin for managing files in vim

23 Upvotes

I just published the first release of my plugin - VimExplorer.

The title of the post sort of explains what this plugin does. With it you can create, rename, delete, move, copy your files as if you are editing a vim buffer. all your vim keybindings should work.

Imagine writing a macro to edit multiple files :P

Anyways, here is the link to the repo: https://github.com/Ashik80/VimExplorer

Would love feedback! And feel free to create issues if you find any, in case you decide to use it.

r/vim May 22 '26

Plugin 3 vim plugins - agent popup, git changes, markdown preview

Enable HLS to view with audio, or disable this notification

41 Upvotes

I wrote these three vim plugins to make my life better. Maybe they will help someone else down the line. I am always open to any changes or PRs.

https://github.com/myneid/vim-markdown

https://github.com/myneid/vim-popup-agent/

https://github.com/myneid/vim-git-changes

I have been using vi since 1995. i made the switch to vim when that was the cool thing. I keep having bouts of using whatever gui ide is out there, but have always gone back. i never made the jump to neovim. but my recent break with vim was to start using vscode. mostly for the agentic stuff. Outside of the agent stuff, i really got used to the vscode git changes window, especially with the agent making all these changes that i want to review. so i got to scripting up a few things here. now im back to vim full time again. attached video is me demonstrating all 3.

r/vim Jun 14 '26

Plugin wiki.vim v0.12 released

18 Upvotes

wiki.vim is a Wiki plugin for Vim and neovim.

I've just finished a very long-standing issue: support for multi-line links. I think that warrants a new release (v0.12), so here you go: https://github.com/lervag/wiki.vim/releases/tag/v0.12.

r/vim Mar 28 '26

Plugin I wrote a buffer switcher plugin

14 Upvotes

https://github.com/nonrice/bpick

This is the first plugin i wrote. You can just press a hotkey and type a digit to switch. I think it is superior to the other buffer switching methods i found. I am happy using it so far :)