Skip to content

Instantly share code, notes, and snippets.

@miranda-zhang
Last active October 18, 2019 05:39
Show Gist options
  • Save miranda-zhang/4708948730cc45a1d94943003176aff9 to your computer and use it in GitHub Desktop.
Save miranda-zhang/4708948730cc45a1d94943003176aff9 to your computer and use it in GitHub Desktop.

Editor Cheatsheet

Vim

https://coderwall.com/p/adv71w/basic-vim-commands-for-getting-started

Press i for insert mode

The ex mode is an extension of command mode. To get into it, press Esc and then : (the colon). The cursor will go to the bottom of the screen at a colon prompt. Write your file by entering :w and quit by entering :q. You can combine these to save and exit by entering :wq. However, if you're finished with your file, it's generally more convenient to type Shift-z-z from command mode.

Sublime text 3

Installation

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
subl &

Read More Here

Open command line window, keyboard shortcut:

Ctrl + `

Package Control

https://packagecontrol.io/installation

CMD+SHIFT+P to open Package Control

Additional syntax highliter

Install via Package Control

[Name in Package Control]:[the file format it is for]

Knockdown: .md https://github.com/aziz/knockdown Enable line numbers

Generic Config: .conf https://packagecontrol.io/packages/Generic%20Config

Monokai JSON+: json https://github.com/ColibriApps/MonokaiJsonPlus Open the file and choose View > Syntax > Open all with current extension as... and pick a syntax (e.g. JSON); Sublime will pick it by default from then on.

ApacheConf: .htaccess

Other usefull packages

SublimeCodeIntel

Provides all the regular functions you'd expect an IDE to have. Code completion, definition lookup, and the like.

Shortcuts for jump to definition:

For Mac OS X:

  • Jump to definition = Control+Click
  • Jump to definition = Control+Command+Alt+Up
  • Go back = Control+Command+Alt+Left
  • Manual CodeIntel = Control+Shift+space

For Linux:

  • Jump to definition = Super+Click
  • Jump to definition = Control+Super+Alt+Up
  • Go back = Control+Super+Alt+Left
  • Manual CodeIntel = Control+Shift+space

For Windows:

  • Jump to definition = Alt+Click
  • Jump to definition = Control+Windows+Alt+Up
  • Go back = Control+Windows+Alt+Left
  • Manual CodeIntel = Control+Shift+space

JSHint Gutter

Lets you 'lint' your code for semantic/good practice types of errors. Once it's installed right click and go to JSHint > Set Linting Preferences and add the following lines to allow JSHint to play nicely with node and JQuery:

 "browser": true,
 "esnext": true,
 "globals": {
   "$": false
 },
 "strict": false,
 "undef": true,
 "unused": true,
 "node": true

You can also use Right Click > JSHint > Set Plugin Options to toggle linting (checking the code) on edit, load and/or save.

SublimeREPL

This provides interpreter functionality for a whole host of languages (Python, Haskell, etc.)

User setting

Preferences -> Settings

Override the default by adding user settings.

Show hidden subfolders

Find line in setting:

"folder_exclude_patterns": [".svn", ".hg", "CVS"],

Remove the extension, i.e. .git, add the new line in user setting.

Line numbers

Settings - Syntax Specific, i.e. Markdown (Github Flavored).sublime-settings

"line_numbers": true,

Line ending

"default_line_ending": "unix",

multiple line edit

Ctrl+Shift+L

replace all

Ctrl+H

VSCode

Multiline editing

CTRL+ALT+ARROW https://stackoverflow.com/a/30039968/646732

Command palette

Open the command palette using Ctrl+Shift+P

Treat other file extensions as certain language

Ctrl+, to open settings.json

"files.associations": {
    "*.rqg": "sparql"
}

https://stackoverflow.com/a/36789145/646732

Line endings

File->Preferences->Settings under user settings

// The default end of line character.
//  - \n: LF
//  - \r\n: CRLF
"files.eol": "\n"

https://stackoverflow.com/questions/39525417/visual-studio-code-how-to-show-line-endings

Open single file in workspace

Create a symlic of the original file.

ln -s ~/.bash_profile .bash_profile

IntelliJ

Move lines left/right:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment