Some small scripts and configurations I use to develop python code using VSCode
Ctrl+K, Ctrl+V
to toggle vim mode
Running sudo ansible-playbook root_install.yaml
will:
- install git, python3-pip, virtualenvwrapper, ipython
- install zsh, fzf
- install vscodium
- install Sourcetrail
- download (not install) Fura Mono Nerd Font and Fira Code
Running ansible-playbook user_install.yaml
setting will:
- Install all the vscodium plugins that I use (see list below)
- create color and debug IPython profiles
- Install zsh-autosuggestions and zsh-syntax-highlighting
- Install zsh powerlevel10k theme
- This script
- At the top of the script,
venvs=`echo $HOME/.virtualenvs/*/`
defines where to look for virtual environments, which by default is the virtualenvwrapperWORKON_HOME
variable. If you want to change your virtual enviroment location, you have to change this path. However, the script assumes your virtual environment are all located under a common top directory:
/foo/bar/myproject/bin/activate
/foo/bar/http_requester/bin/activate
/foo/bar/scrapy/bin/activate
...
in this case, venvs=`echo /foo/bar/*/`
- Microsoft Ansible extension
- Microsoft Docker extension
- Microsft yaml extension
- Kubernetes ipedrazas extension
- TabSanity Navigate or modify soft tabs as if they were hard tabs (e.g. if tab=4spaces you can only move 4spaces back/fwd)
- Bracket Pair Colorizer 2
- Monokai Vibrant
- Color Highlight
ctrl+shift+F5
-> Revert (Reload) Filealt+Z
-> Toggle word wrapping
ctrl+shift+T
-> Open a new terminal (shell launcher)ctrl+alt+J
-> Toggle terminalctrl+`
-> Toggle between terminal and editor focusctrl+k ctrl+shift+n
-> Switch to next terminalctrl+k ctrl+shift+p
-> Switch to previous terminalctrl+shift+N
-> Switch to Nth terminal (N=1-9)
F5
-> Write run 'path/to/script.py' into the terminal (assumes it's an IPython terminal)F9
-> Copy-paste selection into terminalCtrl+J, Ctrl+Q
-> Create a new line in IPython without executingEsc, Enter
-> Execute current IPython cell now without having to scroll to the bottomCtrl+Q
-> Extract caller's enviroment to the IPython shell. Note that this it overwrites the predefined shortcut for exiting VSCode- Customize text color
- Move ipython_config.py to
~/.ipython/profile_default/ipython_config.py
(only newer IPython versions have syntax highlighting)
Ctrl+B
->Ctrl+Shift+B
Reassignsworkbench.action.toggleSidebarVisibility
to usetmux
shortcutsCtrl+K, U
-> Keep unsaved and close saved files onlyCtrl+K, W
-> Whack and close (discard unsaved files)
Ctrl+K, Enter
-> Keep current file from closing (italics means it's opened in preview mode and opening a new file will replace it)F12
-> Go to DefinitionCtrl+F12
-> Go to ImplementationShift+F12
-> Go to References
F2
-> Rename symbol consistently with language syntaxRight click
- Extract method
- Extract variable
Ctrl+F
-> SearchCtrl+H
-> Search and replaceEnter
-> Single replaceCtrl+Alt+Enter
-> Replace allAlt+R
-> Toggle Regex
Alt+Ctrl+-
-> BackCtrl+Shift+-
-> Forward
Ctrl+B, Ctrl+Q
-> Extract caller's enviroment to the IPython shell.Ctrl+B, Ctrl+E
->from IPython import embed; embed()
Ctrl+B, Ctrl+B
-> Set Breakpoint with IPythonembed()
Ctrl+Shift+R
-> Rerun: Reload all modules an run on IPython%load_ext autoreload %autoreload run
- I use Fira Code, a monospaced font with programming ligatures.
- Open with
Ctrl+Shift+P
Terminal: Rename
to rename current integrated terminal
- To select the proper pylint path for your project, set .vscode/settings.json ->
"python.linting.pylintPath": "cd /home/user/full/path/to/code && pylint"