mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-01-30 22:57:54 +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) {
|
||||
var subcommand = args[0]
|
||||
shift 1
|
||||
case (subcommand) {
|
||||
passphrase {
|
||||
gopass pwgen --xkcd --lang en --one-per-line --xkcdnumbers --xkcdcapitalize @[args] | head -n1
|
||||
}
|
||||
password {
|
||||
gopass pwgen --symbols --one-per-line @[args] | head -n1
|
||||
}
|
||||
secret {
|
||||
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
|
||||
}
|
||||
}
|
||||
# Generate a passphrase.
|
||||
def "main passphrase" --wrapped [
|
||||
...rest: string # Additional arguments to be added to the passphrase generation command.
|
||||
] {
|
||||
gopass pwgen --xkcd --lang en --one-per-line --xkcdnumbers --xkcdcapitalize ...$rest | head -n1
|
||||
}
|
||||
|
||||
if is-main {
|
||||
main @ARGV
|
||||
# Generate a password.
|
||||
def "main password" --wrapped [
|
||||
...rest # Additional arguments to be added to the password generation command.
|
||||
] {
|
||||
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
|
||||
}
|
||||
|
||||
# Encode the given string to argon2.
|
||||
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.
|
||||
# - FZF_ALT_C_COMMAND contains the executable and its arguments used for
|
||||
# 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 = [
|
||||
--height ($env.FZF_TMUX_HEIGHT? | default "40%")
|
||||
@ -25,24 +30,24 @@ let envconvert_cmdstring = {
|
||||
to_string: { |s| $s | str join ' ' }
|
||||
}
|
||||
|
||||
def __fzf_select [...flags: string] {
|
||||
def __fzf_select --wrapped [...rest: string] {
|
||||
with-env {
|
||||
FZF_CTRL_T_COMMAND: ($env.FZF_CTRL_T_COMMAND? | default "fzf")
|
||||
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 {
|
||||
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS | default $__fzf_defaults)
|
||||
} {
|
||||
if "FZF_ALT_C_COMMAND" in $env {
|
||||
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 {
|
||||
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]
|
||||
event: {
|
||||
send: ExecuteHostCommand
|
||||
cmd: "cd (__fzf_cd)"
|
||||
cmd: "dirs add (__fzf_cd)"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -1,6 +1,7 @@
|
||||
$env.config = $env.config | merge deep --strategy=append {
|
||||
show_banner: false
|
||||
shell_integration: {
|
||||
osc2: true
|
||||
osc7: true
|
||||
osc133: true
|
||||
osc633: true
|
||||
|
@ -10,12 +10,13 @@ mkShell {
|
||||
# Language servers for...
|
||||
lua-language-server # ...Lua.
|
||||
pyright # ...Python.
|
||||
rnix-lsp # ...Nix.
|
||||
nixd # ...Nix.
|
||||
|
||||
# Formatters for...
|
||||
treefmt # ...everything under the sun.
|
||||
stylua # ...Lua.
|
||||
nixpkgs-fmt # ...Nix.
|
||||
black # ...Python.
|
||||
nufmt # ... Nushell.
|
||||
];
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
[formatter.lua]
|
||||
command = "stylua"
|
||||
includes = [ "*.lua" ]
|
||||
|
||||
[formatter.nu]
|
||||
command = "nufmt"
|
||||
includes = [ "*.nu" ]
|
||||
|
@ -3,6 +3,8 @@ local module = {}
|
||||
|
||||
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 theme_dir = xdg_data_home .. "/base16/bark-on-a-tree"
|
||||
local light_scheme, light_scheme_metadata =
|
||||
@ -61,9 +63,8 @@ function module.apply_to_config(config)
|
||||
|
||||
-- Disable some more annoyances.
|
||||
config.enable_tab_bar = true
|
||||
config.enable_scroll_bar = false
|
||||
config.tab_bar_at_bottom = false
|
||||
config.window_decorations = "RESIZE"
|
||||
config.window_decorations = "NONE"
|
||||
|
||||
-- Configuring the appearance of the tab bar.
|
||||
config.window_frame = {
|
||||
@ -74,7 +75,7 @@ function module.apply_to_config(config)
|
||||
-- Configuring the windows padding.
|
||||
config.window_padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
right = '1cell',
|
||||
top = 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 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)
|
||||
-- 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 }
|
||||
@ -100,7 +113,7 @@ function module.apply_to_config(config)
|
||||
{ mods = alt_keymod, key = "j", action = act.ActivateTab(-1) },
|
||||
{ mods = alt_keymod, key = "k", action = act.ActivateTab(0) },
|
||||
{ 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 }) },
|
||||
|
||||
-- Hints and quick selections
|
||||
@ -123,6 +136,7 @@ function module.apply_to_config(config)
|
||||
{ key = "r", mods = keymod, action = act.ReloadConfiguration },
|
||||
{ key = "o", mods = keymod, action = act.ShowDebugOverlay },
|
||||
{ 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") },
|
||||
|
||||
-- Selection
|
||||
@ -198,6 +212,8 @@ function module.apply_to_config(config)
|
||||
{ key = "Escape", action = act.PopKeyTable },
|
||||
{ key = "Enter", action = act.PopKeyTable },
|
||||
},
|
||||
|
||||
copy_mode = copy_mode,
|
||||
}
|
||||
return config
|
||||
end
|
||||
|
@ -8,9 +8,9 @@ function module.apply_to_config(config)
|
||||
|
||||
config.tls_clients = {
|
||||
{
|
||||
name = "mux.foodogsquared.one",
|
||||
remote_address = "mux.foodogsquared.one:9801",
|
||||
bootstrap_via_ssh = "plover@mux.foodogsquared.one",
|
||||
name = "foodogsquared.one",
|
||||
remote_address = "plover.foodogsquared.one:9801",
|
||||
bootstrap_via_ssh = "plover@plover.foodogsquared.one",
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user