repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

add indexa config

695a4706f83414e2cd2d2f414dfc0c94be9399ca

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

unsigned

Browse filesCompare with HEAD

Changed files (13)

EJ-PC-00363.symlinks

Modified
34 34 cargo/config.toml
35 35 ~/.cargo/config.toml
37 -tools
38 -D:/Tools/tools
37 +indexa/config.toml
38 +~/AppData/Roaming/indexa/config.toml

TODO.md

Modified
6 6 - fd: find files recursively
7 7 - diskonaut: explore file system visually for large files
8 8 - btm (bottom): system overview
9 -- grep (rg): search file contents
9 +- rg: search file contents
10 10 - bat: show file content
11 -- glow: render markdown in the terminal
11 +- mdcat: render markdown in the terminal
12 12 - tokei: count lines of code
13 13 - hyperfine: benchmark tool
14 +- menyoki: capture screenshots, record gifs
15 +- rpick: Choose something out of predefined model using fancy algorithms
14 16 - tldr: tool documentation
15 17 - grex: regular expression pattern generator
16 18 - xh: make HTTP requests
17 19 - watchexec: filesystem watcher
20 +- viu: view images in terminal (blocky approximation)
18 21 - licensor: print a license text
19 22 - pastel: manage colors
20 23 - hexyl: terminal hex viewer
24 27 - eva: calculator
25 28 - bandwhich: show network traffic information
26 29 - so: search Stack Exchange
30 +- prose: simple text (markdown, emails, paragraphs) formatter
28 32 ## Stuff to do
30 34 - [ ] kill thy babbies: remove obsolete java commands. nu has builtins now for checksums and for random uuids
31 35 - [ ] rewrite bootstripper and java commmands with zig. how to run them? precompile? zig run?
32 36 - [ ] encrypt box key
33 -- [ ] sumneko on linux
34 37 - [ ] get indexa config into dotfiles?
35 -- [ ] is there something like glow but in rust?
38 +- [ ] use [systemd user] instance to manage env vars
39 +- [ ] how to abstract configs defferences per platform? templates are painful to work with.
40 + - [ ] abstract indexa config for windows / linux
37 42 ## Done
39 44 - [x] what to do about ssh and GPG keys? or secrets in general?
40 45 - [x] say goodbye to GPG, too hard to manage.
41 46 - [x] how to handle java tools in `tools` cross platform?
47 +- [x] sumneko on linux
48 +- [x] is there something like glow but in rust?
50 +[systemd user]: https://wiki.archlinux.org/title/Systemd/User

bootstripper.java

