repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

nushell/config.nu

Raw
def expand-home [] {
	let p = $in
	if ( $p =~ '~') {
		return ($p | path expand)
	}
	return $p
}

def direnv [] {
	[
		{
			condition: {|before, after| ($before != $after) and ($after | path join '.env' | path exists) }
			code: r#'
				open .env
				| lines
				| parse --regex '\s*(?P<key>.+?)\s*=\s*?(?P<value>.+)?\s*'
				| reduce --fold {} { | entry, acc|
					$acc | upsert $entry.key ( $entry.value | str trim | expand-home )
				}
				| load-env'#
		}
	]
}

$env.config = {
	#color_config: $base16_theme # <-- this is the theme
	use_ansi_coloring: true
	edit_mode: vi
	show_banner: false
  table: {
    mode: none
  }
  rm: {
    always_trash: true
  }
  completions: {
    use_ls_colors: true
  }
  cursor_shape: {
		  vi_insert: line
		  vi_normal: block
	  }

	float_precision: 3
	shell_integration: {
			osc9_9: true
			# unfortunatelly, this seems to be buggy on win32 with wezterm
			osc133: false
		}
  # some experimental options
  buffer_editor: ["nvim" "--clean"]
  highlight_resolved_externals : true
  use_kitty_protocol : true

  history: {
    file_format: "sqlite"
    isolation: true
  }
	hooks: {
		env_change: {
			PWD: (direnv)
		}
	}
}