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 4: #386

Open
hhstore opened this issue Sep 8, 2022 · 9 comments
Open

Sublime Text 4: #386

hhstore opened this issue Sep 8, 2022 · 9 comments

Comments

@hhstore
Copy link
Owner

hhstore commented Sep 8, 2022

related:

@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2022

Sublime Text 4 配置开发环境:

  • ✅ Sublime Text 4 的代码补全能力, 至今依旧吊打 vscode!
  • ✅ Sublime Text 4 的代码补全能力, 至今依旧吊打 vscode!
  • ✅ Sublime Text 4 的代码补全能力, 至今依旧吊打 vscode!

目标语言:

  • rust
  • go
  • python
  • zig
  • dart/flutter

下载安装:

新特性:

配置好的效果图:

  • 不比 vscode 配色差.

image

通用必装插件:

theme 主体配色插件:

必装插件:

  • ✅ 终端插件
  • ✅ git 插件
  • LSP 插件: ⭐️⭐️⭐️⭐️⭐️
  • ✅ 语言插件: rust/zig/go/python

@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2022

Sublime Text 4 配置 Rust 开发环境:

插件:

lsp 插件:

配置步骤:

  1. 安装 ra:
 which rust-analyzer
/opt/homebrew/bin/rust-analyzer

 rust-analyzer --version
rust-analyzer 0.0.0 (67920f797 2022-09-04)
  1. 安装 LSP 插件: LSP-rust-analyzer
  2. 添加 LSP 配置段:

image

  • 注意, 与 zig 的配置段, 有差异. rust-analyzer 路径还是填自己机器的.
  • 这里有坑, 保存配置, 建议关闭 subl, 重写打开 rust 项目. 再执行后续步骤.
// Settings in here override those in "LSP-rust-analyzer/LSP-rust-analyzer.sublime-settings"
{
	"selector": "source.rust",
	"command": ["/opt/homebrew/bin/rust-analyzer"],
}

image

  1. 打开一个 rust 项目, 并打开一个 rust 文件. 然后 CMD + Shift + P, 输入: lsp enable, 选择在项目内激活 LSP-rust-analyzer. 先不要全局激活, 可能会出现始终找不到 LSP-rust-analyzer 选项.

image

  1. 激活 LSP 插件, 就会创建项目索引, 完成后, 就能正常跳转代码. 如下图.

image

image

@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2022

Sublime Text 4 配置 zig 开发环境:

LSP 配置段:

// Settings in here override those in "LSP/LSP.sublime-settings"
{
    "clients": {
        "zig": {
            "command": ["/Users/dev/zls/zls"],
            "enabled": true,
            "selector": "source.zig"
        }
    }
}

@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2022

@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2022

sublime text 快捷键更改:

自定义快捷键: (兼容 Jetbrains Idea)

  • CMD + [: 代码跳转定义
  • CMD + ]: 跳转返回
[
		{ "keys": ["super+["], "command": "goto_definition" },
		{ "keys": ["super+]"], "command": "jump_back" },			
]

常用快捷键表:

@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2022

1

1 similar comment
@hhstore
Copy link
Owner Author

hhstore commented Sep 8, 2022

1

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

No branches or pull requests

1 participant