mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-01-31 04:57:57 +00:00
Compare commits
5 Commits
56541bae23
...
f2f7a9e221
Author | SHA1 | Date | |
---|---|---|---|
f2f7a9e221 | |||
dab0e3aba6 | |||
5bff5dfdab | |||
774fa3b7b1 | |||
5f0248de65 |
@ -1,28 +1,34 @@
|
|||||||
#!/usr/bin/env ysh
|
#!/usr/bin/env nu
|
||||||
|
|
||||||
proc main(...args) {
|
# Generate a passphrase.
|
||||||
var subcommand = args[0]
|
def "main passphrase" --wrapped [
|
||||||
shift 1
|
...rest: string # Additional arguments to be added to the passphrase generation command.
|
||||||
case (subcommand) {
|
] {
|
||||||
passphrase {
|
gopass pwgen --xkcd --lang en --one-per-line --xkcdnumbers --xkcdcapitalize ...$rest | head -n1
|
||||||
gopass pwgen --xkcd --lang en --one-per-line --xkcdnumbers --xkcdcapitalize @[args] | head -n1
|
}
|
||||||
}
|
|
||||||
password {
|
# Generate a password.
|
||||||
gopass pwgen --symbols --one-per-line @[args] | head -n1
|
def "main password" --wrapped [
|
||||||
}
|
...rest # Additional arguments to be added to the password generation command.
|
||||||
secret {
|
] {
|
||||||
|
gopass pwgen --symbols --one-per-line ...$rest | head -n1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generate a randomly-generated base64-encoded string.
|
||||||
|
def "main secret" [] {
|
||||||
dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64
|
dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64
|
||||||
}
|
|
||||||
encode-argon2 {
|
|
||||||
write -- $[args[1]] | argon2 $(openssl rand -base64 32) -e -id -k 65540 -t 3 -p 4
|
|
||||||
}
|
|
||||||
(else) {
|
|
||||||
echo "Invalid subcommand: '$[arg1]'." 1>&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if is-main {
|
# Encode the given string to argon2.
|
||||||
main @ARGV
|
def "main encode-argon2" [
|
||||||
|
string # The string to be encoded.
|
||||||
|
] {
|
||||||
|
$string | argon2 (openssl rand -base64 32) -e -id -k 65540 -t 3 -p 4
|
||||||
|
}
|
||||||
|
|
||||||
|
# A toolbelt for anything secret-related. It can be used to generate a
|
||||||
|
# passphrase, password, and encode into several variants.
|
||||||
|
def "main" [] {
|
||||||
|
help main | print -e
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
44
nu/autoload/dirs.nu
Normal file
44
nu/autoload/dirs.nu
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
use std/dirs
|
||||||
|
use std/dirs shells-aliases *
|
||||||
|
|
||||||
|
$env.config.keybindings = $env.config.keybindings | append [
|
||||||
|
{
|
||||||
|
name: dirs_quickadd
|
||||||
|
modifier: control
|
||||||
|
keycode: char_f
|
||||||
|
mode: [emacs vi_normal vi_insert]
|
||||||
|
event: {
|
||||||
|
send: ExecuteHostCommand
|
||||||
|
cmd: "dirs add .."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name: dirs_drop
|
||||||
|
modifier: alt
|
||||||
|
keycode: char_f
|
||||||
|
mode: [emacs vi_normal vi_insert]
|
||||||
|
event: {
|
||||||
|
send: ExecuteHostCommand
|
||||||
|
cmd: "dirs drop"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name: dirs_prev
|
||||||
|
modifier: control
|
||||||
|
keycode: char_h
|
||||||
|
mode: [emacs vi_normal vi_insert]
|
||||||
|
event: [
|
||||||
|
{
|
||||||
|
send: ExecuteHostCommand
|
||||||
|
cmd: "dirs prev"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
send: ExecuteHostCommand
|
||||||
|
cmd: "cd -"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@ -13,6 +13,11 @@
|
|||||||
# executing.
|
# executing.
|
||||||
# - FZF_ALT_C_COMMAND contains the executable and its arguments used for
|
# - FZF_ALT_C_COMMAND contains the executable and its arguments used for
|
||||||
# entering directories (with Alt+C keybinding).
|
# entering directories (with Alt+C keybinding).
|
||||||
|
#
|
||||||
|
# Note that most of the values from their respective variables are converted
|
||||||
|
# over from what would how fzf normally expects it to be.
|
||||||
|
|
||||||
|
use std/dirs
|
||||||
|
|
||||||
let __fzf_defaults = [
|
let __fzf_defaults = [
|
||||||
--height ($env.FZF_TMUX_HEIGHT? | default "40%")
|
--height ($env.FZF_TMUX_HEIGHT? | default "40%")
|
||||||
@ -25,24 +30,24 @@ let envconvert_cmdstring = {
|
|||||||
to_string: { |s| $s | str join ' ' }
|
to_string: { |s| $s | str join ' ' }
|
||||||
}
|
}
|
||||||
|
|
||||||
def __fzf_select [...flags: string] {
|
def __fzf_select --wrapped [...rest: string] {
|
||||||
with-env {
|
with-env {
|
||||||
FZF_CTRL_T_COMMAND: ($env.FZF_CTRL_T_COMMAND? | default "fzf")
|
FZF_CTRL_T_COMMAND: ($env.FZF_CTRL_T_COMMAND? | default "fzf")
|
||||||
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS? | default $__fzf_defaults)
|
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS? | default $__fzf_defaults)
|
||||||
} {
|
} {
|
||||||
fzf ...$flags ...$env.FZF_DEFAULT_OPTS
|
fzf ...$rest ...$env.FZF_DEFAULT_OPTS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def __fzf_cd [...flags: string] {
|
def __fzf_cd --wrapped [...rest: string] {
|
||||||
with-env {
|
with-env {
|
||||||
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS | default $__fzf_defaults)
|
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS | default $__fzf_defaults)
|
||||||
} {
|
} {
|
||||||
if "FZF_ALT_C_COMMAND" in $env {
|
if "FZF_ALT_C_COMMAND" in $env {
|
||||||
let command = $env.FZF_ALT_C_COMMAND
|
let command = $env.FZF_ALT_C_COMMAND
|
||||||
run-external ($command | get 0) ...($command | range 1..) | fzf ...$env.FZF_DEFAULT_OPTS ...$flags
|
run-external ($command | get 0) ...($command | range 1..) | fzf ...$env.FZF_DEFAULT_OPTS ...$rest
|
||||||
} else {
|
} else {
|
||||||
fzf ...$env.FZF_DEFAULT_OPTS --walker=dir,hidden,follow ...$flags
|
fzf ...$env.FZF_DEFAULT_OPTS --walker=dir,hidden,follow ...$rest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +90,7 @@ $env.config.keybindings = $env.config.keybindings | append [
|
|||||||
mode: [emacs vi_normal vi_insert]
|
mode: [emacs vi_normal vi_insert]
|
||||||
event: {
|
event: {
|
||||||
send: ExecuteHostCommand
|
send: ExecuteHostCommand
|
||||||
cmd: "cd (__fzf_cd)"
|
cmd: "dirs add (__fzf_cd)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
$env.config = $env.config | merge deep --strategy=append {
|
$env.config = $env.config | merge deep --strategy=append {
|
||||||
show_banner: false
|
show_banner: false
|
||||||
shell_integration: {
|
shell_integration: {
|
||||||
|
osc2: true
|
||||||
osc7: true
|
osc7: true
|
||||||
osc133: true
|
osc133: true
|
||||||
osc633: true
|
osc633: true
|
||||||
|
@ -10,12 +10,13 @@ mkShell {
|
|||||||
# Language servers for...
|
# Language servers for...
|
||||||
lua-language-server # ...Lua.
|
lua-language-server # ...Lua.
|
||||||
pyright # ...Python.
|
pyright # ...Python.
|
||||||
rnix-lsp # ...Nix.
|
nixd # ...Nix.
|
||||||
|
|
||||||
# Formatters for...
|
# Formatters for...
|
||||||
treefmt # ...everything under the sun.
|
treefmt # ...everything under the sun.
|
||||||
stylua # ...Lua.
|
stylua # ...Lua.
|
||||||
nixpkgs-fmt # ...Nix.
|
nixpkgs-fmt # ...Nix.
|
||||||
black # ...Python.
|
black # ...Python.
|
||||||
|
nufmt # ... Nushell.
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
[formatter.lua]
|
[formatter.lua]
|
||||||
command = "stylua"
|
command = "stylua"
|
||||||
includes = [ "*.lua" ]
|
includes = [ "*.lua" ]
|
||||||
|
|
||||||
|
[formatter.nu]
|
||||||
|
command = "nufmt"
|
||||||
|
includes = [ "*.nu" ]
|
||||||
|
@ -3,6 +3,8 @@ local module = {}
|
|||||||
|
|
||||||
local wezterm = require("wezterm")
|
local wezterm = require("wezterm")
|
||||||
|
|
||||||
|
-- This has to be setup outside of this configuration. I don't want to have the
|
||||||
|
-- same code fetching the colors all over various config files.
|
||||||
local xdg_data_home = os.getenv("XDG_DATA_HOME") or "~/.local/share"
|
local xdg_data_home = os.getenv("XDG_DATA_HOME") or "~/.local/share"
|
||||||
local theme_dir = xdg_data_home .. "/base16/bark-on-a-tree"
|
local theme_dir = xdg_data_home .. "/base16/bark-on-a-tree"
|
||||||
local light_scheme, light_scheme_metadata =
|
local light_scheme, light_scheme_metadata =
|
||||||
@ -61,9 +63,8 @@ function module.apply_to_config(config)
|
|||||||
|
|
||||||
-- Disable some more annoyances.
|
-- Disable some more annoyances.
|
||||||
config.enable_tab_bar = true
|
config.enable_tab_bar = true
|
||||||
config.enable_scroll_bar = false
|
|
||||||
config.tab_bar_at_bottom = false
|
config.tab_bar_at_bottom = false
|
||||||
config.window_decorations = "RESIZE"
|
config.window_decorations = "NONE"
|
||||||
|
|
||||||
-- Configuring the appearance of the tab bar.
|
-- Configuring the appearance of the tab bar.
|
||||||
config.window_frame = {
|
config.window_frame = {
|
||||||
@ -74,7 +75,7 @@ function module.apply_to_config(config)
|
|||||||
-- Configuring the windows padding.
|
-- Configuring the windows padding.
|
||||||
config.window_padding = {
|
config.window_padding = {
|
||||||
left = 0,
|
left = 0,
|
||||||
right = 0,
|
right = '1cell',
|
||||||
top = 0,
|
top = 0,
|
||||||
bottom = 0,
|
bottom = 0,
|
||||||
}
|
}
|
||||||
|
13
wezterm/config/helpers.lua
Normal file
13
wezterm/config/helpers.lua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
local module = {}
|
||||||
|
|
||||||
|
function module.get_zone_around_cursor(pane)
|
||||||
|
local cursor = pane:get_cursor_position()
|
||||||
|
-- using x-1 here because the cursor may be one cell outside the zone
|
||||||
|
local zone = pane:get_semantic_zone_at(cursor.x - 1, cursor.y)
|
||||||
|
if zone then
|
||||||
|
return pane:get_text_from_semantic_zone(zone)
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return module
|
@ -6,6 +6,19 @@ local keymod = base.keymod
|
|||||||
local alt_keymod = base.alt_keymod
|
local alt_keymod = base.alt_keymod
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
|
local copy_mode = nil
|
||||||
|
if wezterm.gui then
|
||||||
|
copy_mode = wezterm.gui.default_key_tables().copy_mode
|
||||||
|
table.insert(
|
||||||
|
copy_mode,
|
||||||
|
{
|
||||||
|
key = 'z',
|
||||||
|
mods = keymod,
|
||||||
|
action = act.CopyMode { MoveBackwardZoneOfType = 'Output' },
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
function module.apply_to_config(config)
|
function module.apply_to_config(config)
|
||||||
-- I'm very used to setting <SPACE> as the leader so I'm continuing the tradition.
|
-- I'm very used to setting <SPACE> as the leader so I'm continuing the tradition.
|
||||||
config.leader = { key = "Space", mods = keymod, timeout_milliseconds = 1000 }
|
config.leader = { key = "Space", mods = keymod, timeout_milliseconds = 1000 }
|
||||||
@ -100,7 +113,7 @@ function module.apply_to_config(config)
|
|||||||
{ mods = alt_keymod, key = "j", action = act.ActivateTab(-1) },
|
{ mods = alt_keymod, key = "j", action = act.ActivateTab(-1) },
|
||||||
{ mods = alt_keymod, key = "k", action = act.ActivateTab(0) },
|
{ mods = alt_keymod, key = "k", action = act.ActivateTab(0) },
|
||||||
{ mods = alt_keymod, key = "l", action = act.ActivateTabRelative(1) },
|
{ mods = alt_keymod, key = "l", action = act.ActivateTabRelative(1) },
|
||||||
{ key = "t", mods = keymod, action = act.ShowTabNavigator },
|
{ key = "t", mods = alt_keymod, action = act.ShowTabNavigator },
|
||||||
{ key = "d", mods = alt_keymod, action = act.CloseCurrentTab({ confirm = false }) },
|
{ key = "d", mods = alt_keymod, action = act.CloseCurrentTab({ confirm = false }) },
|
||||||
|
|
||||||
-- Hints and quick selections
|
-- Hints and quick selections
|
||||||
@ -123,6 +136,7 @@ function module.apply_to_config(config)
|
|||||||
{ key = "r", mods = keymod, action = act.ReloadConfiguration },
|
{ key = "r", mods = keymod, action = act.ReloadConfiguration },
|
||||||
{ key = "o", mods = keymod, action = act.ShowDebugOverlay },
|
{ key = "o", mods = keymod, action = act.ShowDebugOverlay },
|
||||||
{ key = "p", mods = keymod, action = act.ActivateCommandPalette },
|
{ key = "p", mods = keymod, action = act.ActivateCommandPalette },
|
||||||
|
{ key = "y", mods = keymod, action = act.ActivateCopyMode },
|
||||||
{ key = "e", mods = keymod, action = act.EmitEvent("view-last-output-in-new-pane") },
|
{ key = "e", mods = keymod, action = act.EmitEvent("view-last-output-in-new-pane") },
|
||||||
|
|
||||||
-- Selection
|
-- Selection
|
||||||
@ -198,6 +212,8 @@ function module.apply_to_config(config)
|
|||||||
{ key = "Escape", action = act.PopKeyTable },
|
{ key = "Escape", action = act.PopKeyTable },
|
||||||
{ key = "Enter", action = act.PopKeyTable },
|
{ key = "Enter", action = act.PopKeyTable },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
copy_mode = copy_mode,
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
end
|
end
|
||||||
|
@ -8,9 +8,9 @@ function module.apply_to_config(config)
|
|||||||
|
|
||||||
config.tls_clients = {
|
config.tls_clients = {
|
||||||
{
|
{
|
||||||
name = "mux.foodogsquared.one",
|
name = "foodogsquared.one",
|
||||||
remote_address = "mux.foodogsquared.one:9801",
|
remote_address = "plover.foodogsquared.one:9801",
|
||||||
bootstrap_via_ssh = "plover@mux.foodogsquared.one",
|
bootstrap_via_ssh = "plover@plover.foodogsquared.one",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user