A Neovim plugin that watches your Laravel application's laravel.log file and
notifies you as errors are written, so you never have to leave the editor to
check why something broke.
When you open Neovim inside a Laravel project (detected by the presence of an
artisan file at the project root), the plugin:
storage/logs/laravel.log for new writes using a native file watcher.vim.notify notification.DirChanged).storage/logs/laravel.log when an
artisan file is present in the current working directory.fs_event (inotify / FSEvents / ReadDirectoryChangesW)
with a built-in polling fallback.vim.uv/vim.loop, vim.schedule, and vim.notify).{
"Doehnert/laravel-log-watcher.nvim",
event = "VeryLazy", -- optional; default loads lazily
opts = {}, -- calls require("laravel-log-watcher").setup(opts)
}
use({
"Doehnert/laravel-log-watcher.nvim",
config = function()
require("laravel-log-watcher").setup({})
end,
})
require("paq")({ "Doehnert/laravel-log-watcher.nvim" })
-- then:
require("laravel-log-watcher").setup({})
For all non-lazy plugin managers, call
setup()yourself. The plugin registers its commands, keymaps, and autocmds insidesetup().
There is nothing to configure to get started — open Neovim inside a Laravel app
and the watcher starts automatically. New entries in laravel.log will appear
as notifications.
Full in-editor documentation is available with
:h laravel-log-watcher.
| Command | Description |
|---|---|
:LaravelLogTail |
Open (and jump to the end of) laravel.log |
:LaravelLogWatchToggle |
Toggle the file watcher on/off |
| Key | Action |
|---|---|
<leader>kt |
Tail laravel.log (:LaravelLogTail) |
<leader>kw |
Toggle the watcher (:LaravelLogWatchToggle) |
The default prefix is <leader>k. You can change it via the keymap_prefix
option (see below). To disable the keymaps entirely, set keymap_prefix = false.
setup() accepts a table of options, all optional:
require("laravel-log-watcher").setup({
enabled = true, -- start watching on startup (VimEnter)
notify = true, -- show a vim.notify for new log entries
max_len = 500, -- max characters shown per notification
group = "LaravelLogWatcher", -- notify / autocmd group name
log_rel = "storage/logs/laravel.log", -- path relative to the project root
poll_interval = 1000, -- fallback polling interval (milliseconds)
keymap_prefix = "<leader>k", -- prefix for the plugin keymaps
})
| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | true |
Auto-start the watcher on startup |
notify |
boolean | true |
Emit notifications for new log entries |
max_len |
number | 500 |
Truncate notification text to this many chars |
group |
string | "LaravelLogWatcher" |
Notification / augroup name |
log_rel |
string | "storage/logs/laravel.log" |
Log path relative to the Laravel root |
poll_interval |
number | 1000 |
Fallback polling interval in ms |
keymap_prefix |
string|false | "<leader>k" |
Keymap prefix; set to false to disable |
The module exposes a small API in case you want to wire it up yourself:
setup(opts) — configure and register commands/keymaps/autocmds.enable() — start watching the current directory (returns true if it is a
Laravel app).disable() — stop the watcher and release handles.toggle() — toggle the watcher on/off.jump_to_log() — open (and tail) laravel.log.VimEnter (and DirChanged), enable() checks whether the current working
directory contains an artisan file.fs_event watcher on storage/logs/laravel.log
(falling back to a poll_interval-based timer where fs_event is unavailable).vim.notify on WARN level.MIT