I have a short question.
Currently, I am spending (way too much time) modding my neovim setup. I have multiple devices where I use my setup and sync those with git ( second-best feature, after restoring my config every time I destroy everything ) but there are some small differences in my configuration like plugins, which I don't need on my on-the-way-notebook.
Is there any way to differ in the lua configuration, on which device is currently running neovim?
Sure, multi-branching would be a way, but I'd like a more comfortable way. Thanks for helping
You could use hostname to determine your device and use it to create configuration with conditions.
Lua code to get hostname:
local function get_hostname()
local f = io.popen ("/bin/hostname")
local hostname = f:read("*a") or ""
f:close()
hostname =string.gsub(hostname, "\n$", "")
return hostname
end
Neovim configuration:
if get_hostname() == "foo" then
do_something
else
do_otherthing
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.