Compare commits

...

2 Commits

Author SHA1 Message Date
TuDatTr 38b7133cfb Removed history.txt
Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
2023-10-09 01:21:40 +02:00
TuDatTr fd2da739e8 Added nuconfig
Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
2023-10-09 01:14:30 +02:00
5 changed files with 65 additions and 47 deletions

1
config/.config/nushell/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
history.txt

View File

@ -554,10 +554,6 @@ def pwd_xsel [] {
$"Copied `($path)`";
}
def load_env [] {
open .env | lines | parse "{name}={value};" | transpose -r | into record | load-env
}
alias ll = ls -la
alias la = ls -a
alias q = exit
@ -573,18 +569,49 @@ alias defaultres = xrandr --output HDMI1 --transform 1.00,0,0,0,1.00,0,0,0,1
alias latexmk = ^latexmk -f -pdf -interaction=nonstopmode
alias ranger = own_ranger
alias xselp = pwd_xsel
alias lenv = load_env
# git
alias gpa = git push all --all
# alias gras = add_soft
alias gd = git diff
alias gnd = git --no-pager diff
alias gp = git push
alias gcsm = git commit -s -m
alias gaa = git add --all
alias gco = git checkout
alias grv = git remote -v
# alias kubectl = minikube kubectl --
def completion_nmcli_connection_show [] {
nmcli c s | lines | skip 1 | parse -r "(?P<name>.+) +\(?P<uuid>[a-z0-9-]{36}\) +\(?P<type>[a-z]+\)" | where type == wifi | get name | str trim
}
extern "nmcli c u" [name: string@completion_nmcli_connection_show]
def completion_ssh_host [] {
open ~/.ssh/config | parse -r "Host (?P<host>.+)" | get host | uniq | str trim
}
extern "ssh" [host: string@completion_ssh_host]
def completion_git_branch [] {
git --no-pager branch | str replace '\*' ' ' | lines | str trim
}
extern "git branch" [host: string@completion_git_branch]
def completion_docker_kill [] {
docker ps | lines | skip 1 | parse -r '^(?P<container>\w+) +(?P<image>\w+) .*' | get container | str trim
}
extern "docker kill" [host: string@completion_docker_kill]
def completion_ip_addr [] {
ip link | lines | parse -r '\d+: (?P<name>[\w@\.]+):' | get name | str trim
}
extern "ip addr show" [host: string@completion_ip_addr]
extern "ip a s" [host: string@completion_ip_addr]
$env.DOCKER_BUILDKIT = 1 # Disable for podman
source ~/.cache/starship/init.nu

View File

