aboutsummaryrefslogtreecommitdiff
path: root/autoload/build.kak
blob: d8a676c39cc9ff292e9b1dd05e4f9e280dc41d8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
set-option global makecmd 'echo "Build command not set"; exit 1'

define-command makecmd-set-tsc %{ set-option buffer makecmd "%val{config}/scripts/tsc-vimgrep.sh" }
define-command makecmd-set-cabal %{ set-option buffer makecmd "cabal build" }
define-command makecmd-set-cargo %{ set-option buffer makecmd "cargo build" }

# Overriding the make command
provide-module make-override %{
  define-command -params .. -override -docstring %{
    make [<arguments>]: make utility wrapper
    All the optional arguments are forwarded to the make utility
  } make %{
    evaluate-commands -save-regs m %{
      set-register m %opt{makecmd}
      evaluate-commands -try-client %opt{toolsclient} %{
        fifo -scroll -name *make* -script %{
          trap - INT QUIT
          trap 'echo -e "\n\nExited with $?" >&2' EXIT
          eval "$kak_reg_m \"\$@\""
        } -- %arg{@}
        set-option buffer filetype make
        set-option buffer jump_current_line 0
      }
    }
  }
}

hook -once global KakBegin .* %{ require-module make-override }