From eeeb516897c0a069a4351aaf8ab14a9158213764 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 22 Mar 2023 14:35:47 -0700 Subject: [PATCH] [nvim] Fix the merge conflicts (again) in the nvim config files --- config/nvim/init.lua | 29 ++++++++++++++++++++--------- config/nvim/lua/configuration.lua | 5 ----- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 687ac0e..fd46a55 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,31 +1,42 @@ -- Eryn Wells -vim.opt.runtimepath:prepend "~/.vim" - vim.cmd [[ source ~/.vimrc.common source ~/.vim/plugins.vim ]] +require 'os' + require 'configuration' require 'colors' require 'keys' -require 'os' function ensureMetadataDirectoriesExist() - local paths = { + local options = { vim.opt.backupdir:get(), vim.opt.directory:get(), vim.opt.undodir:get(), - vim.fs.dirname(vim.opt.shadafile:get()), } - for _, opt in ipairs(paths) do - local firstPath = opt[1] - if string.find(firstPath, "//$") then - os.execute("mkdir", "-p", firstPath) + local function makeDirectory(path) + os.execute("mkdir", "-p", path) + end + + for _, opt in ipairs(options) do + for _, path in ipairs(opt) do + if string.find(path, "//$") then + makeDirectory(path) + end end end + + -- The shadafile option is a single option but get() returns a table, so + -- iterate it just to be safe. + local shadaFile = vim.opt.shadafile:get() + for _, path in ipairs(shadaFile) do + local shadaFileDirectory = vim.fs.dirname(path) + makeDirectory(shadaFileDirectory) + end end ensureMetadataDirectoriesExist() diff --git a/config/nvim/lua/configuration.lua b/config/nvim/lua/configuration.lua index 4fa9e69..31f7666 100644 --- a/config/nvim/lua/configuration.lua +++ b/config/nvim/lua/configuration.lua @@ -1,10 +1,5 @@ -- Eryn Wells -<<<<<<< HEAD -======= -require 'os' - ->>>>>>> 298c137 ([nvim] Fix the editor metadata settings, again, for hopefully the last time) -- [[ Editor Confguration ]] local opt = vim.opt