Vincent Touache - Character TD
/tutos/17_sublime_cheatsheet/content.php
data=================:ArraySublime cheat sheet

Table of Contents

  1. Quick boring introduction
  2. Enable Vintage
  3. Common hotkeys
  4. Misc.



Quick boring introduction

I've tested a lot of IDEs, Eclipse, jedit, VSCode, pycharm, etc.... Eventually, I ended up with 2 different favorites. I love gvim, which allow me to be super fast at typing and editing code. But what I never managed to do well, with vim, is files navigation. I'm not a big fan of buffers, and generally speaking, I'm not fluent enough to navigate as quickly as I would like to. On the other hand, lately, when I was not coding so much, but more navigating around other people's projects, reviewing code and whatnote, I was really enjoying SublimeText, which I still find super powerful. Just the Ctrl+P itself (that you can find for vim, by the way), is a gem. But despite all those amazing shortcuts, I am still missing some of the vim behaviors.

That was before I discover "Vintage"

Vintage is a (native) plugin for Sublime, that emulates Vim behavior. It is part of the ignored packages by default, but you can super easily remove it by editing your user preferences to remove Vintage from the ignore packages. Once done, you will be hable to hit <Esc> to switch to normal mode, in which all the vim hotkeys are valid. If you hit i to go back to Insert mode, boom, you're back to the regular Sublime, more or less. With that in mind, it will be my pleasure to give you a complete tour of Sublime, or at least of how I use it!

Enable Vintage

Common hotkeys

cmd+P go to anything - opens a field, in which you can search for files in your project, plugins, preferences, etc...
cmd+P, then "indent" brings you to Indentation: converts everything to space
cmd+P, then "wrap" brings you to "word wrap: toggle"
cmd+P, then "pyth" brings you to "Set Syntax: Python"
cmd+R go to function definition - you can navigate between all your classes or functions easily with this
cmd+shift+j  Bring the line below to the end of the current line 
cmd+Return Create a new line below the current line and put the cursor at the begining 
cmd+SHIFT+D Duplicate a line 
cmd+Shift+Return Create a new line above the current line and put the cursor at the begining  
ctrl+cmd+up moves the current line one line up 
ctrl+cmd+down moves the current line one line down 
cmd+K, cmd+U switch the word to uppercase 
cmd+K, cmd+L switch the word to lowercase 
cmd+K ctrl+B show/hide the outliner, with all your files and projects 
cmd+K ctrl+1 folds everything to the maximum level of indent 
cmd+K ctrl+2 folds everything up to 2 levels of indent 
cmd+K ctrl+J unfold everything
   
cmd+L select a line
cmd+X cut the current line (meaning the line will be in your clipboard)
cmd+shift+K delete the current line
   
cmd+shift+up adds another cursor on the line above
cmd+shift+down adds another cursor on the line below
cmd+shift+[ folds the current block
cmd+shift+] unfolds the current block
cmd+F search
cmd+alt+F search & replace
cmd+D duplicate your cursor to the next occurence of the current word (or the selection, if something is selected)
cmd+ctrl+G (Alt+F3) duplicate your cursor to all occurrences of the current word (or the selection, if something is selected)
cmd+shift+L With multiple lines selected, adds one cursor per line
MMB Drag MMB pressed to add one cursor on every line you hover
   
cmd+B compile (you need to specify a language, and have a compiler set up)
ctrl+` show console
   
cmd+1 switch to tab 1
cmd+alt+2 vertical split with 2 parts
ctrl+1 In split mode, moves to the 1st vertical part

Misc.

You can use regular expressions in your searches. The caught expressions are available in your replace using the syntax {1} for each maching group

This is a bit more advanced, but if you want to know how Sublime interprets the inputs from your keyboard, you can enter sublime.log_commands(True) from the console (View/show console)