Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

Latest commit

 

History

History
51 lines (31 loc) · 1.57 KB

README.md

File metadata and controls

51 lines (31 loc) · 1.57 KB

⚠️ Deprecated since the release of Cairo 1. Now using Scarb Vim.

Starknet Vim

Updated Vim plugin to write Cairo contracts on Starknet.

  1. Auto-format
  2. Syntax highlighting
  3. Asynchronous linting with Vim ALE
  4. Ctags

Tags:

image

Linting:

image

image

Ctags regex:

--langdef=cairo
--map-cairo=+.cairo
--mline-regex-cairo=/@event([[:space:]])*([a-z ]+)[[:space:]]*([a-zA-Z]*)\(/\3\4/e,event/{mgroup=0}
--mline-regex-cairo=/@storage_var([[:space:]]+)func[ \t]+([a-zA-Z0-9_]+)*\(/\2\3/s,storage/{mgroup=0}
--mline-regex-cairo=/@constructor([[:space:]]+)func*([a-z ]+)*\{/\2\3/c,constructor/{mgroup=0}
--mline-regex-cairo=/@external([[:space:]]+)func*(.*)\{/\2\3/f,external/{mgroup=0}
--mline-regex-cairo=/@view([[:space:]]+)func*(.*)\{/\2\3/v,view/{mgroup=0}
--mline-regex-cairo=/(error_message+)\("(.*)\"/\2\3/r,error/{mgroup=0}

Install

with Vim-Plug:

Plug '0xhyoga/starknet-vim'

and put this in your .vimrc:

filetype plugin on

For ALE you can install here: https://github.com/dense-analysis/ale

For universal Ctags you can follow here for instructions https://github.com/universal-ctags/ctags

Depending on your setup, you will need to create a .ctags file with the above regex rules