Last active
September 23, 2022 13:25
-
-
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`
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
# 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