Modified
41 41 var target_path = Path.of(target.replace("~", home)).toAbsolutePath();
42 42 var is_directory = Files.isDirectory(source_path);
43 43 if(Files.exists(target_path, LinkOption.NOFOLLOW_LINKS)){
44 - System.out.printf("✅%s already exists!%nNot linking %s.%n", emphasize_global(target_path.toString()), emphasize_local(source_path.toString()));
44 + if(Files.exists(target_path)) {
45 + System.out.printf("✅ %s already exists!%nNot linking %s.%n", emphasize_global(target_path.toString()), emphasize_local(source_path.toString()));
46 + return;
47 + }
48 + else {
49 + System.out.printf("❌ %s exists, but it points into nirvana. Removing broken link!%n", target_path.toString());
50 + Files.delete(target_path);
51 + }
46 - else{
47 - System.out.printf("🔗 %s ➔ %s.%n", emphasize_local(source_path.toString()), emphasize_local(target_path.toString()));
48 - if(!is_directory){
49 - Files.createDirectories(target_path.getParent());
50 - }
51 - try{
52 - Files.createSymbolicLink(target_path, source_path);
53 - }
54 - catch (Exception __) {
55 - /*
56 - * Creating symbolic links on Windows only recently became possible without admin rights.
57 - * However, most tools (including JDK) have not yet adapted to this change and still require admin rights.
58 - * Until that is fixed, we escape to a system tool that is known to behave correcty in this regard.
59 - */
60 - var operating_system = System.getProperty("os.name");
61 - if(operating_system.toLowerCase().contains("win")){
62 - var process = new ProcessBuilder();
63 - var command = process.command();
64 - command.add("cmd.exe");
65 - command.add("/c");
66 - command.add("mklink");
67 - if(is_directory){
68 - command.add("/d");
69 - }
70 - command.add(target_path.toString());
71 - command.add(source_path.toString());
72 - process.inheritIO()
73 - .start()
74 - .onExit()
75 - .join();
53 + System.out.printf("🔗 %s ➔ %s.%n", emphasize_local(source_path.toString()), emphasize_local(target_path.toString()));
54 + Files.createDirectories(target_path.getParent());
55 + try{
56 + Files.createSymbolicLink(target_path, source_path);
57 + }
58 + catch (Exception __) {
59 + /*
60 + * Creating symbolic links on Windows only recently became possible without admin rights.
61 + * However, most tools (including JDK) have not yet adapted to this change and still require admin rights.
62 + * Until that is fixed, we escape to a system tool that is known to behave correcty in this regard.
63 + */
64 + var operating_system = System.getProperty("os.name");
65 + if(operating_system.toLowerCase().contains("win")){
66 + var process = new ProcessBuilder();
67 + var command = process.command();
68 + command.add("cmd.exe");
69 + command.add("/c");
70 + command.add("mklink");
71 + if(is_directory){
72 + command.add("/d");
77 - else {
78 - __.printStackTrace();
79 - fail("Could not create symbolic link!");
80 - }
74 + command.add(target_path.toString());
75 + command.add(source_path.toString());
76 + process.inheritIO()
77 + .start()
78 + .onExit()
79 + .join();
80 + }
81 + else {
82 + __.printStackTrace();
83 + fail("Could not create symbolic link!");

indexa/config.toml

Added
new file mode 100644
1 +# Default indexa configuration file.
3 +[flags]
4 +# Default values for command-line flags.
5 +# Flags provided to CLI will override this group of options.
7 +# Initial query.
8 +# query = "blah blah"
10 +# Whether to search case-sensitively.
11 +# Defaults to smart case.
12 +# case_sensitive = false
14 +# Whether to search case-insensitively.
15 +# Defaults to smart case.
16 +# ignore_case = false
18 +# Whether to search in path.
19 +# match_path = false
21 +# Whether to search in path when query contains path separators.
22 +# auto_match_path = false
24 +# Whether to enable regex.
25 +# regex = true
27 +# Number of threads to use.
28 +# Defaults to the number of available CPUs - 1.
29 +# threads = 4
31 +[database]
32 +# Location of database file. Defaults to {user's data directory}/indexa/database.db
33 +# location = "/path/to/database/database.db"
35 +# File/directory statuses to index.
36 +# basename, path and extension are implicitly specified.
37 +index = [
38 + # "size",
39 + # "mode",
40 + # "created",
41 + # "modified",
42 + # "accessed",
45 +# File/directory statuses to enable fast sorting for.
46 +# basename is implicitly specified.
47 +fast_sort = [
48 + # "path",
49 + # "extension",
50 + # "size",
51 + # "mode",
52 + # "created",
53 + # "modified",
54 + # "accessed",
57 +# Root directories to index. Defaults to / on Unix and %HOMEDRIVE%\ (usually C:\) on Windows.
58 +dirs = [
59 + "C:\\",
60 + "D:\\"
61 + ]
63 +# Whether to ignore hidden files/directories.
64 +ignore_hidden = false
66 +[ui]
67 +# File/directory status to sort by.
68 +sort_by = "basename"
69 +# sort_by = "path"
70 +# sort_by = "extension"
71 +# sort_by = "size"
72 +# sort_by = "mode"
73 +# sort_by = "created"
74 +# sort_by = "modified"
75 +# sort_by = "accessed"
77 +# Sort order.
78 +sort_order = "ascending"
79 +# sort_order = "descending"
81 +# Whether to sort directories before files.
82 +sort_dirs_before_files = true
84 +# Whether to show size in human readable format.
85 +human_readable_size = true
87 +# Datetime format for Created, Modified, and Accessed columns.
88 +datetime_format = "%Y-%m-%d %R"
90 +# Margin between columns.
91 +column_spacing = 2
93 +# Columns from left to right.
94 +# Columns with width specified will have fixed widths.
95 +# Remaining screen width is evenly distributed among other columns.
96 +[[ui.columns]]
97 +status = "basename"
99 +[[ui.columns]]
100 +status = "size"
101 +width = 10
103 +[[ui.columns]]
104 +status = "modified"
105 +width = 16
107 +[[ui.columns]]
108 +status = "path"
110 +[ui.unix]
111 +# Format of mode column.
112 +mode_format = "symbolic"
113 +# mode_format = "octal"
115 +[ui.windows]
116 +# Format of mode column.
117 +# mode_format = "traditional"
118 +mode_format = "powershell"
120 +[ui.colors]
121 +# Colors in one of following formats:
122 +# - Color name
123 +# reset, black, white, red, green, yellow, blue, magenta, cyan, gray, darkgray,
124 +# lightred, lightgreen, lightyellow, lightblue, lightmagenta, lightcyan
125 +# - RGB e.g. "66, 135, 245"
126 +# - Hex e.g. "#e43", "#fcba03"
128 +# Text (selected line)
129 +selected_fg = "lightblue"
130 +# Background (selected line)
131 +selected_bg = "reset"
133 +# Text (matched substring)
134 +matched_fg = "black"
135 +# Background (matched substring)
136 +matched_bg = "lightblue"
138 +# Text (error message)
139 +error_fg = "red"
140 +# Background (error message)
141 +error_bg = "reset"
143 +# Prompt
144 +prompt = "lightblue"

neovim/init.lua

Modified
47 47 -- when started with '--headless', there will be no attached UIs
48 48 local non_interactive = #vim.api.nvim_list_uis() == 0
49 49 -- Put the plugins module into the global scope, so that it can be used more easily in commands
50 -_G.plugins = require("plugins")(autocommand, data_path, non_interactive)
50 +_G.plugins = require("plugins")(data_path, non_interactive)
51 51 -- setup my own keybindings
52 52 require("keybinds")(cheatsheet)
60 60 -- Commands have no nvim API yet, so we use vimscript...
61 61 cheatsheet(":WhatHighlight => This command shows the highlight group under the cursor")
62 62 vim.cmd([[command! WhatHighlight lua syntax_stack()]])
63 -cheatsheet(":TSHighlightCapturesUnderCursor => This command shows the highlight group under the cursor, when TreeSitter is used")
63 +cheatsheet(
64 + ":TSHighlightCapturesUnderCursor => This command shows the highlight group under the cursor, when TreeSitter is used"
65 67 -- Lazy load the plugin manager packer, when using these commands
66 68 -- cheatsheet':PluginsInstall => Install the specified plugins if they are not already installed'

neovim/lua/general_editor_settings.lua

Modified
6 6 vim.opt.tabstop = tab_size
7 7 vim.opt.shiftwidth = tab_size
8 8 vim.opt.softtabstop = tab_size
9 + -- show status line and tabline
10 + vim.opt.laststatus = 2
11 + vim.opt.showtabline = 2
9 12 -- convert tabs to spaces
10 13 vim.opt.expandtab = true
11 14 -- Keep indentation of new lines in line with previuos lines
63 66 vim.opt.showcmd = false
64 67 vim.opt.wildmode = "list:longest"
65 68 -- Set the current working directory to the parent of the active buffer
66 - vim.opt.autochdir = true
69 + vim.opt.autochdir = false
67 70 -- Keep track of file changes outside of vim
68 71 vim.opt.autoread = true
69 72 -- Make backups of all touched files in a special directory

neovim/lua/lsp.lua

Modified
22 22 chain_complete_list = chain_complete_list,
25 - -- hook lsp into vim autocomplete in insert mode
26 - vim.api.nvim_buf_set_option(buffer_number, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
25 + -- hook lsp into vim autocomplete in insert mode
26 + vim.api.nvim_buf_set_option(buffer_number, "omnifunc", "v:lua.vim.lsp.omnifunc")
28 28 local map = function(type, key, value)
29 29 vim.api.nvim_buf_set_keymap(buffer_number, type, key, value, { noremap = true, silent = true })
77 77 local sumneko_home = "~/Workspace/sua-language-server"
78 78 if system_name == "Windows" then
79 - sumneko_home = "W:/misc/lua-language-server"
80 - end
79 + sumneko_home = "W:/misc/lua-language-server"
80 + end
81 81 -- This loads the `lua` files from nvim into the runtime.
82 82 neovim_lua_library[vim.fn.expand("$VIMRUNTIME/lua")] = true
83 83 --TODO: How to switch this configuration based upon if we are editing neovim configuration or just any Lua file/project?
144 144 -- JSON LSP
145 145 lsp.jsonls.setup({
146 146 on_attach = integrate_into_neovim,
147 + --FIXME: Only works on Windows
147 148 cmd = { "vscode-json-language-server.cmd", "--stdio" },
148 149 commands = {
149 150 Format = {
161 162 -- Null-ls
162 163 local nls = require("null-ls")
164 + local helpers = require("null-ls.helpers")
165 + local methods = require("null-ls.methods")
166 + local prose_format = helpers.make_builtin({
167 + method = methods.internal.FORMATTING,
168 + filetypes = { "markdown" },
169 + generator_opts = {
170 + command = "prose",
171 + --FIXME this should be a higher order function, because the tab width needs to be lazily fetched at callsite and for the buffer instead of the global value.
172 + args = { "-f", "-w", "80", "-m", "-t", vim.o.tabstop },
173 + to_stdin = true,
174 + },
175 + factory = helpers.formatter_factory,
176 + })
163 177 nls.setup({
164 178 debug = false,
179 + -- Format: [CODE] MESSAGE (SOURCE)
180 + diagnostics_format = "[#{c}] #{m} (#{s})",
165 181 sources = {
166 - nls.builtins.formatting.stylua.with({
167 - args = { "-s", "$FILENAME" },
168 - to_stdin = false,
169 - }),
182 + nls.builtins.formatting.stylua,
183 + prose_format,
184 + -- this is a nice linter, but wihtout configuration, it spews too much nonsense.
185 + -- one can define the stdlib for vim in a config file, but the builtin selene does not find the config file.
186 + -- this is a general issue with formatters/linters integrated into neovim.
187 + -- how should i handle this?
188 + -- write a function, that searches the path to root for a config file? (internal stylua behaviour)
189 + -- somehow make sure, that vim root folder is always correct...?
190 + -- nls.builtins.diagnostics.selene,
171 192 on_attach = integrate_into_neovim,

neovim/lua/plugins.lua

Modified
7 7 -- autocommand:function => API to create vim autocmds
8 8 -- data_path:string => root directory into which packer can be installed, if not already done
9 9 -- non_interactive:boolean => wether to show a display when updating plugins or not. Typically set to true, when nvim is used for scripting.
10 -return function(autocommand, data_path, non_interactive)
10 +return function(data_path, non_interactive)
11 11 local plugin_package = "plugins"
12 12 -- packer will be loaded into the optionals folder and loaded later on demand by `packadd packer.nvim`
13 13 -- glob will normalize the path with respect to path separators.
53 53 vim.g.nvim_tree_ignore_ft = { "cheatsheet" }
54 54 -- disable git because slow
55 55 vim.g.nvim_tree_git_hl = 0
56 - vim.g.nvim_tree_gitignore = 0
57 - vim.g.nvim_tree_show_icons = {
58 - git = 0,
59 - folders = 1,
60 - files = 1,
61 - }
56 + vim.g.nvim_tree_gitignore = 0
57 + vim.g.nvim_tree_show_icons = {
58 + git = 0,
59 + folders = 1,
60 + files = 1,
61 + }
94 + -- TODO learn to configure minimal status line and tabline
94 96 -- NVIM API for defining color schemes
95 97 -- TODO: when profiling, this plugins loading times are high
96 98 -- maybe the cause is that it loads a bunch of files
108 110 config = function()
109 111 require("nvim-treesitter.install").compilers = { "clang" }
110 112 require("nvim-treesitter.configs").setup({
111 - ensure_installed = {"zig", "java", "rust", "lua", "toml", "yaml", "json", "c"},
113 + ensure_installed = { "zig", "java", "rust", "lua", "toml", "yaml", "json", "c" },
112 114 highlight = { enable = true },
113 115 incremental_selection = { enable = true },
114 116 indent = { enable = true },
115 - query_linter = { enable = true },
117 + query_linter = { enable = true, use_virtual_text = true, lint_events = { "BufWrite" } },
122 + -- Treesitter Playground
123 + -- Show the treesitter parse tree.
124 + -- Lint syntax errors
125 + -- Show highlight groupsunder cursor
126 + use({ "nvim-treesitter/playground" })
120 128 -- Basic integration of ziglang
121 129 use({ "ziglang/zig.vim", opt = true, ft = "zig" })
134 142 require("colorizer").setup()
138 146 -- Fuzzy matcher
140 148 "nvim-telescope/telescope.nvim",
141 149 requires = { "nvim-lua/popup.nvim", "nvim-lua/plenary.nvim" },
144 - -- Render markdown previews in the terminal
145 - use({ "npxbr/glow.nvim", opt = true, cmd = "Glow", ft = { "markdown" } })
147 152 -- Type :<number> to jump to line numbers
149 154 "nacro90/numb.nvim",
163 168 -- But because Null-ls depends on lspconfig, we have to delay this
164 169 require("lsp")()
166 - requires = {
167 - -- extensions to the std lib
168 - "nvim-lua/plenary.nvim",
169 - -- Preprepared collection of glue code for neovim lsp-client and thrid party lsp servers.
170 - "neovim/nvim-lspconfig",
171 - -- Completions support, that integrates advanced nvim features (LSP+treesitter)
172 - "nvim-lua/completion-nvim",
173 - },
171 + requires = {
172 + -- extensions to the std lib
173 + "nvim-lua/plenary.nvim",
174 + -- Preprepared collection of glue code for neovim lsp-client and thrid party lsp servers.
175 + "neovim/nvim-lspconfig",
176 + -- Completions support, that integrates advanced nvim features (LSP+treesitter)
177 + "nvim-lua/completion-nvim",
178 + },
176 181 -- Deeper integration of JDTLS from Eclipse with nvim

neovim/lua/theme/init.lua

Modified
1 1 return function(Color, colors, Group, groups, styles)
2 - -- TODO: manage background light and dark
3 - --
4 - -- let us first create some colors, that will later be mapped to highlight groups
5 - -- these will be saved in the `colors` table
6 - Color.new('important', '#e0e0e0')
7 - Color.new('normal', '#adadad')
8 - Color.new('minor', '#7c7c7c')
9 - Color.new('nonessential', '#4f4f4f')
2 + -- TODO: manage background light and dark
3 + --
4 + -- let us first create some colors, that will later be mapped to highlight groups
5 + -- these will be saved in the `colors` table
6 + Color.new("important", "#e0e0e0")
7 + Color.new("normal", "#adadad")
8 + Color.new("minor", "#7c7c7c")
9 + Color.new("nonessential", "#4f4f4f")
11 - Color.new('error', '#e080a8')
12 - Color.new('warning', '#e0d996')
13 - Color.new('information', '#69cde0')
11 + Color.new("error", "#e080a8")
12 + Color.new("warning", "#e0d996")
13 + Color.new("information", "#69cde0")
15 - Color.new('accent_strong', '#cfa1e6')
16 - Color.new('accent_weak', '#574461')
15 + Color.new("accent_strong", "#cfa1e6")
16 + Color.new("accent_weak", "#574461")
18 - Color.new('ui_normal', '#5e5e5e')
19 - Color.new('ui_important', '#78aba9')
20 - Color.new('ui_minor', '#547877')
18 + Color.new("ui_normal", "#5e5e5e")
19 + Color.new("ui_important", "#78aba9")
20 + Color.new("ui_minor", "#547877")
22 - --intentionally ugly and easy to spot color, so that i can find out where it is used
23 - Color.new('debug', '#f111e1')
22 + --intentionally ugly and easy to spot color, so that i can find out where it is used
23 + Color.new("debug", "#f111e1")
25 - require 'theme.terminal_colors'(Group, groups, colors, styles)
26 - require 'theme.nvim_editor_colors'(Group, groups, colors, styles)
27 - require 'theme.lsp_colors'(Group, groups, colors, styles)
28 - require 'theme.treesitter_colors'(Group, groups, colors, styles)
29 - require 'theme.java_colors'(Group, groups, colors, styles)
30 - require 'theme.lua_colors'(Group, groups, colors, styles)
31 - require 'theme.nvim_tree_colors'(Group, groups, colors, styles)
32 - require 'theme.diff_colors'(Group, groups, colors, styles)
25 + require("theme.terminal_colors")(Group, groups, colors, styles)
26 + require("theme.nvim_editor_colors")(Group, groups, colors, styles)
27 + require("theme.lsp_colors")(Group, groups, colors, styles)
28 + require("theme.treesitter_colors")(Group, groups, colors, styles)
29 + require("theme.java_colors")(Group, groups, colors, styles)
30 + require("theme.lua_colors")(Group, groups, colors, styles)
31 + require("theme.nvim_tree_colors")(Group, groups, colors, styles)
32 + require("theme.diff_colors")(Group, groups, colors, styles)

neovim/selene.toml

Added
new file mode 100644
1 +std = "vim"

neovim/vim.toml

Added
new file mode 100644
1 +[selene]
2 +base = "lua51"
3 +name = "vim"
5 +[vim]
6 +any = true
8 +[[describe.args]]
9 +type = "string"
10 +[[describe.args]]
11 +type = "function"
13 +[[it.args]]
14 +type = "string"
15 +[[it.args]]
16 +type = "function"
18 +[[before_each.args]]
19 +type = "function"
20 +[[after_each.args]]
21 +type = "function"
23 +[assert.is_not]
24 +any = true
26 +[[assert.equals.args]]
27 +type = "any"
28 +[[assert.equals.args]]
29 +type = "any"
30 +[[assert.equals.args]]
31 +type = "any"
32 +required = false
34 +[[assert.same.args]]
35 +type = "any"
36 +[[assert.same.args]]
37 +type = "any"
39 +[[assert.truthy.args]]
40 +type = "any"
42 +[[assert.spy.args]]
43 +type = "any"
45 +[[assert.stub.args]]
46 +type = "any"

nushell/config.toml

Modified
16 16 # the only get loaded in interactive nu session.
17 17 # not for scripts and --commands.
18 18 # see https://github.com/nushell/nushell/issues/3892
19 -"nu plugin --load ~/.cargo/bin",
19 +"nu plugin --load (build-string $nu.env.CARGO_HOME /bin)",
20 20 "source nurc",

nushell/nurc

Modified
5 5 # GLOBAL VARIABLES
6 6 let-env NURC = (build-string (pwd) /nurc)
7 7 let-env DOTFILES = ((build-string (pwd) /..) | path expand)
8 +let-env TODO = (build-string $nu.env.DOTFILES /TODO.md)
9 10 # ALIASES
10 11 alias cat = bat
11 12 alias vim = nvim
12 13 alias edit = nvim
14 +alias e = nvim
15 +alias ll = exa --group-directories-first --classify --long --icons --git
16 +alias la = exa --group-directories-first --classify --all --long --icons --git
17 +alias tr = exa --tree
13 18 alias doas = sudo
14 19 alias grep = rg
15 -alias todo = glow (build-string $nu.env.DOTFILES / TODO.md)
16 -alias nurc = nvim $nu.env.NURC
18 21 # CUSTOM LITTLE JAVA COMMANDS
19 22 alias sha = java (build-string $nu.env.DOTFILES /tools/ sha.java)
22 25 alias download = java (build-string $nu.env.DOTFILES /tools/ download.java)
23 26 alias download_jar = java (build-string $nu.env.DOTFILES /tools/ download_jar.java)
28 +# MY STDLIB UTIL MISC HELPER FUNCTIONS
30 +# Check whether table in pipeline has a column with given name
31 +def "has-column?" [
32 + name: string # Name of the column to check for
33 +] {
34 + pivot | any? Column0 == $name
37 +# Prints out a list of stuff.
38 +# Appends a newline at the end.
39 +def print [
40 + ...rest: any # list of stuff to echo out
41 +] {
42 + echo (build-string ($rest | flatten | into string | str collect) )
43 + echo (char newline)
46 +# Flattens a table into a string separated by a single space character.
47 +def to-string [] { flatten | into string | str collect ' ' }
25 49 # FUNCTIONS
51 +# Render my To-Do file in the terminal
52 +def todo [] { mdcat $nu.env.TODO }
53 +# Open my To-Do file for editing
54 +def "todo edit" [] { nvim $nu.env.TODO }
55 +# Open the Nushell configuration file for editing
56 +def "config edit" [] { nvim (config path) }
57 +# Open my Nushell startup script for editing
58 +def nurc [] { nvim $nu.env.NURC }
27 60 # Uploads a PUBLIC ssh key to GitHub.
28 61 # Will prompt for the AES encryption password of my dotfiles.
29 62 def github-upload-key [
78 111 git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD -n 25 $rest | lines | split column "»¦«" commit subject name email date | update date { get date | str to-datetime} | sort-by date
115 +# Open manual page.
116 +# On Windows, a man web page is opened.
81 117 def man [
82 - program: string
118 + ...rest: string # Arguments to man
84 120 if (sys).host.name == "Windows" {
85 - start (build-string https://man.cx/ $program)
121 + start (build-string https://man.cx/ ($rest | to-string))
87 - exec man $program
123 + exec man $rest
91 127 # Search the given query on the web with the default browser in DuckDuckGo.
92 128 def web [
93 - query:string # The search query
129 + ...rest:string # The search query
95 131 # There seems to be an issue with the nu start command on windows: It does not handle URLs
96 132 # Using windows command for now:
97 - start (build-string "https://duckduckgo.com/?q=" $query)
133 + start (build-string "https://duckduckgo.com/?q=" ($rest | to-string))
100 -# Check whether table in pipeline has a column with given name
101 -def "has-column?" [
102 - name: string # Name of the column to check for
103 -] {
104 - pivot | any? Column0 == $name
107 -# Prints out a list of stuff.
108 -# Appends a newline at the end.
109 -def print [
110 - ...rest: any # list of stuff to echo out
111 -] {
112 - echo (build-string ($rest | flatten | into string | str collect) )
113 - echo (char newline)