RicardoRamirezR/lali-components.nvim
Open on GitHub →
[!WARNING] Any issue please report it at blade-nav
[!CAUTION] There is a more comprehensive plugin, blade-nav It opens views from controllers and routes for view(), View::make(), and Route::view(). Additionally, it can generate a component using an Artisan command as an option. Sorry for any inconvenience. Why not here? My OCD wins, since blade-nav is a superset of this plugin.
Laravel / Livewire Components
Features
1. Navigating to Components with gf
Using the gf command on certain component names in your code will open the corresponding component file. This feature works with the following patterns:
<x-name>@extends('name')@include('name')<livewire:name>@livewire('name')
If the component has an associated class, you will be prompted to choose which one to open.
2. Autocompletion with nvim-cmp
When using the Neovim completion plugin (nvim-cmp), suggestions for relevant components will appear as you type the following prefixes:
<x-@extends@include<live@livewire
Setup
To get started with lali-components.nvim, add the plugin to your init.lua or init.vim file:
Using packer:
use {
'ricardoramirezr/lali-components.nvim',
ft = 'blade'
}
Using lazy:
{
'ricardoramirezr/lali-components.nvim',
ft = 'blade'
}
Usage
-
Navigating to Components: Place your cursor on the component name and press
gf. If the component has multiple classes, you will be prompted to choose which one to open. -
Autocompletion: Start typing the component prefix (
<x-,@extends, etc.) andnvim-cmpwill suggest the relevant components. Select from the suggestions to complete your component names quickly.
Example
Here is an example to illustrate the usage of the plugin:
<!-- Blade Template Example -->
<x-button>Click Me</x-button>
@extends('layouts.app')
@include('partials.header')
<livewire:counter />
@livewire('counter')
In the example above, you can:
- Place your cursor on , @extends('layouts.app'), @include('partials.header'), <livewire:counter />, or @livewire('counter') and press gf to navigate to the respective component file.
- Start typing <x-, @extends, @include, <live, or @livewire to get autocompletion suggestions from nvim-cmp.
Contributing
Contributions are welcome! Please submit issues and pull requests to the GitHub repository.
License
This plugin is open-source and distributed under the MIT License.