Skip to content

Commit

Permalink
runtime: add PicoLisp filetype
Browse files Browse the repository at this point in the history
  • Loading branch information
nat-418 committed Apr 10, 2024
1 parent df46115 commit 64034de
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
28 changes: 21 additions & 7 deletions runtime/autoload/dist/ft.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1156,13 +1156,13 @@ export def FTfoam()
endwhile
enddef

# Determine if a *.tf file is TF mud client or terraform
export def FTtf()
var numberOfLines = line('$')
for i in range(1, numberOfLines)
var currentLine = trim(getline(i))
var firstCharacter = currentLine[0]
if firstCharacter !=? ";" && firstCharacter !=? "/" && firstCharacter !=? ""
# determine if a *.tf file is tf mud client or terraform
export def fttf()
var numberoflines = line('$')
for i in range(1, numberoflines)
var currentline = trim(getline(i))
var firstcharacter = currentline[0]
if firstcharacter !=? ";" && firstcharacter !=? "/" && firstcharacter !=? ""
setf terraform
return
endif
Expand Down Expand Up @@ -1191,6 +1191,20 @@ export def FTdat()
endif
enddef

# Determne if a *.l file is Lex or PicoLisp
export def FTl()
var numberoflines = line('$')
for i in range(1, numberoflines)
var currentline = trim(getline(i))
var firstcharacter = currentline[0]
if firstcharacter !=? "("
setf picolisp
return
endif
endfor
setf lex
enddef

export def FTlsl()
if exists("g:filetype_lsl")
exe "setf " .. g:filetype_lsl
Expand Down
5 changes: 4 additions & 1 deletion runtime/filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,10 @@ au BufRead,BufNewFile *.ldg,*.ledger,*.journal setf ledger
au BufNewFile,BufRead *.less setf less

" Lex
au BufNewFile,BufRead *.lex,*.l,*.lxx,*.l++ setf lex
au BufNewFile,BufRead *.lex,*.lxx,*.l++ setf lex

" Lex and PicoLisp
au BufNewFile,BufRead *.l call dist#ft#FTl()

" Libao
au BufNewFile,BufRead */etc/libao.conf,*/.libao setf libao
Expand Down
14 changes: 14 additions & 0 deletions runtime/ftplugin/picolisp.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
" PicoLisp filetype plugin file
" Language: PicoLisp
" Maintainer: nat-418 <[email protected]>
" Latest Revision: 2024-04-10

if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1

setlocal comments=s1:#{,ex:}#,:#
setlocal commentstring=#\ %s

let b:undo_ftplugin = "setl com< cms<"
3 changes: 2 additions & 1 deletion src/testdir/test_filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def s:GetFilenameChecks(): dict<list<string>>
lean: ['file.lean'],
ledger: ['file.ldg', 'file.ledger', 'file.journal'],
less: ['file.less'],
lex: ['file.lex', 'file.l', 'file.lxx', 'file.l++'],
lex: ['file.lex', 'file.lxx', 'file.l++'],
lftp: ['lftp.conf', '.lftprc', 'anylftp/rc', 'lftp/rc', 'some-lftp/rc'],
lhaskell: ['file.lhs'],
libao: ['/etc/libao.conf', '/.libao', 'any/.libao', 'any/etc/libao.conf'],
Expand Down Expand Up @@ -528,6 +528,7 @@ def s:GetFilenameChecks(): dict<list<string>>
pf: ['pf.conf'],
pfmain: ['main.cf', 'main.cf.proto'],
php: ['file.php', 'file.php9', 'file.phtml', 'file.ctp', 'file.phpt', 'file.theme'],
picolisp: ['file.l'],
pike: ['file.pike', 'file.pmod'],
pilrc: ['file.rcp'],
pine: ['.pinerc', 'pinerc', '.pinercex', 'pinercex'],
Expand Down

0 comments on commit 64034de

Please sign in to comment.