Skip to content

Instantly share code, notes, and snippets.

@gngdb
Last active September 23, 2022 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gngdb/9c7ca08f789a61c5c1f1aa23a390fcf7 to your computer and use it in GitHub Desktop.
Save gngdb/9c7ca08f789a61c5c1f1aa23a390fcf7 to your computer and use it in GitHub Desktop.
Add to bashrc to autocomplete nvim scp commands: `nvim <remote>:/path/to/file.py`
# autocomplete nvim scp commands
nvim () {
local params=();
while [[ ! -z $1 ]]; do
if [[ "$1" =~ ^[a-z0-9-]*:/.*$ ]]; then
params=("scp://${1/:\//\/\//}" "${params[@]}");
else
params+=("$1");
fi;
shift;
done;
echo nvim ${params[@]};
`which nvim` ${params[@]};
}
. /usr/share/bash-completion/completions/scp
complete -F _scp -o nospace nvim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment