Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sublime Text #2

Open
TracerLee opened this issue Mar 27, 2016 · 8 comments
Open

Sublime Text #2

TracerLee opened this issue Mar 27, 2016 · 8 comments
Assignees
Labels

Comments

@TracerLee
Copy link
Owner

TracerLee commented Mar 27, 2016

记录一些sublime text的技巧。

个人的sublime text配置

{
	"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
	"font_size": 10,
	"ignored_packages":
	[
		"Markdown",
		"Vintage"
	],
	"material_theme_small_statusbar": true,
	"material_theme_small_tab": true,
	"theme": "Material-Theme.sublime-theme",
	"highlight_line": true,
	"word_wrap": true,
	"auto_upgrade_ignore": ["Material Theme"],
	"tab_size": 2,
	"translate_tabs_to_spaces": true
	//set proxy
	//"http_proxy": "http://127.0.0.1:1087",
	//"https_proxy": "http://127.0.0.1:1087"
}

快捷键

[
	// 默认配置增强
	{ "keys": ["alt+shift+c"], "command": "clone_file" },
	{ "keys": ["ctrl+alt+shift+o"], "command": "prompt_open_folder" },
	{ "keys": ["ctrl+shift+o"], "command": "prompt_add_folder" },
	{ "keys": ["ctrl+alt+e"], "command": "open_dir", "args": { "dir": "$file_path", "file": "$file_name" } },
	{ "keys": ["ctrl+alt+up"], "command": "select_lines", "args": { "forward": false } },
	{ "keys": ["ctrl+alt+down"], "command": "select_lines", "args": { "forward": true } },
	{ "keys": ["ctrl+up"], "command": "scroll_lines", "args": { "amount": 6.0 } },
	{ "keys": ["ctrl+down"], "command": "scroll_lines", "args": { "amount": -6.0 } },

	// alignment
	{ "keys": ["ctrl+alt+d"], "command": "alignment" },

	// 浏览器打开配置
	{
		"keys": ["f12"],
		"command": "side_bar_files_open_with",
		"args": {
			"paths": [],
			"application": "F:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
			"extensions": ".*" //any file with extension
		}
	}, {
		"keys": ["ctrl+f11"],
		"command": "side_bar_files_open_with",
		"args": {
			"paths": [],
			"application": "F:\\Program Files\\Internet Explorer\\iexplore.exe",
			"extensions": ".*" //any file with extension
		}
	}, {
		"keys": ["f9"],
		"command": "side_bar_files_open_with",
		"args": {
			"paths": [],
			"application": "D:\\Program Files (x86)\\360Chrome\\Chrome\\Application\\360chrome.exe",
			"extensions": ".*" //any file with extension
		}
	},

	{
		// 在jsx里面使用emmmet
		"keys": ["tab"],
		"command": "expand_abbreviation_by_tab",
		"context": [{
			"operand": "source.js",
			"operator": "equal",
			"match_all": true,
			"key": "selector"
		}, {
			"key": "selection_empty",
			"operator": "equal",
			"operand": true,
			"match_all": true
		}]
	},
	// 在jsx里面使用emmmet
	{
		"keys": ["tab"],
		"command": "next_field",
		"context": [
			{ "key": "has_next_field", "operator": "equal", "operand": true }
		]
	}

	// linter
	{ "keys": ["alt+shift+n"], "command": "sublimelinter_goto_error", "args": { "direction": "next" } },
	{ "keys": ["alt+shift+p"], "command": "sublimelinter_goto_error", "args": { "direction": "previous" } },
	{ "keys": ["alt+shift+a"], "command": "sublimelinter_show_all_errors" },
	{ "keys": ["alt+shift+t"], "command": "sublimelinter_toggle_linter", "args": { "which": "all" } },

	// svn
	{ "keys": ["alt+l"], "command": "svn_log" },
	{ "keys": ["alt+d"], "command": "svn_diff" }
]
@TracerLee TracerLee changed the title 【工具篇】sublime text使用 sublime text使用 Mar 27, 2016
@TracerLee TracerLee changed the title sublime text使用 sublime text Mar 31, 2016
@TracerLee
Copy link
Owner Author

TracerLee commented Apr 5, 2016

设置单行高亮

{
    "highlight_line": true
}

@TracerLee
Copy link
Owner Author

TracerLee commented Aug 23, 2016

使用Quick Switch Project来切换多个项目

// 快捷键设置
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" }

@TracerLee
Copy link
Owner Author

TracerLee commented Aug 23, 2016

获取快捷键名称的方法

打开命令行`ctrl +``

输入sublime.log_commands(True)

@TracerLee TracerLee self-assigned this Sep 8, 2016
@TracerLee
Copy link
Owner Author

TracerLee commented Sep 9, 2016

默认制表符改为2个空格

{
  "tab_size": 2,
  "translate_tabs_to_spaces": true
}

@TracerLee
Copy link
Owner Author

改为大写:ctrl + KU
改为小写:ctrl + KL

@TracerLee
Copy link
Owner Author

TracerLee commented Sep 14, 2017

常用插件

Package Desc
DocBlockr 智能注释
Emmet 智能html编辑
Git Git集成环境
JsFormat JavaScript格式化
Material Theme 一款不错的主题
SublimeLinter 代码检查框架
SublimeLinter-jshint JavaScript代码检查
TortoiseSVN SVN集成环境
Vue Syntax Highlight Vue组件语法高亮
Alignment 代码对齐
... ...
... ...

@TracerLee TracerLee changed the title sublime text Sublime Text Oct 31, 2017
@TracerLee
Copy link
Owner Author

TracerLee commented Jan 5, 2018

在文件夹的右键菜单上添加一个”Sublime Text 3 打开“

  • 打开注册列表编辑器,win+R打开运行工具,输入regedit

image

  • 点开HKEY_CLASSES_ROOT\Directory\shell

image

  • 新建一个新的项,这里命名为sublime,然后将其默认值改为”用Sublime Text 3打开“,这个值是显示在文件夹右键菜单上的值

image

  • 在新建的sublime项下再新建一个项,命名为Command,编辑Command的值。我的值为”D:\Program Files\Sublime Text 3\sublime_text.exe %1“,前面的路径要替换成安装Sublime Text的路径。

image

  • ok,至此已经设置完成,可以在任意文件夹点击右键使用Sublime Text快速打开了。

image

参考: http://blog.csdn.net/sogoe12345/article/details/43836339


同理新建项到 HKEY_CLASSES_ROOT\*\shell 下可以设置文件的右键

@TracerLee
Copy link
Owner Author

Package Install

SUBLIME TEXT 3

Ctrl + ~

import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant