From 07db909eb5ae2a559771068be64439eba394cd61 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 20 Nov 2024 23:50:30 +0100 Subject: docs: misc (#31138) Co-authored-by: zeertzjq --- runtime/indent/query.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'runtime/indent') diff --git a/runtime/indent/query.lua b/runtime/indent/query.lua index c5b4f1f03d..17b8e9d2ac 100644 --- a/runtime/indent/query.lua +++ b/runtime/indent/query.lua @@ -1,6 +1,5 @@ -- Neovim indent file -- Language: Treesitter query --- Last Change: 2024 Jul 03 -- it's a lisp! vim.cmd([[runtime! indent/lisp.vim]]) -- cgit From 4182e98752105eb62b412e1fb065923694e57d4d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 9 Dec 2024 20:37:36 +0100 Subject: vim-patch:b66cac1: runtime(typst): add definition lists to formatlistpat, update maintainer closes: vim/vim#16192 https://github.com/vim/vim/commit/b66cac1a8ed8636a38e867226f5bb621c96ff322 Co-authored-by: Luca Saccarola --- runtime/indent/typst.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/typst.vim b/runtime/indent/typst.vim index 6aaa04a53a..c990b968c8 100644 --- a/runtime/indent/typst.vim +++ b/runtime/indent/typst.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Typst -" Maintainer: Gregory Anders -" Last Change: 2024-07-14 +" Previous Maintainer: Gregory Anders +" Maintainer: Luca Saccarola +" Last Change: 2024 Dec 09 " Based on: https://github.com/kaarmu/typst.vim if exists('b:did_indent') -- cgit From adcd9360dfefc7b1e1edb0e86df460e074991c8d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 23 Dec 2024 11:12:58 +0100 Subject: vim-patch:4ce1cb5: runtime(graphql): contribute vim-graphql to Vim core Contribute the core of my vim-graphql project (ftplugin, indent, syntax) to the Vim project. This replaces the basic ftplugin support that was already in the runtime with a more complete set of filetype settings. I can assume maintainership for all of these files. I'll continue to maintain the higher-level embedded filetype support separately (in vim-graphql) for now, because it's fairly complex, but we can consider integrating that code directly into vim later. runtime files use the MIT license. closes: vim/vim#16273 https://github.com/vim/vim/commit/4ce1cb5bf1dc507224792543d8e56e6ab431a2b5 Co-authored-by: Jon Parise --- runtime/indent/graphql.vim | 92 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 runtime/indent/graphql.vim (limited to 'runtime/indent') diff --git a/runtime/indent/graphql.vim b/runtime/indent/graphql.vim new file mode 100644 index 0000000000..dc0769b9a8 --- /dev/null +++ b/runtime/indent/graphql.vim @@ -0,0 +1,92 @@ +" Vim indent file +" Language: graphql +" Maintainer: Jon Parise +" Filenames: *.graphql *.graphqls *.gql +" URL: https://github.com/jparise/vim-graphql +" License: MIT +" Last Change: 2024 Dec 21 + +" Set our local options if indentation hasn't already been set up. +" This generally means we've been detected as the primary filetype. +if !exists('b:did_indent') + setlocal autoindent + setlocal nocindent + setlocal nolisp + setlocal nosmartindent + + setlocal indentexpr=GetGraphQLIndent() + setlocal indentkeys=0{,0},0),0[,0],0#,!^F,o,O + + let b:did_indent = 1 +endif + +" If our indentation function already exists, we have nothing more to do. +if exists('*GetGraphQLIndent') + finish +endif + +let s:cpo_save = &cpoptions +set cpoptions&vim + +" searchpair() skip expression that matches in comments and strings. +let s:pair_skip_expr = + \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "comment\\|string"' + +" Check if the character at lnum:col is inside a string. +function s:InString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') ==# 'graphqlString' +endfunction + +function GetGraphQLIndent() + " If this is the first non-blank line, we have nothing more to do because + " all of our indentation rules are based on matching against earlier lines. + let l:prevlnum = prevnonblank(v:lnum - 1) + if l:prevlnum == 0 + return 0 + endif + + " If the previous line isn't GraphQL, assume we're part of a template + " string and indent this new line within it. + let l:stack = map(synstack(l:prevlnum, 1), "synIDattr(v:val, 'name')") + if get(l:stack, -1) !~# '^graphql' + return indent(l:prevlnum) + shiftwidth() + endif + + let l:line = getline(v:lnum) + + " If this line contains just a closing bracket, find its matching opening + " bracket and indent the closing bracket to match. + let l:col = matchend(l:line, '^\s*[]})]') + if l:col > 0 && !s:InString(v:lnum, l:col) + call cursor(v:lnum, l:col) + + let l:bracket = l:line[l:col - 1] + if l:bracket ==# '}' + let l:matched = searchpair('{', '', '}', 'bW', s:pair_skip_expr) + elseif l:bracket ==# ']' + let l:matched = searchpair('\[', '', '\]', 'bW', s:pair_skip_expr) + elseif l:bracket ==# ')' + let l:matched = searchpair('(', '', ')', 'bW', s:pair_skip_expr) + else + let l:matched = -1 + endif + + return l:matched > 0 ? indent(l:matched) : virtcol('.') - 1 + endif + + " If we're inside of a multiline string, continue with the same indentation. + if s:InString(v:lnum, matchend(l:line, '^\s*') + 1) + return indent(v:lnum) + endif + + " If the previous line ended with an opening bracket, indent this line. + if getline(l:prevlnum) =~# '\%(#.*\)\@ Date: Mon, 20 Jan 2025 22:45:47 +0100 Subject: vim-patch:9.1.1042: filetype: just files are not recognized Problem: filetype: just files are not recognized Solution: adjust filetype detection pattern, detect just shebang line, include just ftplugin, indent and syntax plugin (Peter Benjamin) closes: vim/vim#16466 https://github.com/vim/vim/commit/72755b3c8e91ec90447969b736f080e0de36003d Co-authored-by: Peter Benjamin --- runtime/indent/just.vim | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 runtime/indent/just.vim (limited to 'runtime/indent') 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 -- cgit