feat: Automatically map ports via scanning - #31
Merged
Merged
Conversation
mikew
commented
Jul 15, 2025
Comment on lines
+593
to
+597
| local detach = vim.api.nvim_buf_attach(bufnr, false, { | ||
| on_lines = on_lines, | ||
| }) | ||
|
|
||
| nvrh_port_scanner.active_watchers[bufnr] = detach |
Owner
Author
There was a problem hiding this comment.
thought this returned a function, but it's just a boolean. can remove the assignment
Owner
Author
|
I've been using this for about a week now. Very few false positives, but I did notice slowdown after keeping nvim-qt open for a couple of days. Didn't delve into whether it was this change tho 🤦 |
…ts-scan * 'main' of https://github.com/mikew/nvrh: [skip ci] Release v0.1.19 feat: More env vars (#32) [skip ci] Release v0.1.18 feat: Override vim.ui.open for http urls (#35)
Owner
Author
|
Followup could be to make sure the port is actually open on the machine, to further guard ports being tunnelled that don't need to be. Something like this works across macos / linux, but needs #!/usr/bin/env bash
set -ex
if command -v lsof; then
lsof -i ":$1"
elif command -v netstat; then
netstat -an | grep LISTEN | grep ":$1"
else
true
fi |
Owner
Author
|
Eh, works well enough. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This works by scanning terminal output for something that looks like a port being logged.
Closes #10