Conditional config based on the project I'm in #138
-
I want to hide/change some things if I'm working on work stuff vs my own stuff. I'm new to neovim, so not sure if this is just a normal and easy thing to do or not and have no idea how to do it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey! |
Beta Was this translation helpful? Give feedback.
-
local cwd = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
local is_work = (cwd == "acme")
return {
"vyfor/cord.nvim",
build = "./build || .\\build",
event = "VeryLazy",
opts = { -- calls require('cord').setup()
display = {
show_time = true, -- Display start timestamp
show_repository = not is_work, -- Display 'View repository' button linked to repository url, if any
show_cursor_position = false, -- Display line and column number of cursor's position
swap_fields = false, -- If enabled, workspace is displayed first
swap_icons = false, -- If enabled, editor is displayed on the main image
workspace_blacklist = {}, -- List of workspace names that will hide rich presence
},
text = {
viewing = is_work and "Viewing [redacted]" or "Viewing {}",
editing = is_work and "Editing [redacted]" or "Editing {}",
file_browser = is_work and "Browsing [redacted]" or "Browsing files in {}",
plugin_manager = is_work and "Managing plugins at work" or "Managing plugins in {}",
lsp_manager = is_work and "Configuring LSP at work" or "Configuring LSP in {}",
vcs = is_work and "Committing work" or "Committing changes in {}",
workspace = is_work and "At work" or "In {}",
},
},
} this seems to be working but might have issues |
Beta Was this translation helpful? Give feedback.
That might work, but it won’t be dynamic. It will persist for the entire session based on where Neovim is opened. You'd need to restart Neovim each time you want to change the workspace. But unfortunately, there's no way around this, which is why a rewrite is being done. I'm currently in the process of writing the new configuration guide, would you like me to notify you when it's ready?