diff --git a/ftdetect/just.vim b/ftdetect/just.vim index 5a8e5be..b9532fd 100644 --- a/ftdetect/just.vim +++ b/ftdetect/just.vim @@ -4,4 +4,4 @@ " URL: https://github.com/NoahTheDuke/vim-just.git " Last Change: 2021 Aug 26 au BufNewFile,BufRead \cjustfile,.justfile,*.just setfiletype just -au BufNewFile,BufRead * if getline(1) =~# '\v^#!/%(\w|[/-])*\w/%(env%(\s+-S)?\s+)?just' | setfiletype just | endif +au BufNewFile,BufRead * if getline(1) =~# '\v^#!//@!%(\w|-|//@!)*/%(env%(\s+-S)?\s+)?just\A' | setfiletype just | endif diff --git a/tests/batch_ftdetect_res.vim b/tests/batch_ftdetect_res.vim index 023bb60..a16439f 100644 --- a/tests/batch_ftdetect_res.vim +++ b/tests/batch_ftdetect_res.vim @@ -1,3 +1,9 @@ +" Disable pager +set nomore + bufdo redir >> $OUTPUT | echo @% | set ft? | redir END +" Prevent stalling on 'Press ENTER or type command to continue' +call feedkeys("\") + qa diff --git a/tests/cases/ftdetect.json b/tests/cases/ftdetect.json index d065231..df9b1b8 100644 --- a/tests/cases/ftdetect.json +++ b/tests/cases/ftdetect.json @@ -17,8 +17,27 @@ { "content": "#!/usr/local/bin/just -f\n" }, + { + "content": "#!/opt/local/bin-/just -f\n" + }, { "content": "", "not_justfile": true + }, + { + "content": "#!/usr/bin/just", + "not_justfile": true + }, + { + "content": "#!/usr/bin/just\n", + "not_justfile": true + }, + { + "content": "#!/usr//bin/env just -f\n", + "not_justfile": true + }, + { + "content": "#!//usr/local/bin/just -f\n", + "not_justfile": true } ] \ No newline at end of file diff --git a/tests/src/test-ftdetect.rs b/tests/src/test-ftdetect.rs index 11f99cd..ea9666d 100644 --- a/tests/src/test-ftdetect.rs +++ b/tests/src/test-ftdetect.rs @@ -84,7 +84,7 @@ fn _main() -> io::Result<()> { let ftdetect_results = tempdir.path().join("ftdetect_results.txt"); let mut vim = Command::new("vim") - .args(["--not-a-term", "-S", "batch_ftdetect_res.vim"]) + .args(["--not-a-term", "-R", "-S", "batch_ftdetect_res.vim"]) .args(file2case.keys()) .env("OUTPUT", &ftdetect_results) .env("HOME", env::current_dir().unwrap())