From ec05f799ea519e0d87b849191d64fa4522b10f22 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Sat, 27 Aug 2022 00:07:22 +0200 Subject: [PATCH] neovim: Remove PATH-specific VIML --- home/config/nvim/nifoc/nix.fnl | 13 ++++++++++--- home/programs/nvim/default.nix | 7 +------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/home/config/nvim/nifoc/nix.fnl b/home/config/nvim/nifoc/nix.fnl index acc8d14..4eaac85 100644 --- a/home/config/nvim/nifoc/nix.fnl +++ b/home/config/nvim/nifoc/nix.fnl @@ -1,7 +1,14 @@ ;; Move certain PATH entries to the end of the variable, because XCode CLI is not installed ;; (and I don't want to see the prompt) (let [current-path vim.env.PATH - move-paths ":/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" - new-path (-> current-path (string.gsub move-paths "") (.. move-paths))] - (set vim.env.PATH new-path)) + move-paths [:/usr/local/bin :/usr/bin :/usr/sbin :/bin :/sbin]] + (var new-path []) + (var append-path []) + ;; Loop over PATH and prepare the value tables + (each [part (string.gmatch current-path "[^:]+")] + (if (vim.tbl_contains move-paths part) (table.insert append-path part) + (table.insert new-path part))) + (each [_ part (ipairs append-path)] + (table.insert new-path part)) + (set vim.env.PATH (table.concat new-path ":"))) diff --git a/home/programs/nvim/default.nix b/home/programs/nvim/default.nix index e880d22..f3d4883 100644 --- a/home/programs/nvim/default.nix +++ b/home/programs/nvim/default.nix @@ -15,13 +15,8 @@ in withPython3 = false; extraConfig = '' - " Move these paths to the end of $PATH to prevent triggering the XCode CLI popup - let xcode_paths = [':/usr/local/bin:', ':/usr/bin:', ':/usr/sbin:', ':/bin:', ':/sbin:'] - for xcode_path in xcode_paths - let $PATH = substitute($PATH, xcode_path, ":", "") . substitute(xcode_path, ":$", "", "") - endfor - lua << EOF + require('nifoc.nix') require('impatient') require('configuration.init') EOF