Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: bump up nushell to version 0.72.0 #50

Merged
merged 10 commits into from
Dec 17, 2022
2 changes: 1 addition & 1 deletion .config/alacritty/alacritty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ cursor:
# - (Linux/BSD) user login shell
# - (Windows) powershell
shell:
program: /usr/bin/nu
program: nu
args:
- --login

Expand Down
78 changes: 55 additions & 23 deletions .config/nushell/config.nu
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,70 @@ use core/keybindings.nu *

# The default config record. This is where much of your global configuration is setup.
let-env config = {
filesize_metric: false
table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
use_ls_colors: true
rm_always_trash: false
ls: {
use_ls_colors: true # use the LS_COLORS environment variable to colorize output
clickable_links: false # enable or disable clickable links. Your terminal has to support links.
}
rm: {
always_trash: false # always act as if -t was given. Can be overridden with -p
}
cd: {
abbreviations: true # allows `cd s/o/f` to expand to `cd some/other/folder`
}
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
trim: {
methodology: wrapping # wrapping or truncating
wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology
truncating_suffix: "..." # A suffix used by the 'truncating' methodology
}
}
explore: {
highlight: { bg: 'yellow', fg: 'black' }
status_bar: { bg: '#C4C9C6', fg: '#1D1F21' }
command_bar: { fg: '#C4C9C6' }
split_line: '#404040'
cursor: true
# selected_column: 'blue'
# selected_row: { fg: 'yellow', bg: '#C1C2A3' }
# selected_cell: { fg: 'white', bg: '#777777' }
# line_shift: false,
# line_index: false,
# line_head_top: false,
# line_head_bottom: false,
}
history: {
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"
}
completions: {
case_sensitive: false # set to true to enable case-sensitive completions
quick: true # set this to false to prevent auto-selecting completions when only one remains
partial: true # set this to false to prevent partial filling of the prompt
algorithm: "prefix" # prefix or fuzzy
external: {
enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up my be very slow
max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options
completer: null # check 'carapace_completer' above as an example
}
}
filesize: {
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
}
color_config: (themes base16) # if you want a light theme, replace `(themes dark)` to `(themes light)`
use_grid_icons: true
footer_mode: "25" # always, never, number_of_rows, auto
quick_completions: true # set this to false to prevent auto-selecting completions when only one remains
partial_completions: true # set this to false to prevent partial filling of the prompt
completion_algorithm: "prefix" # prefix, fuzzy
float_precision: 2
#buffer_editor: "helix" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
use_ansi_coloring: true
filesize_format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
edit_mode: vi # emacs, vi
max_history_size: 10000 # Session has to be reloaded for this to take effect
sync_history_on_enter: true # Enable to share the history between multiple sessions, else you have to close the session to persist history to file
history_file_format: "plaintext" # "sqlite" or "plaintext"
shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue
cd_with_abbreviations: false # set to true to allow you to do things like cd s/o/f and nushell expand it to cd some/other/folder
case_sensitive_completions: false # set to true to enable case-sensitive completions
enable_external_completion: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up my be very slow
max_external_completion_results: 100 # setting it lower can improve completion performance at the cost of omitting some options
# A strategy of managing table view in case of limited space.
table_trim: {
methodology: wrapping, # truncating
# A strategy which will be used by 'wrapping' methodology
wrapping_try_keep_words: true,
# A suffix which will be used with 'truncating' methodology
# truncating_suffix: "..."
}
show_banner: false # true or false to enable or disable the banner
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: (hooks)
menus: (menus)
keybindings: (keybindings)
Expand Down
20 changes: 11 additions & 9 deletions .config/nushell/env.nu
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ def spwd [] {

let spwd_len = (($spwd_paths | length) - 1)

for -n i in $spwd_paths {
let spwd_src = ($i.item | split chars)
$spwd_paths
| each {|el id|
let spwd_src = ($el | split chars)

if ($i.index == $spwd_len) {
$i.item
if ($id == $spwd_len) {
$el
} else if ($spwd_src.0 == ".") {
$".($spwd_src.1)"
} else {
$"($spwd_src.0)"
}
} |
str join $sep
}
| str collect $sep
}


Expand All @@ -60,7 +61,8 @@ def build-prompt [
}

let tokens = (
for i in (seq 1 ($len - 1)) {
seq 1 ($len - 1)
| each {|i|
let sep = {
fg: ($segments | get ($i - 1) | get bg),
bg: ($segments | get $i | get bg),
Expand All @@ -72,8 +74,8 @@ def build-prompt [
text: $" ($segments | get $i | get text) "
}
$sep | append $text
} |
flatten
}
| flatten
)

let last = {
Expand Down
2 changes: 1 addition & 1 deletion .config/nushell/lib/applications/dotfiles.nu
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export def "worktree add" [
let branch = (
$branches |
str replace " " "" |
sort --insensitive |
sort --ignore-case |
to text |
str replace --all "\\* (.*)" $"(ansi red)\$1(ansi reset)" |
str replace --all "\\+ (.*)" $"(ansi yellow)\$1(ansi reset)" |
Expand Down
11 changes: 6 additions & 5 deletions .config/nushell/lib/applications/hx.nu
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ export def "get lsp" [
}

let lsp = (
for language -n in $languages {
$languages
| each {|language id|
if ($progress) {
print -n $"(ansi erase_line)"
print -n $"loading language support [($language.index + 1) / ($languages | length)]: ($language.item)\r"
print -n $"loading language support [($id + 1) / ($languages | length)]: ($language)\r"
}

{language: $language.item} |
merge {
hx --health $language.item | lines | split column ": " | transpose -ird
}
merge (
helix --health $language.item | lines | split column ": " | transpose -ird
)
}
)
if ($progress) {
Expand Down
4 changes: 2 additions & 2 deletions .config/nushell/lib/applications/repo.nu
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def pick_repo [
ghq list |
lines |
str replace ".com/" ": " |
sort --insensitive |
sort --ignore-case |
prompt fzf_ask $prompt |
str replace ": " ".com/"
)
Expand Down Expand Up @@ -78,7 +78,7 @@ export def pull [
gh repo list $owner --json name |
from json |
get name |
sort --insensitive |
sort --ignore-case |
uniq |
prompt fzf_ask $"Please choose a repo to pull from https://github.com/($owner)"
)
Expand Down
6 changes: 3 additions & 3 deletions .config/nushell/lib/applications/vm.nu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def list_remote_os [] {
get OS |
sort |
uniq |
sort --insensitive
sort --ignore-case
}


Expand All @@ -26,7 +26,7 @@ def list_release_for_os [os: string] {
split column " " |
transpose |
get column1 |
sort --insensitive |
sort --ignore-case |
uniq
}

Expand Down Expand Up @@ -73,7 +73,7 @@ def base_list [] {
|it|
$it | path basename
} |
sort --insensitive |
sort --ignore-case |
uniq
}

Expand Down