implement nushell support

This commit is contained in:
LordMZTE 2024-05-09 14:55:59 +02:00
parent 1d0fb8136d
commit bbabd015e7
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
7 changed files with 61 additions and 4 deletions

View file

@ -0,0 +1,25 @@
# The default config record. This is where much of your global configuration is setup.
$env.config = {
show_banner: false
table: {
mode: reinforced
index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column
padding: { left: 0, right: 0 }
header_on_separator: true
}
completions: {
algorithm: "fuzzy"
}
cursor_shape: {
vi_insert: line
vi_normal: block
}
edit_mode: vi
shell_integration: true
use_kitty_protocol: true
highlight_resolved_externals: true
}

View file

@ -0,0 +1,5 @@
# Nushell Environment Config File
#
# version = "0.92.1"
<% opt.system "prompt setup nu" %>

View file

@ -0,0 +1,2 @@
(local nu (require :nu))
(nu.setup {})

View file

@ -7,7 +7,7 @@
;; Nix based parsers
(let [path mztenv.reg.tree_sitter_parsers]
(when path
(vim.opt.runtimepath:append path)))
(vim.opt.runtimepath:prepend path)))
(var parser-config (parsers.get_parser_configs))
@ -16,7 +16,11 @@
:branch :main}
:filetype :haxe})
(configs.setup {:highlight {:enable true}
(local install-dir (.. (vim.loop.os_homedir) :/.local/share/nvim/ts-parsers))
(vim.opt.runtimepath:append install-dir)
(configs.setup {:parser_install_dir install-dir
:highlight {:enable true}
:autotag {:enable true}
:indent {:enable true}
:playground {:enable true}

View file

@ -33,7 +33,8 @@
:recorder
:tsn-actions
:dressing
:gitsigns])
:gitsigns
:nu])
(local errors {})

View file

@ -108,7 +108,7 @@ fn Renderer(comptime Writer: type) type {
fn renderShell(self: *Self) !void {
switch (self.options.shell) {
.fish => {},
.fish, .nu => {},
.bash => {
const bgcol = Color{ .Grey = 150 };
const fgcol = Color.Black;

View file

@ -11,6 +11,25 @@ const setup_fmtstrs = struct {
\\end
\\
;
const nu =
\\$env.PROMPT_COMMAND = {{ ||
\\ $env.MZPROMPT_SHELL = "nu"
\\ $env.MZPROMPT_STATUS = $env.LAST_EXIT_CODE
\\ $env.MZPROMPT_VI_MODE = "_none"
\\ $env.MZPROMPT_DURATION = $env.CMD_DURATION_MS
\\ $env.MZPROMPT_JOBS = 0
\\ {[argv0]s} show
\\}}
\\
\\$env.PROMPT_COMMAND_RIGHT = ""
\\
\\$env.PROMPT_INDICATOR = ""
\\$env.PROMPT_INDICATOR_VI_INSERT = ""
\\$env.PROMPT_INDICATOR_VI_NORMAL = "〉"
\\$env.PROMPT_MULTILINE_INDICATOR = "::: "
\\$env.PROMPT_INDICATOR = ""
\\
;
const bash =
\\__mzprompt_show() {{
\\ export MZPROMPT_STATUS="$?"
@ -27,6 +46,7 @@ const setup_fmtstrs = struct {
pub const Shell = enum {
fish,
nu,
bash,
pub fn writeInitCode(self: Shell, argv0: []const u8, writer: anytype) !void {