Skip to content

Commit

Permalink
vim compiler plugin for ghostty filetype (#4645)
Browse files Browse the repository at this point in the history
Basically integrates `ghostty +validate-config` with vim's compiler
feature. This allows validating the config from vim and navigating to
errors e.g. with the quickfix list.
  • Loading branch information
mitchellh authored Jan 6, 2025
2 parents 5346854 + 94bf448 commit 6181487
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ pub fn build(b: *std.Build) !void {
_ = wf.add("syntax/ghostty.vim", config_vim.syntax);
_ = wf.add("ftdetect/ghostty.vim", config_vim.ftdetect);
_ = wf.add("ftplugin/ghostty.vim", config_vim.ftplugin);
_ = wf.add("compiler/ghostty.vim", config_vim.compiler);
b.installDirectory(.{
.source_dir = wf.getDirectory(),
.install_dir = .prefix,
Expand All @@ -646,6 +647,7 @@ pub fn build(b: *std.Build) !void {
_ = wf.add("syntax/ghostty.vim", config_vim.syntax);
_ = wf.add("ftdetect/ghostty.vim", config_vim.ftdetect);
_ = wf.add("ftplugin/ghostty.vim", config_vim.ftplugin);
_ = wf.add("compiler/ghostty.vim", config_vim.compiler);
b.installDirectory(.{
.source_dir = wf.getDirectory(),
.install_dir = .prefix,
Expand Down
15 changes: 15 additions & 0 deletions src/config/vim.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ pub const ftplugin =
\\
\\let b:undo_ftplugin = 'setl cms< isk< ofu<'
\\
\\if !exists('current_compiler')
\\ compiler ghostty
\\ let b:undo_ftplugin .= " makeprg< errorformat<"
\\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.
Expand Down

0 comments on commit 6181487

Please sign in to comment.