AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题

问题[prompt](computer)

Martin Hope
Tyler Shellberg
Asked: 2022-05-21 07:22:09 +0800 CST

FISH - 如何从提示中隐藏主机名/计算机?

  • 5

对于上下文,我使用的是 FISH 3.1.0。

我查看了fish_config,但没有一个提示选项只是删除主机名/计算机,而其余部分保持不变。

有没有办法保留大部分默认提示,但只是在开始时删除该部分?

我只是使用默认提示。这里完全使用type fish_prompt:

fish_prompt is a function with definition
# Defined in /usr/share/fish/functions/fish_prompt.fish @ line 4
function fish_prompt --description 'Write out the prompt'
    set -l last_pipestatus $pipestatus
    set -l normal (set_color normal)

    # Color the prompt differently when we're root
    set -l color_cwd $fish_color_cwd
    set -l prefix
    set -l suffix '>'
    if contains -- $USER root toor
        if set -q fish_color_cwd_root
            set color_cwd $fish_color_cwd_root
        end
        set suffix '#'
    end

    # If we're running via SSH, change the host color.
    set -l color_host $fish_color_host
    if set -q SSH_TTY
        set color_host $fish_color_host_remote
    end

    # Write pipestatus
    set -l prompt_status (__fish_print_pipestatus " [" "]" "|" (set_color 
    $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus)

    echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color 
    $color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) 
(prompt_pwd) $normal (fish_vcs_prompt) $normal $prompt_status $suffix " "                       
end
fish prompt
  • 1 个回答
  • 261 Views
Martin Hope
user1934428
Asked: 2021-06-10 00:28:00 +0800 CST

使 zsh 提示闪烁

  • 6

有没有办法导致(部分)zsh 提示闪烁?我知道我可以设置颜色(用%F/%f)和其他视觉效果(比如%S/%s),但是我没有找到打开闪烁的格式代码。

%?我的最终目标是在当前状态码 ( ) 非零时让部分提示闪烁。

我的 TERM 是xterm-256color。

zsh prompt
  • 1 个回答
  • 370 Views
Martin Hope
ManuelSchneid3r
Asked: 2020-11-29 03:42:42 +0800 CST

在另一种 shell 类型下运行的 shell 脚本中的奇怪 shell 提示符 (PS)

  • 5

当我运行#!/bin/sh包含set -o xtrace交互式脚本的脚本时,zsh我得到的输出看起来很奇怪%F{red}>> %f。显然使用的是我的 PS4,.zshrc但解释 shell 是 sh。我怎样才能避免这种情况?

zsh prompt
  • 1 个回答
  • 23 Views
Martin Hope
Suzana
Asked: 2019-11-20 09:30:11 +0800 CST

将当前时间添加到鱼提示的最简单方法是什么?

  • 11

我想在我的鱼提示中查看当前时间,以便我总能看到,例如当我启动最后一个命令时。我不想安装扩展。

shell prompt
  • 1 个回答
  • 1025 Views
Martin Hope
Bill Daugherty
Asked: 2019-10-30 10:23:14 +0800 CST

如何获得提示的长度?

  • 5

有没有办法可以确定提示的长度?有没有一种方法可以查看PS1变量并从中获取长度并重复相同长度的字符?

我正在尝试为 bash 命令创建一个新的终端提示符。

bash prompt
  • 1 个回答
  • 604 Views
Martin Hope
Chris Muench
Asked: 2019-10-09 05:53:16 +0800 CST

zsh-git-prompt 自定义路径

  • 6
source ~/zsh-git-prompt/zshrc.sh
PROMPT='%B%m%~%b$(git_super_status) %# '

我有zsh-git-prompt的默认配置,如上所示

在我的提示中,它输出:

cmuench-air /Applications/MAMP/htdocs/phppos/PHP-Point-Of-Sale(master|✔) % 

我希望它看起来像这样:

cmuench-air PHP-Point-Of-Sale(master|✔) % 

如何更改配置?

zsh prompt
  • 1 个回答
  • 151 Views
Martin Hope
ChrisWatson
Asked: 2019-09-13 10:14:22 +0800 CST

PS1 定制

  • 5

只是一个快速的。

试图修改我的 PS1 以仅显示特定数量的字符。

目前 :

[email protected]@linuxhostname

这是因为我刚刚在我的环境中集成了一些系统,这些系统允许 windows 用户使用 windows ceredntials 登录到 linux 环境。Hense 双域。

我想删除第一个 @ 符号之后的所有内容,该符号当前适合 \u 开关。

有没有办法告诉 \u 开关只使用说用户名的前 4 个字符。所以我得到的不是“[email protected]”,而是“user”,最终得到 user@linuxhost?

提前致谢!!!

bash prompt
  • 2 个回答
  • 62 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve