Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/praem90/nvim-phpcsf
A simple nvim plugin wrapper for both phpcs and phpcbf.
https://github.com/praem90/nvim-phpcsf
lua nvim nvim-plugin php-codesniffer
Last synced: about 1 month ago
JSON representation
A simple nvim plugin wrapper for both phpcs and phpcbf.
- Host: GitHub
- URL: https://github.com/praem90/nvim-phpcsf
- Owner: praem90
- Created: 2021-05-13T15:50:40.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-14T06:25:32.000Z (7 months ago)
- Last Synced: 2024-06-15T07:39:53.942Z (6 months ago)
- Topics: lua, nvim, nvim-plugin, php-codesniffer
- Language: Lua
- Homepage: https://praem90.github.io/nvim-phpcsf/
- Size: 34.2 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nvim-phpcsf
## What is nvim-phpcsf?
`nvim-phpcsf` is a simple nvim plugin wrapper for both phpcs and phpcbf.
The PHP_CodeSniffer's output is populated using the telescope picker. Telescope helps to navigate through phpcs errors and warnings and preview.## Instalation
Install [telescope](https://github.com/nvim-telescope/telescope.nvim) and [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
Using the [vim-plug](https://github.com/junegunn/vim-plug) plugin manager add the following in your VIM configuration (e.g. ~/.vimrc or ~/.config/nvim/init.vim when using Neovim):```
Plug 'praem90/nvim-phpcsf'
```To run sniffer
```
:lua require'phpcs'.cs()
```To run beautifier
```
:lua require'phpcs'.cbf()
```To run PHP_CodeBeautifier after save (It is recommended to run this after the buffer has been written BufWritePost)
```
augroup PHBSCF
autocmd!
autocmd BufWritePost,BufReadPost,InsertLeave *.php :lua require'phpcs'.cs()
autocmd BufWritePost *.php :lua require'phpcs'.cbf()
augroup END
```## Configurations
```vim
let g:nvim_phpcs_config_phpcs_path = 'phpcs'
let g:nvim_phpcs_config_phpcbf_path = 'phpcbf'
let g:nvim_phpcs_config_phpcs_standard = 'PSR12' " or path to your ruleset phpcs.xml
```Using lua
```lua
require("phpcs").setup({
phpcs = "phpcs",
phpcbf = "phpcbf",
standard = "PSR12"
})
```## Thanks
[@thePrimeagen](https://github.com/theprimeagen)
[@tjDevries](https://github.com/tjDevries)## TODO:
- [x] Detect phpcs.xml automatically on the project root
- [x] Add sign to current buffer