Giter VIP home page Giter VIP logo

speeddating.vim's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=2120

Take the following date:

1999-12-31

Because Vim treats the hyphen as a negative sign, pressing CTRL-A on the 31 would normally increment it to

1999-12-30

Compare this with what happens when speeddating.vim is installed:

2000-01-01

Pressing 5<C-X> on the 03 in the first line below transforms it into the second:

Sat, 01 Jan 2000 00:00:03 +0000
Fri, 31 Dec 1999 23:59:58 +0000

Several date, time, and datetime formats are included.  Additional formats can be defined in a strftime-like syntax with the :SpeedDatingFormat command.

Existing Vim semantics are preserved.  CTRL-A and CTRL-X accept a count, and plain number incrementing is used if no date format is matched.

Use of CTRL-A/X in visual mode enables incrementing several lines at once.  Blank spots are filled by incrementing the match from the previous line, allowing for creation of sequences (1, 2, 3; 2000-10-30, 2000-10-31, 2000-11-01).

Can also increment roman numerals and ordinals (1st, 2nd, 3rd, ...).  In visual mode, letters of the alphabet are supported.

d<C-A> sets the timestamp under the cursor to the current time.  d<C-X> does the same, but uses UTC rather than the local time.

The "." command will work as expected if you install repeat.vim, vimscript #2136.

Feedback wanted: speeddating currently supports locale dependent day/month names/abbrevations, but also includes English abbreviation support.  However, most of the built-in formats just use the English version, because it is either mandated by a standard (like RFC 822) or because they are typically used in an international context (like the Last Change: header in Vim scripts).  Is it even worth supporting the locale dependent names at all?  Is anyone actively using them?

http://github.com/tpope/vim-speeddating

speeddating.vim's People

Stargazers

 avatar  avatar

Watchers

 avatar  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.