mirror of
https://github.com/thegeneralist01/config.git
synced 2026-05-30 08:37:01 +02:00
Compare commits
2 commits
65ad4a6d6b
...
0505ec375b
| Author | SHA1 | Date | |
|---|---|---|---|
| 0505ec375b | |||
| b5d2518afd |
2 changed files with 51 additions and 39 deletions
|
|
@ -219,6 +219,10 @@ do --env {
|
|||
if ($env.IN_NIX_SHELL? | is-not-empty) {
|
||||
$suffix ++= [ $"(ansi light_blue_bold)nix" ]
|
||||
}
|
||||
# .VENV
|
||||
if ($env.VIRTUAL_ENV? | is-not-empty) {
|
||||
$suffix ++= [ $"(ansi light_green_bold)($env.VIRTUAL_ENV_PROMPT)" ]
|
||||
}
|
||||
|
||||
$suffix | each { $'(ansi light_yellow_bold)•(ansi reset) ($in)(ansi reset)' } | str join " "
|
||||
}
|
||||
|
|
@ -226,6 +230,7 @@ do --env {
|
|||
([ $prefix, $body, $suffix ] | str join " ") + (char newline)
|
||||
}
|
||||
|
||||
$env.VIRTUAL_ENV_DISABLE_PROMPT = true
|
||||
$env.PROMPT_INDICATOR = $"(ansi light_yellow_bold)┃(ansi reset) "
|
||||
$env.PROMPT_INDICATOR_VI_NORMAL = $env.PROMPT_INDICATOR
|
||||
$env.PROMPT_INDICATOR_VI_INSERT = $env.PROMPT_INDICATOR
|
||||
|
|
|
|||
|
|
@ -1,47 +1,54 @@
|
|||
{ lib, pkgs, ... }: let
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib) getExe;
|
||||
zoxide = getExe pkgs.zoxide;
|
||||
in {
|
||||
home-manager.sharedModules = [{
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
options = [ "--cmd cd" ];
|
||||
enableNushellIntegration = false;
|
||||
};
|
||||
in
|
||||
{
|
||||
home-manager.sharedModules = [
|
||||
{
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
options = [ "--cmd cd" ];
|
||||
enableNushellIntegration = false;
|
||||
};
|
||||
|
||||
programs.nushell.extraConfig = /* nu */ ''
|
||||
# Zoxide integration with full path
|
||||
$env.config = ($env.config? | default {})
|
||||
$env.config.hooks = ($env.config.hooks? | default {})
|
||||
$env.config.hooks.env_change = ($env.config.hooks.env_change? | default {})
|
||||
$env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD? | default [])
|
||||
programs.nushell.extraConfig = # nu
|
||||
''
|
||||
# Zoxide integration with full path
|
||||
$env.config = ($env.config? | default {})
|
||||
$env.config.hooks = ($env.config.hooks? | default {})
|
||||
$env.config.hooks.env_change = ($env.config.hooks.env_change? | default {})
|
||||
$env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD? | default [])
|
||||
|
||||
let __zoxide_hooked = ($env.config.hooks.env_change.PWD | any { try { get __zoxide_hook } catch { false } })
|
||||
if not $__zoxide_hooked {
|
||||
$env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD | append {
|
||||
__zoxide_hook: true,
|
||||
code: {|_, dir| ${zoxide} add -- $dir}
|
||||
})
|
||||
}
|
||||
let __zoxide_hooked = ($env.config.hooks.env_change.PWD | any { try { get __zoxide_hook } catch { false } })
|
||||
if not $__zoxide_hooked {
|
||||
$env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD | append {
|
||||
__zoxide_hook: true,
|
||||
code: {|_, dir| ${zoxide} add -- $dir}
|
||||
})
|
||||
}
|
||||
|
||||
def --env __zoxide_z [...rest: string] {
|
||||
let path = if ($rest | length) == 0 {
|
||||
$env.HOME
|
||||
} else if ($rest | length) == 1 and ($rest.0 == "-") {
|
||||
$env.OLDPWD
|
||||
} else {
|
||||
${zoxide} query --exclude (pwd) -- ...$rest | str trim -r -c (char newline)
|
||||
}
|
||||
cd $path
|
||||
}
|
||||
def --env __zoxide_z [...rest: string] {
|
||||
let path = if ($rest | length) == 0 {
|
||||
$env.HOME
|
||||
} else if ($rest | length) == 1 and ($rest.0 == "-") {
|
||||
$env.OLDPWD
|
||||
} else if ($rest | length) == 1 and (($rest.0 | path expand) | path exists) {
|
||||
$rest.0
|
||||
} else {
|
||||
${zoxide} query --exclude (pwd) -- ...$rest | str trim -r -c (char newline)
|
||||
}
|
||||
cd $path
|
||||
}
|
||||
|
||||
def --env __zoxide_zi [...rest: string] {
|
||||
let path = ${zoxide} query --interactive -- ...$rest | str trim -r -c (char newline)
|
||||
cd $path
|
||||
}
|
||||
def --env __zoxide_zi [...rest: string] {
|
||||
let path = ${zoxide} query --interactive -- ...$rest | str trim -r -c (char newline)
|
||||
cd $path
|
||||
}
|
||||
|
||||
alias cd = __zoxide_z
|
||||
alias cdi = __zoxide_zi
|
||||
'';
|
||||
}];
|
||||
alias cd = __zoxide_z
|
||||
alias cdi = __zoxide_zi
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue