Coder Social home page Coder Social logo

repeatable.vim's Introduction

Repeatable.vim

Repeatable.vim provides a simple interface to create dot(.) repeatable mappings via tpope's repeat.vim. Add Repeatable in front of your mapping and it will be repeatable. This works with the various mapping arguments such as <silent>, <expr>, <buffer>, etc. It is designed to work exactly as you'd expect with a typical mapping, except repeatable.

Example with Repeatable.vim

Repeatable nnoremap gp p`]

Example without Repeatable.vim

nnoremap <silent> <Plug>PasteBelowCursorEnd p`]
\:call repeat#set("\<Plug>PasteBelowCursorEnd")<CR>
nmap gp <Plug>PasteBelowCursorEnd

Many users install repeat.vim as a supplement to other plugins however some may shy away from creating their own mappings due to its interface being verbose or intimidating. This plugin reduces it down to one Repeatable command which you add as a prefix to your mapping. No need to mess with custom <Plug> mappings, Repeatable.vim will take care of that for you.

Install with on-demand loading

Add the Repeatable command to on-demand loading if your plugin manager supports it.

" Example using vim-plug and on-demand loading
Plug 'tpope/vim-repeat'
Plug 'kreskij/Repeatable.vim', { 'on': 'Repeatable' }

Install without on-demand loading

If your plugin manager doesn't support on-demand loading, call the repeatable#Setup() function before any use of the Repeatable command

" Example using vim-plug and without on-demand loading
Plug 'tpope/vim-repeat'
Plug 'kreskij/Repeatable.vim'
"...
call repeatable#Setup()

Usage

Define mappings as you normally would and add Repeatable in front.

This plugin works with <expr> mappings too.

Examples

" Paste below/above and put cursor at the end of the paste
Repeatable nnoremap gp p`]
Repeatable nnoremap gP P`]

" Paste inside current line (overwrites line) (repeatable)
Repeatable nnoremap <expr> gpp '"_dd"'.v:register.'P'

repeatable.vim's People

Contributors

bobwhitelock avatar kreskij avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

bobwhitelock

repeatable.vim's Issues

`repeatable#Set` doesn't pass map count to `repeat#set`

vim-repeat gives the option to pass a count to the repeat, so it can be used when pressing .. It seems like Repeating doesn't pass any count to repeat#set, which usually receives v:count. It would be nice to have the option to automatically pass the <count> used in the mapping to it.

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.