repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk

ba3f97721a36026807f1247b19e9494ee3de6375

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (37)

+600 / −655 text lines · all files grouped into 32 bars

cargo/config.toml

Modified

+1 / −0 text lines

1 1 [build]
2 2 # since we only care for builds for our own machine, let's benefit from thise juicy modern cpu features
3 3 rustflags = ["-C", "target-cpu=native"]
4 +jobs = 8
5 6 # let's have some fun with "omgz performance rice dat cake"
6 7 # aaand we get out of memory errors when building nu...

fedora.symlinks

Modified

+7 / −4 text lines

31 31 nushell/env.nu
32 32 ~/.config/nushell/env.nu
34 -nushell/modules
35 -~/.config/nushell/modules
34 +nushell/login.nu
35 +~/.config/nushell/login.nu
37 -nushell/plugin.nu
38 -~/.config/nushell/plugin.nu
37 +nushell/gen-aliases.nu
38 +~/.config/nushell/gen-aliases.nu
40 +nushell/scripts
41 +~/.config/nushell/scripts
40 43 topgrade/topgrade.linux.toml
41 44 ~/.config/topgrade.toml

justfile

Modified

+3 / −0 text lines

27 27 # link dorkfiles into HOME
28 28 link:
29 29 java bootstripper.java
31 +tools:
32 + cd tools;java install.java

neovim/lazy-lock.json

Modified

+11 / −11 text lines

18 18 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
19 19 "heirline.nvim": { "branch": "master", "commit": "0d797435e54645a5f98bad7ad6046aac1ef95c1e" },
20 20 "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" },
21 - "lazy.nvim": { "branch": "main", "commit": "89ddc59d19513c5c19c8f8d2ad8573890bd00eef" },
21 + "lazy.nvim": { "branch": "main", "commit": "eab487c2520f0fe9e54eb5e3ea0606e20512492e" },
22 22 "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
23 23 "mini.bracketed": { "branch": "main", "commit": "06ad08fc75dc540cba76d3d8de0f2dc9f75b5812" },
24 24 "mini.bufremove": { "branch": "main", "commit": "e6044aa28e61d4dd9ec86194d6f81743eced0c1c" },
29 29 "nui.nvim": { "branch": "main", "commit": "322978c734866996274467de084a95e4f9b5e0b1" },
30 30 "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
31 31 "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
32 - "nvim-genghis": { "branch": "main", "commit": "7055134943460d962b4909b43b4c3cd5f011c153" },
32 + "nvim-genghis": { "branch": "main", "commit": "6c3a123dcd355a33f5dd624b0a841e8f88c11f8d" },
33 33 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
34 34 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
35 - "nvim-lint": { "branch": "master", "commit": "1a3a8d047bc01f1760ae4a0f5e80f111ea222e67" },
35 + "nvim-lint": { "branch": "master", "commit": "2f90fe977ef21db3bf3b7a1ceaf4a1e3aafb2b26" },
36 36 "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
37 37 "nvim-navbuddy": { "branch": "master", "commit": "f22bac988f2dd073601d75ba39ea5636ab6e38cb" },
38 38 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
39 - "nvim-neoclip.lua": { "branch": "main", "commit": "709c97fabec9da7d04f7d2f5e207423af8c02871" },
40 - "nvim-spectre": { "branch": "master", "commit": "4d22fe03554056de4325762add3e546c77e3a275" },
41 - "nvim-surround": { "branch": "main", "commit": "ae876ab0f8d41213131c3ed4eeb4c48328f45e12" },
39 + "nvim-neoclip.lua": { "branch": "main", "commit": "9b02a625dfa22499089458554be86171a1dfe8b1" },
40 + "nvim-spectre": { "branch": "master", "commit": "366f46fdd4a1593cc237aea13d5ef113739a472c" },
41 + "nvim-surround": { "branch": "main", "commit": "f1f0699a1d49f28e607ffa4361f1bbe757ac5ebc" },
42 42 "nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" },
43 - "nvim-treesitter": { "branch": "master", "commit": "3a74b5831058d0daf8952a5b8c556c61b30a3f46" },
44 - "nvim-treesitter-context": { "branch": "master", "commit": "5efba33af0f39942e426340da7bc15d7dec16474" },
43 + "nvim-treesitter": { "branch": "master", "commit": "979beffc1a86e7ba19bd6535c0370d8e1aaaad3c" },
44 + "nvim-treesitter-context": { "branch": "master", "commit": "f62bfe19e0fbc13ae95649dfb3cf22f4ff85b683" },
45 45 "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
46 - "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
47 - "nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" },
46 + "nvim-treesitter-textobjects": { "branch": "master", "commit": "fd41b7ccc5490a3a99c734d1ee418b68d06c48a9" },
47 + "nvim-ts-autotag": { "branch": "main", "commit": "bcf3146864262ef2d3c877beba3e222b5c73780d" },
48 48 "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
49 49 "nvim-web-devicons": { "branch": "master", "commit": "b4b302d6ae229f67df7a87ef69fa79473fe788a9" },
50 50 "nvim-window": { "branch": "main", "commit": "81f29840ac3aaeea6fc2153edfabebd00d692476" },
75 75 "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
76 76 "which-key.nvim": { "branch": "main", "commit": "4b7167f8fb2dba3d01980735e3509e172c024c29" },
77 77 "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }
78 -}

neovim/puck.lua

Modified

+32 / −15 text lines

