summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-09-08 21:55:30 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-09-08 21:55:30 +0800
commit758d808513dc014849cf8e51b7bc870b5acf46f2 (patch)
tree526c025c40ecd82ae4784ae78b15603259c0ae8d
parent0b74e0e163246d92a2295b6c79e3a1413b3a20b8 (diff)
new: helix
-rw-r--r--dot-config/helix/config.toml84
-rw-r--r--dot-config/helix/languages.toml40
-rw-r--r--dot-config/helix/themes/tokyonight-transparent.toml2
-rw-r--r--dot-scls/external-snippets.toml303
m---------dot-scls/external-snippets/friendly-snippets0
-rw-r--r--dot-scls/run.js101
6 files changed, 530 insertions, 0 deletions
diff --git a/dot-config/helix/config.toml b/dot-config/helix/config.toml
new file mode 100644
index 00000000..8bedc0f7
--- /dev/null
+++ b/dot-config/helix/config.toml
@@ -0,0 +1,84 @@
+theme = "tokyonight-transparent"
+
+[editor]
+line-number = "relative"
+default-yank-register = "+"
+popup-border = "all"
+completion-trigger-len = 1
+bufferline = "always"
+auto-format = true
+
+[editor.cursor-shape]
+insert = "bar"
+normal = "block"
+
+[editor.lsp]
+display-inlay-hints = true
+
+[editor.statusline]
+left = ["mode", "spinner"]
+center = ["file-name"]
+right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending", "file-type"]
+separator = "│"
+mode.normal = "NORMAL"
+mode.insert = "INSERT"
+mode.select = "SELECT"
+diagnostics = ["warning", "error"]
+workspace-diagnostics = ["warning", "error"]
+
+[editor.file-picker]
+hidden = false
+
+[editor.whitespace.render]
+space = "none"
+tab = "all"
+nbsp = "none"
+nnbsp = "none"
+newline = "none"
+
+[editor.whitespace.characters]
+space = "·"
+nbsp = "⍽"
+nnbsp = "␣"
+tab = "→"
+newline = "⏎"
+tabpad = "·" # Tabs will look like "→···" (depending on tab width)
+
+[editor.indent-guides]
+render = true
+
+[editor.smart-tab]
+enable = false
+supersede-menu = true
+
+[keys.normal]
+tab = "move_parent_node_end"
+S-tab = "move_parent_node_start"
+
+# [keys.insert]
+# S-tab = "move_parent_node_start"
+
+[keys.select]
+tab = "extend_parent_node_end"
+S-tab = "extend_parent_node_start"
+
+# [keys.normal]
+# C-f = "jump_forward"
+# C-S-f = "jump_backward"
+
+# [keys.insert]
+# # Disable Tab as a jump so it doesn't override
+# tab = "no_op"
+# C-f = "jump_forward"
+# C-S-f = "jump_backward"
+
+# [keys.select]
+# C-f = "jump_forward"
+# C-S-f = "jump_backward"
+
+
+[keys.normal." "]
+q = ":quit"
+c = ":buffer-close"
+tab = "insert_tab"
+w = ":write"
diff --git a/dot-config/helix/languages.toml b/dot-config/helix/languages.toml
new file mode 100644
index 00000000..612d4dab
--- /dev/null
+++ b/dot-config/helix/languages.toml
@@ -0,0 +1,40 @@
+[language-server.scls]
+command = "simple-completion-language-server"
+
+[language-server.scls.config]
+feature_words = false # enable completion by word
+feature_snippets = true # enable snippets
+snippets_first = true # completions will return before snippets by default
+snippets_inline_by_word_tail = false # suggest snippets by WORD tail, for example text `xsq|` become `x^2|` when snippet `sq` has body `^2`
+feature_unicode_input = false # enable "unicode input"
+feature_paths = false # enable path completion
+feature_citations = false # enable citation completion (only on `citation` feature enabled)
+
+
+# write logs to /tmp/completion.log
+[language-server.scls.environment]
+RUST_LOG = "info,simple-completion-language-server=info"
+LOG_FILE = "/tmp/completion.log"
+
+[[language]]
+name = "git-commit"
+language-servers = [ "scls" ]
+
+[[language]]
+name = "cpp"
+auto-format = true
+indent = { tab-width = 4, unit = "t" }
+language-servers = [ "scls", "clangd" ]
+
+[[language]]
+name = "rust"
+indent = { tab-width = 4, unit = "t" }
+language-servers = [ "scls", "rust-analyzer" ]
+
+# [[language]]
+# name = "markdown"
+# language-servers = [ "mdpls" ]
+
+# [language-server.mdpls]
+# command = "/usr/bin/mdpls"
+# config = { markdown.preview.auto = true }
diff --git a/dot-config/helix/themes/tokyonight-transparent.toml b/dot-config/helix/themes/tokyonight-transparent.toml
new file mode 100644
index 00000000..b0cb35eb
--- /dev/null
+++ b/dot-config/helix/themes/tokyonight-transparent.toml
@@ -0,0 +1,2 @@
+inherits = "tokyonight"
+"ui.background" = {}
diff --git a/dot-scls/external-snippets.toml b/dot-scls/external-snippets.toml
new file mode 100644
index 00000000..c99d5e66
--- /dev/null
+++ b/dot-scls/external-snippets.toml
@@ -0,0 +1,303 @@
+[[sources]]
+name = "friendly-snippets"
+git = "https://github.com/rafamadriz/friendly-snippets.git"
+
+[[sources.paths]]
+scope = ["python"]
+path = "snippets/python/python.json"
+
+[[sources.paths]]
+scope = ["asciidoc"]
+path = "snippets/asciidoc.json"
+
+[[sources.paths]]
+scope = ["beancount"]
+path = "snippets/beancount.json"
+
+[[sources.paths]]
+scope = ["c"]
+path = "snippets/c"
+
+[[sources.paths]]
+scope = ["cmake"]
+path = "snippets/cmake.json"
+
+[[sources.paths]]
+scope = ["cobol"]
+path = "snippets/cobol"
+
+[[sources.paths]]
+scope = ["cpp", "c++", "cplusplus", "cc"]
+path = "snippets/cpp"
+
+[[sources.paths]]
+scope = ["csharp", "cs", "dotnet"]
+path = "snippets/csharp"
+
+[[sources.paths]]
+scope = ["css"]
+path = "snippets/css.json"
+
+[[sources.paths]]
+scope = ["dart"]
+path = "snippets/dart.json"
+
+[[sources.paths]]
+scope = ["docker", "dockerfile", "containerfile"]
+path = "snippets/docker"
+
+[[sources.paths]]
+scope = ["editorconfig"]
+path = "snippets/editorconfig.json"
+
+[[sources.paths]]
+scope = ["eelixir"]
+path = "snippets/eelixir.json"
+
+[[sources.paths]]
+scope = ["elixir"]
+path = "snippets/elixir.json"
+
+[[sources.paths]]
+scope = ["erb"]
+path = "snippets/erb.json"
+
+[[sources.paths]]
+scope = ["erlang"]
+path = "snippets/erlang.json"
+
+[[sources.paths]]
+scope = ["fennel"]
+path = "snippets/fennel.json"
+
+[[sources.paths]]
+scope = ["fortran"]
+path = "snippets/fortran.json"
+
+[[sources.paths]]
+scope = ["frameworks"]
+path = "snippets/frameworks"
+
+[[sources.paths]]
+scope = ["fsh"]
+path = "snippets/fsh.json"
+
+[[sources.paths]]
+scope = ["gdscript"]
+path = "snippets/gdscript.json"
+
+[[sources.paths]]
+scope = ["gitcommit"]
+path = "snippets/gitcommit.json"
+
+[[sources.paths]]
+scope = ["gleam"]
+path = "snippets/gleam.json"
+
+[[sources.paths]]
+scope = ["global"]
+path = "snippets/global.json"
+
+[[sources.paths]]
+scope = ["glsl"]
+path = "snippets/glsl.json"
+
+[[sources.paths]]
+scope = ["go", "golang"]
+path = "snippets/go.json"
+
+[[sources.paths]]
+scope = ["haskell"]
+path = "snippets/haskell.json"
+
+[[sources.paths]]
+scope = ["html"]
+path = "snippets/html.json"
+
+[[sources.paths]]
+scope = ["java"]
+path = "snippets/java"
+
+[[sources.paths]]
+scope = ["javascript", "js", "node"]
+path = "snippets/javascript"
+
+[[sources.paths]]
+scope = ["julia"]
+path = "snippets/julia.json"
+
+[[sources.paths]]
+scope = ["kivy"]
+path = "snippets/kivy.json"
+
+[[sources.paths]]
+scope = ["kotlin", "kt"]
+path = "snippets/kotlin"
+
+[[sources.paths]]
+scope = ["kubernetes", "k8s"]
+path = "snippets/kubernetes.json"
+
+[[sources.paths]]
+scope = ["latex"]
+path = "snippets/latex"
+
+[[sources.paths]]
+scope = ["latex"]
+path = "snippets/latex.json"
+
+[[sources.paths]]
+scope = ["license"]
+path = "snippets/license.json"
+
+[[sources.paths]]
+scope = ["liquid"]
+path = "snippets/liquid.json"
+
+[[sources.paths]]
+scope = ["loremipsum"]
+path = "snippets/loremipsum.json"
+
+[[sources.paths]]
+scope = ["lua"]
+path = "snippets/lua"
+
+[[sources.paths]]
+scope = ["make", "makefile"]
+path = "snippets/make.json"
+
+[[sources.paths]]
+scope = ["markdown", "md"]
+path = "snippets/markdown.json"
+
+[[sources.paths]]
+scope = ["mint"]
+path = "snippets/mint.json"
+
+[[sources.paths]]
+scope = ["nix"]
+path = "snippets/nix.json"
+
+[[sources.paths]]
+scope = ["norg"]
+path = "snippets/norg.json"
+
+[[sources.paths]]
+scope = ["nushell", "nu"]
+path = "snippets/nushell.json"
+
+[[sources.paths]]
+scope = ["objc", "objective-c"]
+path = "snippets/objc.json"
+
+[[sources.paths]]
+scope = ["ocaml"]
+path = "snippets/ocaml"
+
+[[sources.paths]]
+scope = ["org"]
+path = "snippets/org.json"
+
+[[sources.paths]]
+scope = ["perl"]
+path = "snippets/perl.json"
+
+[[sources.paths]]
+scope = ["php"]
+path = "snippets/php"
+
+[[sources.paths]]
+scope = ["plantuml"]
+path = "snippets/plantuml.json"
+
+[[sources.paths]]
+scope = ["powershell", "pwsh"]
+path = "snippets/PowerShell.json"
+
+[[sources.paths]]
+scope = ["purescript"]
+path = "snippets/purescript.json"
+
+[[sources.paths]]
+scope = ["python"]
+path = "snippets/python"
+
+[[sources.paths]]
+scope = ["quarto"]
+path = "snippets/quarto.json"
+
+[[sources.paths]]
+scope = ["reason"]
+path = "snippets/reason.json"
+
+[[sources.paths]]
+scope = ["rescript"]
+path = "snippets/rescript.json"
+
+[[sources.paths]]
+scope = ["r"]
+path = "snippets/r.json"
+
+[[sources.paths]]
+scope = ["rmarkdown", "rmd"]
+path = "snippets/rmarkdown.json"
+
+[[sources.paths]]
+scope = ["rst", "restructuredtext"]
+path = "snippets/rst.json"
+
+[[sources.paths]]
+scope = ["ruby"]
+path = "snippets/ruby"
+
+[[sources.paths]]
+scope = ["rust"]
+path = "snippets/rust"
+
+[[sources.paths]]
+scope = ["scala"]
+path = "snippets/scala.json"
+
+[[sources.paths]]
+scope = ["shell", "sh", "bash", "zsh", "fish"]
+path = "snippets/shell"
+
+[[sources.paths]]
+scope = ["solidity"]
+path = "snippets/solidity.json"
+
+[[sources.paths]]
+scope = ["sql"]
+path = "snippets/sql.json"
+
+[[sources.paths]]
+scope = ["svelte"]
+path = "snippets/svelte.json"
+
+[[sources.paths]]
+scope = ["swift"]
+path = "snippets/swift.json"
+
+[[sources.paths]]
+scope = ["systemverilog", "sv"]
+path = "snippets/systemverilog.json"
+
+[[sources.paths]]
+scope = ["tcl"]
+path = "snippets/tcl.json"
+
+[[sources.paths]]
+scope = ["terraform", "tf", "hcl"]
+path = "snippets/terraform.json"
+
+[[sources.paths]]
+scope = ["verilog"]
+path = "snippets/verilog.json"
+
+[[sources.paths]]
+scope = ["vhdl"]
+path = "snippets/vhdl.json"
+
+[[sources.paths]]
+scope = ["zig"]
+path = "snippets/zig.json"
diff --git a/dot-scls/external-snippets/friendly-snippets b/dot-scls/external-snippets/friendly-snippets
new file mode 160000
+Subproject 572f5660cf05f8cd8834e096d7b4c921ba18e17
diff --git a/dot-scls/run.js b/dot-scls/run.js
new file mode 100644
index 00000000..119592d1
--- /dev/null
+++ b/dot-scls/run.js
@@ -0,0 +1,101 @@
+/*
+
+写 Rust 真的是浪费生命!!!
+
+*/
+const { homedir } = require('os')
+const { join, parse } = require('path')
+const { execSync } = require('child_process')
+const fs = require('fs')
+
+const rootDir = join(homedir(), '.scls')
+const cfgFile = join(rootDir, 'external-snippets.toml')
+const externalSnippets = join(rootDir, 'external-snippets')
+
+function clone(url, destination) {
+ const cmd = `git clone ${url} ${destination}`
+ console.log(cmd)
+ execSync(cmd, { cwd: externalSnippets })
+}
+
+function mkdirp(path) {
+ if (fs.existsSync(path)) {
+ return
+ }
+ mkdirp(join(path, '..'))
+ fs.mkdirSync(path)
+}
+
+function isDir(path) {
+ return fs.existsSync(path) && fs.lstatSync(path).isDirectory()
+}
+
+function realName(filename) {
+ return parse(filename).name
+}
+
+/**
+ * 生成配置文件
+ * @param {string} file
+ * @param {string} workspace
+ */
+function createConfigFile(file, workspace) {
+ let content = `[[sources]]
+name = "friendly-snippets"
+git = "https://github.com/rafamadriz/friendly-snippets.git"
+`
+
+ function addSnippet(lang, path) {
+return `
+[[sources.paths]]
+scope = ["${lang}"]
+path = "snippets/${path}"
+`
+ }
+
+ const frameworks = 'frameworks'
+
+ function append(workspace, always = false) {
+ fs.readdirSync(workspace).forEach(filename=> {
+ if (filename.startsWith('.') || (filename == frameworks && !always)) return
+ let name = realName(filename)
+ const filepath = join(workspace, filename)
+ if (!isDir(filepath)) {
+ if (always) {
+ filename = join(frameworks, filename)
+ }
+ content += addSnippet(name, filename)
+ } else {
+ fs.readdirSync(filepath).forEach(subname=> {
+ let filepath = join(filename, subname)
+ if (always) {
+ filepath = join(frameworks, filepath)
+ }
+ content += addSnippet(filename, filepath)
+ })
+ }
+ })
+ }
+
+ append(workspace)
+ append(join(workspace, frameworks), true)
+
+ fs.writeFileSync(file, content)
+}
+
+
+function main() {
+ mkdirp(externalSnippets)
+ const name = 'friendly-snippets'
+ const workspace = join(externalSnippets, name)
+ if (!fs.existsSync(workspace)) {
+ clone('https://github.com/rafamadriz/friendly-snippets', name)
+ if (!fs.existsSync(workspace)) {
+ throw new Error('Failed to clone external snippets')
+ }
+ }
+ if (fs.existsSync(cfgFile)) return
+ createConfigFile(cfgFile, join(workspace, 'snippets'))
+}
+
+main() \ No newline at end of file