aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rotate-nvim-lsp-log.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/rotate-nvim-lsp-log.sh b/scripts/rotate-nvim-lsp-log.sh
new file mode 100644
index 0000000..705aa60
--- /dev/null
+++ b/scripts/rotate-nvim-lsp-log.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+lsp_log=$(nvim --headless -c "lua io.stdout:write(vim.lsp.get_log_path())" -c "qa" 2>/dev/null)
+
+if [[ -s "$lsp_log" ]]; then
+ cp "$lsp_log" "$lsp_log.bak"
+ truncate -s 0 "$lsp_log"
+fi