Giter Club home page Giter Club logo

scalpel.nvim's Introduction

scalpel.nvim

scalpel.nvim is a Neovim plugin designed to expedite your find/replace workflow within a buffer. It sets up Neovim's native substitution command, automating some steps to reduce some typing.

scalpel-nvim demo

build release

Installation

Install scalpel.nvim with your preferred plugin manager.

The following example shows the installation process using lazy.nvim. It sets the scalpel substitute keymap to <leader>e.

{
  'wassimk/scalpel.nvim',
  version = "*",
  config = true,
  keys = {
    {
      '<leader>e',
      function()
        require('scalpel').substitute()
      end,
      mode = { 'n', 'x' },
      desc = 'substitute word(s)',
    },
  },
}

Note

You can set the keymap to anything you wish.

Usage

Normal Mode

  1. Move the cursor over the word to replace
  2. Trigger the substitution with your keymap
  3. Begin typing the desired substitution and hit return

Visual Mode

  1. Use visual mode (v) to select the word(s) to replace within a single line
  2. Trigger the substitution with your keymap
  3. Begin typing the desired substitution and hit return

Visual Line Mode

  1. Highlight word(s) to substitute with * or /
  2. Use visual line mode (V) to highlight the lines with the word(s) to substitute
  3. Trigger the substitution with your keymap
  4. Begin typing the desired substitution and hit return

Tip

The word(s) being replaced during substitution are available in the replacement text using &.

Acknowledgments

This project was inspired by Scalpel, a Vimscript plugin I've used for many years. scalpel.nvim is my version, which was reimagined and implemented in Lua for fun.

scalpel.nvim's People

Contributors

wassimk avatar github-actions[bot] avatar

Stargazers

Mauricio Vieira avatar Christian McCormick avatar Philipp Steinrötter avatar  avatar Yuta Katayama avatar

Watchers

 avatar

scalpel.nvim's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.