mattn / mattn/vim-xxdcursor

Support xxd's -g flag

Open
#1 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vim Script
Stars
39
Forks
2
PR merge metrics
No merged PRs in 30d

Description

xxd has -g flag:

Usage:
       xxd [options] [infile [outfile]]
    or
       xxd -r [-s [-]offset] [-c cols] [-ps] [infile [outfile]]
Options:
    -a          toggle autoskip: A single '*' replaces nul-lines. Default off.
    -b          binary digit dump (incompatible with -ps,-i,-r). Default hex.
    -C          capitalize variable names in C include file style (-i).
    -c cols     format <cols> octets per line. Default 16 (-i: 12, -ps: 30).
    -E          show characters in EBCDIC. Default ASCII.
    -e          little-endian dump (incompatible with -ps,-i,-r).
    -g          number of octets per group in normal output. Default 2 (-e: 4).
    -h          print this summary.
    -i          output in C include file style.
    -l len      stop after <len> octets.
    -o off      add <off> to the displayed file position.
    -ps         output in postscript plain hexdump style.
    -r          reverse operation: convert (or patch) hexdump into binary.
    -r -s off   revert with <off> added to file positions found in hexdump.
    -s [+][-]seek  start at <seek> bytes abs. (or +: rel.) infile offset.
    -u          use upper case hex letters.
    -v          show version: "xxd V1.10 27oct98 by Juergen Weigert".

For example, xxd -l 32 ftplugin/xxd/cursor.vim:

00000000: 6675 6e63 7469 6f6e 2120 733a 6869 6768  function! s:high
00000010: 6c69 6768 7428 290a 2020 6966 2065 7869  light().  if exi

and xxd -g 4 -l 32 ftplugin/xxd/cursor.vim:

00000000: 66756e63 74696f6e 2120733a 68696768  function! s:high
00000010: 6c696768 7428290a 20206966 20657869  light().  if exi

When the cursor is on the first 66, the highlighting goes to the fifth character, t.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ftplugin/xxd/cursor.vim and inspect how the cursor position is derived from normal xxd output. Compare the shown default grouping with the xxd -g 4 example, then verify that placing the cursor on the first 66 highlights the fifth character as described. No test file is mentioned, so use these command-output examples as the completion check.

Written by the indexing model from the issue text.

Assessment

Tech stack
vim
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.