From f27f7c4ed6cf162ffad37bad9197cf44540ff1cb Mon Sep 17 00:00:00 2001 From: cscherrNT Date: Wed, 28 Jun 2023 16:34:24 +0200 Subject: [PATCH] detect os for init.vim --- home/.config/nvim/init.vim | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index 68eee00..2c06fe4 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -1,5 +1,19 @@ -" check if firenvim is accessing this, load it's specific configs if so. lua << EOF +local BinaryFormat = package.cpath:match("%p[\\|/]?%p(%a+)") +if BinaryFormat == "dll" then + function os.name() + return "Windows" + end +elseif BinaryFormat == "so" then + function os.name() + return "Linux" + end +elseif BinaryFormat == "dylib" then + function os.name() + return "MacOS" + end +end + if vim.g.started_by_firenvim == true then vim.cmd('runtime firenvim.vim') vim.cmd('runtime common.vim') @@ -8,4 +22,8 @@ else vim.cmd('runtime main.vim') end +if os.name() == "Windows" then + vim.cmd('runtime windows.vim') +end + EOF