@ -1,6 +1,6 @@
# Nushell Environment Config File
#
# version = 0.79.1
# version = 0.83.1
def create_left_prompt [] {
mut home = ""
@ -13,7 +13,7 @@ def create_left_prompt [] {
}
let dir = ([
($env.PWD | str substring 0..($home | str length) | str replace --string $home "~"),
($env.PWD | str substring 0..($home | str length) | str replace $home "~"),
($env.PWD | str substring ($home | str length)..)
] | str join)
@ -21,18 +21,17 @@ def create_left_prompt [] {
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
let path_segment = $"($path_color)($dir)"
$path_segment | str replace --all --string (char path_sep) $"($separator_color)/($path_color)"
$path_segment | str replace --all (char path_sep) $"($separator_color)/($path_color)"
}
def create_right_prompt [] {
let time_segment_color = (ansi magenta)
# create a right prompt in magenta with green separators and am/pm underlined
let time_segment = ([
(ansi reset)
$time_segment_color
(date now | date format '%m/%d/%Y %r')
] | str join | str replace --all "([/:])" $"(ansi light_magenta_bold)${1}($time_segment_color)" |
str replace --all "([AP]M)" $"(ansi light_magenta_underline)${1}")
(ansi magenta)
(date now | date format '%Y/%m/%d %r')
] | str join | str replace --all "([/:])" $"(ansi green)${1}(ansi magenta)" |
str replace --all "([AP]M)" $"(ansi magenta_underline)${1}")
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
(ansi rb)
@ -45,13 +44,13 @@ def create_right_prompt [] {
# Use nushell functions to define your right and left prompt
$env.PROMPT_COMMAND = {|| create_left_prompt }
$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
# $env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
# The prompt indicators are environmental variables that represent
# the state of the prompt
$env.PROMPT_INDICATOR = {|| "> " }
$env.PROMPT_INDICATOR_VI_INSERT = {|| ": " }
$env.PROMPT_INDICATOR_VI_NORMAL = {|| "> " }
$env.PROMPT_INDICATOR = {|| " > " }
$env.PROMPT_INDICATOR_VI_INSERT = {|| " : " }
$env.PROMPT_INDICATOR_VI_NORMAL = {|| " > " }
$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }
# Specifies how environment variables are:
@ -59,32 +58,32 @@ $env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }
# - converted from a value back to a string when running external commands (to_string)
# Note: The conversions happen *after* config.nu is loaded
$env.ENV_CONVERSIONS = {
"PATH": {
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
}
"Path": {
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
}
"PATH": {
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
}
"Path": {
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
}
}
# Directories to search for scripts when calling source or use
#
# By default, <nushell-config-dir>/scripts is added
$env.NU_LIB_DIRS = [
($nu.default-config-dir | path join 'scripts')
# ($nu.default-config-dir | path join 'scripts') # add <nushell-config-dir>/scripts
($nu.default-config-dir | path join completions) # add <nushell-config-dir>/completions
]
# Directories to search for plugin binaries when calling register
#
# By default, <nushell-config-dir>/plugins is added
$env.NU_PLUGIN_DIRS = [
($nu.default-config-dir | path join 'plugins')
# ($nu.default-config-dir | path join 'plugins') # add <nushell-config-dir>/plugins
]
$env.GOPATH = ($env.HOME + '/.go/')
$env.GOBIN = ($env.GOPATH + 'bin/')
# To add entries to PATH (on Windows you might use Path), you can use the following pattern:
$env.PATH = ($env.PATH | split row (char esep) | prepend '~/.cargo/bin' | prepend '~/.emacs.d/bin/' | prepend $env.GOBIN)
# $env.PATH = ($env.PATH | split row (char esep))
$env.EDITOR = "emacs -nw"
$env.VISUAL = "bat"
$env.PAGER = "bat --pager auto"
$env.KUBECONFIG = $"($env.HOME)/.kube/config"

View File

@ -1,9 +0,0 @@
# Example Nushell Loginshell Config File
# - has to be as login.nu in the default config directory
# - will be sourced after config.nu and env.nu in case of nushell started as login shell
# just as an example for overwriting of an environment variable of env.nu
let-env PROMPT_INDICATOR = {|| "(LS)> " }
# Similar to env-path and config-path there is a variable containing the path to login.nu
echo $nu.loginshell-path

View File

@ -9,7 +9,7 @@ t:/home/tuan/Templates
w:/home/tuan/workspace_l/home_lab/wiki
k:/home/tuan/.syncthing/Documents/Uni/Studium/2022_Sommersemester/Bachelorprojekt/Implement EFCF based on libAFL/git/foundry/evm/src/executor
q:/home/tuan/Documents/Arbeit/Uni-DuE_NCS_SHK/04_-_Projekte/04-5G_IANA/02-gps
':/home/tuan/.syncthing/Documents/Uni/Studium/2022&2023_Wintersemester/Bachelorprojekt
':/home/tuan/.dotfiles/config/.config/nushell
e:/home/tuan/Documents/Uni/Studium/2022&2023_Wintersemester/Bachelorprojekt/LibAFL with EVM/Project/ethfuzz
s:/home/tuan/Pictures/Screenshots
v:/home/tuan/.aya01/Documents/Arbeit/Uni-DuE_NCS_SHK/04_-_Projekte/06-Server_Setup/ansible