A Neovim plugin to view and manage processes from within Neovim.
Video with a demo: https://www.youtube.com/watch?v=2WDSGvltxHo
- View process list output (
ps aux) in a Neovim buffer - View list of open files (
lsof) in a Neovim buffer with syntax highlighting - Kill processes directly from the buffer
- Kill multiple processes using visual selection
- Filter processes by name
- Pin/filter by specific PID (toggle on/off)
- Sort processes by CPU or memory usage
- Auto-reload process list (toggle on/off)
- Refresh process list
- Inspect detailed process information
- Open
/procfilesystem for processes (Linux) - Quick browser access to network ports from process inspector
Using lazy.nvim
{
"jugarpeupv/processmonitor.nvim",
config = function()
require("ps").setup({
-- Optional configuration
ps_cmd = "ps aux", -- Command to list processes
kill_cmd = "kill -9", -- Command to kill processes
})
end,
}Using packer.nvim
use {
"jugarpeupv/processmonitor.nvim",
config = function()
require("ps").setup()
end,
}| Command | Description |
|---|---|
:PS |
Open a new buffer with process list |
:PsRefresh |
Refresh the process list |
:PsKillLine |
Kill the process on the current line |
:PsKillAllLines |
Kill all processes in the selected range |
:PsKillWord |
Kill the process with PID under cursor |
:PsInspect |
Open detailed inspector for current process |
:PsOpenProcLine |
Open /proc directory for the process |
:PsFilter |
Set a filter to show only matching processes |
:PsThisBuffer |
Convert current buffer to ps buffer |
| Command | Description |
|---|---|
:Lsof |
Open a new buffer with list of open files |
:LsofRefresh |
Refresh the lsof output |
:LsofFilter |
Set a filter to show only matching entries |
When in a ps buffer:
| Key | Action |
|---|---|
r |
Refresh process list |
K |
Kill process on current line |
I |
Inspect process (detailed view) |
p |
Open /proc directory for process |
q |
Close buffer |
f |
Filter processes by name |
F |
Toggle PID filter (pin/unpin current process) |
gC |
Sort by CPU usage (highest first) |
gm |
Sort by memory usage (highest first) |
gl |
Toggle auto-reload (every 2 seconds) |
g? |
Show help with all keybindings |
| Key | Action |
|---|---|
K |
Kill all processes in selection |
When in an lsof buffer:
| Key | Action |
|---|---|
r |
Refresh lsof output |
q |
Close buffer |
f |
Filter lsof output |
When viewing detailed process information (opened with I or :PsInspect):
| Key | Action |
|---|---|
r |
Refresh inspector |
K |
Kill the inspected process |
q |
Close inspector window |
gx |
Open port in browser (when cursor is on a network connection line) |
The gx keymap is particularly useful when inspecting processes with network connections. Position your cursor on any line showing a network connection (e.g., TCP [::1]:4873 (LISTEN)) and press gx to automatically open http://localhost:<port> in your default browser.
You can filter the process list by name or other text:
- Press
fin the ps buffer - Enter a search term (e.g., "node" to see all Node.js processes)
- Press Enter
To clear the filter:
- Press
f - Clear the input and press Enter
The filter is case-insensitive and searches across the entire process line.
You can filter to show only a specific process by PID:
- Move cursor to the line with the process you want to pin
- Press
Fto toggle the PID filter - The view will now show only that specific process
- Press
Fagain to clear the filter
When a PID filter is active, it will be shown in the status bar at the top of the buffer.
You can sort the process list by different criteria:
- Sort by CPU: Press
gCto sort processes by CPU usage (highest first) - Sort by Memory: Press
gmto sort processes by memory/RSS usage (highest first)
The sort order persists when you refresh the list with r. To return to the default order, close and reopen the buffer.
You can configure processmonitor.nvim by passing options to the setup function:
require("ps").setup({
ps_cmd = "ps aux", -- Command to list processes
kill_cmd = "kill -9", -- Command to kill processes (SIGKILL)
regex_rule = [[\w\+\s\+\zs\d\+\ze]], -- Regex to extract PID from line
})To use a different kill signal:
require("ps").setup({
kill_cmd = "kill -15", -- Use SIGTERM instead of SIGKILL
})To use a different ps command format:
require("ps").setup({
ps_cmd = "ps axfu", -- Show process tree
})- Neovim 0.7+
pscommand (available on most Unix-like systems)killcommandlsofcommand (for:Lsoffunctionality)
MIT
Based on ps.vim by katonori, reimplemented in Lua for Neovim with additional features.
