Git Product home page Git Product logo

vim-stamp's Introduction

Vim Stamp

Stamp is a NeoVim and Vim plugin that makes it easy to replace text with the contents of the last command. This allows you to very quickly replace text in a repeatable way without the need for macros.

Demo

This is easiest to explain with a demo. Let's take this line of text as an example:

Hello Hola Bonjour Olà Hallo

With your cursor on Hello, run yiw to copy the first word.

[H]ello Hola Bonjour Olà Hallo

Next, his w to move to Hola and run Siw (stamp inner word).

Hello [H]ello Bonjour Olà Hallo

Tuh duh! You've just stamped a word. The contents of your unnamed register (in this case when you yanked the first word) have now replaced the second word. You can use Stamp with any command that populates the unnamed register, such as d, dd, y, yy and x.

If you have repeat.vim installed, you can repeat a stamp with the . key. Try it by switching to the next word and then stamping again with w..

Hello Hello [H]ello Olà Hallo

The great thing about Stamp is it works with any motion. That means you have maximum flexibility when stamping. Some of the more useful motions include stamping inside strings (Si"), stamping blocks (Sib), stamping paragraphs (Sip) and stamping until the end of the line (S$).

Stamp supports the following modes:

  • Normal mode motions (S<motion>)
  • Visual line selections (V<motion>S)
  • Visual character selections (v<motion>S)
  • Lines (SS)

Installation

Stamp can be installed using your favorite Vim plugin manager. I recommend using vim-plug.

Plug 'LandonSchropp/vim-stamp'

If you'd like Stamp to work with the repeat key (.), you need to install the repeat.vim plugin as well.

Development

If you'd like to poke around in this repo, it comes with a few scripts to make local development much easier:

  • bin/run: Execute arbitrary commands inside of a Neovim instance that only has Vader and Stamp loaded.
  • bin/test: Run the Vader test suite.
  • bin/example: Calls bin/run and loads a buffer with some sample data for easy, on-the-fly testing.

vim-stamp's People

Contributors

landonschropp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.