diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-02-29 17:22:26 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2024-02-29 17:22:26 +0100 |
| commit | aa3a69e0d72cdb1d239058792461d9343ea72800 (patch) | |
| tree | f4ec69ced76dfad76f9fc7d12e3fd10b508ba16f | |
| parent | 25ecd338367c5458bdb0332a1ba066fd1a32b358 (diff) | |
| download | dotfiles-aa3a69e0d72cdb1d239058792461d9343ea72800.tar.gz dotfiles-aa3a69e0d72cdb1d239058792461d9343ea72800.zip | |
[vis] replace vis-build with a submodule
| -rw-r--r-- | .gitmodules | 3 | ||||
| m--------- | config/vis/plugins/vis-build | 0 | ||||
| -rw-r--r-- | config/vis/plugins/vis-build/.editorconfig | 11 | ||||
| -rw-r--r-- | config/vis/plugins/vis-build/Makefile | 19 | ||||
| -rw-r--r-- | config/vis/plugins/vis-build/README.md | 24 | ||||
| -rw-r--r-- | config/vis/plugins/vis-build/init.lua | 52 | ||||
| -rwxr-xr-x | config/vis/plugins/vis-build/tools/check-format | 8 |
7 files changed, 3 insertions, 114 deletions
diff --git a/.gitmodules b/.gitmodules index d9c10e7..b5fb427 100644 --- a/.gitmodules +++ b/.gitmodules @@ -44,3 +44,6 @@ [submodule "config/vis/plugins/vis-snippets"] path = config/vis/plugins/vis-snippets url = git@gitlab.com:muhq/vis-snippets.git +[submodule "config/vis/plugins/vis-build"] + path = config/vis/plugins/vis-build + url = git@gitlab.com:muhq/vis-build.git diff --git a/config/vis/plugins/vis-build b/config/vis/plugins/vis-build new file mode 160000 +Subproject 7eea122ccf24efc9de55e2d9bf0dd69f0e18e50 diff --git a/config/vis/plugins/vis-build/.editorconfig b/config/vis/plugins/vis-build/.editorconfig deleted file mode 100644 index 1635025..0000000 --- a/config/vis/plugins/vis-build/.editorconfig +++ /dev/null @@ -1,11 +0,0 @@ -# http://editorconfig.org - -root = true - -[*.lua] -indent_style = space -indent_size = 2 - -[.gitlab-ci.yml] -indent_style = space -indent_size = 2 diff --git a/config/vis/plugins/vis-build/Makefile b/config/vis/plugins/vis-build/Makefile deleted file mode 100644 index 144e229..0000000 --- a/config/vis/plugins/vis-build/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -.PHONY: check format check-luacheck check-format - -LUA_FILES := $(shell find -name "*.lua" -not -path "./json.lua") - -TEST_FILES := $(shell find -name "*_test.lua") - -check: check-luacheck check-format - -check-luacheck: - luacheck --globals=vis -- $(LUA_FILES) - -check-format: - set -e; for lf in $(LUA_FILES); do tools/check-format "$${lf}"; done - -format: - lua-format -i $(LUA_FILES) - -test: - set -e; for tf in $(TEST_FILES); do "$$tf"; done diff --git a/config/vis/plugins/vis-build/README.md b/config/vis/plugins/vis-build/README.md deleted file mode 100644 index 23c4de0..0000000 --- a/config/vis/plugins/vis-build/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# vis-build - asynchronously run (build) commands - -This is a simple `vis` plugin to asynchronously run any shell command using -the `vis:communicate` API. - -I use the plugin to run build commands while keeping my editor usable. - -## Configuration - -By default, the `build` will execute `make(1)` in the current directory. -The used build command can either be passed as first argument to `build` or -is retrieved by calling the function `build.get_default_build_cmd`. - -So in order to change the default build command to ninja add this snippet to -you `visrc.lua`: - -```lua -local build = require('plugins/vis-build') -build.get_default_build_cmd = function() return 'ninja' end -``` - -## Bindings - -`<M-b>` is bound to the `build` command. diff --git a/config/vis/plugins/vis-build/init.lua b/config/vis/plugins/vis-build/init.lua deleted file mode 100644 index 0558c39..0000000 --- a/config/vis/plugins/vis-build/init.lua +++ /dev/null @@ -1,52 +0,0 @@ -local M = {} -M.get_default_build_cmd = function() return 'make' end - -local build_id = 0 -local builds = {} - -M.new_build = function(cmd) - build_id = build_id + 1 - local build_name = 'build' .. build_id - local build_fd = vis:communicate(build_name, cmd) - local build = {fd = build_fd, out = '', err = '', cmd = cmd} - builds[build_name] = build -end - -vis.events.subscribe(vis.events.PROCESS_RESPONSE, - function(name, event, code, msg) - local build = builds[name] - if not build then return end - - if event == 'EXIT' or event == 'SIGNAL' then - if code ~= 0 then - vis:message('build: ' .. name .. ' cmd: ' .. build.cmd) - if event == 'EXIT' then - vis:message('failed with: ' .. code) - else - vis:message('got signal: ' .. code) - end - vis:message('stdout:\n' .. build.out) - vis:message('stderr:\n' .. build.err) - else - vis:info(name .. ' done') - end - builds[name] = nil - end - - if event == 'STDOUT' then - build.out = build.out .. msg - elseif event == 'STDERR' then - build.err = build.err .. msg - end -end) - -vis:command_register('build', function(argv) - M.new_build(argv[1] or M.get_default_build_cmd()) -end, 'Asynchronously build the current file or project') - -vis:map(vis.modes.NORMAL, '<M-b>', function() - vis:command('build') - return 0 -end, 'Asynchronously build the current file or project') - -return M diff --git a/config/vis/plugins/vis-build/tools/check-format b/config/vis/plugins/vis-build/tools/check-format deleted file mode 100755 index 392d023..0000000 --- a/config/vis/plugins/vis-build/tools/check-format +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -LUA_FILE=$1 -lua-format "${LUA_FILE}" > "${LUA_FILE}.fmt" -diff "${LUA_FILE}" "${LUA_FILE}.fmt" -RET=$? -rm "${LUA_FILE}.fmt" -exit ${RET} |
