on master help sign in
Merge branch 'master' into debug
48cb81eDmitry Sharshakov
Cargo.lock+8−8
@@ -599,9 +599,9 @@ dependencies = [
599
599
600[[package]]
600[[package]]
601name = "lsp-types"
601name = "lsp-types"
602−version = "0.89.2"
602+version = "0.90.0"
603source = "registry+https://github.com/rust-lang/crates.io-index"
603source = "registry+https://github.com/rust-lang/crates.io-index"
604−checksum = "852e0dedfd52cc32325598b2631e0eba31b7b708959676a9f837042f276b09a2"
604+checksum = "a7404037aab080771c90b0a499836d9d8a10336ecd07badf969567b65c6d51a1"
605dependencies = [
605dependencies = [
606 "bitflags",
606 "bitflags",
607 "serde",
607 "serde",
@@ -966,9 +966,9 @@ dependencies = [
966
966
967[[package]]
967[[package]]
968name = "similar"
968name = "similar"
969−version = "2.0.0"
969+version = "2.1.0"
970source = "registry+https://github.com/rust-lang/crates.io-index"
970source = "registry+https://github.com/rust-lang/crates.io-index"
971−checksum = "6bf11003835e462f07851028082d2a1c89d956180ce4b4b50e07fb085ec4131a"
971+checksum = "2e24979f63a11545f5f2c60141afe249d4f19f84581ea2138065e400941d83d3"
972
972
973[[package]]
973[[package]]
974name = "slab"
974name = "slab"
@@ -987,9 +987,9 @@ dependencies = [
987
987
988[[package]]
988[[package]]
989name = "smallvec"
989name = "smallvec"
990−version = "1.6.1"
990+version = "1.7.0"
991source = "registry+https://github.com/rust-lang/crates.io-index"
991source = "registry+https://github.com/rust-lang/crates.io-index"
992−checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
992+checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
993
993
994[[package]]
994[[package]]
995name = "str-buf"
995name = "str-buf"
@@ -1074,9 +1074,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
1074
1074
1075[[package]]
1075[[package]]
1076name = "tokio"
1076name = "tokio"
1077−version = "1.11.0"
1077+version = "1.12.0"
1078source = "registry+https://github.com/rust-lang/crates.io-index"
1078source = "registry+https://github.com/rust-lang/crates.io-index"
1079−checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce"
1079+checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc"
1080dependencies = [
1080dependencies = [
1081 "autocfg",
1081 "autocfg",
1082 "bytes",
1082 "bytes",
book/src/keymap.md+4−4
@@ -88,10 +88,10 @@
88| `,` | Keep only the primary selection | `keep_primary_selection` |
88| `,` | Keep only the primary selection | `keep_primary_selection` |
89| `C` | Copy selection onto the next line | `copy_selection_on_next_line` |
89| `C` | Copy selection onto the next line | `copy_selection_on_next_line` |
90| `Alt-C` | Copy selection onto the previous line | `copy_selection_on_prev_line` |
90| `Alt-C` | Copy selection onto the previous line | `copy_selection_on_prev_line` |
91−| `(` | Rotate main selection forward | `rotate_selections_backward` |
91+| `(` | Rotate main selection backward | `rotate_selections_backward` |
92−| `)` | Rotate main selection backward | `rotate_selections_forward` |
92+| `)` | Rotate main selection forward | `rotate_selections_forward` |
93−| `Alt-(` | Rotate selection contents forward | `rotate_selection_contents_backward` |
93+| `Alt-(` | Rotate selection contents backward | `rotate_selection_contents_backward` |
94−| `Alt-)` | Rotate selection contents backward | `rotate_selection_contents_forward` |
94+| `Alt-)` | Rotate selection contents forward | `rotate_selection_contents_forward` |
95| `%` | Select entire file | `select_all` |
95| `%` | Select entire file | `select_all` |
96| `x` | Select current line, if already selected, extend to next line | `extend_line` |
96| `x` | Select current line, if already selected, extend to next line | `extend_line` |
97| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
97| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
helix-core/Cargo.toml+2−2
@@ -17,7 +17,7 @@ helix-syntax = { version = "0.4", path = "../helix-syntax" }
17helix-dap = { version = "0.4", path = "../helix-dap" }
17helix-dap = { version = "0.4", path = "../helix-dap" }
18
18
19ropey = "1.3"
19ropey = "1.3"
20−smallvec = "1.4"
20+smallvec = "1.7"
21tendril = "0.4.2"
21tendril = "0.4.2"
22unicode-segmentation = "1.8"
22unicode-segmentation = "1.8"
23unicode-width = "0.1"
23unicode-width = "0.1"
@@ -31,7 +31,7 @@ regex = "1"
31serde = { version = "1.0", features = ["derive"] }
31serde = { version = "1.0", features = ["derive"] }
32toml = "0.5"
32toml = "0.5"
33
33
34−similar = "2.0"
34+similar = "2.1"
35
35
36etcetera = "0.3"
36etcetera = "0.3"
37
37
helix-lsp/Cargo.toml+3−3
@@ -19,9 +19,9 @@ futures-executor = "0.3"
19futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
19futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
20jsonrpc-core = { version = "18.0", default-features = false } # don't pull in all of futures
20jsonrpc-core = { version = "18.0", default-features = false } # don't pull in all of futures
21log = "0.4"
21log = "0.4"
22−lsp-types = { version = "0.89", features = ["proposed"] }
22+lsp-types = { version = "0.90", features = ["proposed"] }
23serde = { version = "1.0", features = ["derive"] }
23serde = { version = "1.0", features = ["derive"] }
24serde_json = "1.0"
24serde_json = "1.0"
25thiserror = "1.0"
25thiserror = "1.0"
26−tokio = { version = "1.11", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
26+tokio = { version = "1.12", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
27−tokio-stream = "0.1"
27+tokio-stream = "0.1.7"
helix-syntax/languages/tree-sitter-zig+1−1

Submodule changed.

helix-term/src/commands.rs+52−48
@@ -1310,6 +1310,7 @@ fn global_search(cx: &mut Context) {
1310
1310
1311 cx.push_layer(Box::new(prompt));
1311 cx.push_layer(Box::new(prompt));
1312
1312
1313+ let root = find_root(None).unwrap_or_else(|| PathBuf::from("./"));
1313 let show_picker = async move {
1314 let show_picker = async move {
1314 let all_matches: Vec<(usize, PathBuf)> =
1315 let all_matches: Vec<(usize, PathBuf)> =
1315 UnboundedReceiverStream::new(all_matches_rx).collect().await;
1316 UnboundedReceiverStream::new(all_matches_rx).collect().await;
@@ -1321,7 +1322,13 @@ fn global_search(cx: &mut Context) {
1321 }
1322 }
1322 let picker = FilePicker::new(
1323 let picker = FilePicker::new(
1323 all_matches,
1324 all_matches,
1324− move |(_line_num, path)| path.to_str().unwrap().into(),
1325+ move |(_line_num, path)| {
1326+ path.strip_prefix(&root)
1327+ .unwrap_or(path)
1328+ .to_str()
1329+ .unwrap()
1330+ .into()
1331+ },
1325 move |editor: &mut Editor, (line_num, path), action| {
1332 move |editor: &mut Editor, (line_num, path), action| {
1326 match editor.open(path.into(), action) {
1333 match editor.open(path.into(), action) {
1327 Ok(_) => {}
1334 Ok(_) => {}
@@ -1504,7 +1511,7 @@ mod cmd {
1504 #[derive(Clone)]
1511 #[derive(Clone)]
1505 pub struct TypableCommand {
1512 pub struct TypableCommand {
1506 pub name: &'static str,
1513 pub name: &'static str,
1507− pub alias: Option<&'static str>,
1514+ pub aliases: &'static [&'static str],
1508 pub doc: &'static str,
1515 pub doc: &'static str,
1509 // params, flags, helper, completer
1516 // params, flags, helper, completer
1510 pub fun: fn(&mut compositor::Context, &[&str], PromptEvent) -> anyhow::Result<()>,
1517 pub fun: fn(&mut compositor::Context, &[&str], PromptEvent) -> anyhow::Result<()>,
@@ -2178,238 +2185,238 @@ mod cmd {
2178 pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
2185 pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
2179 TypableCommand {
2186 TypableCommand {
2180 name: "quit",
2187 name: "quit",
2181− alias: Some("q"),
2188+ aliases: &["q"],
2182 doc: "Close the current view.",
2189 doc: "Close the current view.",
2183 fun: quit,
2190 fun: quit,
2184 completer: None,
2191 completer: None,
2185 },
2192 },
2186 TypableCommand {
2193 TypableCommand {
2187 name: "quit!",
2194 name: "quit!",
2188− alias: Some("q!"),
2195+ aliases: &["q!"],
2189 doc: "Close the current view.",
2196 doc: "Close the current view.",
2190 fun: force_quit,
2197 fun: force_quit,
2191 completer: None,
2198 completer: None,
2192 },
2199 },
2193 TypableCommand {
2200 TypableCommand {
2194 name: "open",
2201 name: "open",
2195− alias: Some("o"),
2202+ aliases: &["o"],
2196 doc: "Open a file from disk into the current view.",
2203 doc: "Open a file from disk into the current view.",
2197 fun: open,
2204 fun: open,
2198 completer: Some(completers::filename),
2205 completer: Some(completers::filename),
2199 },
2206 },
2200 TypableCommand {
2207 TypableCommand {
2201 name: "write",
2208 name: "write",
2202− alias: Some("w"),
2209+ aliases: &["w"],
2203 doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)",
2210 doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)",
2204 fun: write,
2211 fun: write,
2205 completer: Some(completers::filename),
2212 completer: Some(completers::filename),
2206 },
2213 },
2207 TypableCommand {
2214 TypableCommand {
2208 name: "new",
2215 name: "new",
2209− alias: Some("n"),
2216+ aliases: &["n"],
2210 doc: "Create a new scratch buffer.",
2217 doc: "Create a new scratch buffer.",
2211 fun: new_file,
2218 fun: new_file,
2212 completer: Some(completers::filename),
2219 completer: Some(completers::filename),
2213 },
2220 },
2214 TypableCommand {
2221 TypableCommand {
2215 name: "format",
2222 name: "format",
2216− alias: Some("fmt"),
2223+ aliases: &["fmt"],
2217 doc: "Format the file using a formatter.",
2224 doc: "Format the file using a formatter.",
2218 fun: format,
2225 fun: format,
2219 completer: None,
2226 completer: None,
2220 },
2227 },
2221 TypableCommand {
2228 TypableCommand {
2222 name: "indent-style",
2229 name: "indent-style",
2223− alias: None,
2230+ aliases: &[],
2224 doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)",
2231 doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)",
2225 fun: set_indent_style,
2232 fun: set_indent_style,
2226 completer: None,
2233 completer: None,
2227 },
2234 },
2228 TypableCommand {
2235 TypableCommand {
2229 name: "line-ending",
2236 name: "line-ending",
2230− alias: None,
2237+ aliases: &[],
2231 doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.",
2238 doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.",
2232 fun: set_line_ending,
2239 fun: set_line_ending,
2233 completer: None,
2240 completer: None,
2234 },
2241 },
2235 TypableCommand {
2242 TypableCommand {
2236 name: "earlier",
2243 name: "earlier",
2237− alias: Some("ear"),
2244+ aliases: &["ear"],
2238 doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.",
2245 doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.",
2239 fun: earlier,
2246 fun: earlier,
2240 completer: None,
2247 completer: None,
2241 },
2248 },
2242 TypableCommand {
2249 TypableCommand {
2243 name: "later",
2250 name: "later",
2244− alias: Some("lat"),
2251+ aliases: &["lat"],
2245 doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.",
2252 doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.",
2246 fun: later,
2253 fun: later,
2247 completer: None,
2254 completer: None,
2248 },
2255 },
2249 TypableCommand {
2256 TypableCommand {
2250 name: "write-quit",
2257 name: "write-quit",
2251− alias: Some("wq"),
2258+ aliases: &["wq", "x"],
2252 doc: "Writes changes to disk and closes the current view. Accepts an optional path (:wq some/path.txt)",
2259 doc: "Writes changes to disk and closes the current view. Accepts an optional path (:wq some/path.txt)",
2253 fun: write_quit,
2260 fun: write_quit,
2254 completer: Some(completers::filename),
2261 completer: Some(completers::filename),
2255 },
2262 },
2256 TypableCommand {
2263 TypableCommand {
2257 name: "write-quit!",
2264 name: "write-quit!",
2258− alias: Some("wq!"),
2265+ aliases: &["wq!", "x!"],
2259 doc: "Writes changes to disk and closes the current view forcefully. Accepts an optional path (:wq! some/path.txt)",
2266 doc: "Writes changes to disk and closes the current view forcefully. Accepts an optional path (:wq! some/path.txt)",
2260 fun: force_write_quit,
2267 fun: force_write_quit,
2261 completer: Some(completers::filename),
2268 completer: Some(completers::filename),
2262 },
2269 },
2263 TypableCommand {
2270 TypableCommand {
2264 name: "write-all",
2271 name: "write-all",
2265− alias: Some("wa"),
2272+ aliases: &["wa"],
2266 doc: "Writes changes from all views to disk.",
2273 doc: "Writes changes from all views to disk.",
2267 fun: write_all,
2274 fun: write_all,
2268 completer: None,
2275 completer: None,
2269 },
2276 },
2270 TypableCommand {
2277 TypableCommand {
2271 name: "write-quit-all",
2278 name: "write-quit-all",
2272− alias: Some("wqa"),
2279+ aliases: &["wqa", "xa"],
2273 doc: "Writes changes from all views to disk and close all views.",
2280 doc: "Writes changes from all views to disk and close all views.",
2274 fun: write_all_quit,
2281 fun: write_all_quit,
2275 completer: None,
2282 completer: None,
2276 },
2283 },
2277 TypableCommand {
2284 TypableCommand {
2278 name: "write-quit-all!",
2285 name: "write-quit-all!",
2279− alias: Some("wqa!"),
2286+ aliases: &["wqa!", "xa!"],
2280 doc: "Writes changes from all views to disk and close all views forcefully (ignoring unsaved changes).",
2287 doc: "Writes changes from all views to disk and close all views forcefully (ignoring unsaved changes).",
2281 fun: force_write_all_quit,
2288 fun: force_write_all_quit,
2282 completer: None,
2289 completer: None,
2283 },
2290 },
2284 TypableCommand {
2291 TypableCommand {
2285 name: "quit-all",
2292 name: "quit-all",
2286− alias: Some("qa"),
2293+ aliases: &["qa"],
2287 doc: "Close all views.",
2294 doc: "Close all views.",
2288 fun: quit_all,
2295 fun: quit_all,
2289 completer: None,
2296 completer: None,
2290 },
2297 },
2291 TypableCommand {
2298 TypableCommand {
2292 name: "quit-all!",
2299 name: "quit-all!",
2293− alias: Some("qa!"),
2300+ aliases: &["qa!"],
2294 doc: "Close all views forcefully (ignoring unsaved changes).",
2301 doc: "Close all views forcefully (ignoring unsaved changes).",
2295 fun: force_quit_all,
2302 fun: force_quit_all,
2296 completer: None,
2303 completer: None,
2297 },
2304 },
2298 TypableCommand {
2305 TypableCommand {
2299 name: "theme",
2306 name: "theme",
2300− alias: None,
2307+ aliases: &[],
2301 doc: "Change the theme of current view. Requires theme name as argument (:theme <name>)",
2308 doc: "Change the theme of current view. Requires theme name as argument (:theme <name>)",
2302 fun: theme,
2309 fun: theme,
2303 completer: Some(completers::theme),
2310 completer: Some(completers::theme),
2304 },
2311 },
2305 TypableCommand {
2312 TypableCommand {
2306 name: "clipboard-yank",
2313 name: "clipboard-yank",
2307− alias: None,
2314+ aliases: &[],
2308 doc: "Yank main selection into system clipboard.",
2315 doc: "Yank main selection into system clipboard.",
2309 fun: yank_main_selection_to_clipboard,
2316 fun: yank_main_selection_to_clipboard,
2310 completer: None,
2317 completer: None,
2311 },
2318 },
2312 TypableCommand {
2319 TypableCommand {
2313 name: "clipboard-yank-join",
2320 name: "clipboard-yank-join",
2314− alias: None,
2321+ aliases: &[],
2315 doc: "Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
2322 doc: "Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
2316 fun: yank_joined_to_clipboard,
2323 fun: yank_joined_to_clipboard,
2317 completer: None,
2324 completer: None,
2318 },
2325 },
2319 TypableCommand {
2326 TypableCommand {
2320 name: "primary-clipboard-yank",
2327 name: "primary-clipboard-yank",
2321− alias: None,
2328+ aliases: &[],
2322 doc: "Yank main selection into system primary clipboard.",
2329 doc: "Yank main selection into system primary clipboard.",
2323 fun: yank_main_selection_to_primary_clipboard,
2330 fun: yank_main_selection_to_primary_clipboard,
2324 completer: None,
2331 completer: None,
2325 },
2332 },
2326 TypableCommand {
2333 TypableCommand {
2327 name: "primary-clipboard-yank-join",
2334 name: "primary-clipboard-yank-join",
2328− alias: None,
2335+ aliases: &[],
2329 doc: "Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
2336 doc: "Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
2330 fun: yank_joined_to_primary_clipboard,
2337 fun: yank_joined_to_primary_clipboard,
2331 completer: None,
2338 completer: None,
2332 },
2339 },
2333 TypableCommand {
2340 TypableCommand {
2334 name: "clipboard-paste-after",
2341 name: "clipboard-paste-after",
2335− alias: None,
2342+ aliases: &[],
2336 doc: "Paste system clipboard after selections.",
2343 doc: "Paste system clipboard after selections.",
2337 fun: paste_clipboard_after,
2344 fun: paste_clipboard_after,
2338 completer: None,
2345 completer: None,
2339 },
2346 },
2340 TypableCommand {
2347 TypableCommand {
2341 name: "clipboard-paste-before",
2348 name: "clipboard-paste-before",
2342− alias: None,
2349+ aliases: &[],
2343 doc: "Paste system clipboard before selections.",
2350 doc: "Paste system clipboard before selections.",
2344 fun: paste_clipboard_before,
2351 fun: paste_clipboard_before,
2345 completer: None,
2352 completer: None,
2346 },
2353 },
2347 TypableCommand {
2354 TypableCommand {
2348 name: "clipboard-paste-replace",
2355 name: "clipboard-paste-replace",
2349− alias: None,
2356+ aliases: &[],
2350 doc: "Replace selections with content of system clipboard.",
2357 doc: "Replace selections with content of system clipboard.",
2351 fun: replace_selections_with_clipboard,
2358 fun: replace_selections_with_clipboard,
2352 completer: None,
2359 completer: None,
2353 },
2360 },
2354 TypableCommand {
2361 TypableCommand {
2355 name: "primary-clipboard-paste-after",
2362 name: "primary-clipboard-paste-after",
2356− alias: None,
2363+ aliases: &[],
2357 doc: "Paste primary clipboard after selections.",
2364 doc: "Paste primary clipboard after selections.",
2358 fun: paste_primary_clipboard_after,
2365 fun: paste_primary_clipboard_after,
2359 completer: None,
2366 completer: None,
2360 },
2367 },
2361 TypableCommand {
2368 TypableCommand {
2362 name: "primary-clipboard-paste-before",
2369 name: "primary-clipboard-paste-before",
2363− alias: None,
2370+ aliases: &[],
2364 doc: "Paste primary clipboard before selections.",
2371 doc: "Paste primary clipboard before selections.",
2365 fun: paste_primary_clipboard_before,
2372 fun: paste_primary_clipboard_before,
2366 completer: None,
2373 completer: None,
2367 },
2374 },
2368 TypableCommand {
2375 TypableCommand {
2369 name: "primary-clipboard-paste-replace",
2376 name: "primary-clipboard-paste-replace",
2370− alias: None,
2377+ aliases: &[],
2371 doc: "Replace selections with content of system primary clipboard.",
2378 doc: "Replace selections with content of system primary clipboard.",
2372 fun: replace_selections_with_primary_clipboard,
2379 fun: replace_selections_with_primary_clipboard,
2373 completer: None,
2380 completer: None,
2374 },
2381 },
2375 TypableCommand {
2382 TypableCommand {
2376 name: "show-clipboard-provider",
2383 name: "show-clipboard-provider",
2377− alias: None,
2384+ aliases: &[],
2378 doc: "Show clipboard provider name in status bar.",
2385 doc: "Show clipboard provider name in status bar.",
2379 fun: show_clipboard_provider,
2386 fun: show_clipboard_provider,
2380 completer: None,
2387 completer: None,
2381 },
2388 },
2382 TypableCommand {
2389 TypableCommand {
2383 name: "change-current-directory",
2390 name: "change-current-directory",
2384− alias: Some("cd"),
2391+ aliases: &["cd"],
2385 doc: "Change the current working directory (:cd <dir>).",
2392 doc: "Change the current working directory (:cd <dir>).",
2386 fun: change_current_directory,
2393 fun: change_current_directory,
2387 completer: Some(completers::directory),
2394 completer: Some(completers::directory),
2388 },
2395 },
2389 TypableCommand {
2396 TypableCommand {
2390 name: "show-directory",
2397 name: "show-directory",
2391− alias: Some("pwd"),
2398+ aliases: &["pwd"],
2392 doc: "Show the current working directory.",
2399 doc: "Show the current working directory.",
2393 fun: show_current_directory,
2400 fun: show_current_directory,
2394 completer: None,
2401 completer: None,
2395 },
2402 },
2396 TypableCommand {
2403 TypableCommand {
2397 name: "encoding",
2404 name: "encoding",
2398− alias: None,
2405+ aliases: &[],
2399 doc: "Set encoding based on `https://encoding.spec.whatwg.org`",
2406 doc: "Set encoding based on `https://encoding.spec.whatwg.org`",
2400 fun: set_encoding,
2407 fun: set_encoding,
2401 completer: None,
2408 completer: None,
2402 },
2409 },
2403 TypableCommand {
2410 TypableCommand {
2404 name: "reload",
2411 name: "reload",
2405− alias: None,
2412+ aliases: &[],
2406 doc: "Discard changes and reload from the source file.",
2413 doc: "Discard changes and reload from the source file.",
2407 fun: reload,
2414 fun: reload,
2408 completer: None,
2415 completer: None,
2409 },
2416 },
2410 TypableCommand {
2417 TypableCommand {
2411 name: "tree-sitter-scopes",
2418 name: "tree-sitter-scopes",
2412− alias: None,
2419+ aliases: &[],
2413 doc: "Display tree sitter scopes, primarily for theming and development.",
2420 doc: "Display tree sitter scopes, primarily for theming and development.",
2414 fun: tree_sitter_scopes,
2421 fun: tree_sitter_scopes,
2415 completer: None,
2422 completer: None,
@@ -2437,14 +2444,14 @@ mod cmd {
2437 },
2444 },
2438 TypableCommand {
2445 TypableCommand {
2439 name: "vsplit",
2446 name: "vsplit",
2440− alias: Some("vs"),
2447+ aliases: &["vs"],
2441 doc: "Open the file in a vertical split.",
2448 doc: "Open the file in a vertical split.",
2442 fun: vsplit,
2449 fun: vsplit,
2443 completer: Some(completers::filename),
2450 completer: Some(completers::filename),
2444 },
2451 },
2445 TypableCommand {
2452 TypableCommand {
2446 name: "hsplit",
2453 name: "hsplit",
2447− alias: Some("sp"),
2454+ aliases: &["hs", "sp"],
2448 doc: "Open the file in a horizontal split.",
2455 doc: "Open the file in a horizontal split.",
2449 fun: hsplit,
2456 fun: hsplit,
2450 completer: Some(completers::filename),
2457 completer: Some(completers::filename),
@@ -2452,16 +2459,13 @@ mod cmd {
2452 ];
2459 ];
2453
2460
2454 pub static COMMANDS: Lazy<HashMap<&'static str, &'static TypableCommand>> = Lazy::new(|| {
2461 pub static COMMANDS: Lazy<HashMap<&'static str, &'static TypableCommand>> = Lazy::new(|| {
2455− let mut map = HashMap::new();
2456−
2457− for cmd in TYPABLE_COMMAND_LIST {
2462+ TYPABLE_COMMAND_LIST
2458− map.insert(cmd.name, cmd);
2463+ .iter()
2459− if let Some(alias) = cmd.alias {
2464+ .flat_map(|cmd| {
2460− map.insert(alias, cmd);
2465+ std::iter::once((cmd.name, cmd))
2461− }
2466+ .chain(cmd.aliases.iter().map(move |&alias| (alias, cmd)))
2462− }
2467+ })
2463−
2468+ .collect()
2464− map
2465 });
2469 });
2466}
2470}
2467
2471
runtime/queries/zig/highlights.scm+117−80
@@ -4,82 +4,89 @@
4 (line_comment)
4 (line_comment)
5] @comment
5] @comment
6
6
7−; field in top level decl, and in struct, union...
7+[
8−(ContainerField
9− (IDENTIFIER) @property
8+ variable: (IDENTIFIER)
10− (SuffixExpr (IDENTIFIER) @type)?
9+ variable_type_function: (IDENTIFIER)
11−)
10+] @variable
12
11
13−; error.OutOfMemory;
12+parameter: (IDENTIFIER) @variable.parameter
14−(SuffixExpr
13+
15− "error"
14+[
16− "."
15+ field_member: (IDENTIFIER)
16+ field_access: (IDENTIFIER)
17+] @variable.property
18+
19+;; assume TitleCase is a type
20+(
21+ [
22+ variable_type_function: (IDENTIFIER)
23+ field_access: (IDENTIFIER)
24+ parameter: (IDENTIFIER)
25+ ] @type
26+ (#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$")
27+)
28+;; assume camelCase is a function
29+(
30+ [
17− (IDENTIFIER) @constant
31+ variable_type_function: (IDENTIFIER)
32+ field_access: (IDENTIFIER)
33+ parameter: (IDENTIFIER)
34+ ] @function
35+ (#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$")
18)
36)
19
37
38+;; assume all CAPS_1 is a constant
39+(
40+ [
20−; var x: IDENTIFIER
41+ variable_type_function: (IDENTIFIER)
21−type: (SuffixExpr (IDENTIFIER) @type)
42+ field_access: (IDENTIFIER)
43+ ] @constant
44+ (#match? @constant "^[A-Z][A-Z_0-9]+$")
45+)
22
46
47+[
23−; IDENTIFIER{}
48+ function_call: (IDENTIFIER)
24−constructor: (SuffixExpr (IDENTIFIER) @constructor)
49+ function: (IDENTIFIER)
50+] @function
25
51
26−; fields
52+exception: "!" @function.macro
27−(FieldInit (IDENTIFIER) @property)
28
53
29−; foo.bar.baz.function() calls
30(
54(
31− (SuffixOp
32− (IDENTIFIER) @function
55+ (IDENTIFIER) @variable.builtin
33− )
56+ (#eq? @variable.builtin "_")
34− .
35− (FnCallArguments)
36)
57)
37
58
38−; function() calls
59+(PtrTypeStart "c" @variable.builtin)
60+
39(
61(
40− (
62+ (ContainerDeclType
41− (IDENTIFIER) @function
63+ [
64+ (ErrorUnionExpr)
65+ "enum"
66+ ]
42 )
67 )
43− .
68+ (ContainerField (IDENTIFIER) @constant)
44− (FnCallArguments)
45)
69)
46
70
47−; functionn decl
71+field_constant: (IDENTIFIER) @constant
48−(FnProto
49− (IDENTIFIER) @function
50− (SuffixExpr (IDENTIFIER) @type)?
51− ("!")? @function.macro
52−)
53
72
54−; function parameters and types
73+(BUILTINIDENTIFIER) @function.builtin
55−(ParamDecl
56− (IDENTIFIER) @variable.parameter
57− ":"
58− [
59− (ParamType (SuffixExpr (IDENTIFIER) @type))
60− (ParamType)
61− ]
62−)
63
74
64−; switch
75+((BUILTINIDENTIFIER) @keyword.control.import
65−(SwitchItem
76+ (#any-of? @keyword.control.import "@import" "@cImport"))
66− (SuffixExpr
67− "."
68− .
69− (IDENTIFIER) @constant
70− )
71−)
72
77
73(INTEGER) @number
78(INTEGER) @number
74
79
75(FLOAT) @number
80(FLOAT) @number
76
81
77[
82[
78− (STRINGLITERAL)
83+ (LINESTRING)
79 (STRINGLITERALSINGLE)
84 (STRINGLITERALSINGLE)
80] @string
85] @string
81
86
82−(CHAR_LITERAL) @string
87+(CHAR_LITERAL) @constant.character
88+(EscapeSequence) @escape
89+(FormatSequence) @string.special
83
90
84[
91[
85 "allowzero"
92 "allowzero"
@@ -95,6 +102,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
95[
102[
96 "true"
103 "true"
97 "false"
104 "false"
105+] @constant.builtin.boolean
106+
107+[
98 "undefined"
108 "undefined"
99 "unreachable"
109 "unreachable"
100 "null"
110 "null"
@@ -104,21 +114,18 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
104 "else"
114 "else"
105 "if"
115 "if"
106 "switch"
116 "switch"
117+] @keyword.control.conditional
118+
119+[
107 "for"
120 "for"
108 "while"
121 "while"
109− "return"
110− "break"
111− "continue"
112− "defer"
113− "errdefer"
114− "async"
115− "nosuspend"
116− "await"
117− "suspend"
118− "resume"
119− "try"
120− "catch"
121−] @keyword.control
122+] @keyword.control.repeat
123+
124+[
125+ "or"
126+ "and"
127+ "orelse"
128+] @operator
122
129
123[
130[
124 "struct"
131 "struct"
@@ -127,21 +134,48 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
127 "error"
134 "error"
128 "packed"
135 "packed"
129 "opaque"
136 "opaque"
130− "test"
131− "usingnamespace"
132− "export"
133− "extern"
134− "const"
135− "var"
136− "comptime"
137− "threadlocal"
138] @keyword
137] @keyword
139
138
140[
139[
141− "pub"
140+ "try"
141+ "error"
142+ "catch"
143+] @function.macro
144+
145+; VarDecl
146+[
147+ "comptime"
148+ "threadlocal"
142 "fn"
149 "fn"
143] @keyword.function
150] @keyword.function
144
151
152+[
153+ "const"
154+ "var"
155+ "test"
156+ "pub"
157+ "usingnamespace"
158+] @keyword
159+
160+[
161+ "return"
162+ "break"
163+ "continue"
164+] @keyword.control
165+
166+; Macro
167+[
168+ "defer"
169+ "errdefer"
170+ "async"
171+ "nosuspend"
172+ "await"
173+ "suspend"
174+ "resume"
175+ "export"
176+ "extern"
177+] @function.macro
178+
145; PrecProc
179; PrecProc
146[
180[
147 "inline"
181 "inline"
@@ -149,10 +183,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
149 "asm"
183 "asm"
150 "callconv"
184 "callconv"
151 "noalias"
185 "noalias"
152−] @attribute
186+] @keyword.directive
153
187
154[
188[
155− (BUILTINIDENTIFIER)
156 "linksection"
189 "linksection"
157 "align"
190 "align"
158] @function.builtin
191] @function.builtin
@@ -164,9 +197,6 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
164 (AdditionOp)
197 (AdditionOp)
165 (MultiplyOp)
198 (MultiplyOp)
166 (PrefixOp)
199 (PrefixOp)
167− "or"
168− "and"
169− "orelse"
170 "*"
200 "*"
171 "**"
201 "**"
172 "->"
202 "->"
@@ -174,6 +204,7 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
174 ".?"
204 ".?"
175 ".*"
205 ".*"
176 "="
206 "="
207+ "?"
177] @operator
208] @operator
178
209
179[
210[
@@ -186,6 +217,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
186[
217[
187 ".."
218 ".."
188 "..."
219 "..."
220+] @punctuation.special
221+
222+[
189 "["
223 "["
190 "]"
224 "]"
191 "("
225 "("
@@ -195,4 +229,7 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
195 (Payload "|")
229 (Payload "|")
196 (PtrPayload "|")
230 (PtrPayload "|")
197 (PtrIndexPayload "|")
231 (PtrIndexPayload "|")
198−] @punctuation
232+] @punctuation.bracket
233+
234+; Error
235+(ERROR) @keyword
runtime/queries/zig/indents.toml+5−4
@@ -1,8 +1,9 @@
1indent = [
1indent = [
2− "block",
2+ "Block",
3− "match_block",
3+ "BlockExpr",
4− "arguments",
4+ "ContainerDecl",
5− "parameters"
5+ "SwitchExpr",
6+ "InitList"
6]
7]
7
8
8outdent = [
9outdent = [
runtime/themes/nord.tomlnew file+84
@@ -0,0 +1,84 @@
1+# Author : RayGervais<raygervais@hotmail.ca>
2+
3+# "ui.linenr.selected" = { fg = "#d8dee9" }
4+# "ui.text.focus" = { fg = "#e5ded6", modifiers= ["bold"] }
5+# "ui.menu.selected" = { fg = "#e5ded6", bg = "#313f4e" }
6+
7+# "info" = "#b48ead"
8+# "hint" = "#a3be8c"
9+
10+# Polar Night
11+# nord0 - background color
12+"ui.background" = { bg = "#2e3440" }
13+"ui.statusline.inactive" = { fg = "#d8dEE9", bg = "#2e3440" }
14+
15+
16+# nord1 - status bars, panels, modals, autocompletion
17+"ui.statusline" = { fg = "#88c0d0", bg = "#3b4252" }
18+"ui.popup" = { bg = "#232d38" }
19+"ui.window" = { bg = "#232d38" }
20+"ui.help" = { bg = "#232d38", fg = "#e5ded6" }
21+
22+# nord2 - active line, highlighting
23+"ui.selection" = { bg = "#434c5e" }
24+"ui.cursor.match" = { bg = "434c5e" }
25+
26+# nord3 - comments
27+"comment" = "#4c566a"
28+"ui.linenr" = { fg = "#4c566a" }
29+
30+# Snow Storm
31+# nord4 - cursor, variables, constants, attributes, fields
32+"ui.cursor.primary" = { fg = "#d8dee9", modifiers = ["reversed"] }
33+"attribute" = "#d8dee9"
34+"variable" = "#d8dee9"
35+"constant" = "#d8dee9"
36+"variable.builtin" = "#d8dee9"
37+"constant.builtin" = "#d8dee9"
38+"namespace" = "#d8dee9"
39+
40+# nord5 - suble UI text
41+
42+# nord6 - base text, punctuation
43+"ui.text" = { fg = "#eceff4" }
44+"punctuation" = "#eceff4"
45+
46+# Frost
47+# nord7 - classes, types, primiatives
48+"type" = "#8fbcbb"
49+"type.builtin" = { fg = "#8fbcbb"}
50+"label" = "#8fbcbb"
51+
52+# nord8 - declaration, methods, routines
53+"constructor" = "#88c0d0"
54+"function" = "#88c0d0"
55+"function.macro" = { fg = "#88c0d0" }
56+"function.builtin" = { fg = "#88c0d0" }
57+
58+# nord9 - operator, tags, units, punctuations
59+"punctuation.delimiter" = "#81a1c1"
60+"operator" = { fg = "#81a1c1" }
61+"property" = "#81a1c1"
62+
63+# nord10 - keywords, special
64+"keyword" = { fg = "#5e81ac" }
65+"keyword.directive" = "#5e81ac"
66+"variable.parameter" = "#5e81ac"
67+
68+# Aurora
69+# nord11 - error
70+"error" = "#bf616a"
71+
72+# nord12 - annotations, decorators
73+"special" = "#d08770"
74+"module" = "#d08770"
75+
76+# nord13 - warnings, escape characters, regex
77+"warning" = "#ebcb8b"
78+"escape" = { fg = "#ebcb8b" }
79+
80+# nord14 - strings
81+"string" = "#a3be8c"
82+
83+# nord15 - integer, floating point
84+"number" = "#b48ead"