1

I've been writing some 65c816 assembly lately. They have some interesting commenting conventions that I was hoping VIM could help me with.

        LDA $E7         ; You see, they
        BEQ IfZero      ; put comments like this,
        INC A           ; all lined up with 1 TAB
        STA $E7         ; after the longest line.
IfZero:
        BRK ; and this is a comment that is not lined up correctly
        CPY      ; this one too!

I was wondering if there is a clever way to have all the comments in the file (or in a selection) lined up on the same column.

Desired result:

        LDA $E7         ; You see, they
        BEQ IfZero      ; put comments like this,
        INC A           ; all lined up with 1 TAB
        STA $E7         ; after the longest line.
IfZero:
        BRK             ; and this is a comment that is not lined up correctly (now it is)
        CPY             ; this one too!
2
  • If you search this site for "align", you can find lots of answers you can apply to this problem. This is my favourite question on the subject: How to left-align two columns of text?
    – Rich
    Jun 17, 2020 at 15:18
  • Hmmm. Although possibly I misread the question. Are you saying you want to keep one tab character between the commands and the comments, but just display all the comments lined up? If so, you just need to do :setlocal tabstop=24
    – Rich
    Jun 17, 2020 at 15:34

0

Browse other questions tagged or ask your own question.