When you use Visual Studio Code with SSH extension you can run from your linux command line the command "code" to edit your files. let me say it's fantastic, real useful. If you still using classic Terminal session with Putty or others, you will need a classic linux editor like nano. Well I often fall in a mitstake and write code in putty and viceversa.
Solution is to create a function () and name it "nano" and stored it in the .bashrc file.
FUNCTION
# - "Command" nano will open Visual Studio Code is available otherwise the real nano function nano() { if [[ $(type -t code) = "file" ]]; then code "$@" else command nano "$@" fi }
Function tests if the command "code" is available and run the right editor.
- have fun -