26 26 return vim.fs.basename(plugin_coords):gsub( '(%w+)%.?%w*', '%1' )
29 -local download_plugin_into = function ( plugin_tarball_url, plugin_install_path )
29 +local download_plugin_into = function ( plugin_name, plugin_tarball_url, plugin_install_path )
31 31 assert(vim.fn.executable 'curl', 'curl not found')
32 32 assert(vim.fn.executable 'tar', 'tar not found')
34 - vim.fn.mkdir( plugin_install_path, 'p' )
34 + local tmp_dir = vim.uv.fs_mkdtemp(vim.fs.joinpath(vim.uv.os_tmpdir(),'puck_tmp_install_path_XXXXXX'))
35 + -- vim.fn.mkdir( plugin_install_path, 'p' )
36 37 local tarball_data_stream = vim.uv.new_pipe(true)
37 38 local error_stream = vim.uv.new_pipe()
44 45 local curl_handle, curl_pid = vim.uv.spawn( 'curl',
46 47 args = { '--silent', '--location', plugin_tarball_url },
47 - cwd = plugin_install_path,
48 + cwd = tmp_dir,
48 49 stdio = {nil, tarball_data_stream, error_stream},
49 50 hide = true,
50 - },
51 - function(code, signal)
52 - vim.print('curl done', code, signal)
53 - end )
51 + })
52 + -- function(code, signal)
53 + -- --TODO: error handle
54 + -- vim.print('curl done', code, signal)
55 + -- end )
54 56 local tar_handle, tar_pid = vim.uv.spawn( 'tar',
56 58 args = { '--extract','--gzip', '--file', '-' },
57 - cwd = plugin_install_path,
59 + cwd = tmp_dir,
58 60 stdio = { tarball_data_stream, nil, error_stream},
59 61 hide = true,
60 - },
61 - function(code, signal)
62 - vim.print('tar done', code, signal)
63 - end )
62 + })
63 + -- function(code, signal)
64 + -- --TODO: error handle
65 + -- vim.print('tar done', code, signal)
66 + --
67 + -- -- move from tmp_dir to install_dir
68 + --
69 + -- end )
65 - print(curl_handle, curl_handle, tar_handle, tar_pid)
71 + vim.print(tmp_dir)
72 + local extracted_dir = vim.fs.find(
73 + function(name, path) return name:find(plugin_name,0,true) end,
74 + { path = tmp_dir, type = 'directory', limit = 1 }
75 + )
76 + vim.print(vim.inspect(extracted_dir))
77 + assert(#extracted_dir ~= 0, 'No directory was found in tarball')
78 + assert(#extracted_dir == 1, 'Too many directories were found in tarball. Expected one!')
79 + -- the libuv way of getting files accross partitions is PITA
80 + local ok = vim.fn.rename(extracted_dir[1], plugin_install_path)
81 + vim.print(ok)
82 + assert(ok, string.format('Failed to move extracted plugin from %s to %s.', extracted_dir[1], plugin_install_path))
67 84 vim.uv.shutdown(tarball_data_stream, function()
68 85 vim.uv.close(curl_handle, function()
113 130 local install_plugin = function ( puck_root, plugin_type, plugin_coords, plugin_rev )
114 131 local plugin_name = as_name( plugin_coords )
115 - local plugin_install_path = vim.fs.normalize( vim.fs.joinpath( puck_root, plugin_name ) ) --TODO unused?
132 + local plugin_install_path = vim.fs.normalize( vim.fs.joinpath( puck_root, plugin_name ) )
116 133 local plugin_install_path_stat = vim.uv.fs_stat( plugin_install_path )
117 134 local plugin_already_exists = plugin_install_path_stat and plugin_install_path_stat.type == 'directory'
130 147 local removed = delete_directory_recursive( plugin_install_path )
131 148 local url_format = as_url_format(plugin_type)
132 149 local plugin_tarball_url = url_format:format( plugin_coords, plugin_rev )
133 - local ok = pcall( download_plugin_into, plugin_tarball_url, puck_root )
150 + local ok = pcall( download_plugin_into, plugin_name, plugin_tarball_url, plugin_install_path )
134 151 if ok then
135 152 local mode = vim.uv.fs_access(plugin_install_rev_path, 'W') and 'w+' or 'w'
136 153 local plugin_install_rev_file = io.open( plugin_install_rev_path, mode)

nushell/completions/svn-completions.nu

Deleted
deleted file mode 100644

+0 / −137 text lines

1 -def "complete svn subcommands" [] {
2 - ^svn help
3 - | lines
4 - | skip until { | line | $line | str starts-with "Available subcommands:" }
5 - | skip 1
6 - | each { |line| $line | str trim }
7 - | take until { |line| $line | empty? }
8 - | split column " "
9 - | get column1
12 -# TODO: parse xml output
14 -def "complete svn add paths" [] {
15 - ^svn status --depth infinity
16 - | lines
17 - | parse "{mode} {file}"
18 - | str trim
19 - | where mode == ?
20 - | get file
23 -def "complete svn revert paths" [] {
24 - ^svn status --depth infinity
25 - | lines
26 - | parse "{mode} {file}"
27 - | where mode == M
28 - | str trim
29 - | get file
32 -def "complete svn depth" [] { ['empty', 'files', 'immediates', 'infinity'] }
34 -def "complete svn changelists" [] {
35 - ^svn status --depth infinity
36 - | lines
37 - | parse "--- Changelist '{changelist}':"
38 - | get --ignore-errors changelist
41 -# FIXME: This is commented out in order to leave unexterne'd commands be.
42 -#
43 -# Subversion is a tool for version control.
44 -# For additional information, see http://subversion.apache.org/
45 -#export extern svn [
46 - #subcommand?: string@"complete svn subcommands" # for help on a specific subcommand.
47 - #--version # to see the program version and RA modules
48 - #--quiet # to see just the version number
49 - #--verbose # to see dependency versions as well
50 -#]
52 -# help (?, h): Describe the usage of this program or its subcommands.
53 -# usage: help [SUBCOMMAND...]
54 -export extern "svn help" [
55 - subcommand?: string@"complete svn subcommands" # for help on a specific subcommand.
56 - --verbose(-v) # also show experimental subcommands and options
59 -# FIXME:
60 -# SVN has short options with double dashes: --changelist(--cl).
61 -# This is not allowed in nu.
63 -# FIXME:
64 -# Multiline doccomments will be rendered without the newlines.
66 -# Print the status of working copy files and directories.
67 -export extern "svn status" [
68 - ...paths: path # PATHs
69 - --show-updates(-u) # display update information
70 - --verbose(-v) # print extra information
71 - --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
72 - --revision(-r): string # ARG (some commands also take ARG1:ARG2 range)
73 - # A revision argument can be one of:
74 - # NUMBER revision number
75 - # '{' DATE '}' revision at start of the date
76 - # 'HEAD' latest in repository
77 - # 'BASE' base rev of item's working copy
78 - # 'COMMITTED' last commit at or before BASE
79 - # 'PREV' revision just before COMMITTED
80 - --quiet(-q) # don't print unversioned items
81 - --no-ignore # disregard default and svn:ignore and svn:global-ignores property ignores
82 - --incremental # give output suitable for concatenation
83 - --xml # output in XML
84 - --ignore-externals # ignore externals definitions
85 - --changelist:string@"complete svn changelists" # operate only on members of changelist ARG
88 -# FIXME: https://github.com/nushell/nushell/issues/5012
89 -# rest parameters do not play well with completions yet
90 -# the `paths` parameter should be `...paths`
92 -# Put new files and directories under version control.
93 -export extern "svn add" [
94 - paths: path@"complete svn add paths" # unversioned PATHs for addition
95 - --targets: path # pass contents of file ARG as additional args
96 - --non-recursive(-N) # obsolete; same as --depth=empty
97 - --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
98 - --quiet(-q) # print nothing, or only summary information
99 - --force # ignore already versioned paths
100 - --no-ignore # disregard default and svn:ignore and svn:global-ignores property ignores
101 - --auto-props # enable automatic properties
102 - --no-auto-props # disable automatic properties
103 - --parents # add intermediate parents
106 -# Restore pristine working copy state (undo local changes).
107 -export extern "svn revert" [
108 - paths: path@"complete svn revert paths"
109 - --targets: path # pass contents of file as additional args
110 - --recursive(-R) # descend recursively, same as --depth=infinity
111 - --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
112 - --quiet(-q) # print nothing, or only summary information
113 - --changelist: string@"complete svn changelists" # operate only on members of changelist ARG
114 - --remove-added # reverting an added item will remove it from disk
117 -# FIXME
118 -# SVN uses aliases for subcommands. E.g. `co` for `checkout`.
119 -# How to express that with nu extern commands?
121 -# Check out a working copy from a repository.
122 -export extern "svn checkout" [
123 - ...url_with_rev:string # source
124 - path: path # destination
125 - --revision(-r) # ARG (some commands also take ARG1:ARG2 range)
126 - # A revision argument can be one of:
127 - # NUMBER revision number
128 - # '{' DATE '}' revision at start of the date
129 - # 'HEAD' latest in repository
130 - # 'BASE' base rev of item's working copy
131 - # 'COMMITTED' last commit at or before BASE
132 - # 'PREV' revision just before COMMITTED
133 - --quiet(-q) # print nothing, or only summary information
134 - --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
135 - --force # force operation to run
136 - --ignore-externals # ignore externals definitions

nushell/config.nu

Modified

+16 / −82 text lines

1 -# Nushell Config File
2 -use modules/table.nu *
3 -use modules/os.nu *
4 -use modules/prompt.nu *
5 -use modules/aliases.nu *
6 -use modules/todo.nu
7 -use modules/openssl.nu *
8 -use modules/md.nu
1 +use external_completer.nu
10 3 # TODO: use nugu colors
11 4 # for more information on themes see
12 5 # https://github.com/nushell/nushell/blob/main/docs/How_To_Coloring_and_Theming.md
13 -let default_theme = {
14 - # color for nushell primitives
15 - separator: white
16 - leading_trailing_space_bg: { attr: n } # no fg, no bg, attr non effectively turns this off
17 - header: green_bold
18 - empty: blue
19 - bool: white
20 - int: white
21 - filesize: white
22 - duration: white
23 - date: white
24 - range: white
25 - float: white
26 - string: white
27 - nothing: white
28 - binary: white
29 - cellpath: white
30 - row_index: green_bold
31 - record: white
32 - list: white
33 - block: white
34 - hints: dark_gray
36 - # shapes are used to change the cli syntax highlighting
37 - shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
38 - shape_binary: purple_bold
39 - shape_bool: light_cyan
40 - shape_int: purple_bold
41 - shape_float: purple_bold
42 - shape_range: yellow_bold
43 - shape_internalcall: cyan_bold
44 - shape_external: cyan
45 - shape_externalarg: green_bold
46 - shape_literal: blue
47 - shape_operator: yellow
48 - shape_signature: green_bold
49 - shape_string: green
50 - shape_string_interpolation: cyan_bold
51 - shape_datetime: cyan_bold
52 - shape_list: cyan_bold
53 - shape_table: blue_bold
54 - shape_record: cyan_bold
55 - shape_block: blue_bold
56 - shape_filepath: cyan
57 - shape_globpattern: cyan_bold
58 - shape_variable: purple
59 - shape_flag: blue_bold
60 - shape_custom: green
61 - shape_nothing: light_cyan
64 -# The default config record. This is where much of your global configuration is setup.
65 7 $env.config = {
66 8 show_banner: false
67 9 table: {
68 - mode: light # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
69 - }
70 - ls: {
71 - use_ls_colors: true
72 - clickable_links: true
10 + mode: none
74 12 rm: {
75 13 always_trash: true
77 - color_config: $default_theme
78 - use_grid_icons: true
79 - footer_mode: "auto" # always, never, number_of_rows, auto
80 15 completions: {
81 - quick: true # set this to false to prevent auto-selecting completions when only one remains
82 - partial: true # set this to false to prevent partial filling of the prompt
16 + use_ls_colors: true
17 + algorithm: "fuzzy"
18 + external: {
19 + completer: (external_completer)
20 + }
84 - float_precision: 2
85 - use_ansi_coloring: true
86 - filesize: {
87 - metric: false
88 - format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
89 - }
90 - edit_mode: emacs # emacs, vi
23 + # some experimental options
24 + buffer_editor: "nvim --clean"
25 + highlight_resolved_externals : true
26 + use_kitty_protocol : true
27 + render_right_prompt_on_last_line: true
91 29 history: {
92 - file_format: "plaintext"
93 - max_size: 10000
94 - sync_on_enter: true # Enable to share the history between multiple sessions, else you have to close the session to persist history to file
30 + file_format: "sqlite"
31 + isolation: true
98 -# must be done, after defining config, since zoxide mutates it
99 -# this will fail if zoxide is not installed yet
100 -source ($nu.config-path | path dirname | path join "zoxide.nu")

nushell/env.nu

Modified

+15 / −2 text lines

1 1 # GLOBAL VARIABLES
3 3 $env.WIN32 = ( $nu.os-info.name =~ "windows" )
4 -$env.NURC_DIR = ( $nu.config-path | path expand | path dirname )
5 -$env.DOTFILES = ( $env.NURC_DIR | path join ".." | path expand )
6 5 $env.WORKSPACE = if $env.WIN32 { "~/Workspaces" } else { "~/Workspace" | path expand }
6 +$env.DOTFILES = ( $env.WORKSPACE | path join 'dotfiles' )
7 7 $env.NOTES = ("~/Notes" | path expand)
8 8 $env.TOOLS = ("~/Tools" | path expand)
37 37 to_string: { |v| $v | str join (char esep) }
41 +$env.NU_LIB_DIRS = [
42 + ($nu.default-config-dir | path join 'scripts')
45 +# generate aliases here and now, so that we can apply conditions.
46 +# later, in config.nu, the evaluated aliases will be sourced
47 +source ($nu.default-config-dir | path join 'gen-aliases.nu')
49 +# generate zoxide hooks for sourcing later on
50 +if not (which zoxide | is-empty) {
51 + zoxide init nushell | save -f ($nu.default-config-dir | path join 'zoxide.nu')

nushell/gen-aliases.nu

Modified

+38 / −13 text lines

1 -#!/usr/bin/env nu
1 +# create file initially, so that we can append to it later
3 2 let file = $"($nu.default-config-dir)/aliases.nu"
5 -def save-alias [...args: string] {
6 - $"alias ($args | str join ' ')\n" | save -a $file
7 -}
9 3 '' | save -f $file
5 +def aka [
6 + name: string # name of the new alias
7 + command: string # program to alias to
8 + ...args: string # optional arguemtns to program
9 +] {
11 + if not (which $command | is-empty) {
12 + $"alias ($name) = ($command) ($args | str join ' ')\n" | save -a $file
13 + }
11 16 ########################################
12 17 # Start defining your aliases here
14 -if not (which bat | is-empty) {
15 - save-alias cat = bat
16 -}
19 +aka cat bat
20 +aka show bat
21 +aka tar bsdtar
22 +aka walk yazi
23 +aka tree tre
24 +aka ll list
18 -if not (which bsdtar | is-empty) {
19 - save-alias tar = bsdtar
20 -}
26 +aka browse firefox
28 +aka vim nvim
29 +aka code nvim
30 +aka edit nvim '--clean'
31 +aka ed nvim '--clean'
32 +aka vi nvim '--clean'
34 +# TODO write bak command
35 +# aka backup bak
37 +aka userctl systemctl '--user'
39 +# https://gist.github.com/mullnerz/9fff80593d6b442d5c1b
40 +aka archive wget "-mpck" "--html-extension" '--user-agent=""' "-e" "robots=off" "--wait" 1 "-P" .
42 +# CUSTOM LITTLE JAVA COMMANDS
43 +aka aes java ($env.DOTFILES + /tools/ + aes.java)
44 +aka download java ($env.DOTFILES + /tools/ + download.java)
45 +aka download_jar java ($env.DOTFILES + /tools/ + download_jar.java)

nushell/login.nu

Added
new file mode 100644

+12 / −0 text lines

1 +use prompt.nu *
2 +use commands.nu *
3 +use todo.nu
4 +use ssh-keygen-ed.nu
5 +use md.nu
6 +use start.nu
8 +source ($nu.default-config-dir | path join 'aliases.nu')
10 +# must be done, after defining config, since zoxide mutates it
11 +# this will fail if zoxide is not installed yet
12 +source ($nu.default-config-dir | path join "zoxide.nu")

nushell/modules/aliases.nu

Deleted
deleted file mode 100644

+0 / −41 text lines

1 -# Semantic aliases
2 -export alias show = bat
3 -export def list [] { ls --all --long --du --mime-type | where type == dir | append (ls --all --long --du --mime-type | where type != dir) }
4 -export alias walk = yazi
5 -export alias browse = firefox
6 -export alias vim = nvim
7 -export alias edit = nvim --clean
9 -# TODO ewrite bak command
10 -export alias backup = bak
12 -export alias userctl = systemctl --user
14 -# https://gist.github.com/mullnerz/9fff80593d6b442d5c1b
15 -export alias archive = wget -mpck --html-extension --user-agent="" -e robots=off --wait 1 -P .
18 -export def fkill [ query:string ] {
19 - let pid = (^ps -ef | sed 1d | fzf -m --query $query | awk '{print $2}')
20 - if not ($pid | is-empty) {
21 - kill ($pid | into int )
22 - }
23 -}
25 -export def --env yy [...args] {
26 - let tmp = (mktemp -t "yazi-cwd.XXXXXX")
27 - yazi ...$args --cwd-file $tmp
28 - let cwd = (open $tmp)
29 - if $cwd != "" and $cwd != $env.PWD {
30 - cd $cwd
31 - }
32 - rm -fp $tmp
33 -}
35 -# TODO: HOST SPECIFIC ALIASES
36 -# I do not see a way right now the have different aliases per host with nu.
38 -# CUSTOM LITTLE JAVA COMMANDS
39 -export alias aes = java ($env.DOTFILES + /tools/ + aes.java)
40 -export alias download = java ($env.DOTFILES + /tools/ + download.java)
41 -export alias download_jar = java ($env.DOTFILES + /tools/ + download_jar.java)

nushell/modules/md.nu

Deleted
deleted file mode 100644

+0 / −5 text lines

1 -# create new directory and change into to.
2 -export def --env main [ p:path ] {
3 - mkdir $p
4 - cd $p
5 -}

nushell/modules/openssl.nu

Deleted
deleted file mode 100644

+0 / −6 text lines

1 -# Generate a new ed25519 SSH private key
2 -export def ssh-keygen-ed [
3 - email: string # Identifier for the COMMENT section of the key
4 -] {
5 - ssh-keygen -t ed25519 -C $email
6 -}

nushell/modules/os.nu

Deleted
deleted file mode 100644

+0 / −11 text lines

2 -# Opens the given resource in the operating systems preferred application.
3 -export def start [
4 - ...rest: string # Paths or URLs the OS should open for you.
5 -] {
6 - if $env.WIN32 {
7 - $rest | each { |thing| ^start $thing}
8 - } else {
9 - $rest | each { |thing| ^xdg-open $thing }
10 - }
11 -}

nushell/modules/prompt.nu

Deleted
deleted file mode 100644

+0 / −109 text lines

1 -# Map of paths to icons.
2 -# These will be used to replace certain path segments in the prompt for example.
3 -# Order these paths for precedence.
4 -def icons [] {
5 - [
6 - [ path icon ];
8 - [ "/home/oli/Notes" (char -u "03C0") ]
9 - [ "/home/bugabinga/Notes" (char -u "03C0") ]
10 - [ "C:\\Users\\okr\\Notizen" (char -u "03C0") ]
12 - [ "/home/oli/Workspace" (char -u "03BB") ]
13 - [ "/home/bugabinga/Workspace" (char -u "03BB") ]
14 - [ "C:\\Users\\okr\\Workspaces" (char -u "03BB") ]
16 - [ "/home/oli" (char home) ]
17 - [ "/home/bugabinga" (char home) ]
18 - [ "C:\\Users\\okr" (char home) ]
19 - ]
22 -# Uses a special escape code to set the window title of the terminal emulator.
23 -# This will be ignored in terminal emulator, that do not support that escape code.
24 -# The title to be set is derived from the current working directory.
25 -# Special types of directories, e.g. HOME, get custom icons.
26 -def set-window-title [] {
27 - # Some terminals freeze, if they do not support this OSC
28 - if ($env | get -i TERM_PROGRAM) == WezTerm {
29 - # normalize path
30 - let pwd = ( $env.PWD | path expand )
31 - let icon = if (icons | any { |icon| $icon.path == $pwd } ) { ( icons | where path == $pwd | get icon.0 ) } else { $"(char nf_folder1)" }
32 - echo ([ (ansi title) $icon " " ( $pwd | path basename ) (ansi reset) ] | str join)
33 - }
36 -def prompt-git-branch [] {
39 -def get_vcs_path [] {
40 - #normalize path
41 - let pwd = ($env.PWD | path expand)
43 - let svn_relative_cmd = ( do --ignore-errors { ^svn info --show-item relative-url --no-newline $pwd | complete } )
44 - let svn_relative_path = if ( (not ($svn_relative_cmd | is-empty)) and ($svn_relative_cmd.exit_code == 0)) { $" 🐢 (char nf_branch) ($svn_relative_cmd.stdout)" }
46 - let git_branch_cmd = ( do -i { ^git rev-parse --abbrev-ref HEAD | complete } )
47 - let git_path = if (not ($git_branch_cmd | is-empty) and ($git_branch_cmd.exit_code == 0)) { $" (char nf_git) (char nf_branch) ($git_branch_cmd.stdout | str trim -r)" }
49 - [
50 - $svn_relative_path
51 - $git_path
52 - ] | str join
55 -def create_left_prompt [] {
56 - set-window-title
58 - # normalize path
59 - let pwd = ($env.PWD | path expand)
60 - let pwd = ( (icons) | reduce --fold $pwd { |item, accumulator| $accumulator | str replace $item.path $item.icon })
61 - let truncate_level = 5
62 - let truncate_symbol = $"…(char path_sep)"
63 - let path_segment = if ($pwd | path split | length) >= $truncate_level { ($pwd | path dirname --num-levels 2 --replace $truncate_symbol ) } else { $pwd }
65 - let vcs_segment = (get_vcs_path)
67 - [
68 - (ansi dark_gray)
69 - $path_segment
70 - (ansi reset)
71 - (ansi green)
72 - $vcs_segment
73 - (ansi reset)
74 - ] | str join
77 -def create_right_prompt [] {
78 - let time_segment = ([
79 - (date now | format date '%d.%m %R')
80 - ] | str join)
82 - let command_status_segment = if $env.LAST_EXIT_CODE == 0 { $" (char -u '2713') " } else { $"(ansi red) (char failed) (ansi reset)" }
83 - let command_duration_segment = if ( $env.CMD_DURATION_MS | into int) > 0 { $"($env.CMD_DURATION_MS)ms" | into duration }
85 - [
86 - (ansi dark_gray_dimmed)
87 - $command_duration_segment
88 - (ansi reset)
89 - (ansi dark_gray)
90 - $command_status_segment
91 - (ansi reset)
92 - (ansi dark_gray)
93 - ( if (sys host).hostname == "x230" { (akku) } else { $time_segment })
94 - (ansi reset)
95 - ] | str join
98 -export-env {
99 - # Use nushell functions to define your right and left prompt
100 - $env.PROMPT_COMMAND = { || create_left_prompt }
101 - $env.PROMPT_COMMAND_RIGHT = { || create_right_prompt }
103 - # The prompt indicators are environmental variables that represent
104 - # the state of the prompt
105 - $env.PROMPT_INDICATOR = $"(ansi green) (char prompt) (ansi reset)"
106 - $env.PROMPT_INDICATOR_VI_INSERT = $"(ansi magenta) (char pipe) (ansi reset)"
107 - $env.PROMPT_INDICATOR_VI_NORMAL = $"(ansi magenta) (char prompt) (ansi reset)"
108 - $env.PROMPT_MULTILINE_INDICATOR = $"(ansi magenta) (char prompt)(char prompt) (ansi reset)"

nushell/modules/syncthing.nu

Deleted
deleted file mode 100644

+0 / −48 text lines

1 -export def "conflicts list" [] {
2 - fd --hidden --no-ignore sync-conflict $env.HOME |
3 - lines |
4 - filter { |path| not ($path =~ "/Trash/") }
5 -}
7 -export def "conflicts merge" [] {
8 - (conflicts list) |
9 - each { |conflict|
10 - merge ( to_original $conflict ) $conflict
11 - let input = ( input $"Merge successful? \((ansi pb)Y(ansi reset)/n\) \n" )
12 - let sanitize = ( $input | str trim | str downcase | str substring 0..1 )
13 - if ($sanitize | is-empty) or $sanitize == 'y' {
14 - rm --verbose --interactive $conflict
15 - } else {
16 - $conflict
17 - }
18 - }
19 -}
21 -export def "conflicts diff" [] {
22 - (conflicts list) |
23 - each { |conflict|
24 - diff ( to_original $conflict ) $conflict
25 - }
26 -}
28 -def parse-sync-conflict [] {
29 - parse -r '(?<filename>.*)\.sync-conflict-(?<date>.\d+)-(?<time>.\d+)-(?<id>\w+)\.?(?<extension>.*)?'
30 -}
32 -def to_original [ file: path ] {
33 - let conflict = ( $file | parse-sync-conflict )
34 - mut filename = ($conflict | get filename.0)
35 - let extension = ($conflict | get extension.0)
36 - if not ($extension | is-empty) {
37 - $filename = $filename + '.' + $extension
38 - }
39 - $filename
40 -}
42 -def diff [ a: path, b: path ] {
43 - print $"diffing ($a) and ($b)"
44 - ^difft $a $b
45 -}
46 -def merge [ a: path, b: path ] {
47 - meld $a $b
48 -}

nushell/modules/table.nu

Deleted
deleted file mode 100644

+0 / −10 text lines

1 -# Check whether table in pipeline has a column with given name
2 -export def "has-column?" [
3 - name: string # Name of the column to check for
4 -] {
5 - transpose | values | get 0 | any { |column| $column == $name }
6 -}
8 -# Flattens a table into a string separated by a single space character.
9 -export def to-string [] { flatten | into string | str join ' ' }

nushell/modules/todo.nu

Deleted
deleted file mode 100644

+0 / −11 text lines

1 -# Render my To-Do file in the terminal
2 -export def main [] { mdcat ($env.NOTES | path join "TODO.md") }
4 -# Open my To-Do file for editing
5 -export def edit [] { hx ($env.NOTES | path join "TODO.md") }
7 -# Open a list of commands, that I would like to remember to use
8 -export def commands [] { mdcat ($env.NOTES | path join "COMMANDS.md") }
10 -# Open the list of commands to remember for editing.
11 -export def "commands edit" [] { vim ($env.NOTES | path join "COMMANDS.md") }

nushell/scripts/commands.nu

Added
new file mode 100644

+18 / −0 text lines

1 +export def list [] { ls --all --long --du --mime-type | where type == dir | append (ls --all --long --du --mime-type | where type != dir) }
3 +export def fkill [ query:string ] {
4 + let pid = (^ps -ef | sed 1d | fzf -m --query $query | awk '{print $2}')
5 + if not ($pid | is-empty) {
6 + kill ($pid | into int )
7 + }
8 +}
10 +export def --env yy [...args] {
11 + let tmp = (mktemp -t "yazi-cwd.XXXXXX")
12 + yazi ...$args --cwd-file $tmp
13 + let cwd = (open $tmp)
14 + if $cwd != "" and $cwd != $env.PWD {
15 + cd $cwd
16 + }
17 + rm -fp $tmp

nushell/scripts/external_completer.nu

Added
new file mode 100644

+36 / −0 text lines

1 +export def main [] {
3 + let carapace_completer = {|spans: list<string>|
4 + carapace $spans.0 nushell ...$spans
5 + | from json
6 + | if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null }
7 + }
9 + let zoxide_completer = {|spans|
10 + $spans | skip 1 | zoxide query -l ...$in | lines | where {|x| $x != $env.PWD}
11 + }
13 + # This completer will use carapace by default
14 + let external_completer = {|spans|
15 + # https://github.com/nushell/nushell/issues/8483
16 + let expanded_alias = scope aliases
17 + | where name == $spans.0
18 + | get -i 0.expansion
20 + let spans = if $expanded_alias != null {
21 + $spans
22 + | skip 1
23 + | prepend ($expanded_alias | split row ' ' | take 1)
24 + } else {
25 + $spans
26 + }
28 + match $spans.0 {
29 + # use zoxide completions for zoxide commands
30 + __zoxide_z | __zoxide_zi => $zoxide_completer
31 + _ => $carapace_completer
32 + } | do $in $spans
33 + }
35 + $external_completer

nushell/scripts/md.nu

Added
new file mode 100644

+5 / −0 text lines

1 +# create new directory and change into to.
2 +export def --env main [ p:path ] {
3 + mkdir $p
4 + cd $p
5 +}

nushell/scripts/prompt.nu

Added
new file mode 100644

+109 / −0 text lines

1 +# Map of paths to icons.
2 +# These will be used to replace certain path segments in the prompt for example.
3 +# Order these paths for precedence.
4 +def icons [] {
5 + [
6 + [ path icon ];
8 + [ "/home/oli/Notes" (char -u "03C0") ]
9 + [ "/home/bugabinga/Notes" (char -u "03C0") ]
10 + [ "C:\\Users\\okr\\Notizen" (char -u "03C0") ]
12 + [ "/home/oli/Workspace" (char -u "03BB") ]
13 + [ "/home/bugabinga/Workspace" (char -u "03BB") ]
14 + [ "C:\\Users\\okr\\Workspaces" (char -u "03BB") ]
16 + [ "/home/oli" (char home) ]
17 + [ "/home/bugabinga" (char home) ]
18 + [ "C:\\Users\\okr" (char home) ]
19 + ]
22 +# Uses a special escape code to set the window title of the terminal emulator.
23 +# This will be ignored in terminal emulator, that do not support that escape code.
24 +# The title to be set is derived from the current working directory.
25 +# Special types of directories, e.g. HOME, get custom icons.
26 +def set-window-title [] {
27 + # Some terminals freeze, if they do not support this OSC
28 + if ($env | get -i TERM_PROGRAM) == WezTerm {
29 + # normalize path
30 + let pwd = ( $env.PWD | path expand )
31 + let icon = if (icons | any { |icon| $icon.path == $pwd } ) { ( icons | where path == $pwd | get icon.0 ) } else { $"(char nf_folder1)" }
32 + echo ([ (ansi title) $icon " " ( $pwd | path basename ) (ansi reset) ] | str join)
33 + }
36 +def prompt-git-branch [] {
39 +def get_vcs_path [] {
40 + #normalize path
41 + let pwd = ($env.PWD | path expand)
43 + let svn_relative_cmd = ( do --ignore-errors { ^svn info --show-item relative-url --no-newline $pwd | complete } )
44 + let svn_relative_path = if ( (not ($svn_relative_cmd | is-empty)) and ($svn_relative_cmd.exit_code == 0)) { $" 🐢 (char nf_branch) ($svn_relative_cmd.stdout)" }
46 + let git_branch_cmd = ( do -i { ^git rev-parse --abbrev-ref HEAD | complete } )
47 + let git_path = if (not ($git_branch_cmd | is-empty) and ($git_branch_cmd.exit_code == 0)) { $" (char nf_git) (char nf_branch) ($git_branch_cmd.stdout | str trim -r)" }
49 + [
50 + $svn_relative_path
51 + $git_path
52 + ] | str join
55 +def create_left_prompt [] {
56 + set-window-title
58 + # normalize path
59 + let pwd = ($env.PWD | path expand)
60 + let pwd = ( (icons) | reduce --fold $pwd { |item, accumulator| $accumulator | str replace $item.path $item.icon })
61 + let truncate_level = 5
62 + let truncate_symbol = $"…(char path_sep)"
63 + let path_segment = if ($pwd | path split | length) >= $truncate_level { ($pwd | path dirname --num-levels 2 --replace $truncate_symbol ) } else { $pwd }
65 + let vcs_segment = (get_vcs_path)
67 + [
68 + (ansi dark_gray)
69 + $path_segment
70 + (ansi reset)
71 + (ansi green)
72 + $vcs_segment
73 + (ansi reset)
74 + ] | str join
77 +def create_right_prompt [] {
78 + let time_segment = ([
79 + (date now | format date '%d.%m %R')
80 + ] | str join)
82 + let command_status_segment = if $env.LAST_EXIT_CODE == 0 { $" (char -u '2713') " } else { $"(ansi red) (char failed) (ansi reset)" }
83 + let command_duration_segment = if ( $env.CMD_DURATION_MS | into int) > 0 { $"($env.CMD_DURATION_MS)ms" | into duration }
85 + [
86 + (ansi dark_gray_dimmed)
87 + $command_duration_segment
88 + (ansi reset)
89 + (ansi dark_gray)
90 + $command_status_segment
91 + (ansi reset)
92 + (ansi dark_gray)
93 + ( if (sys host).hostname == "x230" { (akku) } else { $time_segment })
94 + (ansi reset)
95 + ] | str join
98 +export-env {
99 + # Use nushell functions to define your right and left prompt
100 + $env.PROMPT_COMMAND = { || create_left_prompt }
101 + $env.PROMPT_COMMAND_RIGHT = { || create_right_prompt }
103 + # The prompt indicators are environmental variables that represent
104 + # the state of the prompt
105 + $env.PROMPT_INDICATOR = $"(ansi green) (char prompt) (ansi reset)"
106 + $env.PROMPT_INDICATOR_VI_INSERT = $"(ansi magenta) (char pipe) (ansi reset)"
107 + $env.PROMPT_INDICATOR_VI_NORMAL = $"(ansi magenta) (char prompt) (ansi reset)"
108 + $env.PROMPT_MULTILINE_INDICATOR = $"(ansi magenta) (char prompt)(char prompt) (ansi reset)"

nushell/scripts/ssh-keygen-ed.nu

Added
new file mode 100644

+6 / −0 text lines

1 +# Generate a new ed25519 SSH private key
2 +export def main [
3 + email: string # Identifier for the COMMENT section of the key
4 +] {
5 + ssh-keygen -t ed25519 -C $email
6 +}

nushell/scripts/start.nu

Added
new file mode 100644

+11 / −0 text lines

2 +# Opens the given resource in the operating systems preferred application.
3 +export def main [
4 + ...rest: string # Paths or URLs the OS should open for you.
5 +] {
6 + if $env.WIN32 {
7 + $rest | each { |thing| ^start $thing}
8 + } else {
9 + $rest | each { |thing| ^xdg-open $thing }
10 + }

nushell/scripts/syncthing.nu

Added
new file mode 100644

+48 / −0 text lines

1 +export def "conflicts list" [] {
2 + fd --hidden --no-ignore sync-conflict $env.HOME |
3 + lines |
4 + filter { |path| not ($path =~ "/Trash/") }
5 +}
7 +export def "conflicts merge" [] {
8 + (conflicts list) |
9 + each { |conflict|
10 + merge ( to_original $conflict ) $conflict
11 + let input = ( input $"Merge successful? \((ansi pb)Y(ansi reset)/n\) \n" )
12 + let sanitize = ( $input | str trim | str downcase | str substring 0..1 )
13 + if ($sanitize | is-empty) or $sanitize == 'y' {
14 + rm --verbose --interactive $conflict
15 + } else {
16 + $conflict
17 + }
18 + }
21 +export def "conflicts diff" [] {
22 + (conflicts list) |
23 + each { |conflict|
24 + diff ( to_original $conflict ) $conflict
25 + }
28 +def parse-sync-conflict [] {
29 + parse -r '(?<filename>.*)\.sync-conflict-(?<date>.\d+)-(?<time>.\d+)-(?<id>\w+)\.?(?<extension>.*)?'
32 +def to_original [ file: path ] {
33 + let conflict = ( $file | parse-sync-conflict )
34 + mut filename = ($conflict | get filename.0)
35 + let extension = ($conflict | get extension.0)
36 + if not ($extension | is-empty) {
37 + $filename = $filename + '.' + $extension
38 + }
39 + $filename
42 +def diff [ a: path, b: path ] {
43 + print $"diffing ($a) and ($b)"
44 + ^difft $a $b
46 +def merge [ a: path, b: path ] {
47 + meld $a $b

nushell/scripts/todo.nu

Added
new file mode 100644

+11 / −0 text lines

1 +# Render my To-Do file in the terminal
2 +export def main [] { mdcat ($env.NOTES | path join "TODO.md") }
4 +# Open my To-Do file for editing
5 +export def edit [] { hx ($env.NOTES | path join "TODO.md") }
7 +# Open a list of commands, that I would like to remember to use
8 +export def commands [] { mdcat ($env.NOTES | path join "COMMANDS.md") }
10 +# Open the list of commands to remember for editing.
11 +export def "commands edit" [] { vim ($env.NOTES | path join "COMMANDS.md") }

nushell/scripts/vivid-themes.nu

Added
new file mode 100755

+13 / −0 text lines

1 +export def --env main [] {
2 + (vivid themes) |
3 + lines |
4 + str trim |
5 + each { |theme|
6 + print $"theme: (ansi black_bold)($theme)(ansi reset)"
7 + with-env { LS_COLORS: (vivid generate $theme) } {
8 + ls $env.HOME
9 + print "\n"
10 + print "\n"
11 + }
12 + }

tools/cargo-tools.nu

Deleted
deleted file mode 100644

+0 / −53 text lines

1 -# names of binaries in cargo must not necessarily be equal to the crate name.
2 -# this table resolves the binary name of a crate.
3 -# also, a crate can have more than one binary, but for the purpose of checking if a crate is
4 -# already installed on the system, finding one binary is sufficient.
5 -# we also cannot use `cargo install --list` to search for the binary name, in case the crate
6 -# is not installed yet
7 -let cargo_crates = [
8 - [ name bin crago_args];
9 - [ "bat" "bat" [] ]
10 - [ "bottom" "btm" [] ]
11 - [ "cargo-cache" "cargo-cache" [] ]
12 - [ "cargo-update" "cargo-install-update" [] ]
13 - [ "choose", "choose", [] ]
14 - [ "eva" "eva" [] ]
15 - [ "eva" "eva" [] ]
16 - [ "fd-find" "fd" [] ]
17 - [ "git-delta" "delta" [] ]
18 - [ "gitu" "gitu" [ "--locked" ] ]
19 - [ "hexyl" "hexyl" [] ]
20 - [ "hyperfine" "hyperfine" [] ]
21 - [ "just" "just" [] ]
22 - [ "lms" "lms" [] ]
23 - [ "lychee" "lychee" [ "--locked" "--no-default-features" "--features" "rustls-tls,email-check"] ]
24 - [ "mdcat" "mdcat" [] ]
25 - [ "mdsh" "mdsh" [] ]
26 - [ "nu" "nu" [ "--features" "extra" ] ]
27 - [ "ouch" "ouch" [] ]
28 - [ "pastel" "pastel" [] ]
29 - [ "ripgrep" "rg" [] ]
30 - [ "sd" "sd" [] ]
31 - [ "selene" "selene" [ "--no-default-features" ] ]
32 - [ "stylua" "stylua" [ "--features" "lua52" ] ]
33 - [ "taplo-cli" "taplo" [] ]
34 - [ "tealdeer" "tldr" [] ]
35 - [ "tokei" "tokei" [] ]
36 - [ "viu" "viu" [] ]
37 - [ "vivid" "vivid" [] ]
38 - [ "yazi-cli" "ya" [ "--locked" ] ]
39 - [ "yazi-fm" "yazi" [ "--locked" ] ]
40 - [ "zoxide" "zoxide" [] ]
41 -]
43 -# install all my favorite crate, only if they are not already in PATH.
44 -def main [] {
45 - $cargo_crates | each { | crate |
46 - if ( which $crate.bin | is-empty ) {
47 - echo $'cargo install ($crate.name) ($crate.crago_args)'
48 - cargo install $crate.name ...$crate.crago_args
49 - } else {
50 - echo $"($crate.name) already installed"
51 - }
52 - }
53 -}

tools/download_jar.java

Modified

+1 / −1 text lines

173 173 static void usage() {
174 - out.printf("%s: java download_jar.java <artifact id> <group id> <version>%n", emphasize_global("Usage"));
174 + out.printf("%s: java download_jar.java <group id> <artifact id> <version>%n", emphasize_global("Usage"));
177 177 static void exit() {

tools/install.java

Added
new file mode 100644

+141 / −0 text lines

1 +import static java.lang.System.out;
2 +import static java.lang.System.err;
4 +import java.nio.file.Files;
5 +import java.nio.file.Path;
6 +import java.nio.file.Paths;
7 +import java.util.Arrays;
9 +final class install {
10 + static final String CARGO_PACKAGES_CSV_FILE = "tools.csv";
12 + public static void main(String[] __)
13 + throws Throwable {
14 + exec("cargo", "--version");
16 + var csv = Path.of(CARGO_PACKAGES_CSV_FILE);
17 + if (!Files.exists(csv)) {
18 + throw fail("Expected a CSV file with cargo crates!");
19 + }
21 + var lines = Files.lines(csv).toArray(String[]::new);
22 + for (int index = 1; index < lines.length; ++index) {
23 + var line = lines[index];
24 + var spec = parse(line);
25 + if (!which(spec.bin)) {
26 + install(spec);
27 + }
28 + }
29 + }
31 + static boolean which(String program) {
32 + var pathEnv = System.getenv("PATH");
34 + if (pathEnv == null || pathEnv.isEmpty()) {
35 + return false;
36 + }
38 + var paths = pathEnv.split(System.getProperty("path.separator"));
39 + var extensions = new String[] { "", ".exe", ".bat", ".cmd", ".com" };
41 + for (var path : paths) {
42 + for (var extension : extensions) {
43 + var fullPath = Paths.get(path, program + extension);
44 + if (Files.exists(fullPath) && Files.isExecutable(fullPath)) {
45 + return true;
46 + }
47 + }
48 + }
50 + return false;
51 + }
53 + static void exec(String... command)
54 + throws Exception {
55 + var proc = new ProcessBuilder(command).inheritIO().start();
56 + proc.waitFor();
57 + var exit = proc.exitValue();
58 + if (exit != 0) {
59 + dbg("process failed to exec with code %d.%nproc: %s", exit, emphasize_local(Arrays.toString(command)));
60 + }
61 + }
63 + static void install(Spec spec)
64 + throws Throwable {
65 + out("cargo install %s (%s) %s",
66 + emphasize_global(spec.name),
67 + emphasize_local(spec.bin),
68 + emphasize_local(Arrays.toString(spec.flags)));
70 + var cmd = new String[3 + spec.flags.length];
71 + cmd[0] = "cargo";
72 + cmd[1] = "install";
73 + cmd[2] = spec.name;
75 + System.arraycopy(spec.flags, 0, cmd, 3, spec.flags.length);
77 + exec(cmd);
78 + }
80 + record Spec(String name, String bin, String... flags) {
81 + };
83 + static Spec parse(String line)
84 + throws Throwable {
85 + var by_comma = line.split(";");
86 + if (by_comma.length == 0) {
87 + throw fail("empty line in CSV");
88 + }
89 + if (by_comma.length > 3) {
90 + throw fail("line in CSV should have 1-3 fields%nfound: %s", emphasize_local(line));
91 + }
92 + var name = by_comma[0].strip();
93 + var bin = name;
94 + if (by_comma.length > 1) {
95 + bin = by_comma[1].strip();
96 + }
97 + var flags = new String[] {};
98 + if (by_comma.length == 3) {
99 + flags = by_comma[2].strip().split(" ");
101 + return new Spec(name, bin, flags);
104 + static void out(String fmt, Object... args) {
105 + out.printf(fmt, args);
106 + out.println();
109 + static void dbg(String fmt, Object... args) {
110 + System.err.print("[DBG]: ");
111 + System.err.printf(fmt, args);
112 + System.err.println();
115 + static Throwable exit() {
116 + System.exit(0);
117 + // abuse control flow to make compiler realize `exit` will never return
118 + return new Throwable();
121 + static String emphasize_global(String message) {
122 + return "\033[4m" + message + "\033[0m";
125 + static String emphasize_local(String message) {
126 + return "\033[3m" + message + "\033[0m";
129 + static Throwable fail(String message, Object... arguments) {
130 + err.printf(message, arguments);
131 + System.exit(-1);
132 + // abuse control flow to make compiler realize `fail` will never return
133 + return new Throwable();
136 + static Throwable fail() {
137 + System.exit(-1);
138 + // abuse control flow to make compiler realize `fail` will never return
139 + return new Throwable();

tools/install_wezterm_terminfo.sh

Deleted
deleted file mode 100755

+0 / −4 text lines

1 -tempfile=$(mktemp) \
2 - && curl -o "$tempfile" https://raw.githubusercontent.com/wez/wezterm/main/termwiz/data/wezterm.terminfo \
3 - && tic -x -o ~/.terminfo "$tempfile" \
4 - && rm "$tempfile"

tools/nerd-font.sh

Deleted
deleted file mode 100644

+0 / −29 text lines

1 -#!/bin/bash
2 -set -eu fail
4 -# rewrite this some time...
6 -declare -a fonts=(
7 - IBMPlexMono
8 - VictorMono
9 -)
11 -version='3.0.2'
12 -fonts_dir="${HOME}/.local/share/fonts"
14 -if [[ ! -d "$fonts_dir" ]]; then
15 - mkdir -p "$fonts_dir"
16 -fi
18 -for font in "${fonts[@]}"; do
19 - zip_file="${font}.zip"
20 - download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${zip_file}"
21 - echo "Downloading $download_url"
22 - wget "$download_url"
23 - unzip -d "$fonts_dir" "$zip_file"
24 - rm "$zip_file"
25 -done
27 -find "$fonts_dir" -name '*Windows Compatible*' -delete
29 -fc-cache -fv

tools/parsing-equals-test.nu

Deleted
deleted file mode 100644

+0 / −45 text lines

1 -def main [] {
2 - assert-is-a { "" } string
3 - assert-is-a { "=" } string
4 - assert-is-a { "-" } string
5 - assert-is-a { "-=" } string
6 - assert-is-a { "-=-" } string
7 - assert-is-a { "=-" } string
9 - assert-is-a { [""] } list<string>
10 - assert-is-a { ["="] } list<string>
11 - assert-is-a { ["-"] } list<string>
12 - assert-is-a { ["-="] } list<string>
13 -
14 - # error: unknown command
15 - #assert-is-a { ["-=-"] } list<string>
16 - #assert-is-a { ["=-"] } list<string>
17 - #assert-is-a { ["=-"] } list<string>
19 - assert-is-a { ["= "] } list<string>
20 - assert-is-a { [ "="] } list<string>
21 - assert-is-a { ["=" ] } list<string>
22 - assert-is-a { [ "=" ] } list<string>
24 - assert-is-a { [ "=OK" ] } list<string>
25 -}
27 -def assert-is-a [
28 - code: block # some nu expression
29 - expected_type: string # expected nu type of given expression, as printed by `describe`
30 -] {
31 - let span = (metadata $code).span;
32 - let actual_type = ( do $code | describe )
33 - if $actual_type == $expected_type {
34 - echo $"(char sun)\t(ansi green_bold)OK(ansi reset)\t($actual_type)"
35 - } else {
36 - error make {
37 - msg: $"(char cloud)\t(ansi red_bold)FAIL(ansi reset)",
38 - label: {
39 - text: $"expected a `($expected_type)` but got a `($actual_type)`",
40 - start: $span.start,
41 - end: $span.end
42 - }
43 - }
44 - }
45 -}

tools/tools.csv

Added
new file mode 100644

+55 / −0 text lines

1 +name;bin;cargo_args
2 +asm-cli-rust; asm-cli-rust; --git https://github.com/cch123/asm-cli-rust
3 +bat
4 +bartib
5 +bottom; btm
6 +broot
7 +cargo-cache
8 +cargo-update;cargo-install-update
9 +choose
10 +du-dust; dust
11 +eva
12 +exa
13 +fend
14 +fd-find;fd
15 +git-delta;delta
16 +gitu;gitu; --locked
17 +hck
18 +hexyl
19 +hyperfine
20 +inlyne
21 +jj-cli; jj; --locked --bin jj
22 +jaq;jaq; --locked
23 +just
24 +lemmeknow
25 +lms
26 +lurk-cli; lurk
27 +lychee;lychee; --locked --no-default-features --features rustls-tls,email-check
28 +mask
29 +macchina
30 +mdbook
31 +mdcat
32 +mdsh
33 +monolith
34 +netscanner
35 +nu;nu; --locked
36 +ouch
37 +pastel
38 +pueue;pueue;--locked
39 +ripgrep;rg
40 +rust-parallel
41 +sd
42 +sniffnet
43 +selene;selene; --no-default-features
44 +starship
45 +stylua;stylua; --features lua52
46 +taplo-cli;taplo
47 +tealdeer;tldr
48 +tokei
49 +ugdb
50 +unf
51 +viu
52 +vivid
53 +yazi-cli;ya; --locked
54 +yazi-fm;yazi; --locked
55 +zoxide

tools/vivid_themes.nu

Deleted
deleted file mode 100755

+0 / −14 text lines

1 -#!/usr/bin/env nu
3 -def main [] {
4 - (vivid themes) |
5 - lines |
6 - str trim |
7 - each { |theme|
8 - print $"theme: (ansi black_bold)($theme)(ansi reset)"
9 - with-env { LS_COLORS: (vivid generate $theme) } {
10 - exa
11 - print "\n"
12 - }
13 - }
14 -}

tools/wezterm_terminfo.sh

Added
new file mode 100755

+4 / −0 text lines

1 +tempfile=$(mktemp) \
2 + && curl -o "$tempfile" https://raw.githubusercontent.com/wez/wezterm/main/termwiz/data/wezterm.terminfo \
3 + && tic -x -o ~/.terminfo "$tempfile" \
4 + && rm "$tempfile"

x230.symlinks

Modified

+7 / −4 text lines

13 13 nushell/env.nu
14 14 ~/.config/nushell/env.nu
16 -nushell/modules
17 -~/.config/nushell/modules
16 +nushell/login.nu
17 +~/.config/nushell/login.nu
19 -nushell/plugin.nu
20 -~/.config/nushell/plugin.nu
19 +nushell/gen-aliases.nu
20 +~/.config/nushell/gen-aliases.nu
22 +nushell/scripts
23 +~/.config/nushell/scripts
22 25 icc/thinkpad_x230.icc
23 26 ~/.config/icc/thinkpad_x230.icc