Update various configuration files
Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# Nushell Config File
|
||||
#
|
||||
# version = 0.79.1
|
||||
|
||||
# For more information on defining custom themes, see
|
||||
# https://www.nushell.sh/book/coloring_and_theming.html
|
||||
@@ -12,7 +14,7 @@ let dark_theme = {
|
||||
empty: blue
|
||||
# Closures can be used to choose colors for specific values.
|
||||
# The value (in this case, a bool) is piped into the closure.
|
||||
bool: { || if $in { 'light_cyan' } else { 'light_gray' } }
|
||||
bool: {|| if $in { 'light_cyan' } else { 'light_gray' } }
|
||||
int: white
|
||||
filesize: {|e|
|
||||
if $e == 0b {
|
||||
@@ -22,23 +24,23 @@ let dark_theme = {
|
||||
} else { 'blue' }
|
||||
}
|
||||
duration: white
|
||||
date: { || (date now) - $in |
|
||||
date: {|| (date now) - $in |
|
||||
if $in < 1hr {
|
||||
'red3b'
|
||||
'purple'
|
||||
} else if $in < 6hr {
|
||||
'orange3'
|
||||
'red'
|
||||
} else if $in < 1day {
|
||||
'yellow3b'
|
||||
'yellow'
|
||||
} else if $in < 3day {
|
||||
'chartreuse2b'
|
||||
'green'
|
||||
} else if $in < 1wk {
|
||||
'green3b'
|
||||
'light_green'
|
||||
} else if $in < 6wk {
|
||||
'darkturquoise'
|
||||
'cyan'
|
||||
} else if $in < 52wk {
|
||||
'deepskyblue3b'
|
||||
'blue'
|
||||
} else { 'dark_gray' }
|
||||
}
|
||||
}
|
||||
range: white
|
||||
float: white
|
||||
string: white
|
||||
@@ -55,6 +57,7 @@ let dark_theme = {
|
||||
shape_binary: purple_bold
|
||||
shape_block: blue_bold
|
||||
shape_bool: light_cyan
|
||||
shape_closure: green_bold
|
||||
shape_custom: green
|
||||
shape_datetime: cyan_bold
|
||||
shape_directory: cyan
|
||||
@@ -64,12 +67,13 @@ let dark_theme = {
|
||||
shape_flag: blue_bold
|
||||
shape_float: purple_bold
|
||||
# shapes are used to change the cli syntax highlighting
|
||||
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
|
||||
shape_garbage: { fg: white bg: red attr: b}
|
||||
shape_globpattern: cyan_bold
|
||||
shape_int: purple_bold
|
||||
shape_internalcall: cyan_bold
|
||||
shape_list: cyan_bold
|
||||
shape_literal: blue
|
||||
shape_match_pattern: green
|
||||
shape_matching_brackets: { attr: u }
|
||||
shape_nothing: light_cyan
|
||||
shape_operator: yellow
|
||||
@@ -83,6 +87,7 @@ let dark_theme = {
|
||||
shape_string_interpolation: cyan_bold
|
||||
shape_table: blue_bold
|
||||
shape_variable: purple
|
||||
shape_vardecl: purple
|
||||
}
|
||||
|
||||
let light_theme = {
|
||||
@@ -93,7 +98,7 @@ let light_theme = {
|
||||
empty: blue
|
||||
# Closures can be used to choose colors for specific values.
|
||||
# The value (in this case, a bool) is piped into the closure.
|
||||
bool: { || if $in { 'dark_cyan' } else { 'dark_gray' } }
|
||||
bool: {|| if $in { 'dark_cyan' } else { 'dark_gray' } }
|
||||
int: dark_gray
|
||||
filesize: {|e|
|
||||
if $e == 0b {
|
||||
@@ -103,21 +108,21 @@ let light_theme = {
|
||||
} else { 'blue_bold' }
|
||||
}
|
||||
duration: dark_gray
|
||||
date: { || (date now) - $in |
|
||||
date: {|| (date now) - $in |
|
||||
if $in < 1hr {
|
||||
'red3b'
|
||||
'purple'
|
||||
} else if $in < 6hr {
|
||||
'orange3'
|
||||
'red'
|
||||
} else if $in < 1day {
|
||||
'yellow3b'
|
||||
'yellow'
|
||||
} else if $in < 3day {
|
||||
'chartreuse2b'
|
||||
'green'
|
||||
} else if $in < 1wk {
|
||||
'green3b'
|
||||
'light_green'
|
||||
} else if $in < 6wk {
|
||||
'darkturquoise'
|
||||
'cyan'
|
||||
} else if $in < 52wk {
|
||||
'deepskyblue3b'
|
||||
'blue'
|
||||
} else { 'dark_gray' }
|
||||
}
|
||||
range: dark_gray
|
||||
@@ -136,6 +141,7 @@ let light_theme = {
|
||||
shape_binary: purple_bold
|
||||
shape_block: blue_bold
|
||||
shape_bool: light_cyan
|
||||
shape_closure: green_bold
|
||||
shape_custom: green
|
||||
shape_datetime: cyan_bold
|
||||
shape_directory: cyan
|
||||
@@ -145,12 +151,13 @@ let light_theme = {
|
||||
shape_flag: blue_bold
|
||||
shape_float: purple_bold
|
||||
# shapes are used to change the cli syntax highlighting
|
||||
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
|
||||
shape_garbage: { fg: white bg: red attr: b}
|
||||
shape_globpattern: cyan_bold
|
||||
shape_int: purple_bold
|
||||
shape_internalcall: cyan_bold
|
||||
shape_list: cyan_bold
|
||||
shape_literal: blue
|
||||
shape_match_pattern: green
|
||||
shape_matching_brackets: { attr: u }
|
||||
shape_nothing: light_cyan
|
||||
shape_operator: yellow
|
||||
@@ -164,6 +171,7 @@ let light_theme = {
|
||||
shape_string_interpolation: cyan_bold
|
||||
shape_table: blue_bold
|
||||
shape_variable: purple
|
||||
shape_vardecl: purple
|
||||
}
|
||||
|
||||
# External completer example
|
||||
@@ -174,6 +182,8 @@ let light_theme = {
|
||||
|
||||
# The default config record. This is where much of your global configuration is setup.
|
||||
let-env config = {
|
||||
# true or false to enable or disable the welcome banner at startup
|
||||
show_banner: false
|
||||
ls: {
|
||||
use_ls_colors: true # use the LS_COLORS environment variable to colorize output
|
||||
clickable_links: true # enable or disable clickable links. Your terminal has to support links.
|
||||
@@ -186,6 +196,8 @@ let-env config = {
|
||||
}
|
||||
table: {
|
||||
mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
|
||||
index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column
|
||||
show_empty: true # show 'empty list' and 'empty record' placeholders for command output
|
||||
trim: {
|
||||
methodology: wrapping # wrapping or truncating
|
||||
wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology
|
||||
@@ -254,6 +266,7 @@ let-env config = {
|
||||
max_size: 10000 # Session has to be reloaded for this to take effect
|
||||
sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file
|
||||
file_format: "plaintext" # "sqlite" or "plaintext"
|
||||
# history_isolation: true # true enables history isolation, false disables it. true will allow the history to be isolated to the current session. false will allow the history to be shared across all sessions.
|
||||
}
|
||||
completions: {
|
||||
case_sensitive: false # set to true to enable case-sensitive completions
|
||||
@@ -270,7 +283,11 @@ let-env config = {
|
||||
metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard)
|
||||
format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
|
||||
}
|
||||
|
||||
cursor_shape: {
|
||||
emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default)
|
||||
vi_insert: block # block, underscore, line , blink_block, blink_underscore, blink_line (block is the default)
|
||||
vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default)
|
||||
}
|
||||
color_config: $dark_theme # if you want a light theme, replace `$dark_theme` to `$light_theme`
|
||||
use_grid_icons: true
|
||||
footer_mode: "25" # always, never, number_of_rows, auto
|
||||
@@ -279,26 +296,27 @@ let-env config = {
|
||||
use_ansi_coloring: true
|
||||
edit_mode: emacs # emacs, vi
|
||||
shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue
|
||||
# true or false to enable or disable the welcome banner at startup
|
||||
show_banner: false
|
||||
render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt.
|
||||
|
||||
#hooks: {
|
||||
# pre_prompt: [{ ||
|
||||
# null # replace with source code to run before the prompt is shown
|
||||
# }]
|
||||
# pre_execution: [{ ||
|
||||
# null # replace with source code to run before the repl input is run
|
||||
# }]
|
||||
# env_change: { ||
|
||||
# PWD: [{|before, after|
|
||||
# null # replace with source code to run if the PWD environment is different since the last repl input
|
||||
# }]
|
||||
# }
|
||||
# display_output: { ||
|
||||
# if (term size).columns >= 100 { table -e } else { table }
|
||||
# }
|
||||
#}
|
||||
hooks: {
|
||||
pre_prompt: [{||
|
||||
null # replace with source code to run before the prompt is shown
|
||||
}]
|
||||
pre_execution: [{||
|
||||
null # replace with source code to run before the repl input is run
|
||||
}]
|
||||
env_change: {
|
||||
PWD: [{|before, after|
|
||||
null # replace with source code to run if the PWD environment is different since the last repl input
|
||||
}]
|
||||
}
|
||||
display_output: {||
|
||||
if (term size).columns >= 100 { table -e } else { table }
|
||||
}
|
||||
command_not_found: {||
|
||||
null # replace with source code to return an error message when a command is not found
|
||||
}
|
||||
}
|
||||
menus: [
|
||||
# Configuration for default nushell menus
|
||||
# Note the lack of source parameter
|
||||
@@ -520,16 +538,19 @@ let-env config = {
|
||||
event: { send: menu name: commands_with_description }
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
def add_soft [project] { git remote add soft $"ssh://git.aya00:/($project)" }
|
||||
export def-env own_ranger [] {
|
||||
let lastdir_path = $"($env.HOME)/.rangerdir";
|
||||
^ranger $"--choosedir=($lastdir_path)";
|
||||
let lastdir = (open $lastdir_path);
|
||||
cd $lastdir
|
||||
}
|
||||
|
||||
alias ll = ls -la
|
||||
alias la = ls -a
|
||||
alias q = exit
|
||||
alias e = emacsclient -t
|
||||
alias ekill = (pkill emacs;pkill emacsclient;emacs --daemon)
|
||||
alias picotik = picocom --b 115199 /dev/ttyUSB0
|
||||
alias nmap = ^nmap -T5 --min-parallelism 100 -Pn
|
||||
alias ed = emacs --daemon
|
||||
@@ -540,6 +561,7 @@ alias wttr = curl wttr.in/Essen
|
||||
alias tvres = xrandr --output HDMI1 --transform 1.02,0,-20,0,1.02,-10,0,0,1
|
||||
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
|
||||
|
||||
# git
|
||||
alias gpa = git push all --all
|
||||
|
||||
@@ -1,39 +1,58 @@
|
||||
# Nushell Environment Config File
|
||||
#
|
||||
# version = 0.79.1
|
||||
|
||||
def create_left_prompt [] {
|
||||
let home = ($env | get -i (if $nu.os-info.name == "windows" { "USERPROFILE" } else { "HOME" }) | into string)
|
||||
mut home = ""
|
||||
try {
|
||||
if $nu.os-info.name == "windows" {
|
||||
$home = $env.USERPROFILE
|
||||
} else {
|
||||
$home = $env.HOME
|
||||
}
|
||||
}
|
||||
|
||||
let dir = ([
|
||||
($env.PWD | str substring 0..($home | str length) | str replace -s $home "~"),
|
||||
($env.PWD | str substring 0..($home | str length) | str replace --string $home "~"),
|
||||
($env.PWD | str substring ($home | str length)..)
|
||||
] | str join)
|
||||
|
||||
let path_segment = if (is-admin) {
|
||||
$"(ansi red_bold)($dir)"
|
||||
} else {
|
||||
$"(ansi green_bold)($dir)"
|
||||
}
|
||||
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
|
||||
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
|
||||
let path_segment = $"($path_color)($dir)"
|
||||
|
||||
$path_segment
|
||||
$path_segment | str replace --all --string (char path_sep) $"($separator_color)/($path_color)"
|
||||
}
|
||||
|
||||
def create_right_prompt [] {
|
||||
let time_segment = ([
|
||||
(date now | date format '%m/%d/%Y %r')
|
||||
] | str join)
|
||||
let time_segment_color = (ansi magenta)
|
||||
|
||||
$time_segment
|
||||
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}")
|
||||
|
||||
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
|
||||
(ansi rb)
|
||||
($env.LAST_EXIT_CODE)
|
||||
] | str join)
|
||||
} else { "" }
|
||||
|
||||
([$last_exit_code, (char space), $time_segment] | str join)
|
||||
}
|
||||
|
||||
# Use nushell functions to define your right and left prompt
|
||||
let-env PROMPT_COMMAND = { || create_left_prompt }
|
||||
let-env PROMPT_COMMAND = {|| create_left_prompt }
|
||||
let-env PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
|
||||
|
||||
# The prompt indicators are environmental variables that represent
|
||||
# the state of the prompt
|
||||
let-env PROMPT_INDICATOR = { || "〉" }
|
||||
let-env PROMPT_INDICATOR_VI_INSERT = { || ": " }
|
||||
let-env PROMPT_INDICATOR_VI_NORMAL = { || "〉" }
|
||||
let-env PROMPT_MULTILINE_INDICATOR = { || "::: " }
|
||||
let-env PROMPT_INDICATOR = {|| "> " }
|
||||
let-env PROMPT_INDICATOR_VI_INSERT = {|| ": " }
|
||||
let-env PROMPT_INDICATOR_VI_NORMAL = {|| "> " }
|
||||
let-env PROMPT_MULTILINE_INDICATOR = {|| "::: " }
|
||||
|
||||
# Specifies how environment variables are:
|
||||
# - converted from a string to a value on Nushell startup (from_string)
|
||||
@@ -41,12 +60,12 @@ let-env PROMPT_MULTILINE_INDICATOR = { || "::: " }
|
||||
# Note: The conversions happen *after* config.nu is loaded
|
||||
let-env ENV_CONVERSIONS = {
|
||||
"PATH": {
|
||||
from_string: { |s| $s | split row (char esep) | path expand -n }
|
||||
to_string: { |v| $v | path expand -n | str join (char esep) }
|
||||
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 -n }
|
||||
to_string: { |v| $v | path expand -n | str join (char esep) }
|
||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,17 +73,18 @@ let-env ENV_CONVERSIONS = {
|
||||
#
|
||||
# By default, <nushell-config-dir>/scripts is added
|
||||
let-env NU_LIB_DIRS = [
|
||||
($nu.config-path | path dirname | path join 'scripts')
|
||||
($nu.default-config-dir | path join 'scripts')
|
||||
]
|
||||
|
||||
# Directories to search for plugin binaries when calling register
|
||||
#
|
||||
# By default, <nushell-config-dir>/plugins is added
|
||||
let-env NU_PLUGIN_DIRS = [
|
||||
($nu.config-path | path dirname | path join 'plugins')
|
||||
($nu.default-config-dir | path join 'plugins')
|
||||
]
|
||||
|
||||
let-env GOPATH = ($env.HOME + '/.go/')
|
||||
let-env GOBIN = ($env.GOPATH + 'bin/')
|
||||
|
||||
# To add entries to PATH (on Windows you might use Path), you can use the following pattern:
|
||||
# let-env PATH = ($env.PATH | split row (char esep) | prepend '/some/path')
|
||||
let-env VISUAL = 'emacsclient -t'
|
||||
let-env EDITOR = 'emacsclient -t'
|
||||
let-env PATH = ($env.PATH | split row (char esep) | prepend '~/.cargo/bin' | prepend '~/.emacs.d/bin/' | prepend $env.GOBIN)
|
||||
|
||||
9
config/.config/nushell/login.nu
Normal file
9
config/.config/nushell/login.nu
Normal file
@@ -0,0 +1,9 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user