Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
mojo.vim49 linesDownload Raw Back to ftplugin
1" Vim filetype plugin2" Language:	Mojo3" Maintainer:	Riley Bruins <ribru17@gmail.com>4" Last Change:	2024 Jul 075" 2025 Apr 16 by Vim Project (set 'cpoptions' for line continuation, #17121)6 7if exists('b:did_ftplugin')8  finish9endif10let b:did_ftplugin = 111 12let s:cpo_save = &cpo13set cpo&vim14 15setlocal include=^\\s*\\(from\\\|import\\)16setlocal define=^\\s*\\(\\(async\\s\\+\\)\\?def\\\|class\\)17 18" For imports with leading .., append / and replace additional .s with ../19let b:grandparent_match = '^\(.\.\)\(\.*\)'20let b:grandparent_sub = '\=submatch(1)."/".repeat("../",strlen(submatch(2)))'21 22" For imports with a single leading ., replace it with ./23let b:parent_match = '^\.\(\.\)\@!'24let b:parent_sub = './'25 26" Replace any . sandwiched between word characters with /27let b:child_match = '\(\w\)\.\(\w\)'28let b:child_sub = '\1/\2'29 30setlocal includeexpr=substitute(substitute(substitute(31      \v:fname,32      \b:grandparent_match,b:grandparent_sub,''),33      \b:parent_match,b:parent_sub,''),34      \b:child_match,b:child_sub,'g')35 36setlocal suffixesadd=.mojo37setlocal comments=b:#,fb:-38setlocal commentstring=#\ %s39 40let b:undo_ftplugin = 'setlocal include<'41      \ . '|setlocal define<'42      \ . '|setlocal includeexpr<'43      \ . '|setlocal suffixesadd<'44      \ . '|setlocal comments<'45      \ . '|setlocal commentstring<'46 47let &cpo = s:cpo_save48unlet s:cpo_save49 
codekingpro/portable-devtools · Team Ai