Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jdrupal-dev/drupal.nvim
A Drupal plugin for neovim coded in Lua.
https://github.com/jdrupal-dev/drupal.nvim
drupal neovim-plugin
Last synced: 4 months ago
JSON representation
A Drupal plugin for neovim coded in Lua.
- Host: GitHub
- URL: https://github.com/jdrupal-dev/drupal.nvim
- Owner: jdrupal-dev
- License: mit
- Created: 2024-01-18T14:55:49.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-25T12:48:31.000Z (9 months ago)
- Last Synced: 2024-09-28T10:01:57.294Z (4 months ago)
- Topics: drupal, neovim-plugin
- Language: Lua
- Homepage:
- Size: 14.6 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# drupal.nvim
**drupal.nvim** - _a little less pain for Drupal developers daring to use neovim._
## :lock: Requirements
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) (used for running drush)
- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) (currently autocompletion requires nvim-cmp)
- [cmp_luasnip](https://github.com/saadparwaiz1/cmp_luasnip) (required for adding hook snippets)
- [ripgrep](https://github.com/BurntSushi/ripgrep) (needs to be installed on your machine)
- [drush](https://www.drush.org/12.x) (needs to be installed on your machine/project)## :package: Installation
Install this plugin using your favorite plugin manager, and then call
`require("drupal").setup()`.### [lazy.nvim](https://github.com/folke/lazy.nvim)
Default configuration can be found in `lua/drupal/default_config.lua`.
```lua
{
"jdrupal-dev/drupal.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("drupal").setup({
services_cmp_trigger_character = "@",
get_drush_executable = function(current_dir)
-- You can use current_dir if you have different ways of
-- executing drush across your Drupal projects.
return "drush"
end,
})
end
}
```
## :sparkles: Features### Autocomplete services
You need the `devel` module installed for this feature to work.\
The `drush devel:services` command is used to get a list of all available Drupal services.To trigger the autocompletion of services you need to input the trigger character, which by default is "@".
```php
\Drupal::service('@entity_') // Now you should see services beginning with entity_.
```
### SnippetsA few practical snippets are provided, you can find the complete list of snippets in `lua/drupal/snippets/docs.md`.
LuaSnip snippets are automatically generated for hooks when opening nvim in a Drupal project.
You can use the snippets by typing `hook_` in a `.module` or `.theme` file.
When the snippet is used `hook` will automatically get replaced with the name of the current module.For example, typing `hook_theme + Enter` in `my_module.module` will generate the following code:
```php