sponsor Vim development Vim logo Vim Book Ad

rgbasm syntax file for Linux Users : For those writing Rednex GameBoy Assembly on Vim using a Linux system

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

created by
wady jacoby
 
script type
syntax
 
description
For those looking to write assembly for Game Boy using a Linux system (I'm using Kubuntu) in 2026 and beyond, here you go! Credits to https://www.vim.org/account/profile.php?user_id=3833 (Oyd E Leven) for making the original file back in 2003 or earlier. I encountered some installation errors after sourcing Oyd's original file because the original file had some hidden carriages (/r and /r/n) that my Vim on Linux didn't understand fully because those carriages are only readable on non-Linux systems. So I consulted with Claude.ai, who helped me come up with a python script to convert the file into this Linux-friendly version (simple ASCI II, no other types of non-Linux formatting present). Even AFTER cleaning up the script, there will still errors that I had to go in and manually clean up on my own. Enjoy!!
 
install details
I'll explain the steps first, then provide the terminal commands for your convenience:

Steps:
- Download the rgbasm.vim file here.
- Then, go to your home directory and create new .vim/syntax and .vim/ftdetect directories (Vim automatically recognizes these).
- Then, place the rgbasm.vim file into the .vim/syntax directory.
- Then, you need to create a new file in .vim/ftdetect again called rgbasm.vim, and put the following code in there: "au BufRead,BufNewFile *.asm,*.z80 set filetype=rgbasm" (minus the double quotes).
- Once that's done, you should be good to go. Make a test.asm file to see if everything runs without errors. If you'd like to copy and paste some test assembly code, I've provided some below.
- While in test.asm, hit ESCAPE and then type "set filetype?" and hit enter. you should see that the filetype is rgbasm

Commands (run after downloading the rgbasm.vim file into your downloads folder):
1. "cd ~"
2. "mkdir -p ~/.vim/syntax"
3. "mkdir -p ~/.vim/ftdetect"
4. "mv ~/Downloads/rgbasm.vim ~/.vim/syntax"
5. "echo 'au BufRead,BufNewFile *.asm,*.z80, *.s set filetype=rgbasm' > ~/.vim/ftdetect/rgbasm.vim"

At this point, you may create a new test.asm file in your home directory using the test assembly code below:
First, run the command: "touch test.asm"
then copy the below text and paste into the vim file (right click --> paste).
You should see properly highlighted syntax at this point!
Finally, while in vim, hit ESCAPE and type "ZZ" to save and close the file.

; ============================================================
; Hello World-style test ROM for syntax highlighting check (written by Claude.ai)
; ============================================================

INCLUDE "hardware.inc"

SECTION "Header", ROM0[$100]
    nop
    jp Start

SECTION "Main", ROM0[$150]

; --- Constants ---
SCREEN_WIDTH  EQU 160
SCREEN_HEIGHT EQU 144

; --- Simple macro ---
MACRO wait_vblank
    ld a, [rL

Feel free to reach out with any errors or comments! Happy programming :)

 

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
rgbasm.vim 1 2026-03-29 5.7 wady jacoby Initial version
ip used for rating: 216.73.216.163

Questions about Vim should go to the maillist. Help Uganda.     Vim at Github