Skip to content

Neovim plugin for WordPress and WooCommerce development.

License

Notifications You must be signed in to change notification settings

bitpoke/wordpress.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordPress.nvim

Neovim plugin for WordPress and WooCommerce development.

Features

Requirements

  1. Intelephense

  2. PHP_CodeSniffer with WordPress Coding Standards

    NOTE: If you are using Mason, you need to disable it for phpcs and install phpcs globally with support for WordPress Coding Standards.

    require("mason-null-ls").setup {
        automatic_installation = {
            exclude = { "phpcs", "phpcbf" }
        }
    }
    composer global require "wp-coding-standards/wpcs"

Installation

Install the plugin with your preferred package manager:

{
  "bitpoke/wordpress.nvim",
}
use {
  "bitpoke/wordpress.nvim",
}

Configuration

Where you configure your LSP and none-ls servers, add the following lines

local wp = require('wordpress')
local lspconfig = require('lspconfig')
local null_ls = require('null-ls')

-- setup intelephense for PHP, WordPress and WooCommerce development
lspconfig.intelephense.setup(wp.intelephense)

null_ls.setup({
    ...,
    sources = {
        ...,
        null_ls.builtins.diagnostics.phpcs.with(wp.null_ls_phpcs),
        null_ls.builtins.formatting.phpcbf.with(wp.null_ls_phpcs),
    },
})

Known Issues

Calling vim.lsp.buf.format() formats using both phpcbf and intelephense tools.

vim.lsp.buf.format() uses all available formatters for the current file type. To avoid this, you can use the following command to format the current buffer:

vim.lsp.buf.format({ filter = require('wordpress').null_ls_formatter })

Releases

No releases published

Languages