vim compiler plugin for ghostty filetype - validates config

`:make` will call `ghostty +validate-config` and populate the quickfix
list with the errors that can be navigated to (e.g. with `:cnext`)

`:h write-compiler-plugin`, and neovim's built in ftplugin/ and
compiler/ plugins were used as references
This commit is contained in:
Beau McCartney
2025-01-05 13:06:32 -07:00
parent f4a9b65f78
commit 8d7e57f64b
2 changed files with 17 additions and 0 deletions

View File

@ -615,6 +615,7 @@ pub fn build(b: *std.Build) !void {
_ = wf.add("syntax/ghostty.vim", config_vim.syntax); _ = wf.add("syntax/ghostty.vim", config_vim.syntax);
_ = wf.add("ftdetect/ghostty.vim", config_vim.ftdetect); _ = wf.add("ftdetect/ghostty.vim", config_vim.ftdetect);
_ = wf.add("ftplugin/ghostty.vim", config_vim.ftplugin); _ = wf.add("ftplugin/ghostty.vim", config_vim.ftplugin);
_ = wf.add("compiler/ghostty.vim", config_vim.compiler);
b.installDirectory(.{ b.installDirectory(.{
.source_dir = wf.getDirectory(), .source_dir = wf.getDirectory(),
.install_dir = .prefix, .install_dir = .prefix,
@ -631,6 +632,7 @@ pub fn build(b: *std.Build) !void {
_ = wf.add("syntax/ghostty.vim", config_vim.syntax); _ = wf.add("syntax/ghostty.vim", config_vim.syntax);
_ = wf.add("ftdetect/ghostty.vim", config_vim.ftdetect); _ = wf.add("ftdetect/ghostty.vim", config_vim.ftdetect);
_ = wf.add("ftplugin/ghostty.vim", config_vim.ftplugin); _ = wf.add("ftplugin/ghostty.vim", config_vim.ftplugin);
_ = wf.add("compiler/ghostty.vim", config_vim.compiler);
b.installDirectory(.{ b.installDirectory(.{
.source_dir = wf.getDirectory(), .source_dir = wf.getDirectory(),
.install_dir = .prefix, .install_dir = .prefix,

View File

@ -24,6 +24,21 @@ pub const ftplugin =
\\ \\
\\let b:undo_ftplugin = 'setl cms< isk< ofu<' \\let b:undo_ftplugin = 'setl cms< isk< ofu<'
\\ \\
\\if !exists('current_compiler')
\\ compiler ghostty
\\ let b:undo_ftplugin .= "| compiler make"
\\endif
\\
;
pub const compiler =
\\if exists("current_compiler")
\\ finish
\\endif
\\let current_compiler = "ghostty"
\\
\\CompilerSet makeprg=ghostty\ +validate-config
\\CompilerSet errorformat=%f:%l:%m
\\
; ;
/// Generates the syntax file at comptime. /// Generates the syntax file at comptime.