Neovim plugin to substitute visual selection in a specific range
Find a file
Sett17 bedc193c6d fix(lua/quicksub): do not escape pipe character in selected_text
The pipe character (|) should not be escaped when replacing special characters in the selected_text. This commit removes the escape ("\") for the pipe character in the gsub function.
2023-08-18 16:21:12 +02:00
lua/quicksub fix(lua/quicksub): do not escape pipe character in selected_text 2023-08-18 16:21:12 +02:00
.gitignore Initial commit 2023-08-11 10:16:04 +02:00
LICENSE Initial commit 2023-08-11 10:16:04 +02:00
README.md feat: add quicksub.nvim plugin 2023-08-11 16:08:01 +02:00

quicksub.nvim

quicksub.nvim is a Neovim plugin that streamlines the substitution process. With this plugin, you can visually select text and generate substitution commands interactively, making your editing workflow faster and more efficient.

Features:

  • Visually select text to be substituted.
  • Interactively input range offsets for substitutions.
  • Automatically generate and populate the command-line with the substitution command.

Installation:

Using lazy.nvim

{
    'sett17/quicksub.nvim',
    as = 'quicksub',
},

Usage:

After installation, quicksub.nvim does not have a default keybinding. You need to set it up in your Neovim configuration.

Here's an example of how to set up a keybinding for the plugin:

local qs = require('quicksub.quicksub')
vim.keymap.set("v", "<leader>s", quicksub.quicksub)

This will bind the quicksub function to s in visual mode.

Once activated you are going to be asked for a range:

Input Effect
$ Replace until end of file
% Replace in whole file
x : int Replace from current line until x lines after

quicksub will then input the substitute command for you with cursor in the replacement.

By default, it has the g and i flags. Making it global (replacing all occurrences in a line) and case-insensitive.

If these fit fo your usecase, just start typing to replace.