This PR adds support for the PicoLisp programming language. PicoLisp exclusively uses the *.l filename extension, which is currently also used by Lex among several other extensions, so I have removed *.l from the Lex filename extensions and transferred it to PicoLisp.
https://github.com/vim/vim/pull/14476
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dkearns requested changes on this pull request.
> @@ -1199,7 +1199,7 @@ 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
You can't just steal the *.l extension for the new filetype, unless you're willing to fight off a horde of pitch-fork wielding Lex users.
You need to add a function to https://github.com/vim/vim/tree/master/runtime/autoload/dist/ft.vim that can determine the file type based on content heuristics and call that from the autocmd in filetype.vim.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In runtime/autoload/dist/ft.vim:
> +# determine if a *.tf file is tf mud client or terraform +export def fttf()
The function name should not be changed
⬇️ Suggested change-# determine if a *.tf file is tf mud client or terraform -export def fttf() +# Determine if a *.tf file is TF mud client or terraform +export def FTtf()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 commented on this pull request.
> @@ -1199,7 +1199,7 @@ 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
I confess that I have never written vim9script before and I have forgotten what vimscript I once did know, so if the function I have added seems poor to you I apologize in advance. Essentially, I am trying to express the notion that, as a Lisp, a PicoLisp file should always begin with a leading ( somewhere (excluding shebangs, etc.).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In runtime/autoload/dist/ft.vim:
> @@ -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 !=? "("
⬇️ Suggested change
- if firstcharacter !=? "("
+ if firstcharacter ==? "("
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 commented on this pull request.
In runtime/autoload/dist/ft.vim:
> +# determine if a *.tf file is tf mud client or terraform +export def fttf()
this was a mistake on my part, and I offer my apologies
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dkearns requested changes on this pull request.
In runtime/autoload/dist/ft.vim:
> @@ -1191,6 +1191,28 @@ export def FTdat() endif enddef +# Determne if a *.l file is Lex or PicoLisp⬇️ Suggested change
-# Determne if a *.l file is Lex or PicoLisp +# Determine if a *.l file is Lex or PicoLisp
In runtime/autoload/dist/ft.vim:
> @@ -1191,6 +1191,28 @@ export def FTdat() endif enddef +# Determne if a *.l file is Lex or PicoLisp +export def FTl() + " Default to Lex + set ft=lex⬇️ Suggested change
- set ft=lex + setf lex
All set ft= lines need to use setf.
In runtime/autoload/dist/ft.vim:
> @@ -1191,6 +1191,28 @@ export def FTdat() endif enddef +# Determne if a *.l file is Lex or PicoLisp +export def FTl()
There needs to be an option to override this behaviour with a global variable g:filetype_l like the FTlsl example.
This also needs to be documented at :help filetype-overrule.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Thanks to @dkearns and @zeertzjq for guiding me through this PR.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
thanks, but tests still seem to fail.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
test still fails :/
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In src/testdir/test_filetype.vim:
> @@ -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'],
⬇️ Suggested change
- picolisp: ['file.l'],
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@nat-418 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In runtime/autoload/dist/ft.vim:
> @@ -1191,6 +1191,32 @@ export def FTdat()
endif
enddef
+# Determine if a *.l file is Lex or PicoLisp (default to Lex)
+export def FTl()
+ if exists("g:filetype_l")
+ exe "setf " .. g:filetype_l
+ return
+ endif
+ for i in range(1, line("$"))
Many filetype detection functions have a limit to the number of lines to check, like using range(1, min([line("$"), 100]))
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
this has stalled, so closing
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()