diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS index 6052197de5..9874dc7ac2 100644 --- a/.github/MAINTAINERS +++ b/.github/MAINTAINERS @@ -208,6 +208,7 @@ runtime/ftplugin/json.vim @dbarnett runtime/ftplugin/json5.vim @dkearns runtime/ftplugin/jsonc.vim @izhakjakov runtime/ftplugin/julia.vim @carlobaldassi +runtime/ftplugin/just.vim @pbnj runtime/ftplugin/jq.vim @vito-c runtime/ftplugin/kconfig.vim @chrisbra runtime/ftplugin/kdl.vim @imsnif @jiangyinzuo @@ -354,6 +355,7 @@ runtime/indent/javascript.vim @bounceme runtime/indent/json.vim @elzr runtime/indent/jsonc.vim @izhakjakov runtime/indent/julia.vim @carlobaldassi +runtime/indent/just.vim @pbnj runtime/indent/kdl.vim @imsnif @jiangyinzuo runtime/indent/kotlin.vim @udalov runtime/indent/krl.vim @KnoP-01 @@ -512,6 +514,7 @@ runtime/syntax/jjdescription.vim @gpanders runtime/syntax/json.vim @vito-c runtime/syntax/jsonc.vim @izhakjakov runtime/syntax/julia.vim @carlobaldassi +runtime/syntax/just.vim @pbnj runtime/syntax/jq.vim @vito-c runtime/syntax/karel.vim @kirillmorozov runtime/syntax/kconfig.vim @chrisbra diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim index 33ed7fd2fc..859126f0f6 100644 --- a/runtime/autoload/dist/script.vim +++ b/runtime/autoload/dist/script.vim @@ -4,7 +4,7 @@ vim9script # Invoked from "scripts.vim" in 'runtimepath' # # Maintainer: The Vim Project -# Last Change: 2023 Aug 10 +# Last Change: 2025 Jan 20 # Former Maintainer: Bram Moolenaar export def DetectFiletype() @@ -133,6 +133,9 @@ export def Exe2filetype(name: string, line1: string): string elseif name =~ 'node\(js\)\=\>\|js\>' || name =~ 'rhino\>' return 'javascript' + elseif name =~# 'just' + return 'just' + # BC calculator elseif name =~ '^bc\>' return 'bc' diff --git a/runtime/filetype.vim b/runtime/filetype.vim index f9d189f631..6b323bd823 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: The Vim Project -" Last Change: 2025 Jan 15 +" Last Change: 2025 Jan 20 " Former Maintainer: Bram Moolenaar " Listen very carefully, I will say this only once @@ -1292,7 +1292,7 @@ au BufNewFile,BufRead *.jsonnet,*.libsonnet setf jsonnet au BufNewFile,BufRead *.jl setf julia " Just -au BufNewFile,BufRead [jJ]ustfile,.justfile,*.just setf just +au BufNewFile,BufRead \c{,*.}justfile,\c*.just setf just " KAREL au BufNewFile,BufRead *.kl setf karel diff --git a/runtime/ftplugin/just.vim b/runtime/ftplugin/just.vim new file mode 100644 index 0000000000..6f2acddf96 --- /dev/null +++ b/runtime/ftplugin/just.vim @@ -0,0 +1,17 @@ +" Vim ftplugin file +" Language: Justfile +" Maintainer: Peter Benjamin <@pbnj> +" Last Change: 2025 Jan 19 +" Credits: The original author, Noah Bogart + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal iskeyword+=- +setlocal comments=n:# +setlocal commentstring=#\ %s + +let b:undo_ftplugin = "setlocal iskeyword< comments< commentstring<" diff --git a/runtime/indent/just.vim b/runtime/indent/just.vim new file mode 100644 index 0000000000..d7f82b118f --- /dev/null +++ b/runtime/indent/just.vim @@ -0,0 +1,51 @@ +" Vim indent file +" Language: Justfile +" Maintainer: Peter Benjamin <@pbnj> +" Last Change: 2025 Jan 19 +" Credits: The original author, Noah Bogart + +" Only load this indent file when no other was loaded yet. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetJustfileIndent() +setlocal indentkeys=0},0),!^F,o,O,0=''',0=\"\"\" + +let b:undo_indent = "setlocal indentexpr< indentkeys<" + +if exists("*GetJustfileIndent") + finish +endif + +function GetJustfileIndent() + if v:lnum < 2 + return 0 + endif + + let prev_line = getline(v:lnum - 1) + let last_indent = indent(v:lnum - 1) + + if getline(v:lnum) =~ "\\v^\\s+%([})]|'''$|\"\"\"$)" + return last_indent - shiftwidth() + elseif prev_line =~ '\V#' + return last_indent + elseif prev_line =~ "\\v%([:{(]|^.*\\S.*%([^']'''|[^\"]\"\"\"))\\s*$" + return last_indent + shiftwidth() + elseif prev_line =~ '\\$' + if v:lnum == 2 || getline(v:lnum - 2) !~ '\\$' + if prev_line =~ '\v:\=@!' + return last_indent + shiftwidth() + shiftwidth() + else + return last_indent + shiftwidth() + endif + endif + elseif v:lnum > 2 && getline(v:lnum - 2) =~ '\\$' + return last_indent - shiftwidth() + elseif prev_line =~ '\v:\s*%(\h|\()' && prev_line !~ '\V:=' + return last_indent + shiftwidth() + endif + + return last_indent +endfunction diff --git a/runtime/syntax/just.vim b/runtime/syntax/just.vim new file mode 100644 index 0000000000..77423a3c91 --- /dev/null +++ b/runtime/syntax/just.vim @@ -0,0 +1,406 @@ +" Vim syntax file +" Language: Justfile +" Maintainer: Peter Benjamin <@pbnj> +" Last Change: 2025 Jan 19 +" Credits: The original author, Noah Bogart + +if exists('b:current_syntax') + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +let b:current_syntax = 'just' + +" syncing fromstart prevents mismatched highlighting when jumping around in a justfile +" linebreaks= keeps multi-line constructs highlighted correctly while typing +syn sync fromstart linebreaks=10 + +" a-zA-Z0-9_- +syn iskeyword @,48-57,_,- + +syn match justComment "#.*$" contains=@Spell,justCommentTodo +syn match justCommentInBody '#.*$' contained contains=justCommentTodo,justInterpolation,@justOtherCurlyBraces +syn keyword justCommentTodo TODO FIXME XXX contained +syn match justShebang "^\s*#!.*$" contains=justInterpolation,@justOtherCurlyBraces +syn match justName "\h\k*" contained +syn match justFunction "\h\k*" contained + +syn match justPreBodyComment "\v%(\s|\\\n)*%([^\\]\n)@3%(%(\s|\\\n)*\=)@!" contained + +syn region justRecipeParenDefault + \ matchgroup=justRecipeDepParamsParen start='\v%(\=%(\s|\\\n)*)@<=\(' end='\V)' + \ contained + \ contains=@justExpr +syn match justRecipeSubsequentDeps '\V&&' contained + +syn match justRecipeNoDeps '\v:%(\s|\\\n)*\n|:#@=|:%(\s|\\\n)+#@=' + \ transparent contained + \ contains=justRecipeColon + \ nextgroup=justPreBodyComment,@justBodies +syn region justRecipeDeps start="\v:%(\s|\\\n)*%([a-zA-Z_(]|\&\&)" skip='\\\n' end="\v#@=|\\@1>> expect: [['#!/path/expect']], execline: [['#!/sbin/execlineb -S0'], ['#!/usr/bin/execlineb']], gnuplot: [['#!/path/gnuplot']], + just: [['#!/path/just']], make: [['#!/path/make']], nix: [['#!/path/nix-shell']], pike: [['#!/path/pike'], diff --git a/src/version.c b/src/version.c index 5b3683ddd8..286cbec8cd 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1042, /**/ 1041, /**/