標籤 sublime text 下的所有文章

Sublime Text 開發設定檔

{
	"auto_complete": true,
	"auto_match_enabled": true,
	"auto_upgrade_ignore":
	[
		"GoSublime"
	],
	"autocomplete_suggest_imports": true,
	"color_scheme": "Packages/Monokai Extended/Monokai Extended Origin.tmTheme",
	"env":
	{
		"GOPATH": "/Users/ken_jan/go",
		"GOROOT": "/usr/local/go",
	},
	"file_exclude_patterns":
	[
		"*.odp",
		"*.pptx",
		"*.docx",
		"*.xlsx",
		"*.pdf",
		"*.cache",
		"*.pyc",
		"*.pyo",
		"*.exe",
		"*.dll",
		"*.obj",
		"*.o",
		"*.a",
		"*.lib",
		"*.so",
		"*.dylib",
		"*.ncb",
		"*.sdf",
		"*.suo",
		"*.pdb",
		"*.idb",
		".DS_Store",
		"*.class",
		"*.psd",
		"*.db"
	],
	"folder_exclude_patterns":
	[
		".svn",
		".git",
		".hg",
		"CVS",
		".tdlib"
	],
	"font_face": "Menlo, Monaco, 'Courier New', monospace",
	"font_options":
	[
	],
	"font_size": 12,
	"highlight_line": true,
	"highlight_modified_tabs": true,
	"ignored_packages":
	[
		"SublimeLinter",
		"Vintage",
	],
	"index_exclude_patterns":
	[
		"*.odp",
		"*.pptx",
		"*.docx",
		"*.xlsx",
		"*.pdf",
		"*.cache",
		"*.pyc",
		"*.pyo",
		"*.exe",
		"*.dll",
		"*.obj",
		"*.o",
		"*.a",
		"*.lib",
		"*.so",
		"*.dylib",
		"*.ncb",
		"*.sdf",
		"*.suo",
		"*.pdb",
		"*.idb",
		".DS_Store",
		"*.class",
		"*.psd",
		"*.db",
		"*.sublime-workspace"
	],
	"mini_diff": false,
	"monokai_pro_small_scrollbar": true,
	"show_full_path": true,
	"show_git_status": false,
	"theme": "Monokai Classic.sublime-theme",
	"theme_font_options":
	[
	],
	"translate_tabs_to_spaces": true,
	"wide_caret": true,
	"word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?:",
}

Sublime Text 開發 Golang 環境配置

Sublime Text Package 安裝

GoSublime

在margo.go 註解改用LSP gopls
 
 // &golang.Gocode{
 // // Whether or not to do gocode completion using source code
 // // instead of the pre-compiled package files.
 // // Using source is often slower but offer more up-to-date completions.
 // Source: true,

 // // show the function parameters. this can take up a lot of space
 // ShowFuncParams: true,

 // // whether or not to include Test*, Benchmark* and Example* functions in the auto-completion list
 // // gs: this replaces the `autocomplete_tests` setting
 // ProposeTests: false,

 // // whether or not builtin types and functions should be shown in the auto-completion list
 // // gs: this replaces the `autocomplete_builtins` setting
 // ProposeBuiltins: true,
 // },


 golangci-lint 啟用這些檢查

 &golang.Linter{Name: "golangci-lint", Args: []string{
 "run",

 // 2019/10/29增加
 "--enable=interfacer",
 "--enable=nakedret",
 "--enable=goconst",

 "--enable=bodyclose",
 "--enable=gocritic",
 "--enable=prealloc",
 "--enable=unconvert",
 "--enable=whitespace",
 "--enable=wsl",

 "--disable=deadcode",
 "--max-same-issues=0",
 "--fast",
 }},
LSP (gopls)

配置設定
{
    "auto_show_diagnostics_panel": "never",
    "show_diagnostics_in_view_status": false,
    "log_server": false,
	"clients":
	{
		"gopls":
		{
			"enabled": true
		}
	}
}

還需要特別安裝
LSP-gopls套件

=============2024/05/29更新======================
Gosublime停止更新,不支援sublime text 4
只需要安裝LSP套件

// Settings in here override those in "LSP/LSP.sublime-settings"
{
    "show_diagnostics_in_view_status": false,
    "clients":
    {
        "gopls":
        {
            "enabled": true
        }
    },
    "lsp_format_on_save": true,
    "lsp_code_actions_on_save": {
        "source.fixAll": false, // 自動修復所有錯誤
        "source.organizeImports": true // 自動新增排序import套件
    }
}

 

Sublime Text 小技巧

修改字型,避免Color Scheme,覆蓋預設字型造成中文亂碼

"font_face": "Courier New"

禁止索引,讓cpu不會負擔哪麼高

"index_files":false

或是指定部分檔案不索引

"index_exclude_patterns": [*.log]

指定某些檔案不在側邊欄位出現

"file_exclude_patterns": [*.log]

指定資料夾不在側邊欄位出現

"folder_exclude_patterns": ["logs"]

Sublime Text Package 推薦

1.Package Control

套件管理必裝

2.Alignment

用來對齊格式

3.DocBlockr

用來產生註解

4.Emmet

前端必裝神器

5.SideBarEnhancements

增強側邊欄位選項

6.sublimelint

補齊個種語言代碼

7.EasyMotion

快速移動光標

8.Sublimerge

顯示檔案差異

 

 

sublime text設定檔存放路徑

~/Library/Application\ Support/Sublime\ Text\ 3/Packages/