Install from snap repository
# install sudo snap install code --classic
Install from APT repository
# deb download # https://code.visualstudio.com/docs/setup/linux curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' sudo apt-get install apt-transport-https sudo apt-get update sudo apt-get install code # or code-insiders # manual download wget -q https://update.code.visualstudio.com/latest/linux-deb-x64/stable -O /tmp/code.deb sudo dpkg -i /tmp/code.deb # create starter cat << EOF> /usr/share/applications/code.desktop [Desktop Entry] Name=Visual Studio Code Exec=/snap/bin/code %U Icon=/snap/code/current/usr/share/pixmaps/com.visualstudio.code.png Type=Application StartupNotify=false Categories=Utility;TextEditor;Development;IDE; Actions=new-empty-window; EOF
Configure Visual Studio Code as default text editor
xdg-mime default code.desktop text/html # xdg-mime default code.desktop text/plain xdg-mime default code_code.desktop text/plain # old mkdir -p ~/.local/share/applications cat <<EOF>> ~/.local/share/applications/mimeapps.list [Default Applications] text/plain = code.desktop text/x-shellscript = code.desktop EOF sed -i 's|text/plain = .*|text/plain = code.desktop|g' ~/.local/share/applications/mimeapps.list
Keyboard shortcuts for Linux
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf
Extensions
https://github.com/viatsko/awesome-vscode
Terraform
# code fromatting works only when directory is opened?
https://medium.com/nerd-for-tech/how-to-auto-format-hcl-terraform-code-in-visual-studio-code-6fa0e7afbb5e
https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform
https://github.com/hashicorp/vscode-terraform
# Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter. # ext install HashiCorp.terraform code --install-extension HashiCorp.terraform # formating https://github.com/hashicorp/terraform-ls ~/.vscode/settings.json { "[terraform]": { "editor.defaultFormatter": "hashicorp.terraform", "editor.formatOnSave": true } }
Ansible / YAML
https://selivan.github.io/2018/09/27/vscode-ansible-files-open-right-syntax.html
https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
https://selivan.github.io/2018/09/27/vscode-ansible-files-open-right-syntax.html
code --install-extension redhat.vscode-yaml
Links
https://code.visualstudio.com/
https://code.visualstudio.com/docs/setup/linux
https://stackoverflow.com/questions/34730585/how-can-i-commit-some-changes-to-a-file-but-not-others-in-vscode