mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-05 03:32:34 +01:00
nushell: utilize jobcontrol plugin
This commit is contained in:
parent
ccac84678e
commit
c34fbf3504
3 changed files with 7 additions and 9 deletions
|
@ -37,12 +37,6 @@ $env.config = {
|
|||
]
|
||||
}
|
||||
|
||||
# Run-in-Background function
|
||||
def & [...argv] {
|
||||
# TODO: Use a plugin to track number of running jobs
|
||||
systemd-run --user --same-dir ...$argv
|
||||
}
|
||||
|
||||
# Aliases
|
||||
def l [path: glob = "."] { ls $path | sort-by type }
|
||||
def ll [path: glob = "."] { ls -la $path | sort-by type }
|
||||
|
|
|
@ -22,7 +22,9 @@ pub fn main() !void {
|
|||
const shell = std.meta.stringToEnum(Shell, std.mem.span(std.os.argv[2])) orelse
|
||||
return error.InvalidShell;
|
||||
|
||||
try shell.writeInitCode(std.mem.span(std.os.argv[0]), stdout.writer());
|
||||
var stdout_buf = std.io.bufferedWriter(stdout.writer());
|
||||
try shell.writeInitCode(std.mem.span(std.os.argv[0]), stdout_buf.writer());
|
||||
try stdout_buf.flush();
|
||||
} else if (std.mem.eql(u8, verb, "show")) {
|
||||
const options = prompt.Options{
|
||||
.status = try std.fmt.parseInt(
|
||||
|
|
|
@ -12,12 +12,14 @@ const setup_fmtstrs = struct {
|
|||
\\
|
||||
;
|
||||
const nu =
|
||||
// https://git.mzte.de/LordMZTE/nu-plugin-jobcontrol
|
||||
\\let mzprompt_has_jobcontrol = (which jobs | length) > 0
|
||||
\\$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
|
||||
\\ $env.MZPROMPT_JOBS = if $mzprompt_has_jobcontrol {{ jobs | length }} else {{ 0 }}
|
||||
\\ {[argv0]s} show
|
||||
\\}}
|
||||
\\
|
||||
|
@ -26,7 +28,7 @@ const setup_fmtstrs = struct {
|
|||
\\$env.PROMPT_INDICATOR = ""
|
||||
\\$env.PROMPT_INDICATOR_VI_INSERT = ""
|
||||
\\$env.PROMPT_INDICATOR_VI_NORMAL = "〉"
|
||||
\\$env.PROMPT_MULTILINE_INDICATOR = "::: "
|
||||
\\$env.PROMPT_MULTILINE_INDICATOR = " | "
|
||||
\\$env.PROMPT_INDICATOR = ""
|
||||
\\
|
||||
;
|
||||
|
|
Loading…
Reference in a new issue