sponsor Vim development Vim logo Vim Book Ad

nextval : Inc-/decrement the current value (bool, int, numeric, hex) with one keystroke

 script karma  Rating 8/4, Downloaded by 528    Comments, bugs, improvements  Vim wiki

created by
Michael Arlt
 
script type
utility
 
description
During editing position your cursor on a boolean, integer, number or hex value and press + or - in normal mode (esc).

Examples:

* switch=false # +/- -> true
* switch=TRUE  # +/- -> FALSE
* int=1 # - -> 0 -1 -2
* num=4.98 # + -> 4.99 5.00
* num=.4 # + -> .5
* hex=0x19 # + -> 0x1a
* hex=ab # + -> ac
* hex=1B07 # -> 1B08
* hex=#9 # + -> a

New variants:

* test5 # int surrounded
* test123test # int surrounded
* True # boolean
* 0xf9 # hex
* 5A3 # tex
* ’ # xml/xhtml
* \x19 # unix, bash
* FFh or 05A3H # intel assembly
* #9 # modulo2
* 16#5A3# # ada/vhdl
* 16r5A3 # smalltalk/algol
* 16#5A7 # postscript/bash
* \u0019 \U00000019 # bash
* #16r4a # common lisp
* &H5A3 or &5a3 # several basic
* 0h5A3 ti series
* U+20AD # unicode
* S=U+9 # integer
* $5A3 # assembly/basic
* H'ABCD' # microchip
* x"5A3" # vhdl
* 8'hFF # verilog
* #x4a # common lisp
* X'5A3' # ibm mainframe

Please provide feedback (Wiki/Mail) - especially if you vote "Unfulfilling".
 
install details
# example installation if you use pathogen:
mkdir -p ~/.vim/bundle/netxval/plugin
cp nextval.vim  ~/.vim/bundle/netxval/plugin
vi .vimrc # if you want to modifiy the default keys (C-a/C-x) and add e.g.:
nmap <silent> <unique> + <Plug>nextvalInc
nmap <silent> <unique> - <Plug>nextvalDec
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
nextval.vim 1.11 2013-11-11 7.0 Michael Arlt Bugfix for increment/decrement in last empty line (thx to Serpent)
nextval.vim 1.1 2013-10-14 7.0 Michael Arlt - Added boolen for python (True/False)
- Added integer surrounded by text
- Added many hex-variants
- Improved float
- Bugfix: inc/dec "worked" if you where near a value
- Big thanx to serpent for code/feedback/ideas
- Added expamples in source for simpler testing
nextval.vim 1.02 2013-04-23 7.0 Michael Arlt Set default keys to overwrite Vims internal cmd C-a (inc) and C-x (dec)  - thx to Serpent
nextval.vim 1.01 2013-04-22 7.0 Michael Arlt * Added standard check if already loaded
* Uses <Plug> for automatic mapping (if not already defined)
* Changed plugin calling (see usage)
* Removed forgotten debug output (sorry)
* Added buffer awareness
nextval.vim 1.0 2013-04-21 7.0 Michael Arlt Initial upload
ip used for rating: 54.90.227.32

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo