Compare commits

...

3 commits

Author SHA1 Message Date
LordMZTE 01abdf5cb6
update nushell config 2024-05-09 15:38:08 +02:00
LordMZTE e50f057de4
switch to nushell 2024-05-09 15:01:31 +02:00
LordMZTE bbabd015e7
implement nushell support 2024-05-09 14:55:59 +02:00
12 changed files with 73 additions and 11 deletions

View file

@ -1,6 +1,6 @@
[main]
opener = xdg-open;
shell = /usr/bin/fish -c;
shell = <% opt.system "which nu" %> -c;
theme = catppuccin-mocha;
show-hidden = true;
mouse-support = true;

View file

@ -0,0 +1,29 @@
$env.config = {
show_banner: false
table: {
mode: reinforced
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
}
def l [] { ls | sort-by type }
def ll [] { ls -la | sort-by type }
def la [] { ls -a | sort-by type }
alias nv = nvim
alias nvide = neovide

View file

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

View file

@ -3,7 +3,7 @@ local opts = {}
opts.mzteinit_entries = {
{ key = "z", label = "river", cmd = { cg.opt.system "which mzteriver" } },
{ key = "h", label = "hyprland", cmd = { "Hyprland" } },
{ key = "s", label = "shell", cmd = { "fish" } },
{ key = "s", label = "shell", cmd = { "nu" } },
{ key = "l", label = "logout", cmd = { "!quit" } },
{ key = "p", label = "shutdown", cmd = { "systemctl", "poweroff" }, quit = true },
{ key = "r", label = "reboot", cmd = { "systemctl", "reboot" }, quit = true },

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

@ -13,7 +13,7 @@ pub fn initOptions() !void {
var buf: [512]u8 = undefined;
// Shell (defaults to mzteinit since that's my login shell)
try opt("fish").setLog("shell", .both);
try opt("nu").setLog("shell", .both);
try cmd("syntax on");

View file

@ -41,12 +41,12 @@ pub fn populateEnvironment(env: *std.process.EnvMap) !bool {
try env.put(kv[0], try std.fmt.bufPrint(&sbuf, "{s}/{s}", .{ home, kv[1] }));
}
// set shell to fish to prevent anything from defaulting to mzteinit
if (try util.findInPath(alloc, "fish")) |fish| {
// set shell to nu to prevent anything from defaulting to mzteinit
if (try util.findInPath(alloc, "nu")) |fish| {
defer alloc.free(fish);
try env.put("SHELL", fish);
} else {
log.warn("fish not found! setting $SHELL to /bin/sh", .{});
log.warn("nu not found! setting $SHELL to /bin/sh", .{});
try env.put("SHELL", "/bin/sh");
}

View file

@ -80,7 +80,7 @@ fn tryMain() !void {
if (env_map.data.get("MZTEINIT")) |_| {
try stdout.writer().writeAll("mzteinit running already, starting shell\n");
try stdout.flush();
var child = std.ChildProcess.init(launch_cmd orelse &.{"fish"}, alloc);
var child = std.ChildProcess.init(launch_cmd orelse &.{"nu"}, alloc);
_ = try child.spawnAndWait();
return;
} else {

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 {