mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.7k stars 705 forks source link

support different make_error_patterns for different file types #5175

Open QiBaobin opened 1 month ago

QiBaobin commented 1 month ago

make the option useful in other scopes, for example:

hook global BufSetOption filetype=zig %{
    set-option buffer makecmd 'zig'
    set-option buffer make_error_pattern "^(?:\w:)?([^:\n]+):(\d+):(?:(\d+):)? (?:fatal )?error:([^\n]+)?"
    set-option buffer formatcmd 'zig fmt --stdin'
    set-option buffer lintcmd 'zig fmt --check'
}
hook global BufSetOption filetype=kotlin %{
    set-option buffer makecmd 'abt -s @'
    set-option buffer make_error_pattern '(?:e: file://)([^:\n]+):(\d+):(\d+)([^\n]+)?'
    set-option buffer formatcmd 'java -jar ~/bin/ktfmt.jar -'
    set-option buffer lintcmd 'abt -s @ check'
}