jonathanmorris180 / salesforce.nvim

A Salesforce plugin for Neovim.
MIT License
28 stars 5 forks source link
lua neovim neovim-plugin nvim nvim-plugin salesforce salesforce-developers sfdc sfdx

salesforce.nvim

A plugin for developing Salesforce applications within Neovim

⚡️ Features

Provides a set of utilities that emulate the commands of the Salesforce extension for VS Code. Out of the box commands include:

Execute Anonymous

Diff With Org

📋 Installation

A minimal configuration is as follows:

Package manager Snippet
[wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim) ```lua use { "jonathanmorris180/salesforce.nvim", requires = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" } } ```
[junegunn/vim-plug](https://github.com/junegunn/vim-plug) ```lua Plug "jonathanmorris180/salesforce.nvim" Plug "nvim-lua/plenary.nvim" Plug "nvim-treesitter/nvim-treesitter" ```
[folke/lazy.nvim](https://github.com/folke/lazy.nvim) ```lua { "jonathanmorris180/salesforce.nvim", dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", } } ```

☄ Getting started

To use this plugin, ensure you have the Salesforce CLI installed on your machine. If you don't have it installed, you can do so here.

⚙ Configuration

There are a number of options available to configure salesforce.nvim. See the defaults below.

Note: The options are also available in Neovim at :h salesforce

require("salesforce").setup({
    debug = {
        to_file = false, -- Can also be toggled with :SalesforceToggleLogFileDebug
        to_command_line = false, -- Can also be toggled with :SalesforceToggleCommandLineDebug
    },
    popup = {
        -- The width of the popup window.
        width = 100,
        -- The height of the popup window.
        height = 20,
        -- The border characters to use for the popup window
        borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
    },
    file_manager = {
        ignore_conflicts = false, -- ignores conflicts on "sf project retrieve/deploy"
    },
    org_manager = {
        default_org_indicator = "󰄬",
    },
})

To add the default org to lualine, add the table with require below to lualine.setup (copy from here to include the Salesforce nerd font icon):

lualine.setup({
    -- include the rest of your setup
    sections = {
        lualine_c = {
            "filename",
            {
                "require'salesforce.org_manager':get_default_alias()",
                icon = "󰢎",
            },
        },
    },
})

⌨ Contributing

PRs and issues are always welcome. Make sure to provide as much context as possible and follow the template when opening one.

🎭 Debugging

When debugging is enabled via :SalesforceToggleLogFileDebug, the log file is written to

vim.fn.stdpath("cache") .. "/salesforce.log"