[zsh,nvim] Set up vim's &path based on zsh's FPATH
This commit is contained in:
parent
711dd78a2f
commit
d1e8f59c53
3 changed files with 22 additions and 0 deletions
15
config/nvim/after/ftplugin/zsh.lua
Normal file
15
config/nvim/after/ftplugin/zsh.lua
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
-- Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
|
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
|
6
config/nvim/ftdetect/zsh.lua
Normal file
6
config/nvim/ftdetect/zsh.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
-- Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
|
||||||
|
pattern = {"*/zsh/*"},
|
||||||
|
command = "setfiletype zsh",
|
||||||
|
})
|
1
zshenv
1
zshenv
|
@ -13,6 +13,7 @@ init_env_fpath() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fpath=($user_fpath $fpath)
|
fpath=($user_fpath $fpath)
|
||||||
|
export FPATH
|
||||||
}
|
}
|
||||||
|
|
||||||
init_env_fpath
|
init_env_fpath
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue