사용자 도구

사이트 도구


raylib:install:vim_syntax_for_raylib_cpp
vim syntax for raylib cpp

Introduction

This is Vim Syntax highlighting setting for Raylib. in C++ Developement.

Setting File

1. Make File

Your Custom Syntax File is Located at [~/.vim/after/syntax]

and, We will make C++ Synatx file. So we will make cpp.vim at [~/.vim/after/syntax]

For Linux, This command will make cpp.vim

mkdir -p ~/.vim/after/syntax 
cd ~/.vim/after/syntax 
touch ~/.vim/after/syntax/cpp.vim

Well, 'touch' command is unnessary. (or optional). Cause if we command 'vim cpp.vim', then cpp.vim file is created.

Now, we will Edit “cpp.vim” file.

2. Edit File

For Visual Studio Code,

code cpp.vim  
# code ~/.vim/after/syntax/cpp.vim

and for VIM

vim cpp.vim
# vim ~/.vim/after/syntax/cpp.vim

Create Custom cpp.vim

1. cpp.vim

This is my custom cpp.vim File For Raylib.

"cpp.vim"
" Vim syntax file
" Language:	C++  
" Specific Library : Raylib (https://github.com/raysan5/raylib)
" Author :	Dongkun Lee (https://lawwiki.kr/doku.php/start)
" First Created at : 2025. 12. 25. (Christmas!!)
" ver 1.0 
 
syn keyword raylibWindow	InitWindow CloseWindow SetWindowState ClearWindowState ToggleFullscreen ToggleBorderlessWindowed  
syn keyword raylibWindow    GetScreenWidth GetScreenHeight GetRenderWidth GetRenderHeight GetMonitorCount GetCurrentMonitor 
syn keyword raylibDrawing	BeginDrawing EndDrawing ClearBackground BeginMode2D EndMode2D BeginMode3D EndMode3D BeginTextureMode EndTextureMode 
syn keyword raylibConstant	WindowShouldClose IsWindowReady IsWindowFullscreen IsWindowHidden
syn keyword raylibTiming    SetTargetFPS GetFrameTime GetTime GetFPS 
syn keyword raylibInput     IsKeyPressed IsKeyPressedRepeat IsKeyDown IsKeyReleased IsKeyUp GetKeyPressed GetCharPressed SetExitKey 
syn keyword raylibInput     IsMouseButtonPressed IsMouseButtonDown IsMouseButtonReleased IsMouseButtonUp GetMouseX GetMouseY GetMousePosition GetMouseDelta
 
syn keyword raylibShape     DrawPixel DrawPixelV DrawLine DrawLineV DrawLineEx DrawCircle DrawRectangle DrawRectangleV DrawRectangleRec
syn keyword raylibShape     DrawFPS DrawText DrawTextEx DrawTextPro LoadFont LoadFontEx UnloadFont LoadUTF8 UnloadUTF8 
 
 
hi raylibWindow ctermfg=White ctermbg=Black cterm=NONE
hi raylibDrawing ctermfg=DarkCyan 
hi raylibConstant ctermfg=Magenta ctermbg=Black
hi raylibTiming ctermfg=White ctermbg=darkYellow
hi raylibInput ctermfg=DarkGreen ctermbg=Black
hi raylibShape ctermfg=DarkGreen 

2. Keyword

We can set VIM syntax keyword by this command

syn keyword (TITLE)  [keyword1, keyword2, .....]

You can find Raylib keyword at Raylib CheatShet.

3. color

Color setting is like this

hi (TITLE)  ctermfg=(COLOR) ctermbg=(COLOR) cterm=(NONE/BOLD) 

cterm : NONE / BOLD COLOR : You can find VIM Color constant at this page.

Conclusion

Now we get an brillant Raylib Syntax Highlight for VIM Editor!

VIM Syntax for Raylib

로그인하면 댓글을 남길 수 있습니다.

raylib/install/vim_syntax_for_raylib_cpp.txt · 마지막으로 수정됨: 저자 이거니맨