History
Article Edit this page Discussion

Cool trick to change numbers

From Vim Tips Wiki

(Redirected from VimTip287)
Jump to: navigation, search

[edit] Duplicate tip

This tip is very similar to the following:

These tips need to be merged – see the merge guidelines.

Tip 287 Previous Next Created: July 25, 2002 Complexity: basic Author: Nitya Version: 5.7


To decrement a number, switch to normal mode, place your cursor on it, and press <CTRL-X>. Similarly, use <CTRL-A> to increment it.

The 'nrformats' option controls whether letters, octal and hexadecimal numbers are recognized and modified accordingly. The default value of nrformats is "octal,hex" so numbers that start with 0 are assumed to be octal, and numbers that start with 0x or 0X are assumed to be hexadecimal. :set nrformats+=alpha allows these keys to increment and decrement letters of the alphabet.

[edit] References

[edit] Related plugin

These keys (<CTRL-A>, <CTRL-X>) can be used on a visual selection by using script#821. This plugin also allows resequencing numbers in a selected list (example included on the script page).

[edit] Interaction with other applications or plugins

  • If you use vim under screen, press <CTRL-A> and then hit a. Screen then sends on a translation of <CTRL-A> to the underlying program - vim.
  • Using mswin will override the behaviour of <CTRL-A> and <CTRL-X>. This overriding occurs frenquently on default installations of vim on Ms Windows platforms. See :help mswin.vim.

[edit] Comments

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Cool trick to change numbers"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation