Code Monkey home page Code Monkey logo

vi-increment's Introduction

Vi-Increment

Gitter Matrix

Increment and decrement numbers easily with Ctrl+a and Ctrl+x:

Usage

Vi-increment registers itself as a Vi change, so numeric prefixes and the dot command can be used:

$ 200             # 10<C-x>
$ 190             # 200.
$ -10             # .
$ -210

With setopt octalzeroes, Vi-increment will let Zsh-native arithmetic detect octal numbers and preserve them:

$ 0077            # <C-a>
$ 0100

Binary numbers are also detected and preserved:

$ 0b100011        # 11<C-x>
$ 0b11000

Vi-increment will also preserve leading zeroes, and fully supports negative numbers:

$ (( -0x0040 ))   # 8<C-a>
$ (( -0x0038 ))

Features

  • Operates in both visual and vicmd modes
  • Preserves leading zeroes
  • Preserves C-formatted hexadecimal numbers: 0x[hex]
  • Preserves C-formatted binary numbers: 0b[binary]
  • If setopt OCTAL_ZEROES: Preserves C-formatted octal numbers: 0[oct]

Future features:

  • Detect and preserve arbitrary zsh-format base [base]#[num]
  • Preserve underscores

Installation

Antigen:

antigen bundle zsh-vi-more/vi-increments
antigen apply

Zgen:

zgen load zsh-vi-more/vi-increment
zgen save

Zplug:

zplug zsh-vi-more/vi-increment

Zplugin:

zplugin ice wait "0"
zplugin light zsh-vi-more/vi-increment

# Optionally, track the latest development version:
zplugin ice wait "0" ver"dev"
zplugin light zsh-vi-more/vi-increment

Manually: Clone the project, and then source it:

source /path/to/vi-increment/vi-increment.zsh

vi-increment's People

Contributors

bitkeen avatar freed-wu avatar xpmo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sitdisch

vi-increment's Issues

No such shell function `vi-increment'

I'm getting this error since the last update:

No such shell function `vi-increment'

zsh 5.7.1 (x86_64-apple-darwin18.2.0)
macos 10.15.2
zplug 2.4.2

Act on number to left of cursor

Thank you so much for writing this!

I was wondering if you could support the following functionality (like vim):

$ vim file003.txt

With the cursor at the beginning of that line, pressing CTRL+A increments the number (i.e. it will "jump to the next number").

An additional idea that would be really handy: if the cursor is at the end of the line, do the same backwards (I wish Vim did this).

Change the symbolic link to a shell script?

In windows' msys2, git clone will convert any symbolic link to a file which content is the targe filename.

How about use a shell script which source another shell script to replace the symbolic link?

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.