Neovim plugin that allows you to use the Salesforce CLI, similar to the Visual Studio Code plugin, but for your favorite code editor.
- A NerdFont (optional, but needed to display some icons)
- Salesforce CLI
- nvim-treesitter with apex support
- nvim-notify
- plenary
You can install salesforcedx.nvim with any plugin manager.
{
"cdelmoral/salesforcedx.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"rcarriga/nvim-notify",
},
config = function()
require("salesforcedx").setup()
end,
}
salesforcedx.nvim provides the SalesforceDX
command that opens the Salesforce
command palette.
You can also configure key mappings to execute the Salesforce commands, for example:
vim.keymap.set("n", "<leader>sfd", '<cmd>lua require("salesforcedx.commands").deploy_start()<CR>')
vim.keymap.set("n", "<leader>sft", '<cmd>lua require("salesforcedx.commands").execute_test_method()<CR>')
vim.keymap.set("n", "<leader>sfT", '<cmd>lua require("salesforcedx.commands").execute_test_class()<CR>')
vim.keymap.set("n", "<leader>sfa", '<cmd>lua require("salesforcedx.commands").generate_apex_class()<CR>')
salesforcedx.nvim includes the get_default_target_org
function which can be
used to display the configured default scratch org in the status line.
For example, for lualine.nvim add this to your configuration:
{
require("salesforcedx").get_default_target_org,
cond = require("salesforcedx").is_salesforce_project_directory,
icon = { "", align = "left", color = { fg = "cyan" } },
}