about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/vim/plugins/vim-command-check-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/vim/plugins/vim-command-check-hook.sh')
-rw-r--r--nixpkgs/pkgs/applications/editors/vim/plugins/vim-command-check-hook.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/editors/vim/plugins/vim-command-check-hook.sh b/nixpkgs/pkgs/applications/editors/vim/plugins/vim-command-check-hook.sh
new file mode 100644
index 000000000000..c4ddd8e0c5af
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/vim/plugins/vim-command-check-hook.sh
@@ -0,0 +1,25 @@
+# Setup hook for checking whether a vim command exists
+echo "Sourcing vim-command-check-hook.sh"
+
+vimCommandCheckHook () {
+    echo "Executing vimCommandCheckHook"
+
+    if [ -n "$vimCommandCheck" ]; then
+        echo "Check whether the following modules can be imported: $vimCommandCheck"
+
+		# editorconfig-checker-disable
+        export HOME="$TMPDIR"
+        @vimBinary@ -es -n -u NONE -i NONE --clean -V1 --cmd "set rtp+=$out" \
+			--cmd "runtime! plugin/*.vim"  <<-EOF
+			if exists(":$vimCommandCheck") == 2
+				cquit 0
+			else
+				cquit 1
+			fi
+			EOF
+    fi
+}
+
+echo "Using vimCommandCheckHook"
+preDistPhases+=" vimCommandCheckHook"
+