Skip to content

Instantly share code, notes, and snippets.

@Loupax
Created June 8, 2025 19:37
Show Gist options
  • Save Loupax/0d92f49c110128dff92db235a86c31d7 to your computer and use it in GitHub Desktop.
Save Loupax/0d92f49c110128dff92db235a86c31d7 to your computer and use it in GitHub Desktop.
Edit function that, when called from inside a nvim terminal, it will open the file in the already existing nvim instance
edit() {
if [ -z "$NVIM" ]; then
nvim "$1"
return
fi
nvim --server "$NVIM" --remote-send "<C-\\><C-N><C-w>t:edit $1<CR>"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment