/vim-hexdec

Convert hexadecimal numbers to decimal and vice versa.

Primary LanguageVim scriptMIT LicenseMIT

vim-hexdec

A small number base conversion script for Vim.

Description

This vim plugin lets you convert hexadecimal numbers to decimal counterparts and vice versa by exposing following functions:

  • :Hex2Dec
  • :Dec2Hex

The functions work for visual selection, block selection, line ranges and the whole buffer. You can also convert the numbers without changing the file by passing additional argument as in :Hex2Dec 0xdeadbeef. Conversion should work for arbitrary positive integers.

Demo

GIF animation

Bindings

The plugin doesn't define any bindings and leaves the choice to the user. Here's a demonstration how to bind the commands in the .vimrc file:

nnoremap gbh :Dec2Hex<CR>
nnoremap gbd :Hex2Dec<CR>

Installation

Use your favorite plugin manager. For example, using vim-plug:

Plug 'rr-/vim-hexdec'

Related work

Based on: