From d1e8f59c5314ee6648fa02449c914f8d07ae0283 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 29 Mar 2023 12:52:01 -0700 Subject: [PATCH] [zsh,nvim] Set up vim's &path based on zsh's FPATH --- config/nvim/after/ftplugin/zsh.lua | 15 +++++++++++++++ config/nvim/ftdetect/zsh.lua | 6 ++++++ zshenv | 1 + 3 files changed, 22 insertions(+) create mode 100644 config/nvim/after/ftplugin/zsh.lua create mode 100644 config/nvim/ftdetect/zsh.lua diff --git a/config/nvim/after/ftplugin/zsh.lua b/config/nvim/after/ftplugin/zsh.lua new file mode 100644 index 0000000..3c265c3 --- /dev/null +++ b/config/nvim/after/ftplugin/zsh.lua @@ -0,0 +1,15 @@ +-- Eryn Wells + +local zshFPath = vim.env.FPATH +if zshFPath then + local paths = vim.split(zshFPath, ":") + vim.bo.path = ".," .. table.concat(paths, ",") .. ",," +else + local defaultFPath = { + "~/.dotfiles/zsh/func/**", + "~/.zsh/func/**", + "/usr/local/share/zsh/site-functions", + "/usr/share/zsh/site-functions" + } + vim.bo.path = ".," .. table.concat(defaultFPath) .. ",," +end diff --git a/config/nvim/ftdetect/zsh.lua b/config/nvim/ftdetect/zsh.lua new file mode 100644 index 0000000..1e748af --- /dev/null +++ b/config/nvim/ftdetect/zsh.lua @@ -0,0 +1,6 @@ +-- Eryn Wells + +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = {"*/zsh/*"}, + command = "setfiletype zsh", +}) diff --git a/zshenv b/zshenv index 998665f..1b45e80 100644 --- a/zshenv +++ b/zshenv @@ -13,6 +13,7 @@ init_env_fpath() { fi fpath=($user_fpath $fpath) + export FPATH } init_env_fpath