brainbaking/content/wiki/code/tools/sublime.md

3.4 KiB

+++ title = "sublime" draft = false tags = [ "code", "tools", "sublime" ] date = "2014-06-19" +++

Sublime Text protips

Must-have plugins

Installeren via Sublime Package Control

  1. SublimeLinter - linting in verschillende talen (ook CoffeeScript)
  2. SublimeCodeIntel - autocompletion in verschillende talen. Werkt zoals in eclipse, gebruik ctrl+shift+space voor box te triggeren.
  3. git
  4. jsFormat (mapt by default op cmd+alt+F, heb het remapped naar eclipse equiv. cmd+shift+F)
  5. FilterLines om door logging te ploegen - greplike in subl.

(user) configuratie

Hoofddocumentatie: http://docs.sublimetext.info/en/latest/reference/settings.html

In JSON formaat, zie ctrl+shift+P: Preferences: Settings - User. Proxy definiëren:

{
	"debug": true,

	"http_proxy": "vdabproxy.vdab.be:8080",
	"https_proxy": "vdabproxy.vdab.be:8080"
}

Dit werkt niet als je Package Control nog moet installeren aangezien de settings specifiek hiervoor zijn.

Plugin manueel in plugin dir slepen.

Development in Sublime

Build Systems

CTRL+B (menu build) werkt door een .sublime-build file met configuratie voor de batch die in (onder windows C:<br/>Users<br/>bkwog<br/>AppData<br/>Roaming<br/>Sublime Text 2<br/>Packages<br/>[lang]) uw package dir leven. Een voorbeeld van zo'n file voor ruby, by default:

{
	"cmd": ["ruby", "$file"],
	"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
	"selector": "source.ruby"
}

Syntax: http://docs.sublimetext.info/en/latest/file_processing/build_systems.html

Zie ook Adding custom build systems for popular tools and languages - bijvoorbeeld grunt etc.

Ruby development

Efficiency with Sublime text and Ruby

Python development

Must have plugins

  • PyLint voor code checking
  • autocompletion: jedi of Anaconda zijn de beste specifiek voor Python.
  • Voor checkins: Git & GitGutter

Voor Jedi moet je uw project file aanmaken (& Project -> Add Folder to Project ... base dir kiezen): ziet er bijvoorbeeld zo uit

{
	"folders":
	[
		{
			"path": "/D/Github/polyglata/01_calculatestring/python"
		}
	]
}

Dan kan de autocompleter alles terug vinden. Handige shortcuts: CTRL+SHIFT+G goto/find definition. ALT+SHIFT+F: find all references.

Building etc

Kan ook de SublimeREPL gebruiken, en dan deze in een window langs uw code plaatsen. Keyboard shortcuts zoals CTRL+SHIFT+, F kopiëren heel de file naar de REPL om te evalueren. De huidige file builden met CTRL+B (Tools -> Build System -> Python).