Skip to content

Instantly share code, notes, and snippets.

@thenbe
Created November 23, 2022 20:19
Show Gist options
  • Save thenbe/234df06b9b915feead215152b78f92e4 to your computer and use it in GitHub Desktop.
Save thenbe/234df06b9b915feead215152b78f92e4 to your computer and use it in GitHub Desktop.
Restore original neovim filename substitution behavior when using vscode-neovim extension
#!/bin/bash
# Usage: vnr <your-command>
# Example: vnr node % --my-arg
# Description: This script removes every occurrence of
# "__vscode_neovim__-file://", then runs the command.
# The pattern to replace
PATTERN="__vscode_neovim__-file:\/\/"
# The replacement
REPLACEMENT=""
# The command to run
COMMAND=$@
# Replace the pattern with the replacement in the command
NEW_COMMAND=$(echo "$COMMAND" | sed "s/$PATTERN/$REPLACEMENT/g")
# Run the command
eval $NEW_COMMAND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment