Skip to content

Instantly share code, notes, and snippets.

@dortamiguel
Last active December 16, 2021 21:45
Show Gist options
  • Save dortamiguel/043e1b171535f12402e22e470160b216 to your computer and use it in GitHub Desktop.
Save dortamiguel/043e1b171535f12402e22e470160b216 to your computer and use it in GitHub Desktop.

Sublime Text 3 configuration

subl config

ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

Custom color schemes

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone [email protected]:ellipticaldoor/custom-sublime-themes.git

Packages

General

dependencies

brew update
brew upgrade
brew install the_silver_searcher imagemagick ruby
npm i -g csslint eslint eslint-plugin-vue prettier
SublimeLinter
Color Highlighter
A File Icon
MarkdownEditing
Sass
LESS
Css3
Pug
GraphQL
Git blame
Clickable URLs
Search in Project
SideBarEnhancements
Case Conversion
GitSavvy
GitGutter
Emmet
All Autocomplete
EditorConfig
SyncedSideBar
Single Trailing Newline
Terminal
HyperClick
DotENV
BracketGuard
Tabright
JSONComma
SublimeLinter-annotations
PackageResourceViewer

JS

In order to get working babel highlight with vue you need to disable the default javascript package

JS Custom
SublimeLinter-eslint // Install latest from master
ESLint-Formatter
JavaScript Snippets
ES6-Toolkit
JsPrettier
Vue Syntax Highlight

PHP

dependencies

brew tap homebrew/homebrew-php
brew install php70
PHP Companion
SublimeLinter-php
PHP-Twig
Smarty

Rust

TOML
Rust Enhanced

General settings

Sublime Text > Preferences > Settings or cmd + ,

{
	"always_show_minimap_viewport": true,
	"animation_enabled": false,
	"binary_file_patterns": [
		"*.jpg",
		"*.jpeg",
		"*.png",
		"*.gif",
		"*.ttf",
		"*.tga",
		"*.dds",
		"*.ico",
		"*.eot",
		"*.pdf",
		"*.swf",
		"*.jar",
		"*.zip",
		"*.log",
		"*.csv",
		"*.pyc",
		"*.gz",
		"node_modules/**",
		"bower_components/**",
		"dist/**",
		"vendor/**",
		"cache/**",
		"SmartyCaches/**",
		".sass-cache/**",
		"/tmp/**",
		"gulp/temp/**",
		"www/html2pdf-converter/cache/**",
		"www/html2pdf-converter/temp/**",
		"logs/**"
	],
	"caret_style": "phase",
	"default_line_ending": "unix",
	"drag_text": false,
	"draw_white_space": "selection",
	"enable_tab_scrolling": false,
	"ensure_newline_at_eof_on_save": true,
	"fade_fold_buttons": false,
	"font_face": "SF Mono", // "font_face": "SF Mono Light",
	"font_size": 16,
	"highlight_line": true,
	"ignored_packages": ["Rust", "Vintage"],
	"indent_guide_options": ["draw_normal", "draw_active"],
	"jsoncomma_on_save": true,
	"open_files_in_new_window": false,
	"overlay_scroll_bars": "disabled",
	"rulers": [120],
	"save_on_focus_lost": true,
	"show_full_path": true,
	"tree_animation_enabled": false,
	"trim_trailing_white_space_on_save": true,
	"word_wrap": true,
	"show_definitions": false,
	"bold_folder_labels": true
}

General Key Bindings

Preferences > Key Bindings

[
	// UI
	{ "keys": ["super+shift+o"], "command": "prompt_add_folder" },
	{ "keys": ["super+k"], "command": "toggle_side_bar" },
	{
		"keys": ["super+,"],
		"command": "open_file",
		"args": {
			"file": "$packages/User/Preferences.sublime-settings"
		}
	},
	{
		"keys": ["super+shift+,"],
		"command": "open_file",
		"args": {
			"file": "$packages/User/Default (OSX).sublime-keymap"
		}
	},
	{ "keys": ["super+b"], "command": "toggle_bookmark" },
	{ "keys": ["super+shift+b"], "command": "clear_bookmarks" },
	{ "keys": ["alt+n"], "command": "next_bookmark" },
	{ "keys": ["alt+b"], "command": "prev_bookmark" },

	// Eslint formatter
	{ "keys": ["super+e"], "command": "format_eslint" },

	// SublimeLinter
	{ "keys": ["super+i"], "command": "sublime_linter_panel_toggle" },

	// GitSavvy
	{ "keys": ["super+."], "command": "gs_show_status" },
	{ "keys": ["super+shift+."], "command": "gs_show_branch" },
	{ "keys": ["ctrl+p"], "command": "gs_pull" },
	{ "keys": ["ctrl+shift+p"], "command": "gs_push" },

	// Git Blame
	{ "keys": ["ctrl+b"], "command": "blame" },

	// Hyper click
	{ "keys": ["super+j"], "command": "hyper_click_jump" },

	// Indent single lines
	{
		"keys": ["tab"],
		"command": "indent",
		"context": [
			{
				"key": "selection_empty",
				"operator": "equal",
				"operand": false,
				"match_all": true
			}
		]
	},
	{
		"keys": ["shift+tab"],
		"command": "unindent",
		"context": [
			{
				"key": "selection_empty",
				"operator": "equal",
				"operand": false,
				"match_all": true
			}
		]
	}
]

Package settings

SublimeLinter

Preferences > Package Settings > SublimeLinter > Settings — User

{
	"delay": 0.01,
	"statusbar.show_active_linters": false,
	"linters": {
		"eslint": {
			"disable": false,
			"args": [],
			"excludes": [],
			"env": {
				"PATH": "/usr/local/bin"
			}
		},
		"rust": {
			"disable": false,
			"use-cargo-check": true
		}
	},
	"paths": {
		"osx": ["/usr/local/bin", "~/.cargo/bin"] // which eslint (copy path only until bin)
	}
}

Color Highlighter

Preferences > Package Settings > Color Highlighter > Settings – User

{
	"search_colors_in": {
		"selection": {
			"enabled": true,
			"color_highlighters": {
				"color_scheme": {
					"enabled": true,
					"highlight_style": "text"
				},
				"gutter_icons": {
					"enabled": false,
					"icon_style": "circle"
				},
				"phantoms": {
					"enabled": false,
					"style": "right",
					"length": 2
				}
			}
		},
		"all_content": {
			"enabled": true,
			"color_highlighters": {
				"color_scheme": {
					"enabled": true,
					"highlight_style": "filled"
				},
				"gutter_icons": {
					"enabled": false,
					"icon_style": "circle"
				},
				"phantoms": {
					"enabled": false,
					"style": "right",
					"length": 2
				}
			}
		},
		"hover": {
			"enabled": true,
			"color_highlighters": {
				"color_scheme": {
					"enabled": false,
					"highlight_style": "filled"
				},
				"gutter_icons": {
					"enabled": false,
					"icon_style": "circle"
				},
				"phantoms": {
					"enabled": false,
					"style": "right",
					"length": 2
				}
			}
		}
	},
	"file_extensions": [
		".css",
		".less",
		".scss",
		".sass",
		".styl",
		".js",
		".php",
		".py",
		".rs",
		".json",
		".yml",
		".html",
		".vue",
		".jsx",
		".ejs",
		".md",
		".txt",
		".tmTheme",
		".xml"
	],
	"icon_factory": {
		"convert_command": "/usr/local/bin/convert",
		"convert_timeout": 5
	}
}

MarkdownEditing

Open all with current extension as… > MarkdownEditing > Markdown GFM

Preferences > Package Settings > Markdown Editing > Markdown GFM Editing - User

{
	"extensions": ["md", "txt"],
	"color_scheme": "Packages/custom-sublime-themes/Mariana Custom.tmTheme",
	"rulers": [80],
	"line_numbers": true,
	"caret_style": "phase",
	"highlight_line": true
}

Single Trailing Newline

Preferences > Package Settings > Single Trailing Newline > Settings — User

{
	"enable_for_all_syntaxes": true
}

Terminal

Preferences > Package Settings > Terminal > Settings – User

{
	"terminal": "iTerm2-v3.sh",
	"parameters": ["--open-in-tab"]
}

Preferences > Package Settings > Terminal > Key Bindings – Default

[
	{ "keys": ["super+alt+o"], "command": "open_terminal_project_folder" },
	{ "keys": ["super+ctrl+o"], "command": "open_terminal" }
]

Search in Project

Preferences > Package Settings > Search in Project > Settings — User

{
	"search_in_project_engine": "the_silver_searcher",
	"search_in_project_TheSilverSearcher_common_options":
		"-Q --ignore node_modules/** --ignore dist/** --ignore bower_components/** --ignore dist/** --ignore vendor/** --ignore cache/** --ignore SmartyCaches/** --ignore *.pyc --ignore *.lock --ignore=*min.js --ignore *.map"
}

Preferences > Package Settings > Search in Project > Key Bindings – Default

[{ "keys": ["super+g"], "command": "search_in_project" }]

SideBarEnhancements

Preferences > Package Settings > Side Bar > Settings - User

{
	"statusbar_file_size": true,
	"confirm_before_deleting": false,
	"disabled_menuitem_edit": true,
	"disabled_menuitem_edit_to_right": true,
	"disabled_menuitem_open_in_browser": true,
	"disabled_menuitem_open_in_new_window": true,
	"disabled_menuitem_find_in_project": true,
	"disabled_menuitem_copy_name": false,
	"disabled_menuitem_copy_path": true,
	"disabled_menuitem_copy_path_windows": true,
	"disabled_menuitem_copy_dir_path": true,
	"disabled_menuitem_paste_in_parent": true,
	"disabled_menuitem_empty": true,

	"default_browser": "chrome",

	"disable_send_to_trash": true,

	"use_powershell": false,

	// if you donated set this value to "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DD4SL2AHYJGBW"
	// to remove the menuitem "Donate 20$" from the sidebar context menu.
	"i_donated_to_sidebar_enhancements_developer": false
}

GitGutter

Preferences > Package Settings > GitGutter > Settings

{
	"debounce_delay": 100,
	"show_markers_on_untracked_file": false,
	"enable_hover_diff_popup": false,
	"status_bar_text": ["In {{repo}}"]
}

HyperClick

Preferences > Package Settings > HyperClick > Settings

{
	"annotations_enabled": false,
	"supported_syntaxes": {
		"js": [
			"ecmascript.sublime-syntax",
			"JavaScript.sublime-syntax",
			"JavaScript (Babel).sublime-syntax",
			"JavaScriptNext.tmLanguage",
			"naomi.fjsx15.sublime-syntax"
		]
	}
}

ESLint-Formatter

Preferences > Package Settings > ESLint-Formatter > Settings

{
	"format_on_save": false,
	"format_on_save_extensions": ["js", "jsx", "es", "es6", "babel", "vue"]
}

GitSavvy

Preferences > Package Settings > GitSavvy > Settings

{
	"hide_help_menu": true,
	"tab_order": ["status", "branch"]
}

Emmet

Preferences > Package Settings > Emmet > Settings - User

{
	"css_completions_scope":
		"source.scss - comment - variable - keyword.control - entity.other, source.sass - comment - variable - keyword.control - entity.other"
}

Import cost

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone [email protected]:ellipticaldoor/sublime-import-cost.git import-cost
cd import-cost
npm i

# At the moment this package makes opening js files very slow
# Disable the package and just enable it when you need it
# Oficial repository for updates https://github.com/julianburr/sublime-import-cost

JsPrettier

Preferences > Package Settings > JsPrettier > Settings — User

{
	"auto_format_on_save": true,
	"auto_format_on_save_requires_prettier_config": false,
	"prettier_options": {
		"useTabs": true,
		"printWidth": 80,
		"singleQuote": true,
		"trailingComma": "es5",
		"bracketSpacing": true,
		"jsxBracketSameLine": false,
		"parser": "flow",
		"semi": true
	}
}

BufferScroll

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone https://github.com/titoBouzout/BufferScroll

Gitignored File Excluder (sometimes needs to be enabled/disabled to work)

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone [email protected]:ellipticaldoor/sublime-gitignorer.git

Increase status bar font size

Command palette > Open Resource > Theme - Default > Default.sublime-theme

[
	{
		"class": "sidebar_container",
		"layer0.tint": [215, 217, 219]
	},
	{
		"class": "sidebar_label",
		"font.size": 13
	},
	{
		"class": "status_bar",
		"content_margin": [-25, 1, 8, 1]
	},
	{
		"parents": [{ "class": "status_bar" }],
		"font.size": 15
	},
	{
		"class": "title_bar",
		"bg": [225, 227, 229],
		"fg": [53, 61, 70]
	}
]

Disable eslint error when there is not an .eslintrc file on the project

cd
touch .eslintrc
echo '{ "rules": {} }' > .eslintrc

TODO

  • rethink bookmarks shortcuts
  • find a way of easily showing cheatsheets (emmet, js, etc)
  • Don't hide search bar when clicking find all
  • go to definition using key binding
  • check emmet for jsx
  • improve prettier js setup (read eslint and pretierrc config)
  • search a fix for jsx comments
  • Vue - Hyperclick on vue files - try all vue packages - latest master of vue-syntax-highlight brokes highlight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment