https://wiki.archlinux.org/api.php?action=feedcontributions&user=Liu-shuyuan&feedformat=atom
ArchWiki - User contributions [en]
2024-03-29T06:58:10Z
User contributions
MediaWiki 1.41.0
https://wiki.archlinux.org/index.php?title=Installation_guide_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=675370
Installation guide (简体中文)
2021-06-03T14:24:56Z
<p>Liu-shuyuan: Make a sentence more natural</p>
<hr />
<div>[[Category:Installation process (简体中文)]]<br />
[[ar:Installation guide]]<br />
[[bg:Installation guide]]<br />
[[bs:Installation guide]]<br />
[[cs:Installation guide]]<br />
[[de:Arch Install Scripts]]<br />
[[el:Installation guide]]<br />
[[en:Installation guide]]<br />
[[es:Installation guide]]<br />
[[fa:راهنمای تازهکاران]]<br />
[[fi:Installation guide]]<br />
[[fr:Arch install scripts]]<br />
[[hr:Installation guide]]<br />
[[hu:Installation guide]]<br />
[[id:Installation guide]]<br />
[[it:Installation guide]]<br />
[[ja:インストールガイド]]<br />
[[ko:Installation guide]]<br />
[[lt:Installation guide]]<br />
[[nl:Installation guide]]<br />
[[pl:Installation guide]]<br />
[[pt:Installation guide]]<br />
[[ru:Installation guide]]<br />
[[sk:Installation guide]]<br />
[[sv:Installation guide]]<br />
[[th:Installation guide]]<br />
[[tr:Installation guide]]<br />
[[uk:Installation guide]]<br />
[[zh-hant:Installation guide]]<br />
{{TranslationStatus (简体中文)|Installation guide|2021-4-30|659704}}<br />
本文将指导如何用官方安装镜像启动的 Live 系统安装 [[Arch Linux (简体中文)|Arch Linux]]。安装介质现提供无障碍辅助功能,对此 [[Install Arch Linux with accessibility options|使用无障碍辅助选项安装 Arch Linux (英文)]] 页面有详细描述。关于其它的安装方法, 请参阅 [[:Category:Installation process]]。<br />
<br />
建议在安装前阅读 [[FAQ (简体中文)|FAQ]]。对于本文中使用的惯用术语,请参阅 [[Help:Reading (简体中文)|Help:Reading]]。请将代码中{{ic|''斜体''}}的部分按实际情况替换成具体内容。<br />
<br />
有关更详细的说明,请阅读本指南内相应的 [[ArchWiki:About (简体中文)|ArchWiki]] 文章或各类程序的[[Man page (简体中文)|手册]]。有关配置的概述,请参阅 {{man|7|archlinux}}{{Dead link (简体中文)|2021|02|08}}。若需要交互帮助,可以使用 [[IRC channel|IRC 频道]]和[https://bbs.archlinux.org/ 论坛]。<br />
<br />
Arch Linux 能运行在最少 512 MiB 内存的 [[w:zh:X86-64|x86_64]] 机器上,但从安装媒介启动系统并成功安装需要更多的内存。[https://lists.archlinux.org/pipermail/arch-releng/2020-May/003957.html] 基本安装将占用小于 2 GiB 的存储空间。由于安装过程中需要从远程存储库获取软件包,计算机将需要一个有效的互联网连接。<br />
<br />
== 安装前的准备 ==<br />
<br />
=== 获取安装映像 ===<br />
<br />
访问 [https://archlinux.org/download/ 下载] 页面,并根据需要的引导方式,获取 ISO 文件或 netboot 映像以及相应的 [[GnuPG]] 签名。<br />
<br />
=== 验证签名 ===<br />
<br />
建议使用前先验证所下载文件的签名,特别是从 ''HTTP 镜像源'' 下载的文件,因为 HTTP 连接一般来说容易遭到拦截而 [http://www2.cs.arizona.edu/stork/packagemanagersecurity/attacks-on-package-managers.html 提供恶意镜像]。<br />
<br />
在一台已经安装 [[GnuPG]] 的系统上,可通过下载 ''PGP 签名'' (在 [https://archlinux.org/download/ 下载] 页面的 ''Checksums'' 下方) 到 ISO 文件所在的路径,然后用以下方式 [[GnuPG#Verify a signature|验证]]:<br />
<br />
$ gpg --keyserver-options auto-key-retrieve --verify archlinux-''version''-x86_64.iso.sig<br />
<br />
另外,在一台已经安装 Arch Linux 的计算机上可以通过以下方式验证:<br />
<br />
$ pacman-key -v archlinux-''version''-x86_64.iso.sig<br />
<br />
{{注意|<br />
* 如果安装映像是从镜像站点下载,而不是从 [https://archlinux.org/download/ archlinux.org] 下载的话,则签名是可以被伪造的。在这种情况下,请确保用来解码签名的公钥是被另一个可信的密钥签署的。{{ic|gpg}} 命令将会输出公钥的指纹。<br />
* 另一种验证签名的方法是确保公钥的指纹等于其中一位签署了 ISO 文件 [https://archlinux.org/people/developers/ Arch Linux 开发者]的指纹。请参阅 [[Wikipedia:Public-key_cryptography]] 获取更多关于公钥加密的信息。<br />
}}<br />
<br />
=== 准备安装映像 ===<br />
<br />
安装映像可以通过 [[USB flash installation medium|USB 闪存盘]]、[[Optical disc drive#Burning|光盘]]和带 [[PXE]] 的网络提供给目标机器:请按照合适的文章,使用所选映像为自己准备安装介质。<br />
<br />
=== 启动到 Live 环境 ===<br />
<br />
{{注意|Arch Linux 安装镜像不支持安全启动(Secure Boot)。要引导安装媒介,需要 [[Unified Extensible Firmware Interface/Secure Boot#Disabling Secure Boot|禁用安全启动]]。如果需要,可在完成安装后重新配置 [[Secure Boot|安全启动]]。}}<br />
{{注意|如果您的电脑不支持 Linux,请参阅 [[不支持 Linux 的电脑 (简体中文)]]}}<br />
<br />
# 选择从带有 Arch 安装文件的媒介启动,通常是要在 [[w:Power-on self test|计算机开机自检]] 时按下某个按键,一般在启动画面会有提示。具体情况请参考主板说明书。<br />
# 当引导加载程序菜单出现时,选择 ''Arch Linux install medium'' 并按 {{ic|Enter}} 进入安装环境。{{提示|安装映像使用 [[systemd-boot]] 在 UEFI 模式下引导,使用 [[syslinux]] 在 BIOS 模式下引导。请参阅 [https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/docs/README.bootparams README.bootparams] 获取 [[Kernel parameters#Configuration|引导参数]] 列表。}}<br />
# 您将会以 root 身份登录进一个[[Wikipedia:Virtual console|虚拟控制台]],默认的 Shell 是 [[Zsh]]。<br />
<br />
如果想一边安装,一边使用 [https://lynx.invisible-island.net/lynx_help/Lynx_users_guide.html Lynx] 查看本指南,可以使用 {{ic|Alt+''箭头''}} [[Keyboard shortcuts|快捷键]]切换不同的控制台。要[[textedit|编辑]]配置文件,可以使用 {{man|1|mcedit}}、[[nano#Usage|nano]] 和 [[vim#Usage|vim]]。请参阅 [https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/configs/releng/packages.x86_64 packages.x86_64] 获取安装介质中包含的软件包列表。<br />
<br />
=== 键盘布局 ===<br />
<br />
[[Keyboard_configuration_in_console|控制台键盘布局]]默认为 {{ic|us}}(美式键盘映射)。列出所有可用的键盘布局,可以使用:<br />
<br />
# ls /usr/share/kbd/keymaps/**/*.map.gz<br />
<br />
如果您想要更改键盘布局,可以将一致的文件名添加进 {{man|1|loadkeys}},但请省略路径和扩展名。比如,要添加 [[Wikipedia:File:KB_Germany.svg|German]] 键盘布局:<br />
<br />
# loadkeys de-latin1<br />
<br />
[[Console fonts|控制台字体]] 位于 {{ic|/usr/share/kbd/consolefonts/}} 目录中,设置方式请参考 {{man|8|setfont}}。<br />
<br />
根据 [[Getting and installing Arch (简体中文)|获取和安装 Arch Linux]] 中所述,下载并引导安装介质。启动完成后将会自动以 root 身份登录虚拟控制台并进入 [[Zsh (简体中文)|Zsh]] 命令提示符。<br />
<br />
=== 验证启动模式 ===<br />
<br />
要验证启动模式,请用下列命令列出 [[efivars]] 目录:<br />
<br />
# ls /sys/firmware/efi/efivars<br />
<br />
如果命令没有错误地显示了目录,则系统以 UEFI 模式启动。 如果目录不存在,系统可能以 [[w:BIOS|BIOS]] 模式 (或 [[Wikipedia:Compatibility Support Module|CSM]] 模式) 启动。如果系统未以您想要的模式引导启动,请参考您的主板手册。<br />
<br />
=== 连接到因特网 ===<br />
<br />
要在 Live 环境中配置网络连接,请跟随以下步骤:<br />
<br />
* 确保系统已经启用了 [[Network configuration#Network interfaces|网络接口]],用 {{man|8|ip-link}} 检查: <br>{{bc|# ip link}}<br />
<br />
* 对于无线局域网(Wi-Fi)和无线广域网(WWAN),请确保网卡未被 [[rfkill]] 禁用。<br />
<br />
* 要连接到网络:<br />
** 有线以太网 —— 连接网线。<br />
** WiFi —— 使用 [[iwctl]] 验证无线网络。<br />
** 移动宽带调制解调器(移动网卡) - 使用 [[mmcli]] 实用程序连接到移动网络。<br />
<br />
* 配置网络连接:<br />
** [[DHCP]]: 动态 IP 地址和 DNS 服务器分配(由 [[systemd-networkd]] 和 [[systemd-resolved]] 提供机能)对于 [https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/configs/releng/airootfs/etc/systemd/network/20-ethernet.network 有线以太网]、[https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/configs/releng/airootfs/etc/systemd/network/20-wlan.network 无线局域网(WLAN)] 和 [https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/configs/releng/airootfs/etc/systemd/network/20-wwan.network 无线广域网(WWAN)] 网络接口来说应该能开箱即用。<br />
** 静态 IP 地址: 按照 [[Network configuration#Static IP address]] 进行操作。<br />
<br />
* 用 [[w:ping (networking utility)|ping]] 检查网络连接: {{bc|# ping archlinux.org}}<br />
<br />
{{注意|默认情况下,安装映像已预配置好并启用了 [[systemd-networkd]]、[[systemd-resolved]]、[[iwd (简体中文)|iwd]] 和 [[ModemManager]]。但已经安装好了的系统并非如此。}}<br />
<br />
=== 更新系统时间 ===<br />
<br />
使用 {{man|1|timedatectl}} 确保系统时间是准确的:<br />
<br />
# timedatectl set-ntp true<br />
<br />
可以使用 {{ic|timedatectl status}} 检查服务状态。<br />
<br />
=== 建立硬盘分区 ===<br />
<br />
磁盘若被系统识别到,就会被分配为一个[[Wikipedia:zh:设备文件系统#命名约定|块设备]],如 {{ic|/dev/sda}}, {{ic|/dev/nvme0n1}} 或 {{ic|/dev/mmcblk0}}。可以使用 [[lsblk]] 或者 ''fdisk'' 查看:<br />
<br />
# fdisk -l<br />
<br />
结果中以 {{ic|rom}},{{ic|loop}} 或者 {{ic|airoot}} 结束的可以被忽略。<br />
<br />
对于一个选定的设备,以下的''分区''是必须要有的:<br />
<br />
* 一个根分区(挂载在 [[Wikipedia:Root directory|根目录]]){{ic|/}};<br />
* 要在 [[UEFI]] 模式中启动,还需要一个 [[EFI system partition|EFI 系统分区]]。<br />
<br />
如果需要创建多级存储例如 [[LVM]]、[[disk encryption]] 或 [[RAID]],请在此时完成。<br />
<br />
请使用 [[Fdisk (简体中文)|fdisk]] 或 [[Parted (简体中文)|parted]] 修改分区表。例如:<br />
<br />
# fdisk ''/dev/the_disk_to_be_partitioned(要被分区的磁盘)''<br />
<br />
==== 分区示例 ====<br />
<br />
{| class="wikitable"<br />
|+ BIOS 与 [[Partitioning (简体中文)#Master_Boot_Record|MBR]]<br />
|-<br />
! 挂载点<br />
! 分区<br />
! [[w:Partition type|分区类型]]<br />
! 建议大小<br />
|-<br />
| {{ic|[SWAP]}}<br />
| {{ic|/dev/''swap_partition(交换空间分区)''}}<br />
| Linux swap (交换空间)<br />
| 大于 512 MiB<br />
|-<br />
| {{ic|/mnt}}<br />
| {{ic|/dev/''root_partition(根分区)''}}<br />
| Linux<br />
| 剩余空间<br />
|}<br />
<br />
{| class="wikitable"<br />
|+ UEFI 与 [[Partitioning (简体中文)#GUID 分区表|GPT]]<br />
|-<br />
! 挂载点<br />
! 分区<br />
! [[w:GUID_Partition_Table#Partition_type_GUIDs|分区类型]]<br />
! 建议大小<br />
|-<br />
| {{ic|/mnt/boot}} 或 {{ic|/mnt/efi}}<br />
| {{ic|/dev/''efi_system_partition(efi 系统分区)''}}<br />
| [[EFI_system_partition (简体中文)|EFI 系统分区]]<br />
| 至少 260 MiB<br />
|-<br />
| {{ic|[SWAP]}}<br />
| {{ic|/dev/''swap_partition(交换空间分区)''}}<br />
| Linux swap (交换空间)<br />
| 大于 512 MiB<br />
|-<br />
| {{ic|/mnt}}<br />
| {{ic|/dev/''root_partition(根分区)''}}<br />
| Linux x86-64 根目录 (/)<br />
| 剩余空间<br />
|}<br />
<br />
另请参阅 [[Partitioning (简体中文)#布局示例|布局示例]]。<br />
<br />
{{注意|<br />
* 如果文件系统支持,[[Swap (简体中文)|交换空间]]也可以设在[[Swap (简体中文)#交换文件|交换文件]]上。<br />
* 如果想要引导的磁盘上 [[EFI system partition#Check for an existing partition|已经有一个 EFI 系统分区]] 了,请不要再创建一个,而是使用现有的分区。<br />
}}<br />
<br />
=== 格式化分区 ===<br />
<br />
当分区建立好了,每个新建立的分区都需要使用适当的 [[file systems (简体中文)|文件系统]] 进行格式化。举个例子,要在根分区 {{ic|/dev/''root_partition''}} 上创建一个 Ext4 文件系统,运行:<br />
<br />
# mkfs.ext4 /dev/''root_partition(根分区)''<br />
<br />
如果创建了 [[Swap (简体中文)|交换分区]] (例如 {{ic|/dev/''sda3''}}),请使用 {{man|8|mkswap}} 将其初始化:<br />
<br />
# mkswap /dev/''swap_partition(交换空间分区)''<br />
<br />
详情请参阅 [[File systems (简体中文)#创建文件系统|文件系统]]。<br />
<br />
{{注意|对于堆叠式块设备(stacked block devices)请使用恰当的块设备路径替换上文中的 {{ic|/dev/''*_partition''}} 处。}}<br />
<br />
=== 挂载分区 ===<br />
<br />
将根磁盘卷 [[Mount|挂载]] 到 {{ic|/mnt}},例如:<br />
<br />
# mount /dev/''root_partition'' /mnt<br />
<br />
然后使用 {{man|1|mkdir}} 创建其他剩余的挂载点(比如 {{ic|/mnt/efi}})并挂载其相应的磁盘卷。<br />
<br />
如果你创建了一个 [[swap]] 交换空间卷,请使用 {{man|8|swapon}} 启用它:<br />
<br />
# swapon /dev/''swap_partition(交换空间分区)''<br />
<br />
稍后 {{man|8|genfstab}} 将自动检测挂载的文件系统和交换空间。<br />
<br />
=== 注意事项 ===<br />
<br />
挂载分区的时候,如果boot单独分区,要首先挂载root 即 / 分区,然后挂载boot 分区,最后再挂载其它分区,不然后续安装会出现问题。<br />
<br />
== 安装 ==<br />
<br />
=== 选择镜像 ===<br />
<br />
文件 {{ic|/etc/pacman.d/mirrorlist}} 定义了软件包会从哪个[[Mirrors|镜像源]]下载。在 LiveCD 启动的系统上,在连接到因特网后,[[reflector]] 会通过选择 20 个最新同步的 HTTPS 镜像并按下载速率对其进行排序来更新镜像列表。[https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/configs/releng/airootfs/etc/xdg/reflector/reflector.conf]<br />
<br />
在列表中越前的镜像在下载软件包时有越高的优先权。您或许想检查一下文件,看看是否满意。如果不满意,可以相应的修改 {{ic|/etc/pacman.d/mirrorlist}} 文件,并将地理位置最近的镜像源挪到文件的头部,同时也应该考虑一些其他标准。<br />
<br />
这个文件接下来还会被 ''pacstrap'' 拷贝到新系统里,所以请确保设置正确。<br />
<br />
=== 安装必须的软件包 ===<br />
<br />
使用 [https://git.archlinux.org/arch-install-scripts.git/tree/pacstrap.in pacstrap] 脚本,安装 {{Pkg|base}} 软件包和 Linux [[kernel|内核]]以及常规硬件的固件:<br />
<br />
# pacstrap /mnt base linux linux-firmware<br />
<br />
{{提示|<br />
* 可以将 {{Pkg|linux}} 替换为 [[kernel]] 页面中介绍的内核软件包。<br />
* 在虚拟机或容器中安装时,可以不安装固件软件包。<br />
}}<br />
<br />
{{Pkg|base}} 软件包并没有包含 Live 环境中的全部程序。因此要获得一个功能齐全的基本系统,可能需要安装其他软件包。特别要考虑安装:<br />
<br />
* 管理所用[[file systems|文件系统]]的用户工具 xfs btrfs 需要安装相应的管理工具;<br />
* 访问 [[RAID]] 或 [[LVM]] 分区的工具;<br />
* 未包含在 {{Pkg|linux-firmware}} 中的额外固件;<br />
* [[networking|联网]] 所需要的程序 比如 dhcpcd iwd;<br />
* [[text editor|文本编辑器]] 比如 nano vim;<br />
* 访问 [[man]] 和 [[info]] 页面的工具:{{Pkg|man-db}}, {{Pkg|man-pages}} 和 {{Pkg|texinfo}}。<br />
<br />
要 [[install|安装]] 其他软件包或软件包组 (比如 {{Grp|base-devel}}),请将它们的名字追加到上文的 ''pacstrap'' 命令后 (用空格分隔),或者也可以在 [[#Chroot|Chroot 进新系统]]后使用 [[pacman]] 手动安装软件包或软件包组。[https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/configs/releng/packages.x86_64 packages.x86_64] 中可以看到不同软件包或软件包组间的差异。<br />
<br />
== 配置系统 ==<br />
<br />
=== Fstab ===<br />
<br />
用以下命令生成 [[fstab]] 文件 (用 {{ic|-U}} 或 {{ic|-L}} 选项设置UUID 或卷标):<br />
<br />
# genfstab -U /mnt >> /mnt/etc/fstab<br />
<br />
'''强烈建议'''在执行完以上命令后,后检查一下生成的 {{ic|/mnt/etc/fstab}} 文件是否正确。<br />
<br />
=== Chroot ===<br />
<br />
[[Change root (简体中文)|Change root]] 到新安装的系统:<br />
<br />
# arch-chroot /mnt<br />
<br />
=== 时区 ===<br />
<br />
设置[[time zone|时区]]:<br />
# ln -sf /usr/share/zoneinfo/''Region''/''City'' /etc/localtime<br />
<br />
例如:<br />
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime<br />
<br />
运行 {{man|8|hwclock}} 以生成 {{ic|/etc/adjtime}}:<br />
<br />
# hwclock --systohc<br />
<br />
这个命令假定硬件时间已经被设置为 [[Wikipedia:UTC|UTC 时间]]。详细信息请查看 [[System time#Time standard]]。<br />
<br />
=== 本地化 ===<br />
<br />
本地化的程序与库若要本地化文本,都依赖 [[Locale]],后者明确规定地域、货币、时区日期的格式、字符排列方式和其他本地化标准。<br />
<br />
需在这两个文件设置:{{ic|locale.gen}} 与 {{ic|locale.conf}}。<br />
<br />
编辑{{ic|/etc/locale.gen}} 然后移除需要的 [[Locale (简体中文)|地区]] 前的注释符号 {{ic|#}}。<br />
<br />
接着执行 {{ic|locale-gen}} 以生成 locale 信息:<br />
<br />
# locale-gen<br />
<br />
然后创建 {{man|5|locale.conf}} 文件,并 [[Locale#Setting the system locale|编辑设定 LANG 变量]],比如:<br />
<br />
{{hc|1=/etc/locale.conf|2=<br />
LANG=''en_US.UTF-8''<br />
}}<br />
<br />
另外对于中文用户:<br />
{{提示|<br />
<br />
* 用户可以设置自己的 locale,详情请参阅 [[Locale#Overriding system locale per user session]] 或 [[Locale (简体中文)##设置当前区域]];<br />
* 将系统 locale 设置为 {{ic|en_US.UTF-8}} ,系统的 log 就会用英文显示,这样更容易判断和处理问题;<br />
** 也可以设置为 {{ic|en_GB.UTF-8}} 或 {{ic|en_SG.UTF-8}},附带以下优点:<br />
*** 进入桌面环境后以 24 小时制显示时间;<br />
*** LibreOffice 等办公软件的纸张尺寸会默认为 {{ic|A4}} 而非 {{ic|Letter(US)}};<br />
*** 可尽量避免不必要且可能造成处理麻烦的英制单位。<br />
<br />
}}<br />
<br />
{{警告|不推荐在此设置任何中文 locale,会导致 tty 乱码。}}<br />
<br />
如果需要修改 [[#键盘布局]],并想让这个设置持续生效,编辑 {{man|5|vconsole.conf}},例如:<br />
<br />
{{hc|1=/etc/vconsole.conf|2=<br />
KEYMAP=''de-latin1''<br />
}}<br />
<br />
=== 网络配置 ===<br />
<br />
[[Create|创建]] [[Network configuration (简体中文)#设置计算机名|hostname]] 文件:<br />
<br />
{{hc|/etc/hostname|<br />
''myhostname(主机名)''<br />
}}<br />
<br />
添加对应的信息到 {{man|5|hosts}}:<br />
<br />
{{hc|/etc/hosts|<br />
127.0.0.1 localhost<br />
::1 localhost<br />
127.0.1.1 ''myhostname''.''localdomain'' ''myhostname'' # ''主机名.本地域名'' ''主机名''<br />
}}<br />
<br />
如果系统有一个永久的 IP 地址,请使用这个永久的 IP 地址而不是 {{ic|127.0.1.1}}。<br />
<br />
请注意,目前的 {{Pkg|base}} 不含有任何网络管理工具。针对新安装的系统环境,请完成[[网络配置]],配置过程中可能包括要安装合适的[[网络管理]]软件。<br />
<br />
=== Initramfs ===<br />
<br />
通常不需要自己创建新的 ''initramfs'',因为在执行 ''pacstrap'' 时已经安装 {{Pkg|linux}},这时 [[mkinitcpio]] 会被自动运行。<br />
<br />
对于 [[Install Arch Linux on LVM#Adding mkinitcpio hooks|LVM]]、 [[dm-crypt|system encryption]] 或 [[RAID#Configure_mkinitcpio|RAID]],修改 [[mkinitcpio (简体中文)|mkinitcpio.conf]] 并用以下命令重新创建一个 Initramfs:<br />
<br />
# mkinitcpio -P<br />
<br />
=== Root 密码 ===<br />
<br />
设置 Root [[password|密码]]:<br />
# passwd<br />
<br />
=== 安装引导程序 ===<br />
<br />
需要安装 Linux 引导加载程序,才能在安装后启动系统,可以使用的的引导程序已在 [[Boot loaders (简体中文)|启动加载器]] 中列出,请选择一个安装并配置它,[[GRUB (简体中文)]] 是最常见的选择。<br />
<br />
如果有 Intel 或 AMD 的 CPU,请另外启用 [[Microcode (简体中文)|微码]] 更新。<br />
<br />
{{警告|这是安装的最后但也至关重要的一步,请按上述指引正确安装好引导加载程序后再重新启动。否则将无法正常进入系统。}}<br />
<br />
== 重启 ==<br />
<br />
输入 {{ic|exit}} 或按 {{ic|Ctrl+d}} 退出 chroot 环境。<br />
<br />
可选用 {{ic|umount -R /mnt}} 手动卸载被挂载的分区:这有助于发现任何「繁忙」的分区,并通过 {{man|1|fuser}} 查找原因。<br />
<br />
最后,通过执行 {{ic|reboot}} 重启系统,''systemd'' 将自动卸载仍然挂载的任何分区。不要忘记移除安装介质,然后使用 root 帐户登录到新系统。<br />
<br />
== 安装后的工作 ==<br />
<br />
系统管理引导,图形用户界面的安装、声音管理、触摸板支持等后期工作参见 [[General recommendations (简体中文)]]。<br />
<br />
感兴趣的各类程序,请参见 [[List of applications (简体中文)]]。</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=635162
ArchWiki:Translation Team (简体中文)
2020-09-13T14:28:59Z
<p>Liu-shuyuan: Removed myself from list of translators</p>
<hr />
<div>[[Category:ArchWiki (简体中文)]]<br />
[[Category:Teams (简体中文)]]<br />
[[ar:ArchWiki:Translation Team]]<br />
[[cs:ArchWiki:Translation Team]]<br />
[[el:ArchWiki:Translation Team]]<br />
[[en:ArchWiki:Translation Team]]<br />
[[es:ArchWiki:Translation Team]]<br />
[[fr:ArchWiki Translation Team]]<br />
[[hr:ArchWiki:Translation Team]]<br />
[[it:ArchWiki:Translation Team]]<br />
[[ja:ArchWiki:翻訳チーム]]<br />
[[ko:ArchWiki:Translation Team]]<br />
[[nl:ArchWiki:Translation Team]]<br />
[[pl:ArchWiki:Translation Team]]<br />
[[pt:ArchWiki:Translation Team]]<br />
[[ru:ArchWiki:Translation Team]]<br />
[[sk:ArchWiki:Translation Team]]<br />
[[uk:ArchWiki:Translation Team]]<br />
[[zh-hant:ArchWiki:Translation Team]]<br />
ArchWiki 上有许多中文页面,这其中大部分是从外文翻译过来的,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对 ArchWiki 做贡献,参与 Wiki 建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
<br />
{{警告|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读[[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n 帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin|登录]]以进行编辑。<br />
# 选择要翻译的页面,例如从[[Special:Random|随机页面]]或[[#页面维护列表|页面维护列表]]中选择一个未翻译完成的页面。假设要翻译 [[ArchWiki:Translation Team]]。<br />
# 进入选择的英文页面,点击页面顶部的'''编辑'''。<br />
# 添加要翻译文件的语言间链接, 简体中文的话加入 <nowiki>[[zh-hans:Some Page]]</nowiki>,其它语言参见 [[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 预览页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[ArchWiki Translation Team (Language)]](打开新标签页,不要关闭预览的页面)<br />
# 因为页面不存在,点击'''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:ArchWiki]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:ArchWiki (简体中文)]]</nowiki>}},参阅 [[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-hans}} 修改为 {{ic|en}},并将英文页面的语言间链接移到文章顶部)。<br />
# 翻译页面,进行保存,还需要使用合适的[[Help:Style (简体中文)#编辑摘要|编辑摘要]],例如 {{ic|translate <nowiki>[[ArchWiki Translation Team]]</nowiki>}}。碰到不好翻译的段落,可以保留英文。尽量不要让原文和不太确认的翻译同时存在,会让页面看上去比较杂乱。<br />
# 在翻译页面的底部,列出了该页面所包含的类别。检查所有这些类别是否存在,即,链接不应为红色。否则,请点击红色链接,然后创建所有缺少的类别 - 类别的创建方式与常规页面相同。<br />
# 返回预览的页面并保存页面。<br />
# (可选)将 [[Template:TranslationStatus (简体中文)]] 添加到已翻译的页面。有关使用方法,请参见 [[Template:TranslationStatus (简体中文)#用法]]。<br />
# (可选)创建另一个页面,例如 [[ArchWiki Translation Team 的翻译后的标题]],其标题将是 [[ArchWiki Translation Team (语言)]] 的标题的翻译,输入 {{ic|<nowiki>#redirect [[ArchWiki Translation Team (Language)</nowiki>]]}} 作为其唯一内容并保存。<br />
<br />
== 模版 ==<br />
<br />
下表列出了应翻译的英文[[Help:Template (简体中文)|模版]]及其等效的简体中文模板。<br />
<br />
{| class=wikitable<br />
! 英文模版 || 简体中文模版<br />
|-<br />
! colspan=2| 文章模版<br />
|-<br />
| [[Template:Related articles start]] || [[Template:Related articles start (简体中文)]]<br />
|-<br />
| [[Template:Unsupported]] || [[Template:Unsupported (简体中文)]]<br />
|-<br />
| [[Template:Yes]] || [[Template:是]]<br />
|-<br />
| [[Template:No]] || [[Template:否]]<br />
|-<br />
| [[Template:Tip]] || [[Template:提示]]<br />
|-<br />
| [[Template:Note]] || [[Template:注意]]<br />
|-<br />
| [[Template:Warning]] || [[Template:警告]]<br />
|-<br />
| [[Template:Dead link]] || [[Template:Dead link (简体中文)]]<br />
|-<br />
| [[Template:Broken package link]] || [[Template:Broken package link (简体中文)]]<br />
|-<br />
| [[Template:Broken section link]] || [[Template:Broken section link (简体中文)]]<br />
|-<br />
! colspan=2| 翻译状态模板<br />
|-<br />
| [[Template:Bad translation]] || [[Template:Bad translation (简体中文)]]<br />
|-<br />
| [[Template:Translateme]] || [[Template:Translateme (简体中文)]]<br />
|-<br />
| [[Template:TranslationStatus]] || [[Template:TranslationStatus (简体中文)]]<br />
|-<br />
! colspan=2| 导航模版<br />
|-<br />
| [[Template:Laptops table header]] || [[Template:Laptops table header (简体中文)]]<br />
|-<br />
| [[Template:Laptops navigation]] || [[Template:Laptops navigation (简体中文)]]<br />
|-<br />
| [[Template:List of applications navigation]] || [[Template:List of applications navigation (简体中文)]]<br />
|-<br />
| [[Template:Package guidelines]] || [[Template:Package guidelines (简体中文)]]<br />
|-<br />
! colspan=2| 特殊模版<br />
|-<br />
| [[Template:Cat main]] || [[Template:Cat main (简体中文)]]<br />
|-<br />
| [[Template:Template]] || [[Template:Template (简体中文)]]<br />
|-<br />
| [[Template:META Error]] || [[Template:META Error (简体中文)]]<br />
|-<br />
| [[Template:META Unexplained Status Template]] || [[Template:META Unexplained Status Template (简体中文)]]<br />
|-<br />
| [[Template:Comment]] || [[Template:Comment (简体中文)]]<br />
|-<br />
| [[Template:Committed identity]] || [[Template:Committed identity (简体中文)]]<br />
|-<br />
| [[Template:Unsigned]] || [[Template:Unsigned (简体中文)]]<br />
|}<br />
<br />
== 翻译中应省略的模板 ==<br />
<br />
当页面或部分标记有 [[Template:Accuracy]],[[Template:Style]],[[Template:Archive]],[[Template:Remove]] 或 [[Template:Out of date]] 时 — 在解决问题并且删除模板之前,不要翻译有问题的页面/部分。<br />
<br />
如果看到 [[Template:Expansion]],[[Template:Merge]],[[Template:Move]] 或 [[Template:Redirect]],则可以安全地翻译页面,但不要将这些模板复制到翻译的文章中。<br />
<br />
如果看到 [[Template:Broken package link]],[[Template:Broken section link]] 或 [[Template:Dead link]],请不要将这些模板复制到翻译的文章中。要么在原始文本中将其修复,然后复制并在要翻译时翻译修复的链接,要么在翻译时忽略与它们有关的整个句子或部分。<br />
<br />
== 完善翻译 ==<br />
<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个特殊页面]包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (可选)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],请参见 [[#创建翻译]]。<br />
<br />
== 更新过期页面 ==<br />
<br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模版,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 维护翻译 ==<br />
<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[[Special:WhatLinksHere/Template:TranslationStatus_(简体中文)|模板的反向链接]]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应 {{ic|<nowiki>{{out of date}}</nowiki>}} 模版<br />
;未翻译:页面中含有英文内容,对应 {{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}} 模板<br />
;完成:页面已与英文页面同步<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[Arch-based distributions (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[Arch boot process (简体中文)]]<br />
| 翻译中<br />
| Bangbo Zheng<br />
| <br />
|-<br />
| [[Arch Security Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Arch Testing Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[ArchWiki:Maintenance Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[ArchWiki:News (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[ASCII art (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[AUR helpers (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 部分用词可能需要修改<br />
|-<br />
| [[Bash (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[Common Desktop Environment (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Conky (简体中文)]]<br />
| 完成<br />
| upi<br />
| 无<br />
|-<br />
| [[Core utilities (简体中文)]]<br />
| 完成<br />
| rentaro, Arisaka<br />
| 无<br />
|-<br />
| [[Dark mode switching (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Discord (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Django (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Dynamic Kernel Module Support (简体中文)]]<br />
| 完成<br />
| Mithrandir<br />
| 完善中<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[Equinox Desktop Environment (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[FHEM (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中 <br />
|-<br />
| [[Flatpak (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Fwupd (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Gcin (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[GIMP (简体中文)]]<br />
| 完成<br />
| [[User:驿窗|驿窗]]<br />
| 长期维护中<br />
|-<br />
| [[GNOME (简体中文)]]<br />
| 完成<br />
| skywet<br />
| <br />
|-<br />
| [[Google Authenticator (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[GRUB (简体中文)]]<br />
| 完成<br />
| Armodeniz<br />
| <br />
|-<br />
| [[GRUB/Tips and tricks (简体中文)]]<br />
| 完成<br />
| Armodeniz<br />
| <br />
|-<br />
| [[Heirloom (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Inkscape (简体中文)]]<br />
| 完成<br />
| [[User:驿窗|驿窗]]<br />
| 长期维护中<br />
|-<br />
| [[International communities (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Java (简体中文)]]<br />
| 翻译中<br />
| CaCaCarrot<br />
| 无<br />
|-<br />
| [[Kernel live patching (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[KRunner (简体中文)]]<br />
| 完成<br />
| [[User:Reverier|Reverier]]<br />
| 长期维护中<br />
|-<br />
| [[Libvirt (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 需要格式改进<br />
|-<br />
| [[Liri (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|- <br />
| [[List of applications (简体中文)]]<br />
| 部分翻译<br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Lua (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Lumina (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Minecraft (简体中文)]]<br />
| 完成<br />
| Xavier Lau<br />
| 页面已经与英文版同步,长期维护中<br />
|-<br />
| [[Moksha (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[MySQL (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Notion (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[OpenSSH (简体中文)]]<br />
| 完成<br />
| Arisaka<br />
| 无<br />
|-<br />
| [[Pacman (简体中文)]]<br />
| 翻译中<br />
| [[User:Miswanting|Miswanting]]<br />
| 同步中<br />
|-<br />
| [[pkgstats (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|- <br />
| [[PKGBUILD (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|- <br />
| [[QEMU (简体中文)]]<br />
| 部分翻译<br />
| Heersin<br />
| 翻译中<br />
|- <br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Rockbox (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Roles (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Rxvt-unicode (简体中文)]]<br />
| 完成<br />
| KyanCh<br />
| 无<br />
|-<br />
| [[Scheme (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[SDDM (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Steam (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Syslinux (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[TLP (简体中文)]]<br />
| 完成<br />
| Skywet<br />
| 持续更新中<br />
|-<br />
| [[Trac (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Trusted Users (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Twm (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Unofficial mirrors (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Unofficial user repositories (简体中文)]]<br />
| 翻译中<br />
| TransistorLogic<br />
| 无<br />
|-<br />
| [[UP Squared (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Vivaldi (简体中文)]]<br />
| 完成<br />
| [[User:Aaron Chen|Aaron Chen]]<br />
| 长期维护<br />
|-<br />
| [[Webmin (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|- <br />
| [[X2Go (简体中文)]]<br />
| 过期<br />
| [[User:Aaron Chen|Aaron Chen]]<br />
|</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Amateur_radio_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=584376
Amateur radio (简体中文)
2019-10-04T02:48:11Z
<p>Liu-shuyuan: Translated some more of Amateur radio</p>
<hr />
<div>[[Category:Networking (简体中文)]]<br />
[[en:Amateur radio]]<br />
[[ja:アマチュア無線]]<br />
{{Related articles start}}<br />
{{Related|GNU Radio}}<br />
{{Related|RTL-SDR}}<br />
{{Related articles end}}<br />
<br />
业余无线电爱好者(又称“火腿”)自从无线电存在的早期就活跃在相关实验与开发的前沿。在各个无线电频段上,有多种常用的通信模式。<br />
本页面列举了[[AUR]]中与业余无线电有关的软件,其中有些可以独立运行,但多数处理数字通信的程序则需要配合无线电硬件或者声卡使用。相关硬件可以购买,也可以自制。<br />
<br />
{{Warning|按国际条约要求,你必须持有政府发放的执照才能使用业余无线电频率。但这些条约只是约束信号的发射;只接收业余无线电信号或下载相关软件是不违法的。}}<br />
<br />
== 通用信息 ==<br />
下面的很多程序都需要使用串口(如/dev/ttyS0)与发射器通信。首先,你的用户需要在uucp用户组中。要将一个用户添加到uucp组中,以root身份运行下面的命令:<br />
<br />
# gpasswd -a ''用户名'' uucp<br />
<br />
之后注销再重新登录。<br />
<br />
== 软件列表 ==<br />
* {{App|Hamlib|为无线电硬件和控制程序之间提供了一个通信界面。它只是用于帮助控制电台等硬件,并不是一个能独立使用的程序。|https://sourceforge.net/projects/hamlib/|{{Pkg|hamlib}}}}<br />
<br />
* {{App|Soundmodem|由Tom Sailer(HB9JNX/AE4WA)编写,它能将声卡作为一个分组无线电的调制解调器,从而能使用多种AX.25通信模式。波特率最高能达到9600bps, 但也取决于硬件配置和具体用途。Soundmodem可以在串口上作为一个KISS调制解调器或者AX.25网络设备。To use soundmodem as an MKISS network device, the kernel must be re-built with MKISS modules. 该链接中有更多信息:[http://www.xastir.org/wiki/index.php/HowTo:SoundModem Xastir wiki]<br />
:以root身份运行soundmodem:<br />
:{{bc|# soundmodem}}<br />
:If you have configured soundmodem as a KISS modem, you will need to change permissions to make it user-readable:<br />
:{{bc|# chmod 666 /dev/soundmodem0}}<br />
|http://www.baycom.org/~tom/ham/soundmodem/|{{AUR|soundmodem}}}}<br />
<br />
* {{App|Grig|基于Hamlib的简单的控制程序|http://groundstation.sourceforge.net/grig/|{{AUR|grig}}}}<br />
* {{App|gMFSK|支持多种数字模式,使用hamlib和xlog记录日志|http://gmfsk.connect.fi|{{AUR|gmfsk}}}}<br />
* {{App|lysdr|高度可自定义的无线电界面程序|https://github.com/gordonjcp/lysdr}}<br />
* {{App|linrad|SM5BSZ编写的软件定义无线电|http://www.sm5bsz.com/linuxdsp/linrad.htm|{{AUR|linrad}}}} <br />
* {{App|quisk|N2ADR编写的软件定义无线电|http://james.ahlstrom.name/quisk/|{{AUR|quisk}}}}<br />
* {{App|owx|Command-line utility for programming Wouxun radios using CSV spreadsheets.|http://owx.chmurka.net|{{AUR|owx}}}}<br />
* {{App|fldigi|W1HKJ开发的GUI程序,支持多种数字通信模式|http://w1hkj.com/Fldigi.html|{{AUR|fldigi}}}}<br />
* {{App|libfap|APRS包解析程序|http://pakettiradio.net/libfap/|{{AUR|libfap}}}}<br />
* {{App|aprx|lightweight APRS digipeater and i-Gate interface|http://thelifeofkenneth.com/aprx/|{{AUR|aprx}}}}<br />
* {{App|xdx|网络客户端|http://www.qsl.net/pg4i/linux/xdx.html|{{AUR|xdx}}}}<br />
* {{App|qsstv|慢扫描电视||{{AUR|qsstv}}}}<br />
* {{App|linpsk|PSK31||{{AUR|linpsk}}}}<br />
* {{App|xpsk31|PSK31,GUI使用GTK+|http://www.qsl.net/5b4az/pkg/psk31/xpsk31/xpsk31.html|{{AUR|xpsk31}}}}<br />
<br />
=== AX.25 ===<br />
{{App|[[Wikipedia:AX.25|AX.25]]|一个广泛应用于分组无线电的数据链路层协议。它既支持有线连接(如keyboard-to-keyboard contacts, access to local bulletin board systems, and DX clusters),也支持无线连接(如[[Wikipedia:APRS|APRS]])。Linux内核中有对AX.25的原生支持。这里有更多信息:[http://tldp.org/HOWTO/AX25-HOWTO/ guide][[AUR]]中有以下软件可用:<br />
* {{AUR|ax25-apps}}<br />
* {{AUR|ax25-tools}}<br />
* {{AUR|libax25}}<br />
* {{AUR|node}}<br />
|http://www.ax25.net/|present in stock kernel}}<br />
<br />
=== WSJT ===<br />
{{App|[[Wikipedia:WSJT_(Amateur_radio_software)|WSJT]] (Weak Signal Communication by K1JT)|offers a rich variety of features, including specific digital protocols optimized for meteor scatter, ionospheric scatter, and EME (moonbounce) at VHF/UHF, as well as HF skywave propagation. WSJT的开发者是诺贝尔物理学奖得主Joe Taylor,无线电呼号为KIJT。The program can decode fraction-of-a-second signals reflected from ionized meteor trails and steady signals 10 dB below the audible threshold.<br><br />
WSJT is in ongoing, active development by a team of programmers led by K1JT. WSJT (and the related program WSPR) has the option of being configured with <br />
{{bc|$ ./configure --enable-g95}}<br />
or <br />
{{bc|$ ./configure --enable-gfortran}}<br />
If you build with one and experience problems, edit PKGBUILD to try the other.<br><br />
WSJT requires access to the serial port; see the note in the Interfacing section above about the uucp group.<br />
|http://www.physics.princeton.edu/pulsar/K1JT/|{{AUR|wsjt-svn}}}}<br />
<br />
=== WSPR ===<br />
{{App|[[Wikipedia:WSPR (amateur_radio_software)|WSPR]] (Weak Signal Propagation Reporter, pronounced whisper)|enables the probing of propagation paths on the amateur radio bands using low power transmissions. It was introduced in 2008 by K1JT following the success and widespread adoption of WSJT by the amateur radio community. Stations with Internet access can automatically upload their reception reports to a central database called [http://wsprnet.org/drupal/ WSPRnet], which includes a [http://wsprnet.org/drupal/wsprnet/map mapping facility]<br />
|http://physics.princeton.edu/pulsar/K1JT/wspr.html|{{AUR|wspr-svn}}}}<br />
<br />
=== Xastir ===<br />
{{App|Xastir|stands for X Amateur Station and Information Reporting. It works with [[Wikipedia:APRS|APRS]], an amateur radio-based system for real time tactical digital communications. Xastir is an open-source program that provides full-featured, client-side access to APRS. It is currently in a state of active development.<br>Xastir is highly flexible and there are a wide variety of ways it can be configured. For example, it can be evaluated without radio hardware if an Internet connection is available. The wiki at xastir.org is very thorough and gives excellent information on its range of capabilities and setup.<br>An optional speech feature can be enabled with the {{pkg|festival}} package; you will also need a speaker package such as festival-en or festival-english. If you want this option, festival must be installed on your system before building xastir. Launch festival before the xastir program is started for speech to function properly:<br />
{{bc|$ festival --server}}<br />
or you can write a simple script to automate the sequential starting process. There may be problems if other programs such as a media player are accessing sound simultaneously.<br>The PKGBUILD automatically downloads an 850 kB bundle of .wav files and places them here: {{Ic|/usr/share/xastir/sounds/}}.<br>These are audio alarm recordings of a North American English speaker that do not require the presence of festival to render. The audio play command `play' in the configure menu may not work; try `aplay' instead.<br />
|http://www.xastir.org|{{AUR|xastir}}}}<br />
<br />
<br />
=== 数字语音 ===<br />
{{App|FreeDV|是一个用于 HF 频段的数字语音模式。它使用的是开源免费的 Codec2 语音编解码器,有着窄带宽、低数据速率的特点,特别适用于短波无线电通联。使用FreeDV所需要的只有一台运行Free DV GUI程序的计算机,以及 SSB 模式的电台。对于 Arch Linux,FreeDV 和 Codec2 都可以从 AUR 获取到。两者都需要安装好才能使用 FreeDV!<br />
* http://www.rowetel.com/codec2.html {{Pkg|codec2}}<br />
|http://freedv.org|{{AUR|freedv}}}}<br />
<br />
<br />
=== 分析工具 ===<br />
* {{AUR|gpredict}} &ndash; 实时卫星追踪、卫星轨道预测<br />
* {{AUR|hamsolar}} &ndash; 在桌面上显示当前太阳活动指数<br />
* {{AUR|splat}} &ndash; 无线电信号传播、损耗和地形分析<br />
* {{AUR|sunclock}} &ndash; Useful for predicting grayline propagation paths<br />
* {{AUR|xnec2c}} &ndash; 天线模拟软件<br />
<br />
=== 日志 ===<br />
* {{AUR|cqrlog-bin}} &ndash; 常见的Linux日志程序<br />
* {{AUR|fdlog}} &ndash; a Field Day Logger with networked nodes<br />
* {{AUR|klog}} &ndash; 运行在KDE上的业余无线电日志程序<br />
* {{AUR|qle}} &ndash; QSO 日志记录器和编辑器,用 Perl 编写<br />
* {{AUR|tlf}} &ndash; a console mode networked logging and contest program<br />
* {{AUR|trustedqsl}} &ndash; QSL application for ARRL's Logbook of the World<br />
* {{AUR|xlog}} &ndash; a logging program for amateur radio operators.<br />
* {{AUR|yfklog}} &ndash; 通用的*nix业余无线电日志程序<br />
* {{AUR|yfktest}} &ndash; a logbook program for ham radio contests.<br />
<br />
=== 工具 ===<br />
* {{AUR|cty}} &ndash; 实体(国家)、前缀、呼号等信息,供业余无线电日志程序使用<br />
* {{AUR|dxcc}} &ndash; a small program for determining ARRL DXCC entity of a ham radio callsign<br />
<br />
=== 练习莫尔斯码 ===<br />
* {{AUR|aldo}}<br />
* {{AUR|cutecw}}<br />
* {{AUR|ebook2cw}}<br />
* {{AUR|gtkmmorse}}<br />
* {{AUR|kochmorse}}<br />
* {{AUR|qrq}}<br />
* {{AUR|unixcw}}<br />
<br />
=== 其他 ===<br />
* {{AUR|cwirc}} &ndash; 在IRC上收发莫尔斯码</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Amateur_radio_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=577236
Amateur radio (简体中文)
2019-07-10T11:08:39Z
<p>Liu-shuyuan: Partially translated Amatuer radio into Chinese (simplified)</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:アマチュア無線]]<br />
[[zh-hans:业余无线电]]<br />
{{Related articles start}}<br />
{{Related|GNU Radio}}<br />
{{Related|RTL-SDR}}<br />
{{Related articles end}}<br />
<br />
业余无线电爱好者(又称“火腿”)自从无线电存在的早期就活跃在相关实验与开发的前沿。在各个无线电频段上,有多种常用的通信模式。<br />
本页面列举了[[AUR]]中与业余无线电有关的软件,其中有些可以独立运行,但多数处理数字通信的程序则需要配合无线电硬件或者声卡使用。相关硬件可以购买,也可以自制。<br />
<br />
{{Warning|按国际条约要求,你必须持有政府发放的执照才能使用业余无线电频率。但这些条约只是约束信号的发射;只接收业余无线电信号或下载相关软件是不违法的。}}<br />
<br />
== 通用信息 ==<br />
下面的很多程序都需要使用串口(如/dev/ttyS0)与发射器通信。首先,你的用户需要在uucp用户组中。要将一个用户添加到uucp组中,以root身份运行下面的命令:<br />
<br />
# gpasswd -a ''用户名'' uucp<br />
<br />
之后注销再重新登录。<br />
<br />
== 软件列表 ==<br />
* {{App|Hamlib|为无线电硬件和控制程序之间提供了一个通信界面。它只是用于帮助控制电台等硬件,并不是一个能独立使用的程序。|https://sourceforge.net/projects/hamlib/|{{Pkg|hamlib}}}}<br />
<br />
* {{App|Soundmodem|由Tom Sailer(HB9JNX/AE4WA)编写,它能将声卡作为一个分组无线电的调制解调器,从而能使用多种AX.25通信模式。波特率最高能达到9600bps, 但也取决于硬件配置和具体用途。Soundmodem可以在串口上作为一个KISS调制解调器或者AX.25网络设备。To use soundmodem as an MKISS network device, the kernel must be re-built with MKISS modules. 该链接中有更多信息:[http://www.xastir.org/wiki/index.php/HowTo:SoundModem Xastir wiki]<br />
:以root身份运行soundmodem:<br />
:{{bc|# soundmodem}}<br />
:If you have configured soundmodem as a KISS modem, you will need to change permissions to make it user-readable:<br />
:{{bc|# chmod 666 /dev/soundmodem0}}<br />
|http://www.baycom.org/~tom/ham/soundmodem/|{{AUR|soundmodem}}}}<br />
<br />
* {{App|Grig|基于Hamlib的简单的控制程序|http://groundstation.sourceforge.net/grig/|{{AUR|grig}}}}<br />
* {{App|gMFSK|支持多种数字模式,使用hamlib和xlog记录日志|http://gmfsk.connect.fi|{{AUR|gmfsk}}}}<br />
* {{App|lysdr|高度可自定义的无线电界面程序|https://github.com/gordonjcp/lysdr}}<br />
* {{App|linrad|SM5BSZ编写的软件定义无线电|http://www.sm5bsz.com/linuxdsp/linrad.htm|{{AUR|linrad}}}} <br />
* {{App|quisk|N2ADR编写的软件定义无线电|http://james.ahlstrom.name/quisk/|{{AUR|quisk}}}}<br />
* {{App|owx|Command-line utility for programming Wouxun radios using CSV spreadsheets.|http://owx.chmurka.net|{{AUR|owx}}}}<br />
* {{App|fldigi|W1HKJ开发的GUI程序,支持多种数字通信模式|http://w1hkj.com/Fldigi.html|{{AUR|fldigi}}}}<br />
* {{App|libfap|APRS包解析程序|http://pakettiradio.net/libfap/|{{AUR|libfap}}}}<br />
* {{App|aprx|lightweight APRS digipeater and i-Gate interface|http://thelifeofkenneth.com/aprx/|{{AUR|aprx}}}}<br />
* {{App|xdx|网络客户端|http://www.qsl.net/pg4i/linux/xdx.html|{{AUR|xdx}}}}<br />
* {{App|qsstv|慢扫描电视||{{AUR|qsstv}}}}<br />
* {{App|linpsk|PSK31||{{AUR|linpsk}}}}<br />
* {{App|xpsk31|PSK31,GUI使用GTK+|http://www.qsl.net/5b4az/pkg/psk31/xpsk31/xpsk31.html|{{AUR|xpsk31}}}}<br />
<br />
=== AX.25 ===<br />
{{App|[[Wikipedia:AX.25|AX.25]]|一个广泛应用于分组无线电的数据链路层协议。它既支持有线连接(如keyboard-to-keyboard contacts, access to local bulletin board systems, and DX clusters),也支持无线连接(如[[Wikipedia:APRS|APRS]])。Linux内核中有对AX.25的原生支持。这里有更多信息:[http://tldp.org/HOWTO/AX25-HOWTO/ guide][[AUR]]中有以下软件可用:<br />
* {{AUR|ax25-apps}}<br />
* {{AUR|ax25-tools}}<br />
* {{AUR|libax25}}<br />
* {{AUR|node}}<br />
|http://www.ax25.net/|present in stock kernel}}<br />
<br />
=== WSJT ===<br />
{{App|[[Wikipedia:WSJT_(Amateur_radio_software)|WSJT]] (Weak Signal Communication by K1JT)|offers a rich variety of features, including specific digital protocols optimized for meteor scatter, ionospheric scatter, and EME (moonbounce) at VHF/UHF, as well as HF skywave propagation. WSJT的开发者是诺贝尔物理学奖得主Joe Taylor,无线电呼号为KIJT。The program can decode fraction-of-a-second signals reflected from ionized meteor trails and steady signals 10 dB below the audible threshold.<br><br />
WSJT is in ongoing, active development by a team of programmers led by K1JT. WSJT (and the related program WSPR) has the option of being configured with <br />
{{bc|$ ./configure --enable-g95}}<br />
or <br />
{{bc|$ ./configure --enable-gfortran}}<br />
If you build with one and experience problems, edit PKGBUILD to try the other.<br><br />
WSJT requires access to the serial port; see the note in the Interfacing section above about the uucp group.<br />
|http://www.physics.princeton.edu/pulsar/K1JT/|{{AUR|wsjt-svn}}}}<br />
<br />
=== WSPR ===<br />
{{App|[[Wikipedia:WSPR (amateur_radio_software)|WSPR]] (Weak Signal Propagation Reporter, pronounced whisper)|enables the probing of propagation paths on the amateur radio bands using low power transmissions. It was introduced in 2008 by K1JT following the success and widespread adoption of WSJT by the amateur radio community. Stations with Internet access can automatically upload their reception reports to a central database called [http://wsprnet.org/drupal/ WSPRnet], which includes a [http://wsprnet.org/drupal/wsprnet/map mapping facility]<br />
|http://physics.princeton.edu/pulsar/K1JT/wspr.html|{{AUR|wspr-svn}}}}<br />
<br />
=== Xastir ===<br />
{{App|Xastir|stands for X Amateur Station and Information Reporting. It works with [[Wikipedia:APRS|APRS]], an amateur radio-based system for real time tactical digital communications. Xastir is an open-source program that provides full-featured, client-side access to APRS. It is currently in a state of active development.<br>Xastir is highly flexible and there are a wide variety of ways it can be configured. For example, it can be evaluated without radio hardware if an Internet connection is available. The wiki at xastir.org is very thorough and gives excellent information on its range of capabilities and setup.<br>An optional speech feature can be enabled with the {{pkg|festival}} package; you will also need a speaker package such as festival-en or festival-english. If you want this option, festival must be installed on your system before building xastir. Launch festival before the xastir program is started for speech to function properly:<br />
{{bc|$ festival --server}}<br />
or you can write a simple script to automate the sequential starting process. There may be problems if other programs such as a media player are accessing sound simultaneously.<br>The PKGBUILD automatically downloads an 850 kB bundle of .wav files and places them here: {{Ic|/usr/share/xastir/sounds/}}.<br>These are audio alarm recordings of a North American English speaker that do not require the presence of festival to render. The audio play command `play' in the configure menu may not work; try `aplay' instead.<br />
|http://www.xastir.org|{{AUR|xastir}}}}<br />
<br />
<br />
=== 数字语音 ===<br />
{{App|FreeDV|is a Digital Voice mode for HF radio. It uses the free and open Codec2 voice codec to enable efficient narrow bandwith, low bitrate voice communication ideally suited for shortwave radio contacts. A SSB radio connected to a computer running the FreeDV GUI application are all that is needed to start using the FreeDV mode. FreeDV as well as Codec2 are available to Arch Linux via the AUR system. Both are needed for FreeDV to work!<br />
* http://www.rowetel.com/codec2.html {{Pkg|codec2}}<br />
|http://freedv.org|{{AUR|freedv}}}}<br />
<br />
<br />
=== 分析工具 ===<br />
* {{AUR|gpredict}} &ndash; 实时卫星追踪、卫星轨道预测<br />
* {{AUR|hamsolar}} &ndash; 在桌面上显示当前太阳活动指数<br />
* {{AUR|splat}} &ndash; rf signal propagation, loss, and terrain analysis<br />
* {{AUR|sunclock}} &ndash; Useful for predicting grayline propagation paths<br />
* {{AUR|xnec2c}} &ndash; Electromagnetic antenna modeler<br />
<br />
=== 日志 ===<br />
* {{AUR|cqrlog-bin}} &ndash; 常见的Linux日志程序<br />
* {{AUR|fdlog}} &ndash; a Field Day Logger with networked nodes<br />
* {{AUR|klog}} &ndash; 运行在KDE上的业余无线电日志程序<br />
* {{AUR|qle}} &ndash; QSO Logger and log Editor for amateur radio operators written in Perl<br />
* {{AUR|tlf}} &ndash; a console mode networked logging and contest program<br />
* {{AUR|trustedqsl}} &ndash; QSL application for ARRL's Logbook of the World<br />
* {{AUR|xlog}} &ndash; a logging program for amateur radio operators.<br />
* {{AUR|yfklog}} &ndash; 通用的*nix业余无线电日志程序<br />
* {{AUR|yfktest}} &ndash; a logbook program for ham radio contests.<br />
<br />
=== 工具 ===<br />
* {{AUR|cty}} &ndash; 实体(国家)、前缀、呼号等信息,供业余无线电日志程序使用<br />
* {{AUR|dxcc}} &ndash; a small program for determining ARRL DXCC entity of a ham radio callsign<br />
<br />
=== 莫尔斯码练习 ===<br />
* {{AUR|aldo}}<br />
* {{AUR|cutecw}}<br />
* {{AUR|ebook2cw}}<br />
* {{AUR|gtkmmorse}}<br />
* {{AUR|kochmorse}}<br />
* {{AUR|qrq}}<br />
* {{AUR|unixcw}}<br />
<br />
=== 其他 ===<br />
* {{AUR|cwirc}} &ndash; 在IRC上收发莫尔斯码</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Amateur_radio_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=577234
Amateur radio (简体中文)
2019-07-10T09:59:31Z
<p>Liu-shuyuan: Created page (copied from original, added language tag)</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:アマチュア無線]]<br />
[[zh-hans:业余无线电]]<br />
{{Related articles start}}<br />
{{Related|GNU Radio}}<br />
{{Related|RTL-SDR}}<br />
{{Related articles end}}<br />
<br />
Amateur radio enthusiasts (sometimes called ham radio operators or "hams") have been at the forefront of experimentation and development since the earliest days of radio. A wide variety of communication modes are used on a vast range of frequencies that span the electromagnetic spectrum. <br />
This page lists software related to amateur radio that can be found in the [[AUR]]. Some of it is stand-alone while the various digital communication applications require interfacing to radio hardware and possibly the computer soundcard. Interface hardware can be purchased from vendors or home-built. <br />
<br />
{{Warning|International treaties require that users of amateur radio frequencies have a government-issued license. This only affects you if you have a transmitter and an antenna, receiving amateur radio or just downloading amateur radio software isn't illegal.}}<br />
<br />
== General information ==<br />
Many of the following programs will need to access a serial port to key the transmitter (eg. /dev/ttyS0). This requires that the user belong to the uucp group. To add the user to the uucp group issue the following command as root:<br />
<br />
# gpasswd -a ''username'' uucp<br />
<br />
then logoff and logon.<br />
<br />
== Software list ==<br />
* {{App|Hamlib|provides an interface between hardware and radio control programs. It is a software layer to facilitate the control of radios and other hardware (eg. for logging, digital modes) and is not a stand-alone application.<br />
|https://sourceforge.net/projects/hamlib/|{{Pkg|hamlib}}}}<br />
<br />
* {{App|Soundmodem|was written by Tom Sailer (HB9JNX/AE4WA) to allow a standard PC soundcard to act as a packet radio modem for use with the various AX.25 communication modes. The data rate can be as high as 9600 baud depending on the hardware and application. Soundmodem can be used as a KISS modem on the serial port or as an AX.25 network device. To use soundmodem as an MKISS network device, the kernel must be re-built with MKISS modules. More information is in the [http://www.xastir.org/wiki/index.php/HowTo:SoundModem Xastir wiki]<br />
:Run soundmodem as root:<br />
:{{bc|# soundmodem}}<br />
:If you have configured soundmodem as a KISS modem, you will need to change permissions to make it user-readable:<br />
:{{bc|# chmod 666 /dev/soundmodem0}}<br />
|http://www.baycom.org/~tom/ham/soundmodem/|{{AUR|soundmodem}}}}<br />
<br />
* {{App|Grig|simple control program based on Hamlib|http://groundstation.sourceforge.net/grig/|{{AUR|grig}}}}<br />
* {{App|gMFSK|is a user interface that supports a multitude of digital modes. It uses hamlib and xlog for logging|http://gmfsk.connect.fi|{{AUR|gmfsk}}}}<br />
* {{App|lysdr|highly customizable radio interface|https://github.com/gordonjcp/lysdr}}<br />
* {{App|linrad|Software defined radio by SM5BSZ|http://www.sm5bsz.com/linuxdsp/linrad.htm|{{AUR|linrad}}}} <br />
* {{App|quisk|Software defined radio by N2ADR|http://james.ahlstrom.name/quisk/|{{AUR|quisk}}}}<br />
* {{App|owx|Command-line utility for programming Wouxun radios using CSV spreadsheets.|http://owx.chmurka.net|{{AUR|owx}}}}<br />
* {{App|fldigi|popular GUI developed by W1HKJ for a variety of digital communication modes|http://w1hkj.com/Fldigi.html|{{AUR|fldigi}}}}<br />
* {{App|libfap|APRS packet parser|http://pakettiradio.net/libfap/|{{AUR|libfap}}}}<br />
* {{App|aprx|lightweight APRS digipeater and i-Gate interface|http://thelifeofkenneth.com/aprx/|{{AUR|aprx}}}}<br />
* {{App|xdx|network client|http://www.qsl.net/pg4i/linux/xdx.html|{{AUR|xdx}}}}<br />
* {{App|qsstv|Slow-scan television||{{AUR|qsstv}}}}<br />
* {{App|linpsk|PSK31||{{AUR|linpsk}}}}<br />
* {{App|xpsk31|PSK31 using a GUI rendered by GTK+|http://www.qsl.net/5b4az/pkg/psk31/xpsk31/xpsk31.html|{{AUR|xpsk31}}}}<br />
<br />
=== AX.25 ===<br />
{{App|[[Wikipedia:AX.25|AX.25]]|data link layer protocol that is used extensively in packet radio networks. It supports connected operation (eg. keyboard-to-keyboard contacts, access to local bulletin board systems, and DX clusters) as well as connectionless operation (eg. [[Wikipedia:APRS|APRS]]). The Linux kernel includes native support for AX.25 networking. Please refer to this [http://tldp.org/HOWTO/AX25-HOWTO/ guide] for more information. The following software is available in the AUR:<br />
* {{AUR|ax25-apps}}<br />
* {{AUR|ax25-tools}}<br />
* {{AUR|libax25}}<br />
* {{AUR|node}}<br />
|http://www.ax25.net/|present in stock kernel}}<br />
<br />
=== WSJT ===<br />
{{App|[[Wikipedia:WSJT_(Amateur_radio_software)|WSJT]] (Weak Signal Communication by K1JT)|offers offers a rich variety of features, including specific digital protocols optimized for meteor scatter, ionospheric scatter, and EME (moonbounce) at VHF/UHF, as well as HF skywave propagation. WSJT was developed by Nobel Prize winning physicist Joe Taylor, who has the amateur radio callsign K1JT. The program can decode fraction-of-a-second signals reflected from ionized meteor trails and steady signals 10 dB below the audible threshold.<br><br />
WSJT is in ongoing, active development by a team of programmers led by K1JT. WSJT (and the related program WSPR) has the option of being configured with <br />
{{bc|$ ./configure --enable-g95}}<br />
or <br />
{{bc|$ ./configure --enable-gfortran}}<br />
If you build with one and experience problems, edit PKGBUILD to try the other.<br><br />
WSJT requires access to the serial port; see the note in the Interfacing section above about the uucp group.<br />
|http://www.physics.princeton.edu/pulsar/K1JT/|{{AUR|wsjt-svn}}}}<br />
<br />
=== WSPR ===<br />
{{App|[[Wikipedia:WSPR (amateur_radio_software)|WSPR]] (Weak Signal Propagation Reporter, pronounced whisper)|enables the probing of propagation paths on the amateur radio bands using low power transmissions. It was introduced in 2008 by K1JT following the success and widespread adoption of WSJT by the amateur radio community. Stations with Internet access can automatically upload their reception reports to a central database called [http://wsprnet.org/drupal/ WSPRnet], which includes a [http://wsprnet.org/drupal/wsprnet/map mapping facility]<br />
|http://physics.princeton.edu/pulsar/K1JT/wspr.html|{{AUR|wspr-svn}}}}<br />
<br />
=== Xastir ===<br />
{{App|Xastir|stands for X Amateur Station and Information Reporting. It works with [[Wikipedia:APRS|APRS]], an amateur radio-based system for real time tactical digital communications. Xastir is an open-source program that provides full-featured, client-side access to APRS. It is currently in a state of active development.<br>Xastir is highly flexible and there are a wide variety of ways it can be configured. For example, it can be evaluated without radio hardware if an Internet connection is available. The wiki at xastir.org is very thorough and gives excellent information on its range of capabilities and setup.<br>An optional speech feature can be enabled with the {{pkg|festival}} package; you will also need a speaker package such as festival-en or festival-english. If you want this option, festival must be installed on your system before building xastir. Launch festival before the xastir program is started for speech to function properly:<br />
{{bc|$ festival --server}}<br />
or you can write a simple script to automate the sequential starting process. There may be problems if other programs such as a media player are accessing sound simultaneously.<br>The PKGBUILD automatically downloads an 850 kB bundle of .wav files and places them here: {{Ic|/usr/share/xastir/sounds/}}.<br>These are audio alarm recordings of a North American English speaker that do not require the presence of festival to render. The audio play command `play' in the configure menu may not work; try `aplay' instead.<br />
|http://www.xastir.org|{{AUR|xastir}}}}<br />
<br />
<br />
=== Digital Voice ===<br />
{{App|FreeDV|is a Digital Voice mode for HF radio. It uses the free and open Codec2 voice codec to enable efficient narrow bandwith, low bitrate voice communication ideally suited for shortwave radio contacts. A SSB radio connected to a computer running the FreeDV GUI application are all that is needed to start using the FreeDV mode. FreeDV as well as Codec2 are available to Arch Linux via the AUR system. Both are needed for FreeDV to work!<br />
* http://www.rowetel.com/codec2.html {{Pkg|codec2}}<br />
|http://freedv.org|{{AUR|freedv}}}}<br />
<br />
<br />
=== Analysis tools ===<br />
* {{AUR|gpredict}} &ndash; Real-time satellite tracking and orbit prediction application<br />
* {{AUR|hamsolar}} &ndash; Small desktop display of the current solar indices<br />
* {{AUR|splat}} &ndash; rf signal propagation, loss, and terrain analysis<br />
* {{AUR|sunclock}} &ndash; Useful for predicting grayline propagation paths<br />
* {{AUR|xnec2c}} &ndash; Electromagnetic antenna modeler<br />
<br />
=== Logging ===<br />
* {{AUR|cqrlog-bin}} &ndash; a popular Linux logging program<br />
* {{AUR|fdlog}} &ndash; a Field Day Logger with networked nodes<br />
* {{AUR|klog}} &ndash; a Ham radio logging program for Linux / KDE.<br />
* {{AUR|qle}} &ndash; QSO Logger and log Editor for amateur radio operators written in Perl<br />
* {{AUR|tlf}} &ndash; a console mode networked logging and contest program<br />
* {{AUR|trustedqsl}} &ndash; QSL application for ARRL's Logbook of the World<br />
* {{AUR|xlog}} &ndash; a logging program for amateur radio operators.<br />
* {{AUR|yfklog}} &ndash; a general purpose ham radio logbook for *nix operating systems.<br />
* {{AUR|yfktest}} &ndash; a logbook program for ham radio contests.<br />
<br />
=== Tools ===<br />
* {{AUR|cty}} &ndash; package contains databases of entities (countries), prefixes and callsigns that are used by amateur radio logging software.<br />
* {{AUR|dxcc}} &ndash; a small program for determining ARRL DXCC entity of a ham radio callsign<br />
<br />
=== Morse code training ===<br />
* {{AUR|aldo}}<br />
* {{AUR|cutecw}}<br />
* {{AUR|ebook2cw}}<br />
* {{AUR|gtkmmorse}}<br />
* {{AUR|kochmorse}}<br />
* {{AUR|qrq}}<br />
* {{AUR|unixcw}}<br />
<br />
=== Other ===<br />
* {{AUR|cwirc}} &ndash; Send and receive Morse code messages via IRC</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Amateur_radio&diff=577233
Amateur radio
2019-07-10T09:59:20Z
<p>Liu-shuyuan: Added language tag for Chinese (simplified)</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:アマチュア無線]]<br />
[[zh-hans:业余无线电]]<br />
{{Related articles start}}<br />
{{Related|GNU Radio}}<br />
{{Related|RTL-SDR}}<br />
{{Related articles end}}<br />
<br />
Amateur radio enthusiasts (sometimes called ham radio operators or "hams") have been at the forefront of experimentation and development since the earliest days of radio. A wide variety of communication modes are used on a vast range of frequencies that span the electromagnetic spectrum. <br />
This page lists software related to amateur radio that can be found in the [[AUR]]. Some of it is stand-alone while the various digital communication applications require interfacing to radio hardware and possibly the computer soundcard. Interface hardware can be purchased from vendors or home-built. <br />
<br />
{{Warning|International treaties require that users of amateur radio frequencies have a government-issued license. This only affects you if you have a transmitter and an antenna, receiving amateur radio or just downloading amateur radio software isn't illegal.}}<br />
<br />
== General information ==<br />
Many of the following programs will need to access a serial port to key the transmitter (eg. /dev/ttyS0). This requires that the user belong to the uucp group. To add the user to the uucp group issue the following command as root:<br />
<br />
# gpasswd -a ''username'' uucp<br />
<br />
then logoff and logon.<br />
<br />
== Software list ==<br />
* {{App|Hamlib|provides an interface between hardware and radio control programs. It is a software layer to facilitate the control of radios and other hardware (eg. for logging, digital modes) and is not a stand-alone application.<br />
|https://sourceforge.net/projects/hamlib/|{{Pkg|hamlib}}}}<br />
<br />
* {{App|Soundmodem|was written by Tom Sailer (HB9JNX/AE4WA) to allow a standard PC soundcard to act as a packet radio modem for use with the various AX.25 communication modes. The data rate can be as high as 9600 baud depending on the hardware and application. Soundmodem can be used as a KISS modem on the serial port or as an AX.25 network device. To use soundmodem as an MKISS network device, the kernel must be re-built with MKISS modules. More information is in the [http://www.xastir.org/wiki/index.php/HowTo:SoundModem Xastir wiki]<br />
:Run soundmodem as root:<br />
:{{bc|# soundmodem}}<br />
:If you have configured soundmodem as a KISS modem, you will need to change permissions to make it user-readable:<br />
:{{bc|# chmod 666 /dev/soundmodem0}}<br />
|http://www.baycom.org/~tom/ham/soundmodem/|{{AUR|soundmodem}}}}<br />
<br />
* {{App|Grig|simple control program based on Hamlib|http://groundstation.sourceforge.net/grig/|{{AUR|grig}}}}<br />
* {{App|gMFSK|is a user interface that supports a multitude of digital modes. It uses hamlib and xlog for logging|http://gmfsk.connect.fi|{{AUR|gmfsk}}}}<br />
* {{App|lysdr|highly customizable radio interface|https://github.com/gordonjcp/lysdr}}<br />
* {{App|linrad|Software defined radio by SM5BSZ|http://www.sm5bsz.com/linuxdsp/linrad.htm|{{AUR|linrad}}}} <br />
* {{App|quisk|Software defined radio by N2ADR|http://james.ahlstrom.name/quisk/|{{AUR|quisk}}}}<br />
* {{App|owx|Command-line utility for programming Wouxun radios using CSV spreadsheets.|http://owx.chmurka.net|{{AUR|owx}}}}<br />
* {{App|fldigi|popular GUI developed by W1HKJ for a variety of digital communication modes|http://w1hkj.com/Fldigi.html|{{AUR|fldigi}}}}<br />
* {{App|libfap|APRS packet parser|http://pakettiradio.net/libfap/|{{AUR|libfap}}}}<br />
* {{App|aprx|lightweight APRS digipeater and i-Gate interface|http://thelifeofkenneth.com/aprx/|{{AUR|aprx}}}}<br />
* {{App|xdx|network client|http://www.qsl.net/pg4i/linux/xdx.html|{{AUR|xdx}}}}<br />
* {{App|qsstv|Slow-scan television||{{AUR|qsstv}}}}<br />
* {{App|linpsk|PSK31||{{AUR|linpsk}}}}<br />
* {{App|xpsk31|PSK31 using a GUI rendered by GTK+|http://www.qsl.net/5b4az/pkg/psk31/xpsk31/xpsk31.html|{{AUR|xpsk31}}}}<br />
<br />
=== AX.25 ===<br />
{{App|[[Wikipedia:AX.25|AX.25]]|data link layer protocol that is used extensively in packet radio networks. It supports connected operation (eg. keyboard-to-keyboard contacts, access to local bulletin board systems, and DX clusters) as well as connectionless operation (eg. [[Wikipedia:APRS|APRS]]). The Linux kernel includes native support for AX.25 networking. Please refer to this [http://tldp.org/HOWTO/AX25-HOWTO/ guide] for more information. The following software is available in the AUR:<br />
* {{AUR|ax25-apps}}<br />
* {{AUR|ax25-tools}}<br />
* {{AUR|libax25}}<br />
* {{AUR|node}}<br />
|http://www.ax25.net/|present in stock kernel}}<br />
<br />
=== WSJT ===<br />
{{App|[[Wikipedia:WSJT_(Amateur_radio_software)|WSJT]] (Weak Signal Communication by K1JT)|offers offers a rich variety of features, including specific digital protocols optimized for meteor scatter, ionospheric scatter, and EME (moonbounce) at VHF/UHF, as well as HF skywave propagation. WSJT was developed by Nobel Prize winning physicist Joe Taylor, who has the amateur radio callsign K1JT. The program can decode fraction-of-a-second signals reflected from ionized meteor trails and steady signals 10 dB below the audible threshold.<br><br />
WSJT is in ongoing, active development by a team of programmers led by K1JT. WSJT (and the related program WSPR) has the option of being configured with <br />
{{bc|$ ./configure --enable-g95}}<br />
or <br />
{{bc|$ ./configure --enable-gfortran}}<br />
If you build with one and experience problems, edit PKGBUILD to try the other.<br><br />
WSJT requires access to the serial port; see the note in the Interfacing section above about the uucp group.<br />
|http://www.physics.princeton.edu/pulsar/K1JT/|{{AUR|wsjt-svn}}}}<br />
<br />
=== WSPR ===<br />
{{App|[[Wikipedia:WSPR (amateur_radio_software)|WSPR]] (Weak Signal Propagation Reporter, pronounced whisper)|enables the probing of propagation paths on the amateur radio bands using low power transmissions. It was introduced in 2008 by K1JT following the success and widespread adoption of WSJT by the amateur radio community. Stations with Internet access can automatically upload their reception reports to a central database called [http://wsprnet.org/drupal/ WSPRnet], which includes a [http://wsprnet.org/drupal/wsprnet/map mapping facility]<br />
|http://physics.princeton.edu/pulsar/K1JT/wspr.html|{{AUR|wspr-svn}}}}<br />
<br />
=== Xastir ===<br />
{{App|Xastir|stands for X Amateur Station and Information Reporting. It works with [[Wikipedia:APRS|APRS]], an amateur radio-based system for real time tactical digital communications. Xastir is an open-source program that provides full-featured, client-side access to APRS. It is currently in a state of active development.<br>Xastir is highly flexible and there are a wide variety of ways it can be configured. For example, it can be evaluated without radio hardware if an Internet connection is available. The wiki at xastir.org is very thorough and gives excellent information on its range of capabilities and setup.<br>An optional speech feature can be enabled with the {{pkg|festival}} package; you will also need a speaker package such as festival-en or festival-english. If you want this option, festival must be installed on your system before building xastir. Launch festival before the xastir program is started for speech to function properly:<br />
{{bc|$ festival --server}}<br />
or you can write a simple script to automate the sequential starting process. There may be problems if other programs such as a media player are accessing sound simultaneously.<br>The PKGBUILD automatically downloads an 850 kB bundle of .wav files and places them here: {{Ic|/usr/share/xastir/sounds/}}.<br>These are audio alarm recordings of a North American English speaker that do not require the presence of festival to render. The audio play command `play' in the configure menu may not work; try `aplay' instead.<br />
|http://www.xastir.org|{{AUR|xastir}}}}<br />
<br />
<br />
=== Digital Voice ===<br />
{{App|FreeDV|is a Digital Voice mode for HF radio. It uses the free and open Codec2 voice codec to enable efficient narrow bandwith, low bitrate voice communication ideally suited for shortwave radio contacts. A SSB radio connected to a computer running the FreeDV GUI application are all that is needed to start using the FreeDV mode. FreeDV as well as Codec2 are available to Arch Linux via the AUR system. Both are needed for FreeDV to work!<br />
* http://www.rowetel.com/codec2.html {{Pkg|codec2}}<br />
|http://freedv.org|{{AUR|freedv}}}}<br />
<br />
<br />
=== Analysis tools ===<br />
* {{AUR|gpredict}} &ndash; Real-time satellite tracking and orbit prediction application<br />
* {{AUR|hamsolar}} &ndash; Small desktop display of the current solar indices<br />
* {{AUR|splat}} &ndash; rf signal propagation, loss, and terrain analysis<br />
* {{AUR|sunclock}} &ndash; Useful for predicting grayline propagation paths<br />
* {{AUR|xnec2c}} &ndash; Electromagnetic antenna modeler<br />
<br />
=== Logging ===<br />
* {{AUR|cqrlog-bin}} &ndash; a popular Linux logging program<br />
* {{AUR|fdlog}} &ndash; a Field Day Logger with networked nodes<br />
* {{AUR|klog}} &ndash; a Ham radio logging program for Linux / KDE.<br />
* {{AUR|qle}} &ndash; QSO Logger and log Editor for amateur radio operators written in Perl<br />
* {{AUR|tlf}} &ndash; a console mode networked logging and contest program<br />
* {{AUR|trustedqsl}} &ndash; QSL application for ARRL's Logbook of the World<br />
* {{AUR|xlog}} &ndash; a logging program for amateur radio operators.<br />
* {{AUR|yfklog}} &ndash; a general purpose ham radio logbook for *nix operating systems.<br />
* {{AUR|yfktest}} &ndash; a logbook program for ham radio contests.<br />
<br />
=== Tools ===<br />
* {{AUR|cty}} &ndash; package contains databases of entities (countries), prefixes and callsigns that are used by amateur radio logging software.<br />
* {{AUR|dxcc}} &ndash; a small program for determining ARRL DXCC entity of a ham radio callsign<br />
<br />
=== Morse code training ===<br />
* {{AUR|aldo}}<br />
* {{AUR|cutecw}}<br />
* {{AUR|ebook2cw}}<br />
* {{AUR|gtkmmorse}}<br />
* {{AUR|kochmorse}}<br />
* {{AUR|qrq}}<br />
* {{AUR|unixcw}}<br />
<br />
=== Other ===<br />
* {{AUR|cwirc}} &ndash; Send and receive Morse code messages via IRC</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=577231
ArchWiki:Translation Team (简体中文)
2019-07-10T09:55:54Z
<p>Liu-shuyuan: /* 页面维护列表 */ Added myself as translator for Amateur radio</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:ArchWiki (简体中文)]]<br />
[[ar:ArchWiki Translation Team]]<br />
[[cs:ArchWiki Translation Team]]<br />
[[el:ArchWiki Translation Team]]<br />
[[en:ArchWiki:Translation Team]]<br />
[[es:ArchWiki:Translation Team]]<br />
[[fr:ArchWiki Translation Team]]<br />
[[hr:ArchWiki Translation Team]]<br />
[[it:ArchWiki Translation Team]]<br />
[[ja:ArchWiki 翻訳チーム]]<br />
[[ko:ArchWiki Translation Team]]<br />
[[nl:ArchWiki Translation Team]]<br />
[[pl:ArchWiki Translation Team]]<br />
[[pt:ArchWiki:Translation Team]]<br />
[[ru:ArchWiki Translation Team]]<br />
[[sk:ArchWiki Translation Team]]<br />
[[zh-hant:ArchWiki:Translation Team]]<br />
Arch Wiki 上有许多中文页面,这其中大部分是从外文翻译过来的,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对Arch Wiki做贡献,参与Wiki建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
{{警告|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读 [[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin|登录]] 以进行编辑。<br />
# 选择要翻译的页面,例如从 [[Special:Random|随机页面]] 或[[#页面维护列表|页面维护列表]] 中选择一个未翻译完成的页面。假设要翻译 [[Some Page]].<br />
# 进入选择的英文页面,点击页面顶部的 '''编辑'''。<br />
# 添加要翻译文件的语言间链接, 简体中文的话加入<nowiki>[[zh-hans:Some Page]]</nowiki>,其它语言参见[[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 保存页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[Some Page (简体中文)]] : {{ic|<nowiki>https://wiki.archlinux.org/index.php/Some_Page_(</nowiki>''简体中文'')}}<br />
# 因为页面不存在,点击 '''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:Internationalization]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:Internationalization (简体中文)]]</nowiki>}},参阅[[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-hans}} 修改为 {{ic|en}},并将英文页面移到文章顶部。<br />
# 翻译页面,进行保存。<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
# 更新所有其它语言页面,加入刚翻译文章的语言间链接。<br />
# (可选)创建一个简体中文名称的页面,指向新创建的页面:访问 {{ic|<nowiki>https://wiki.archlinux.org/index.php/</nowiki>''页面的中文名称''}}.<br />
# (可选)建立新页面,并加入:{{bc|<nowiki>#REDIRECT [[Some Page (简体中文)</nowiki>]]}}<br />
<br />
== Templates ==<br />
<br />
{{Translateme (简体中文)|Not translated}}<br />
<br />
The following table lists the [[Help:Template (简体中文)|templates]] that should be translated and their Simplified Chinese equivalent.<br />
<br />
{| class=wikitable<br />
! English template || Simplified Chinese version<br />
|-<br />
! colspan=2| Article templates<br />
|-<br />
| [[Template:Related articles start]] || [[Template:Related articles start (简体中文)]]<br />
|-<br />
| [[Template:Yes]] || [[Template:是]]<br />
|-<br />
| [[Template:No]] || [[Template:否]]<br />
|-<br />
| [[Template:Tip]] || [[Template:提示]]<br />
|-<br />
| [[Template:Note]] || [[Template:注意]]<br />
|-<br />
| [[Template:Warning]] || [[Template:警告]]<br />
|-<br />
| [[Template:Dead link]] || [[Template:失效链接]]<br />
|-<br />
| [[Template:Broken package link]] || {{-}}<br />
|-<br />
! colspan=2| Translation status templates<br />
|-<br />
| [[Template:Bad translation]] || {{-}}<br />
|-<br />
| [[Template:Translateme]] || [[Template:Translateme (简体中文)]]<br />
|-<br />
| [[Template:TranslationStatus]] || [[Template:TranslationStatus (简体中文)]]<br />
|-<br />
! colspan=2| Special templates<br />
|-<br />
| [[Template:Cat main]] || {{-}}<br />
|-<br />
| [[Template:Template]] || {{-}}<br />
|}<br />
<br />
== 完善翻译 ==<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个页面] 包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
<br />
== 更新过期页面 == <br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模版,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 翻译任务 ==<br />
=== 模板 Article summary 变更为 Related ===<br />
因为 Summary 中的简介基本上和正文的介绍一样,所以页面左边的介绍栏进行了简化,只保留相关文章功能。英文页面正在进行大规模修改,相应的中文页面也需要同步更新。<br />
<br />
需要注意的地方:<br />
* 将第一行改成<br />
: <nowiki>{{Related articles start (简体中文)}}</nowiki><br />
* 如果英文的相关文章存在中文翻译,则替换为简体中文页面。示例:<br />
: <nowiki>{{Related2|Display Manager (简体中文)|显示管理器}}</nowiki><br />
* 示例:[https://wiki.archlinux.org/index.php?title=Start_X_at_Login&diff=0&oldid=270155 英文变更], [https://wiki.archlinux.org/index.php?title=Start_X_at_Login_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=285643&oldid=242662 对应的翻译]<br />
<br />
== 维护翻译 ==<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[[Special:WhatLinksHere/Template:TranslationStatus_(简体中文)|模板的反向链接]]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应{{ic|<nowiki>{{out of date}}</nowiki>}} 模版<br />
;未翻译:页面中含有英文内容,对应{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板<br />
;完成:页面已与英文页面同步<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[acpid (简体中文)]]<br />
| 过期<br />
| Cael<br />
|<br />
|-<br />
| [[Advanced Linux Sound Architecture (简体中文)]]<br />
| 翻译中<br />
| ihonliu<br />
| 无<br />
|-<br />
| [[Arch based distributions (active) (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[Amateur radio (简体中文)]]<br />
| 翻译中<br />
| liu-shuyuan<br />
| <br />
|-<br />
| [[AMD Catalyst (简体中文)]]<br />
| 过期<br />
| Shibao Zhao<br />
| 无<br />
|-<br />
| [[ATI (简体中文)]]<br />
| 完成<br />
| skysailing<br />
| 无<br />
|-<br />
| [[AUR helpers (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 部分用词可能需要修改<br />
|-<br />
| [[awesome (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无<br />
|-<br />
| [[BIND (简体中文)]]<br />
| 完成<br />
| Dargasia<br />
|<br />
|-<br />
| [[Bumblebee (简体中文)]]<br />
| 完成<br />
| Peter<br />
| 无<br />
|-<br />
| [[Chromium (简体中文)]]<br />
| 完成<br />
| Bobby<br />
| 无<br />
|-<br />
| [[Ceph (简体中文)]]<br />
| 翻译中<br />
| Aaron Chen<br />
| 部分未翻译 <br />
|-<br />
| [[Cinnamon (简体中文)]]<br />
| 部分翻译 <br />
| Bobby<br />
| 部分未翻译 <br />
|- <br />
| [[Common Applications (简体中文)]]<br />
| 部分翻译 <br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Common Applications/Science (简体中文)]]<br />
| drop maintain<br />
| 更新,翻译中<br />
|<br />
|-<br />
| [[Compiz (简体中文)]]<br />
| 翻译中<br />
| xiii_1991<br />
| 20140813开始<br />
|-<br />
| [[Conky (简体中文)]]<br />
| 完成<br />
| upi<br />
| 无<br />
|-<br />
| [[Core utilities (简体中文)]]<br />
| 完成<br />
| rentaro, Arisaka<br />
| 无<br />
|-<br />
|-<br />
| [[Clover (简体中文)]]<br />
| 完成<br />
| Yume Kankawa<br />
| 无<br />
|-<br />
| [[Disk cloning (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Dynamic Kernel Module Support (简体中文)]]<br />
| 完成<br />
| Mithrandir<br />
| 完善中<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[File recovery (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Fish (简体中文)]]<br />
| 完成<br />
| liu-shuyuan<br />
|<br />
|-<br />
| [[Font configuration (简体中文)]]<br />
| 翻译中<br />
| Jaurung<br />
| 完善中<br />
|-<br />
| [[Fonts (简体中文)]]<br />
| 翻译中<br />
| qqbzg<br />
| 无<br />
|-<br />
| [[GDM (简体中文)]]<br />
| 翻译中<br />
| Junjie Yuan<br />
| 绝大多数内容未翻译,重新进行翻译<br />
|-<br />
| [[GNOME (简体中文)]]<br />
| 完成<br />
| skywet<br />
| <br />
|-<br />
| [[GRUB (简体中文)]]<br />
| 完成<br />
| Armodeniz<br />
| <br />
|-<br />
| [[GRUB/Tips and tricks (简体中文)]]<br />
| 完成<br />
| Armodeniz<br />
| <br />
|-<br />
| [[KDE (简体中文)]]<br />
| 过期<br />
| <br />
| <br />
|-<br />
| [[LAMP (简体中文)]]<br />
| 完成<br />
| Liuzhengyi<br />
| 勘误中<br />
|-<br />
| [[LibreOffice (简体中文)]]<br />
| 完成<br />
| qqbzg<br />
| 勘误中<br />
|-<br />
| [[Libvirt (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 需要格式改进<br />
|-<br />
| [[Local Mirror (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|- <br />
| [[MATLAB (简体中文)]]<br />
| 部分翻译 <br />
| Liu Qinyang<br />
|<br />
|-<br />
| [[Minecraft (简体中文)]]<br />
| 完成 <br />
| Xavier Lau<br />
| 页面已经与英文版同步,长期维护中<br />
|-<br />
| [[NetworkManager (简体中文)]]<br />
| 翻译中 <br />
| Jack-lijing, leeking <br />
| 请优先翻译<br />
|-<br />
| [[Network Time Protocol daemon (简体中文)]]<br />
| 完成<br />
| sid<br />
| 完善中<br />
|-<br />
| [[OpenOffice (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Opera (简体中文)]]<br />
| 未翻译<br />
| Bobby<br />
| 请优先翻译此文 <br />
|-<br />
| [[Pacman GUI Frontends (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Pidgin (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无 <br />
|- <br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Raspberry Pi (简体中文)]]<br />
| 翻译中<br />
| Mithrandir<br />
| <br />
|-<br />
| [[Reporting bug guidelines (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[Secure Shell (简体中文)]]<br />
| 完成<br />
| Arisaka<br />
| 无<br />
|-<br />
| [[Smart Common Input Method platform (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Systemd-timesyncd (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[TLP (简体中文)]]<br />
| 完成<br />
| Skywet<br />
| 持续更新中 <br />
|-<br />
| [[Tomcat (简体中文)]]<br />
| 完成<br />
| Starwing117<br />
| 持续更新中 <br />
|-<br />
| [[Vim (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[VirtualBox (简体中文)]]<br />
| 翻译至 2017-10-15<br />
| [[User:5long]]<br />
|<br />
|-<br />
| [[VMware (简体中文)]]<br />
| 完成<br />
| ThomasWFan<br />
| 页面已经与英文版同步,长期维护中<br />
|- <br />
| [[Xfce (简体中文)]]<br />
| 完成 <br />
| 无<br />
| 无<br />
|-<br />
| [[Xmonad (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Xrandr (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Python打包指引 (简体中文)]]<br />
| 翻译中<br />
| SherlockHolo<br />
| 无<br />
|-<br />
| [[Java (简体中文)]]<br />
| 翻译中<br />
| CaCaCarrot<br />
| 无</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=577229
ArchWiki:Translation Team (简体中文)
2019-07-10T09:54:00Z
<p>Liu-shuyuan: /* 页面维护列表 */ change order of AMD Catalyst (wasn't in alphabetical order)</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:ArchWiki (简体中文)]]<br />
[[ar:ArchWiki Translation Team]]<br />
[[cs:ArchWiki Translation Team]]<br />
[[el:ArchWiki Translation Team]]<br />
[[en:ArchWiki:Translation Team]]<br />
[[es:ArchWiki:Translation Team]]<br />
[[fr:ArchWiki Translation Team]]<br />
[[hr:ArchWiki Translation Team]]<br />
[[it:ArchWiki Translation Team]]<br />
[[ja:ArchWiki 翻訳チーム]]<br />
[[ko:ArchWiki Translation Team]]<br />
[[nl:ArchWiki Translation Team]]<br />
[[pl:ArchWiki Translation Team]]<br />
[[pt:ArchWiki:Translation Team]]<br />
[[ru:ArchWiki Translation Team]]<br />
[[sk:ArchWiki Translation Team]]<br />
[[zh-hant:ArchWiki:Translation Team]]<br />
Arch Wiki 上有许多中文页面,这其中大部分是从外文翻译过来的,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对Arch Wiki做贡献,参与Wiki建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
{{警告|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读 [[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin|登录]] 以进行编辑。<br />
# 选择要翻译的页面,例如从 [[Special:Random|随机页面]] 或[[#页面维护列表|页面维护列表]] 中选择一个未翻译完成的页面。假设要翻译 [[Some Page]].<br />
# 进入选择的英文页面,点击页面顶部的 '''编辑'''。<br />
# 添加要翻译文件的语言间链接, 简体中文的话加入<nowiki>[[zh-hans:Some Page]]</nowiki>,其它语言参见[[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 保存页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[Some Page (简体中文)]] : {{ic|<nowiki>https://wiki.archlinux.org/index.php/Some_Page_(</nowiki>''简体中文'')}}<br />
# 因为页面不存在,点击 '''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:Internationalization]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:Internationalization (简体中文)]]</nowiki>}},参阅[[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-hans}} 修改为 {{ic|en}},并将英文页面移到文章顶部。<br />
# 翻译页面,进行保存。<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
# 更新所有其它语言页面,加入刚翻译文章的语言间链接。<br />
# (可选)创建一个简体中文名称的页面,指向新创建的页面:访问 {{ic|<nowiki>https://wiki.archlinux.org/index.php/</nowiki>''页面的中文名称''}}.<br />
# (可选)建立新页面,并加入:{{bc|<nowiki>#REDIRECT [[Some Page (简体中文)</nowiki>]]}}<br />
<br />
== Templates ==<br />
<br />
{{Translateme (简体中文)|Not translated}}<br />
<br />
The following table lists the [[Help:Template (简体中文)|templates]] that should be translated and their Simplified Chinese equivalent.<br />
<br />
{| class=wikitable<br />
! English template || Simplified Chinese version<br />
|-<br />
! colspan=2| Article templates<br />
|-<br />
| [[Template:Related articles start]] || [[Template:Related articles start (简体中文)]]<br />
|-<br />
| [[Template:Yes]] || [[Template:是]]<br />
|-<br />
| [[Template:No]] || [[Template:否]]<br />
|-<br />
| [[Template:Tip]] || [[Template:提示]]<br />
|-<br />
| [[Template:Note]] || [[Template:注意]]<br />
|-<br />
| [[Template:Warning]] || [[Template:警告]]<br />
|-<br />
| [[Template:Dead link]] || [[Template:失效链接]]<br />
|-<br />
| [[Template:Broken package link]] || {{-}}<br />
|-<br />
! colspan=2| Translation status templates<br />
|-<br />
| [[Template:Bad translation]] || {{-}}<br />
|-<br />
| [[Template:Translateme]] || [[Template:Translateme (简体中文)]]<br />
|-<br />
| [[Template:TranslationStatus]] || [[Template:TranslationStatus (简体中文)]]<br />
|-<br />
! colspan=2| Special templates<br />
|-<br />
| [[Template:Cat main]] || {{-}}<br />
|-<br />
| [[Template:Template]] || {{-}}<br />
|}<br />
<br />
== 完善翻译 ==<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个页面] 包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
<br />
== 更新过期页面 == <br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模版,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 翻译任务 ==<br />
=== 模板 Article summary 变更为 Related ===<br />
因为 Summary 中的简介基本上和正文的介绍一样,所以页面左边的介绍栏进行了简化,只保留相关文章功能。英文页面正在进行大规模修改,相应的中文页面也需要同步更新。<br />
<br />
需要注意的地方:<br />
* 将第一行改成<br />
: <nowiki>{{Related articles start (简体中文)}}</nowiki><br />
* 如果英文的相关文章存在中文翻译,则替换为简体中文页面。示例:<br />
: <nowiki>{{Related2|Display Manager (简体中文)|显示管理器}}</nowiki><br />
* 示例:[https://wiki.archlinux.org/index.php?title=Start_X_at_Login&diff=0&oldid=270155 英文变更], [https://wiki.archlinux.org/index.php?title=Start_X_at_Login_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=285643&oldid=242662 对应的翻译]<br />
<br />
== 维护翻译 ==<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[[Special:WhatLinksHere/Template:TranslationStatus_(简体中文)|模板的反向链接]]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应{{ic|<nowiki>{{out of date}}</nowiki>}} 模版<br />
;未翻译:页面中含有英文内容,对应{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板<br />
;完成:页面已与英文页面同步<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[acpid (简体中文)]]<br />
| 过期<br />
| Cael<br />
|<br />
|-<br />
| [[Advanced Linux Sound Architecture (简体中文)]]<br />
| 翻译中<br />
| ihonliu<br />
| 无<br />
|-<br />
| [[Arch based distributions (active) (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[AMD Catalyst (简体中文)]]<br />
| 过期<br />
| Shibao Zhao<br />
| 无<br />
|-<br />
| [[ATI (简体中文)]]<br />
| 完成<br />
| skysailing<br />
| 无<br />
|-<br />
| [[AUR helpers (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 部分用词可能需要修改<br />
|-<br />
| [[awesome (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无<br />
|-<br />
| [[BIND (简体中文)]]<br />
| 完成<br />
| Dargasia<br />
|<br />
|-<br />
| [[Bumblebee (简体中文)]]<br />
| 完成<br />
| Peter<br />
| 无<br />
|-<br />
| [[Chromium (简体中文)]]<br />
| 完成<br />
| Bobby<br />
| 无<br />
|-<br />
| [[Ceph (简体中文)]]<br />
| 翻译中<br />
| Aaron Chen<br />
| 部分未翻译 <br />
|-<br />
| [[Cinnamon (简体中文)]]<br />
| 部分翻译 <br />
| Bobby<br />
| 部分未翻译 <br />
|- <br />
| [[Common Applications (简体中文)]]<br />
| 部分翻译 <br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Common Applications/Science (简体中文)]]<br />
| drop maintain<br />
| 更新,翻译中<br />
|<br />
|-<br />
| [[Compiz (简体中文)]]<br />
| 翻译中<br />
| xiii_1991<br />
| 20140813开始<br />
|-<br />
| [[Conky (简体中文)]]<br />
| 完成<br />
| upi<br />
| 无<br />
|-<br />
| [[Core utilities (简体中文)]]<br />
| 完成<br />
| rentaro, Arisaka<br />
| 无<br />
|-<br />
|-<br />
| [[Clover (简体中文)]]<br />
| 完成<br />
| Yume Kankawa<br />
| 无<br />
|-<br />
| [[Disk cloning (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Dynamic Kernel Module Support (简体中文)]]<br />
| 完成<br />
| Mithrandir<br />
| 完善中<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[File recovery (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Fish (简体中文)]]<br />
| 完成<br />
| liu-shuyuan<br />
|<br />
|-<br />
| [[Font configuration (简体中文)]]<br />
| 翻译中<br />
| Jaurung<br />
| 完善中<br />
|-<br />
| [[Fonts (简体中文)]]<br />
| 翻译中<br />
| qqbzg<br />
| 无<br />
|-<br />
| [[GDM (简体中文)]]<br />
| 翻译中<br />
| Junjie Yuan<br />
| 绝大多数内容未翻译,重新进行翻译<br />
|-<br />
| [[GNOME (简体中文)]]<br />
| 完成<br />
| skywet<br />
| <br />
|-<br />
| [[GRUB (简体中文)]]<br />
| 完成<br />
| Armodeniz<br />
| <br />
|-<br />
| [[GRUB/Tips and tricks (简体中文)]]<br />
| 完成<br />
| Armodeniz<br />
| <br />
|-<br />
| [[KDE (简体中文)]]<br />
| 过期<br />
| <br />
| <br />
|-<br />
| [[LAMP (简体中文)]]<br />
| 完成<br />
| Liuzhengyi<br />
| 勘误中<br />
|-<br />
| [[LibreOffice (简体中文)]]<br />
| 完成<br />
| qqbzg<br />
| 勘误中<br />
|-<br />
| [[Libvirt (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 需要格式改进<br />
|-<br />
| [[Local Mirror (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|- <br />
| [[MATLAB (简体中文)]]<br />
| 部分翻译 <br />
| Liu Qinyang<br />
|<br />
|-<br />
| [[Minecraft (简体中文)]]<br />
| 完成 <br />
| Xavier Lau<br />
| 页面已经与英文版同步,长期维护中<br />
|-<br />
| [[NetworkManager (简体中文)]]<br />
| 翻译中 <br />
| Jack-lijing, leeking <br />
| 请优先翻译<br />
|-<br />
| [[Network Time Protocol daemon (简体中文)]]<br />
| 完成<br />
| sid<br />
| 完善中<br />
|-<br />
| [[OpenOffice (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Opera (简体中文)]]<br />
| 未翻译<br />
| Bobby<br />
| 请优先翻译此文 <br />
|-<br />
| [[Pacman GUI Frontends (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Pidgin (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无 <br />
|- <br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Raspberry Pi (简体中文)]]<br />
| 翻译中<br />
| Mithrandir<br />
| <br />
|-<br />
| [[Reporting bug guidelines (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[Secure Shell (简体中文)]]<br />
| 完成<br />
| Arisaka<br />
| 无<br />
|-<br />
| [[Smart Common Input Method platform (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Systemd-timesyncd (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[TLP (简体中文)]]<br />
| 完成<br />
| Skywet<br />
| 持续更新中 <br />
|-<br />
| [[Tomcat (简体中文)]]<br />
| 完成<br />
| Starwing117<br />
| 持续更新中 <br />
|-<br />
| [[Vim (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[VirtualBox (简体中文)]]<br />
| 翻译至 2017-10-15<br />
| [[User:5long]]<br />
|<br />
|-<br />
| [[VMware (简体中文)]]<br />
| 完成<br />
| ThomasWFan<br />
| 页面已经与英文版同步,长期维护中<br />
|- <br />
| [[Xfce (简体中文)]]<br />
| 完成 <br />
| 无<br />
| 无<br />
|-<br />
| [[Xmonad (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Xrandr (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Python打包指引 (简体中文)]]<br />
| 翻译中<br />
| SherlockHolo<br />
| 无<br />
|-<br />
| [[Java (简体中文)]]<br />
| 翻译中<br />
| CaCaCarrot<br />
| 无</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=577227
ArchWiki:Translation Team (简体中文)
2019-07-10T09:52:28Z
<p>Liu-shuyuan: /* 页面维护列表 */ change 'Liu-shuyuan' to 'liu-shuyuan'</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:ArchWiki (简体中文)]]<br />
[[ar:ArchWiki Translation Team]]<br />
[[cs:ArchWiki Translation Team]]<br />
[[el:ArchWiki Translation Team]]<br />
[[en:ArchWiki:Translation Team]]<br />
[[es:ArchWiki:Translation Team]]<br />
[[fr:ArchWiki Translation Team]]<br />
[[hr:ArchWiki Translation Team]]<br />
[[it:ArchWiki Translation Team]]<br />
[[ja:ArchWiki 翻訳チーム]]<br />
[[ko:ArchWiki Translation Team]]<br />
[[nl:ArchWiki Translation Team]]<br />
[[pl:ArchWiki Translation Team]]<br />
[[pt:ArchWiki:Translation Team]]<br />
[[ru:ArchWiki Translation Team]]<br />
[[sk:ArchWiki Translation Team]]<br />
[[zh-hant:ArchWiki:Translation Team]]<br />
Arch Wiki 上有许多中文页面,这其中大部分是从外文翻译过来的,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对Arch Wiki做贡献,参与Wiki建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
{{警告|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读 [[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin|登录]] 以进行编辑。<br />
# 选择要翻译的页面,例如从 [[Special:Random|随机页面]] 或[[#页面维护列表|页面维护列表]] 中选择一个未翻译完成的页面。假设要翻译 [[Some Page]].<br />
# 进入选择的英文页面,点击页面顶部的 '''编辑'''。<br />
# 添加要翻译文件的语言间链接, 简体中文的话加入<nowiki>[[zh-hans:Some Page]]</nowiki>,其它语言参见[[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 保存页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[Some Page (简体中文)]] : {{ic|<nowiki>https://wiki.archlinux.org/index.php/Some_Page_(</nowiki>''简体中文'')}}<br />
# 因为页面不存在,点击 '''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:Internationalization]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:Internationalization (简体中文)]]</nowiki>}},参阅[[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-hans}} 修改为 {{ic|en}},并将英文页面移到文章顶部。<br />
# 翻译页面,进行保存。<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
# 更新所有其它语言页面,加入刚翻译文章的语言间链接。<br />
# (可选)创建一个简体中文名称的页面,指向新创建的页面:访问 {{ic|<nowiki>https://wiki.archlinux.org/index.php/</nowiki>''页面的中文名称''}}.<br />
# (可选)建立新页面,并加入:{{bc|<nowiki>#REDIRECT [[Some Page (简体中文)</nowiki>]]}}<br />
<br />
== Templates ==<br />
<br />
{{Translateme (简体中文)|Not translated}}<br />
<br />
The following table lists the [[Help:Template (简体中文)|templates]] that should be translated and their Simplified Chinese equivalent.<br />
<br />
{| class=wikitable<br />
! English template || Simplified Chinese version<br />
|-<br />
! colspan=2| Article templates<br />
|-<br />
| [[Template:Related articles start]] || [[Template:Related articles start (简体中文)]]<br />
|-<br />
| [[Template:Yes]] || [[Template:是]]<br />
|-<br />
| [[Template:No]] || [[Template:否]]<br />
|-<br />
| [[Template:Tip]] || [[Template:提示]]<br />
|-<br />
| [[Template:Note]] || [[Template:注意]]<br />
|-<br />
| [[Template:Warning]] || [[Template:警告]]<br />
|-<br />
| [[Template:Dead link]] || [[Template:失效链接]]<br />
|-<br />
| [[Template:Broken package link]] || {{-}}<br />
|-<br />
! colspan=2| Translation status templates<br />
|-<br />
| [[Template:Bad translation]] || {{-}}<br />
|-<br />
| [[Template:Translateme]] || [[Template:Translateme (简体中文)]]<br />
|-<br />
| [[Template:TranslationStatus]] || [[Template:TranslationStatus (简体中文)]]<br />
|-<br />
! colspan=2| Special templates<br />
|-<br />
| [[Template:Cat main]] || {{-}}<br />
|-<br />
| [[Template:Template]] || {{-}}<br />
|}<br />
<br />
== 完善翻译 ==<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个页面] 包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
<br />
== 更新过期页面 == <br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模版,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 翻译任务 ==<br />
=== 模板 Article summary 变更为 Related ===<br />
因为 Summary 中的简介基本上和正文的介绍一样,所以页面左边的介绍栏进行了简化,只保留相关文章功能。英文页面正在进行大规模修改,相应的中文页面也需要同步更新。<br />
<br />
需要注意的地方:<br />
* 将第一行改成<br />
: <nowiki>{{Related articles start (简体中文)}}</nowiki><br />
* 如果英文的相关文章存在中文翻译,则替换为简体中文页面。示例:<br />
: <nowiki>{{Related2|Display Manager (简体中文)|显示管理器}}</nowiki><br />
* 示例:[https://wiki.archlinux.org/index.php?title=Start_X_at_Login&diff=0&oldid=270155 英文变更], [https://wiki.archlinux.org/index.php?title=Start_X_at_Login_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=285643&oldid=242662 对应的翻译]<br />
<br />
== 维护翻译 ==<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[[Special:WhatLinksHere/Template:TranslationStatus_(简体中文)|模板的反向链接]]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应{{ic|<nowiki>{{out of date}}</nowiki>}} 模版<br />
;未翻译:页面中含有英文内容,对应{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板<br />
;完成:页面已与英文页面同步<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[AMD Catalyst (简体中文)]]<br />
| 过期<br />
| Shibao Zhao<br />
| 无<br />
|-<br />
| [[acpid (简体中文)]]<br />
| 过期<br />
| Cael<br />
|<br />
|-<br />
| [[Advanced Linux Sound Architecture (简体中文)]]<br />
| 翻译中<br />
| ihonliu<br />
| 无<br />
|-<br />
| [[Arch based distributions (active) (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[ATI (简体中文)]]<br />
| 完成<br />
| skysailing<br />
| 无<br />
|-<br />
| [[AUR helpers (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 部分用词可能需要修改<br />
|-<br />
| [[awesome (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无<br />
|-<br />
| [[BIND (简体中文)]]<br />
| 完成<br />
| Dargasia<br />
|<br />
|-<br />
| [[Bumblebee (简体中文)]]<br />
| 完成<br />
| Peter<br />
| 无<br />
|-<br />
| [[Chromium (简体中文)]]<br />
| 完成<br />
| Bobby<br />
| 无<br />
|-<br />
| [[Ceph (简体中文)]]<br />
| 翻译中<br />
| Aaron Chen<br />
| 部分未翻译 <br />
|-<br />
| [[Cinnamon (简体中文)]]<br />
| 部分翻译 <br />
| Bobby<br />
| 部分未翻译 <br />
|- <br />
| [[Common Applications (简体中文)]]<br />
| 部分翻译 <br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Common Applications/Science (简体中文)]]<br />
| drop maintain<br />
| 更新,翻译中<br />
|<br />
|-<br />
| [[Compiz (简体中文)]]<br />
| 翻译中<br />
| xiii_1991<br />
| 20140813开始<br />
|-<br />
| [[Conky (简体中文)]]<br />
| 完成<br />
| upi<br />
| 无<br />
|-<br />
| [[Core utilities (简体中文)]]<br />
| 完成<br />
| rentaro, Arisaka<br />
| 无<br />
|-<br />
|-<br />
| [[Clover (简体中文)]]<br />
| 完成<br />
| Yume Kankawa<br />
| 无<br />
|-<br />
| [[Disk cloning (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Dynamic Kernel Module Support (简体中文)]]<br />
| 完成<br />
| Mithrandir<br />
| 完善中<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[File recovery (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Fish (简体中文)]]<br />
| 完成<br />
| liu-shuyuan<br />
|<br />
|-<br />
| [[Font configuration (简体中文)]]<br />
| 翻译中<br />
| Jaurung<br />
| 完善中<br />
|-<br />
| [[Fonts (简体中文)]]<br />
| 翻译中<br />
| qqbzg<br />
| 无<br />
|-<br />
| [[GDM (简体中文)]]<br />
| 翻译中<br />
| Junjie Yuan<br />
| 绝大多数内容未翻译,重新进行翻译<br />
|-<br />
| [[GNOME (简体中文)]]<br />
| 完成<br />
| skywet<br />
| <br />
|-<br />
| [[GRUB (简体中文)]]<br />
| 完成<br />
| Armodeniz<br />
| <br />
|-<br />
| [[GRUB/Tips and tricks (简体中文)]]<br />
| 完成<br />
| Armodeniz<br />
| <br />
|-<br />
| [[KDE (简体中文)]]<br />
| 过期<br />
| <br />
| <br />
|-<br />
| [[LAMP (简体中文)]]<br />
| 完成<br />
| Liuzhengyi<br />
| 勘误中<br />
|-<br />
| [[LibreOffice (简体中文)]]<br />
| 完成<br />
| qqbzg<br />
| 勘误中<br />
|-<br />
| [[Libvirt (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 需要格式改进<br />
|-<br />
| [[Local Mirror (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|- <br />
| [[MATLAB (简体中文)]]<br />
| 部分翻译 <br />
| Liu Qinyang<br />
|<br />
|-<br />
| [[Minecraft (简体中文)]]<br />
| 完成 <br />
| Xavier Lau<br />
| 页面已经与英文版同步,长期维护中<br />
|-<br />
| [[NetworkManager (简体中文)]]<br />
| 翻译中 <br />
| Jack-lijing, leeking <br />
| 请优先翻译<br />
|-<br />
| [[Network Time Protocol daemon (简体中文)]]<br />
| 完成<br />
| sid<br />
| 完善中<br />
|-<br />
| [[OpenOffice (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Opera (简体中文)]]<br />
| 未翻译<br />
| Bobby<br />
| 请优先翻译此文 <br />
|-<br />
| [[Pacman GUI Frontends (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Pidgin (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无 <br />
|- <br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Raspberry Pi (简体中文)]]<br />
| 翻译中<br />
| Mithrandir<br />
| <br />
|-<br />
| [[Reporting bug guidelines (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[Secure Shell (简体中文)]]<br />
| 完成<br />
| Arisaka<br />
| 无<br />
|-<br />
| [[Smart Common Input Method platform (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Systemd-timesyncd (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[TLP (简体中文)]]<br />
| 完成<br />
| Skywet<br />
| 持续更新中 <br />
|-<br />
| [[Tomcat (简体中文)]]<br />
| 完成<br />
| Starwing117<br />
| 持续更新中 <br />
|-<br />
| [[Vim (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[VirtualBox (简体中文)]]<br />
| 翻译至 2017-10-15<br />
| [[User:5long]]<br />
|<br />
|-<br />
| [[VMware (简体中文)]]<br />
| 完成<br />
| ThomasWFan<br />
| 页面已经与英文版同步,长期维护中<br />
|- <br />
| [[Xfce (简体中文)]]<br />
| 完成 <br />
| 无<br />
| 无<br />
|-<br />
| [[Xmonad (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Xrandr (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Python打包指引 (简体中文)]]<br />
| 翻译中<br />
| SherlockHolo<br />
| 无<br />
|-<br />
| [[Java (简体中文)]]<br />
| 翻译中<br />
| CaCaCarrot<br />
| 无</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=574601
ArchWiki:Translation Team (简体中文)
2019-06-05T01:12:47Z
<p>Liu-shuyuan: Updated translation state of page Fish to completed</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:ArchWiki (简体中文)]]<br />
[[ar:ArchWiki Translation Team]]<br />
[[cs:ArchWiki Translation Team]]<br />
[[el:ArchWiki Translation Team]]<br />
[[en:ArchWiki:Translation Team]]<br />
[[es:ArchWiki:Translation Team]]<br />
[[fr:ArchWiki Translation Team]]<br />
[[hr:ArchWiki Translation Team]]<br />
[[it:ArchWiki Translation Team]]<br />
[[ja:ArchWiki 翻訳チーム]]<br />
[[ko:ArchWiki Translation Team]]<br />
[[nl:ArchWiki Translation Team]]<br />
[[pl:ArchWiki Translation Team]]<br />
[[pt:ArchWiki:Translation Team]]<br />
[[ru:ArchWiki Translation Team]]<br />
[[sk:ArchWiki Translation Team]]<br />
[[zh-hant:ArchWiki:Translation Team]]<br />
Arch Wiki 上有许多中文页面,这其中大部分是从外文翻译过来的,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对Arch Wiki做贡献,参与Wiki建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
{{警告|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读 [[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin|登录]] 以进行编辑。<br />
# 选择要翻译的页面,例如从 [[Special:Random|随机页面]] 或[[#页面维护列表|页面维护列表]] 中选择一个未翻译完成的页面。假设要翻译 [[Some Page]].<br />
# 进入选择的英文页面,点击页面顶部的 '''编辑'''。<br />
# 添加要翻译文件的语言间链接, 简体中文的话加入<nowiki>[[zh-hans:Some Page]]</nowiki>,其它语言参见[[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 保存页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[Some Page (简体中文)]] : {{ic|<nowiki>https://wiki.archlinux.org/index.php/Some_Page_(</nowiki>''简体中文'')}}<br />
# 因为页面不存在,点击 '''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:Internationalization]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:Internationalization (简体中文)]]</nowiki>}},参阅[[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-hans}} 修改为 {{ic|en}},并将英文页面移到文章顶部。<br />
# 翻译页面,进行保存。<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
# 更新所有其它语言页面,加入刚翻译文章的语言间链接。<br />
# (可选)创建一个简体中文名称的页面,指向新创建的页面:访问 {{ic|<nowiki>https://wiki.archlinux.org/index.php/</nowiki>''页面的中文名称''}}.<br />
# (可选)建立新页面,并加入:{{bc|<nowiki>#REDIRECT [[Some Page (简体中文)</nowiki>]]}}<br />
<br />
== Templates ==<br />
<br />
{{Translateme (简体中文)|Not translated}}<br />
<br />
The following table lists the [[Help:Template (简体中文)|templates]] that should be translated and their Simplified Chinese equivalent.<br />
<br />
{| class=wikitable<br />
! English template || Simplified Chinese version<br />
|-<br />
! colspan=2| Article templates<br />
|-<br />
| [[Template:Related articles start]] || [[Template:Related articles start (简体中文)]]<br />
|-<br />
| [[Template:Yes]] || [[Template:是]]<br />
|-<br />
| [[Template:No]] || [[Template:否]]<br />
|-<br />
| [[Template:Tip]] || [[Template:提示]]<br />
|-<br />
| [[Template:Note]] || [[Template:注意]]<br />
|-<br />
| [[Template:Warning]] || [[Template:警告]]<br />
|-<br />
| [[Template:Dead link]] || [[Template:失效链接]]<br />
|-<br />
| [[Template:Broken package link]] || {{-}}<br />
|-<br />
! colspan=2| Translation status templates<br />
|-<br />
| [[Template:Bad translation]] || {{-}}<br />
|-<br />
| [[Template:Translateme]] || [[Template:Translateme (简体中文)]]<br />
|-<br />
| [[Template:TranslationStatus]] || [[Template:TranslationStatus (简体中文)]]<br />
|-<br />
! colspan=2| Special templates<br />
|-<br />
| [[Template:Cat main]] || {{-}}<br />
|-<br />
| [[Template:Template]] || {{-}}<br />
|}<br />
<br />
== 完善翻译 ==<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个页面] 包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
<br />
== 更新过期页面 == <br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模版,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 翻译任务 ==<br />
=== 模板 Article summary 变更为 Related ===<br />
因为 Summary 中的简介基本上和正文的介绍一样,所以页面左边的介绍栏进行了简化,只保留相关文章功能。英文页面正在进行大规模修改,相应的中文页面也需要同步更新。<br />
<br />
需要注意的地方:<br />
* 将第一行改成<br />
: <nowiki>{{Related articles start (简体中文)}}</nowiki><br />
* 如果英文的相关文章存在中文翻译,则替换为简体中文页面。示例:<br />
: <nowiki>{{Related2|Display Manager (简体中文)|显示管理器}}</nowiki><br />
* 示例:[https://wiki.archlinux.org/index.php?title=Start_X_at_Login&diff=0&oldid=270155 英文变更], [https://wiki.archlinux.org/index.php?title=Start_X_at_Login_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=285643&oldid=242662 对应的翻译]<br />
<br />
== 维护翻译 ==<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[[Special:WhatLinksHere/Template:TranslationStatus_(简体中文)|模板的反向链接]]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应{{ic|<nowiki>{{out of date}}</nowiki>}} 模版<br />
;未翻译:页面中含有英文内容,对应{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板<br />
;完成:页面已与英文页面同步<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[AMD Catalyst (简体中文)]]<br />
| 过期<br />
| Shibao Zhao<br />
| 无<br />
|-<br />
| [[acpid (简体中文)]]<br />
| 过期<br />
| Cael<br />
|<br />
|-<br />
| [[Advanced Linux Sound Architecture (简体中文)]]<br />
| 翻译中<br />
| ihonliu<br />
| 无<br />
|-<br />
| [[Arch based distributions (active) (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[ATI (简体中文)]]<br />
| 完成<br />
| skysailing<br />
| 无<br />
|-<br />
| [[AUR helpers (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 部分用词可能需要修改<br />
|-<br />
| [[awesome (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无<br />
|-<br />
| [[BIND (简体中文)]]<br />
| 完成<br />
| Dargasia<br />
|<br />
|-<br />
| [[Bumblebee (简体中文)]]<br />
| 完成<br />
| Peter<br />
| 无<br />
|-<br />
| [[Chromium (简体中文)]]<br />
| 完成<br />
| Bobby<br />
| 无<br />
|-<br />
| [[Ceph (简体中文)]]<br />
| 翻译中<br />
| Aaron Chen<br />
| 部分未翻译 <br />
|-<br />
| [[Cinnamon (简体中文)]]<br />
| 部分翻译 <br />
| Bobby<br />
| 部分未翻译 <br />
|- <br />
| [[Common Applications (简体中文)]]<br />
| 部分翻译 <br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Common Applications/Science (简体中文)]]<br />
| drop maintain<br />
| 更新,翻译中<br />
|<br />
|-<br />
| [[Compiz (简体中文)]]<br />
| 翻译中<br />
| xiii_1991<br />
| 20140813开始<br />
|-<br />
| [[Conky (简体中文)]]<br />
| 完成<br />
| upi<br />
| 无<br />
|-<br />
| [[Core utilities (简体中文)]]<br />
| 完成<br />
| rentaro, Arisaka<br />
| 无<br />
|-<br />
|-<br />
| [[Clover (简体中文)]]<br />
| 完成<br />
| Yume Kankawa<br />
| 无<br />
|-<br />
| [[Disk cloning (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Dynamic Kernel Module Support (简体中文)]]<br />
| 完成<br />
| Mithrandir<br />
| 完善中<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[File recovery (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Fish (简体中文)]]<br />
| 完成<br />
| Liu-shuyuan<br />
|<br />
|-<br />
| [[Font configuration (简体中文)]]<br />
| 翻译中<br />
| Jaurung<br />
| 完善中<br />
|-<br />
| [[Fonts (简体中文)]]<br />
| 翻译中<br />
| qqbzg<br />
| 无<br />
|-<br />
| [[GDM (简体中文)]]<br />
| 翻译中<br />
| Junjie Yuan<br />
| 绝大多数内容未翻译,重新进行翻译<br />
|-<br />
| [[GNOME (简体中文)]]<br />
| 完成<br />
| skywet<br />
| <br />
|-<br />
| [[KDE (简体中文)]]<br />
| 过期<br />
| <br />
| <br />
|-<br />
| [[LAMP (简体中文)]]<br />
| 完成<br />
| Liuzhengyi<br />
| 勘误中<br />
|-<br />
| [[LibreOffice (简体中文)]]<br />
| 完成<br />
| qqbzg<br />
| 勘误中<br />
|-<br />
| [[Libvirt (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 需要格式改进<br />
|-<br />
| [[Local Mirror (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|- <br />
| [[MATLAB (简体中文)]]<br />
| 部分翻译 <br />
| Liu Qinyang<br />
|<br />
|-<br />
| [[Minecraft (简体中文)]]<br />
| 完成 <br />
| Xavier Lau<br />
| 页面已经与英文版同步,长期维护中<br />
|-<br />
| [[NetworkManager (简体中文)]]<br />
| 翻译中 <br />
| Jack-lijing, leeking <br />
| 请优先翻译<br />
|-<br />
| [[Network Time Protocol daemon (简体中文)]]<br />
| 完成<br />
| sid<br />
| 完善中<br />
|-<br />
| [[OpenOffice (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Opera (简体中文)]]<br />
| 未翻译<br />
| Bobby<br />
| 请优先翻译此文 <br />
|-<br />
| [[Pacman GUI Frontends (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Pidgin (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无 <br />
|- <br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Raspberry Pi (简体中文)]]<br />
| 翻译中<br />
| Mithrandir<br />
| <br />
|-<br />
| [[Reporting bug guidelines (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[Secure Shell (简体中文)]]<br />
| 完成<br />
| Arisaka<br />
| 无<br />
|-<br />
| [[Smart Common Input Method platform (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Systemd-timesyncd (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[TLP (简体中文)]]<br />
| 完成<br />
| Skywet<br />
| 持续更新中 <br />
|-<br />
| [[Tomcat (简体中文)]]<br />
| 完成<br />
| Starwing117<br />
| 持续更新中 <br />
|-<br />
| [[Vim (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[VirtualBox (简体中文)]]<br />
| 翻译至 2017-10-15<br />
| [[User:5long]]<br />
|<br />
|-<br />
| [[VMware (简体中文)]]<br />
| 完成<br />
| ThomasWFan<br />
| 页面已经与英文版同步,长期维护中<br />
|- <br />
| [[Xfce (简体中文)]]<br />
| 完成 <br />
| 无<br />
| 无<br />
|-<br />
| [[Xmonad (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Xrandr (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Python打包指引 (简体中文)]]<br />
| 翻译中<br />
| SherlockHolo<br />
| 无<br />
|-<br />
| [[Java (简体中文)]]<br />
| 翻译中<br />
| CaCaCarrot<br />
| 无</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572827
Fish (简体中文)
2019-05-09T13:13:04Z
<p>Liu-shuyuan: Updated last translation time</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-09|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
=== 只把fish设为交互式shell ===<br />
<br />
如果不将fish设为默认shell,就能照常运行Bash的初始化脚本。这能够保证用户当前的环境变量不受影响并且在fish中也能使用,因为fish是作为Bash的子进程运行的。下面是几种只把fish设为交互式shell的方法。<br />
<br />
==== 通过.bashrc启动fish ====<br />
<br />
保持默认shell为Bash不变,然后添加一行{{ic|exec fish}}到合适的[[Bash#Configuration files|Bash配置文件]]中,比如{{ic|.bashrc}}。在这种方法中,Bash会正常执行{{ic|/etc/profile}}和{{ic|/etc/profile.d}}中的所有配置文件。相对于之后几种方法,这种是最通用的,因为这种方法在本机计算机和SSH远程计算机上都能使用。<br />
<br />
{{Tip|<br />
* 在这种配置下,要使用Bash而不是接着启动fish,需要使用{{ic|bash --norc}},以防止Bash加载{{ic|~/.bashrc}}并执行{{ic|exec fish}}。<br />
* 要让类似于{{ic|bash -c 'echo test'}}中的命令在Bash中执行而不是启动fish,你可以将{{ic|exec fish}}换为{{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}}。}}<br />
<br />
==== 使用终端模拟器的选项 ====<br />
<br />
另一种方法是在启动终端模拟器时通过添加命令行选项来启动fish。对于大部分的终端,这个选项是 {{ic|-e}}。比如,要打开gnome-terminal并运行fish,可以将gnome-terminal的快捷方式改为:<br />
<br />
gnome-terminal -e fish<br />
<br />
对于不支持设置shell的终端模拟器,比如{{aur|lilyterm-git}},则需要这样:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
另外,有些终端可以在设置或配置文件中将fish设为默认shell。<br />
<br />
==== 使用终端复用器的选项 ====<br />
<br />
要将fish设为[[tmux]]启动的默认shell,在{{ic|~/.tmux.conf}}中加入这行:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
当''tmux''启动时,就会自动进入fish。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}}。这个文件与 {{ic|.bashrc}}相似,当每次启动时,fish会执行这个文件中的命令。需要注意的是,如果需要设置长期保留的变量,应该将这个变量设为一个''全局变量'',而不是将它定义在这些配置脚本中。<br />
<br />
用户定义的函数保存在{{ic|~/.config/fish/functions}}中,文件名为{{ic|''函数名''.fish}}。<br />
<br />
=== 网页界面 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置fish的配色、提示符、函数、变量、历史记录和快捷键。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据生成自动补全规则。这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面的命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在{{ic|~/.config/fish/completions/}}中定义自己的自动补全规则。{{ic|/usr/share/fish/completions/}}中有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了——fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 命令替换 ===<br />
<br />
''fish''不包含Bash式的历史记录替换功能(如{{ic|sudo !!}})。fish的开发者在[http://fishshell.com/docs/current/faq.html#faq-history fish faq]中建议使用交互式的方式调用历史记录:{{ic|上}}方向键可回顾整条命令,而{{ic|Alt+上}}会回顾命令的单个参数。<br />
<br />
不过,[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C) fish wiki]中介绍了一些在fish中使用历史替换的办法。这种方法提供的历史替换并不完整,但可用的有{{ic|!!}}(替换上一条命令)和{{ic|!$}}(替换上一条命令的最后一个参数)。<br />
<br />
=== 串联命令 ===<br />
<br />
从3.0版本以后,fish不再提供串联命令符号{{ic|&&}}和{{ic|!!}}。在fish中,推荐使用{{ic|; and}}和{{ic|; or}}实现相似的效果。根据[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C)#getting--and- fish wiki]中的步骤,可以通过设置快捷键自动将{{ic|&&}}和{{ic|!!}}替换为{{ic|; and}}和{{ic|; or}}。<br />
<br />
=== 关闭问候语 ===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。要关闭问候语,可以在fish中运行:<br />
<br />
set -U fish_greeting<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt]是一个“用于Bash和Zsh的全功能的、经过仔细设计的、自适应的提示符”,但它目前没有计划兼容fish[https://github.com/nojhan/liquidprompt/pull/230]。 [https://github.com/wesbarnett/fish-lp 这个项目]提供了一种用于fish的实现。<br />
<br />
=== 在提示中增加git状态 ===<br />
<br />
当你处在一个git目录中时,如果你想在fish的提示符中显示分支和修改的相关信息,可以仿照以下的例子编写{{ic|fish_prompt}}函数:<br />
<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
<nowiki>function fish_prompt<br />
set -l last_status $status<br />
<br />
if not set -q __fish_git_prompt_show_informative_status<br />
set -g __fish_git_prompt_show_informative_status 1<br />
end<br />
if not set -q __fish_git_prompt_color_branch<br />
set -g __fish_git_prompt_color_branch brmagenta<br />
end<br />
if not set -q __fish_git_prompt_showupstream<br />
set -g __fish_git_prompt_showupstream "informative"<br />
end<br />
if not set -q __fish_git_prompt_showdirtystate<br />
set -g __fish_git_prompt_showdirtystate "yes"<br />
end<br />
if not set -q __fish_git_prompt_color_stagedstate<br />
set -g __fish_git_prompt_color_stagedstate yellow<br />
end<br />
if not set -q __fish_git_prompt_color_invalidstate<br />
set -g __fish_git_prompt_color_invalidstate red<br />
end<br />
if not set -q __fish_git_prompt_color_cleanstate<br />
set -g __fish_git_prompt_color_cleanstate brgreen<br />
end<br />
<br />
printf '%s%s %s%s%s%s ' (set_color $fish_color_host) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (__fish_git_prompt)<br />
<br />
if not test $last_status -eq 0<br />
set_color $fish_color_error<br />
end<br />
echo -n '$ '<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
然而,fish已经抛弃了这种方式,参见[https://github.com/fish-shell/fish-shell/blob/master/share/functions/__fish_git_prompt.fish fish-shell git]。作为替代,fish现在内置了[http://mariuszs.github.io/blog/2013/informative_git_prompt.html Informative Git Prompt]。该功能可以通过fish_config启用。<br />
<br />
=== 在SSH中用彩色显示主机名 ===<br />
<br />
如果需要在通过SSH登录到fish时用不同的颜色标记提示符中的主机名,请将以下内容添加到函数{{ic|fish_prompt}}中,或者添加到fish的配置文件中。这里以红色为例:<br />
<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
...<br />
if set -q SSH_TTY<br />
set -g fish_color_host brred<br />
end<br />
...}}<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
<br />
这样会把你的别名作为fish中的函数。如果你想查看或者编辑所有的函数可以使用{{ic|fish_config}},然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572825
Fish (简体中文)
2019-05-09T13:11:49Z
<p>Liu-shuyuan: Added and translated section Color the hostname in the prompt in SSH /* 提示与技巧 */</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
=== 只把fish设为交互式shell ===<br />
<br />
如果不将fish设为默认shell,就能照常运行Bash的初始化脚本。这能够保证用户当前的环境变量不受影响并且在fish中也能使用,因为fish是作为Bash的子进程运行的。下面是几种只把fish设为交互式shell的方法。<br />
<br />
==== 通过.bashrc启动fish ====<br />
<br />
保持默认shell为Bash不变,然后添加一行{{ic|exec fish}}到合适的[[Bash#Configuration files|Bash配置文件]]中,比如{{ic|.bashrc}}。在这种方法中,Bash会正常执行{{ic|/etc/profile}}和{{ic|/etc/profile.d}}中的所有配置文件。相对于之后几种方法,这种是最通用的,因为这种方法在本机计算机和SSH远程计算机上都能使用。<br />
<br />
{{Tip|<br />
* 在这种配置下,要使用Bash而不是接着启动fish,需要使用{{ic|bash --norc}},以防止Bash加载{{ic|~/.bashrc}}并执行{{ic|exec fish}}。<br />
* 要让类似于{{ic|bash -c 'echo test'}}中的命令在Bash中执行而不是启动fish,你可以将{{ic|exec fish}}换为{{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}}。}}<br />
<br />
==== 使用终端模拟器的选项 ====<br />
<br />
另一种方法是在启动终端模拟器时通过添加命令行选项来启动fish。对于大部分的终端,这个选项是 {{ic|-e}}。比如,要打开gnome-terminal并运行fish,可以将gnome-terminal的快捷方式改为:<br />
<br />
gnome-terminal -e fish<br />
<br />
对于不支持设置shell的终端模拟器,比如{{aur|lilyterm-git}},则需要这样:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
另外,有些终端可以在设置或配置文件中将fish设为默认shell。<br />
<br />
==== 使用终端复用器的选项 ====<br />
<br />
要将fish设为[[tmux]]启动的默认shell,在{{ic|~/.tmux.conf}}中加入这行:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
当''tmux''启动时,就会自动进入fish。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}}。这个文件与 {{ic|.bashrc}}相似,当每次启动时,fish会执行这个文件中的命令。需要注意的是,如果需要设置长期保留的变量,应该将这个变量设为一个''全局变量'',而不是将它定义在这些配置脚本中。<br />
<br />
用户定义的函数保存在{{ic|~/.config/fish/functions}}中,文件名为{{ic|''函数名''.fish}}。<br />
<br />
=== 网页界面 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置fish的配色、提示符、函数、变量、历史记录和快捷键。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据生成自动补全规则。这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面的命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在{{ic|~/.config/fish/completions/}}中定义自己的自动补全规则。{{ic|/usr/share/fish/completions/}}中有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了——fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 命令替换 ===<br />
<br />
''fish''不包含Bash式的历史记录替换功能(如{{ic|sudo !!}})。fish的开发者在[http://fishshell.com/docs/current/faq.html#faq-history fish faq]中建议使用交互式的方式调用历史记录:{{ic|上}}方向键可回顾整条命令,而{{ic|Alt+上}}会回顾命令的单个参数。<br />
<br />
不过,[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C) fish wiki]中介绍了一些在fish中使用历史替换的办法。这种方法提供的历史替换并不完整,但可用的有{{ic|!!}}(替换上一条命令)和{{ic|!$}}(替换上一条命令的最后一个参数)。<br />
<br />
=== 串联命令 ===<br />
<br />
从3.0版本以后,fish不再提供串联命令符号{{ic|&&}}和{{ic|!!}}。在fish中,推荐使用{{ic|; and}}和{{ic|; or}}实现相似的效果。根据[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C)#getting--and- fish wiki]中的步骤,可以通过设置快捷键自动将{{ic|&&}}和{{ic|!!}}替换为{{ic|; and}}和{{ic|; or}}。<br />
<br />
=== 关闭问候语 ===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。要关闭问候语,可以在fish中运行:<br />
<br />
set -U fish_greeting<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt]是一个“用于Bash和Zsh的全功能的、经过仔细设计的、自适应的提示符”,但它目前没有计划兼容fish[https://github.com/nojhan/liquidprompt/pull/230]。 [https://github.com/wesbarnett/fish-lp 这个项目]提供了一种用于fish的实现。<br />
<br />
=== 在提示中增加git状态 ===<br />
<br />
当你处在一个git目录中时,如果你想在fish的提示符中显示分支和修改的相关信息,可以仿照以下的例子编写{{ic|fish_prompt}}函数:<br />
<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
<nowiki>function fish_prompt<br />
set -l last_status $status<br />
<br />
if not set -q __fish_git_prompt_show_informative_status<br />
set -g __fish_git_prompt_show_informative_status 1<br />
end<br />
if not set -q __fish_git_prompt_color_branch<br />
set -g __fish_git_prompt_color_branch brmagenta<br />
end<br />
if not set -q __fish_git_prompt_showupstream<br />
set -g __fish_git_prompt_showupstream "informative"<br />
end<br />
if not set -q __fish_git_prompt_showdirtystate<br />
set -g __fish_git_prompt_showdirtystate "yes"<br />
end<br />
if not set -q __fish_git_prompt_color_stagedstate<br />
set -g __fish_git_prompt_color_stagedstate yellow<br />
end<br />
if not set -q __fish_git_prompt_color_invalidstate<br />
set -g __fish_git_prompt_color_invalidstate red<br />
end<br />
if not set -q __fish_git_prompt_color_cleanstate<br />
set -g __fish_git_prompt_color_cleanstate brgreen<br />
end<br />
<br />
printf '%s%s %s%s%s%s ' (set_color $fish_color_host) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (__fish_git_prompt)<br />
<br />
if not test $last_status -eq 0<br />
set_color $fish_color_error<br />
end<br />
echo -n '$ '<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
然而,fish已经抛弃了这种方式,参见[https://github.com/fish-shell/fish-shell/blob/master/share/functions/__fish_git_prompt.fish fish-shell git]。作为替代,fish现在内置了[http://mariuszs.github.io/blog/2013/informative_git_prompt.html Informative Git Prompt]。该功能可以通过fish_config启用。<br />
<br />
=== 在SSH中用彩色显示主机名 ===<br />
<br />
如果需要在通过SSH登录到fish时用不同的颜色标记提示符中的主机名,请将以下内容添加到函数{{ic|fish_prompt}}中,或者添加到fish的配置文件中。这里以红色为例:<br />
<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
...<br />
if set -q SSH_TTY<br />
set -g fish_color_host brred<br />
end<br />
...}}<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
<br />
这样会把你的别名作为fish中的函数。如果你想查看或者编辑所有的函数可以使用{{ic|fish_config}},然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572824
Fish (简体中文)
2019-05-09T13:05:05Z
<p>Liu-shuyuan: Updated translation of Put git status in prompt</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
=== 只把fish设为交互式shell ===<br />
<br />
如果不将fish设为默认shell,就能照常运行Bash的初始化脚本。这能够保证用户当前的环境变量不受影响并且在fish中也能使用,因为fish是作为Bash的子进程运行的。下面是几种只把fish设为交互式shell的方法。<br />
<br />
==== 通过.bashrc启动fish ====<br />
<br />
保持默认shell为Bash不变,然后添加一行{{ic|exec fish}}到合适的[[Bash#Configuration files|Bash配置文件]]中,比如{{ic|.bashrc}}。在这种方法中,Bash会正常执行{{ic|/etc/profile}}和{{ic|/etc/profile.d}}中的所有配置文件。相对于之后几种方法,这种是最通用的,因为这种方法在本机计算机和SSH远程计算机上都能使用。<br />
<br />
{{Tip|<br />
* 在这种配置下,要使用Bash而不是接着启动fish,需要使用{{ic|bash --norc}},以防止Bash加载{{ic|~/.bashrc}}并执行{{ic|exec fish}}。<br />
* 要让类似于{{ic|bash -c 'echo test'}}中的命令在Bash中执行而不是启动fish,你可以将{{ic|exec fish}}换为{{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}}。}}<br />
<br />
==== 使用终端模拟器的选项 ====<br />
<br />
另一种方法是在启动终端模拟器时通过添加命令行选项来启动fish。对于大部分的终端,这个选项是 {{ic|-e}}。比如,要打开gnome-terminal并运行fish,可以将gnome-terminal的快捷方式改为:<br />
<br />
gnome-terminal -e fish<br />
<br />
对于不支持设置shell的终端模拟器,比如{{aur|lilyterm-git}},则需要这样:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
另外,有些终端可以在设置或配置文件中将fish设为默认shell。<br />
<br />
==== 使用终端复用器的选项 ====<br />
<br />
要将fish设为[[tmux]]启动的默认shell,在{{ic|~/.tmux.conf}}中加入这行:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
当''tmux''启动时,就会自动进入fish。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}}。这个文件与 {{ic|.bashrc}}相似,当每次启动时,fish会执行这个文件中的命令。需要注意的是,如果需要设置长期保留的变量,应该将这个变量设为一个''全局变量'',而不是将它定义在这些配置脚本中。<br />
<br />
用户定义的函数保存在{{ic|~/.config/fish/functions}}中,文件名为{{ic|''函数名''.fish}}。<br />
<br />
=== 网页界面 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置fish的配色、提示符、函数、变量、历史记录和快捷键。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据生成自动补全规则。这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面的命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在{{ic|~/.config/fish/completions/}}中定义自己的自动补全规则。{{ic|/usr/share/fish/completions/}}中有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了——fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 命令替换 ===<br />
<br />
''fish''不包含Bash式的历史记录替换功能(如{{ic|sudo !!}})。fish的开发者在[http://fishshell.com/docs/current/faq.html#faq-history fish faq]中建议使用交互式的方式调用历史记录:{{ic|上}}方向键可回顾整条命令,而{{ic|Alt+上}}会回顾命令的单个参数。<br />
<br />
不过,[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C) fish wiki]中介绍了一些在fish中使用历史替换的办法。这种方法提供的历史替换并不完整,但可用的有{{ic|!!}}(替换上一条命令)和{{ic|!$}}(替换上一条命令的最后一个参数)。<br />
<br />
=== 串联命令 ===<br />
<br />
从3.0版本以后,fish不再提供串联命令符号{{ic|&&}}和{{ic|!!}}。在fish中,推荐使用{{ic|; and}}和{{ic|; or}}实现相似的效果。根据[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C)#getting--and- fish wiki]中的步骤,可以通过设置快捷键自动将{{ic|&&}}和{{ic|!!}}替换为{{ic|; and}}和{{ic|; or}}。<br />
<br />
=== 关闭问候语 ===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。要关闭问候语,可以在fish中运行:<br />
<br />
set -U fish_greeting<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt]是一个“用于Bash和Zsh的全功能的、经过仔细设计的、自适应的提示符”,但它目前没有计划兼容fish[https://github.com/nojhan/liquidprompt/pull/230]。 [https://github.com/wesbarnett/fish-lp 这个项目]提供了一种用于fish的实现。<br />
<br />
=== 在提示中增加git状态 ===<br />
<br />
当你处在一个git目录中时,如果你想在fish的提示符中显示分支和修改的相关信息,可以仿照以下的例子编写{{ic|fish_prompt}}函数:<br />
<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
<nowiki>function fish_prompt<br />
set -l last_status $status<br />
<br />
if not set -q __fish_git_prompt_show_informative_status<br />
set -g __fish_git_prompt_show_informative_status 1<br />
end<br />
if not set -q __fish_git_prompt_color_branch<br />
set -g __fish_git_prompt_color_branch brmagenta<br />
end<br />
if not set -q __fish_git_prompt_showupstream<br />
set -g __fish_git_prompt_showupstream "informative"<br />
end<br />
if not set -q __fish_git_prompt_showdirtystate<br />
set -g __fish_git_prompt_showdirtystate "yes"<br />
end<br />
if not set -q __fish_git_prompt_color_stagedstate<br />
set -g __fish_git_prompt_color_stagedstate yellow<br />
end<br />
if not set -q __fish_git_prompt_color_invalidstate<br />
set -g __fish_git_prompt_color_invalidstate red<br />
end<br />
if not set -q __fish_git_prompt_color_cleanstate<br />
set -g __fish_git_prompt_color_cleanstate brgreen<br />
end<br />
<br />
printf '%s%s %s%s%s%s ' (set_color $fish_color_host) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (__fish_git_prompt)<br />
<br />
if not test $last_status -eq 0<br />
set_color $fish_color_error<br />
end<br />
echo -n '$ '<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
然而,fish已经抛弃了这种方式,参见[https://github.com/fish-shell/fish-shell/blob/master/share/functions/__fish_git_prompt.fish fish-shell git]。作为替代,fish现在内置了[http://mariuszs.github.io/blog/2013/informative_git_prompt.html Informative Git Prompt]。该功能可以通过fish_config启用。<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish&diff=572823
Fish
2019-05-09T13:03:01Z
<p>Liu-shuyuan: Fish has deprecated the way to display git status introduced in this section so updated accordingly to state that/* Put git status in prompt */</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
[[zh-hans:Fish]]<br />
<br />
[https://fishshell.com fish], the '''''f'''riendly '''i'''nteractive '''sh'''ell'', is a [[command-line shell|commandline shell]] intended to be interactive and user-friendly.<br />
<br />
''fish'' is intentionally not fully [[Wikipedia:POSIX|POSIX]] compliant, it aims at addressing POSIX inconsistencies (as perceived by the creators) with a simplified or a different syntax. This means that even simple POSIX compliant scripts may require some significant adaptation or even full rewriting to run with fish.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|fish}} package. For the development version, install the {{AUR|fish-git}} package.<br />
<br />
Once installed, simply type {{ic|fish}} to drop into the fish shell.<br />
<br />
Documentation can be found by typing {{ic|help}} from fish; it will be opened in a web browser. It is recommended to read at least the "Syntax overview" section, since fish's syntax is different from many other shells.<br />
<br />
== System integration ==<br />
<br />
One must decide whether fish is going to be the default user's shell, which means that the user falls directly in fish at login, or whether it is used in interactive terminal mode as a child process of the current default shell, here we will assume the latter is [[Bash]]. To elaborate on these two setups:<br />
<br />
* fish used as the '''default shell''': this mode requires some basic understanding of the fish functioning and its scripting language. The user's current initialization scripts and environment variables need to be migrated to the new fish environment. To configure the system in this mode, follow [[#Setting fish as default shell]].<br />
<br />
* fish used as an '''interactive shell only''': this is the less disruptive mode, all the Bash initialization scripts are run as usual and fish runs on top of Bash in interactive mode connected to a terminal. To setup fish in this mode, follow [[#Setting fish as interactive shell only]].<br />
<br />
=== Setting fish as default shell ===<br />
If you decide to set fish as the default user shell, the first step is to set the shell of this particular user to {{ic|/usr/bin/fish}}. This can be done by following the instructions in [[Command-line shell#Changing your default shell]].<br />
<br />
The next step is to port the current needed actions and configuration performed in the various Bash initialization scripts, namely {{ic|/etc/profile}}, {{ic|~/.bash_profile}}, {{ic|/etc/bash.bashrc}} and {{ic|~/.bashrc}}, into the fish framework.<br />
<br />
In particular, the content of the {{ic|$PATH}} environment variable, once directly logged under fish, should be checked and adjusted to one's need. In fish, {{ic|$PATH}} is defined as a ''global environment variable'': it has a ''global'' scope across all functions, it is lost upon reboot and it is an ''environment variable'' which means it is exported to child processes.<br />
The recommended way of adding permanently additional locations to the path is by assigning them to the {{ic|fish_user_paths}} universal variable. This variable is automatically added to {{ic|$PATH}} and is preserved across restarts of the shell. For example by setting:<br />
<br />
$ set -U fish_user_paths ''/first/path'' ''/second/path'' ''/third/one''<br />
<br />
These three locations will be permanently prepended to the path. This is an easy way to complement the path without the need to add any instruction in scripts.<br />
<br />
=== Setting fish as interactive shell only ===<br />
Not setting fish as system wide or user default allows the current Bash scripts to run on startup. It ensures the current user's environment variables are unchanged and are exported to fish which then runs as a Bash child. Below are several ways of running fish in interactive mode without setting it as the default shell.<br />
<br />
==== Modify .bashrc to drop into fish ====<br />
Keep the default shell as Bash and simply add the line {{ic|exec fish}} to the appropriate [[Bash#Configuration files]], such as {{ic|.bashrc}}. This will allow Bash to properly source {{ic|/etc/profile}} and all files in {{ic|/etc/profile.d}}. Because fish replaces the Bash process, exiting fish will also exit the terminal. Compared to the following options, this is the most universal solution, since it works both on a local machine and on a SSH server.<br />
<br />
{{Tip|<br />
* In this setup, use {{ic|bash --norc}} to manually enter Bash without executing the commands from {{ic|~/.bashrc}} which would run {{ic|exec fish}} and drop back into fish.<br />
* To have commands such as {{ic|bash -c 'echo test'}} run the command in Bash instead of starting fish, you can write {{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}} instead.}}<br />
<br />
==== Use terminal emulator options ====<br />
<br />
Another option is to open your terminal emulator with a command line option that executes fish. For most terminals this is the {{ic|-e}} switch, so for example, to open gnome-terminal using fish, change your shortcut to use:<br />
<br />
gnome-terminal -e fish<br />
<br />
With terminal emulators that do not support setting the shell, for example {{aur|lilyterm-git}}, it would look like this:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
Also, depending on the terminal, you may be able to set fish as the default shell in either the terminal configuration or the terminal profile.<br />
<br />
==== Use terminal multiplexer options ====<br />
<br />
To set fish as the shell started in [[tmux]], put this into your {{ic|~/.tmux.conf}}:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
Whenever you run ''tmux'', you will be dropped into fish.<br />
<br />
== Configuration ==<br />
<br />
The configuration file runs at every login and is located at {{ic|~/.config/fish/config.fish}}. Adding commands or functions to the file will execute/define them when opening a terminal, similar to {{ic|.bashrc}}. Note that whenever a variable needs to be preserved, it be set as ''universal'' rather than defined in the aforementioned configuration file.<br />
<br />
The user's functions are located in the directory {{ic|~/.config/fish/functions}} under the filenames {{ic|''function_name''.fish}}.<br />
<br />
=== Web interface ===<br />
<br />
The fish terminal colors, prompt, functions, variables, history, bindings and abbreviations can be set with the interactive web interface:<br />
<br />
fish_config<br />
<br />
=== Command completion ===<br />
<br />
fish can generate autocompletions from man pages. Completions are written to {{ic|~/.local/share/fish/generated_completions/}} and can be generated by calling:<br />
<br />
fish_update_completions<br />
<br />
You can also define your own completions in {{ic|~/.config/fish/completions/}}. See {{ic|/usr/share/fish/completions/}} for a few examples.<br />
<br />
Context-aware completions for Arch Linux-specific commands like ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic'' are built into fish, since the policy of the fish development is to include all the existent completions in the upstream tarball. The memory management is clever enough to avoid any negative impact on resources.<br />
<br />
==Tips and tricks==<br />
<br />
===Command substitution===<br />
''fish'' does not implement Bash style history substitution (e.g. {{ic|sudo !!}}), and the developers recommend in the [http://fishshell.com/docs/current/faq.html#faq-history fish faq] to use the interactive history recall interface instead: the {{ic|Up}} arrow recalls whole past lines and {{ic|Alt+Up}} recalls individual arguments.<br />
<br />
However some workarounds are described in the [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C) fish wiki]: while not providing complete history substitution, some functions replace {{ic|!!}} with the previous command or {{ic|!$}} with the previous last argument.<br />
<br />
===Command chaining===<br />
Command chaining {{ic|&&}} and {{ic|{{!}}{{!}}}} is not implemented in versions older than 3.0 and the recommended syntax to achieve similar results in ''fish'' is respectively {{ic|; and}} and {{ic|; or}}.<br />
Some keybindings can be set for automatic substitution as described in the [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C)#getting--and- fish wiki].<br />
<br />
===Disable greeting===<br />
<br />
By default, fish prints a greeting message at startup. To disable it, run once:<br />
<br />
$ set -U fish_greeting<br />
<br />
This clears the universal {{ic|fish_greeting}} variable, shared with all fish instances and which is preserved upon restart of the shell.<br />
<br />
=== Make su launch fish ===<br />
<br />
If ''su'' starts with Bash because Bash is the target user's (''root'' if no username is provided) default shell, one can define a function to redirect it to fish whatever the user's shell:<br />
{{hc|~/.config/fish/functions/su.fish|2=<br />
function su<br />
command su --shell=/usr/bin/fish $argv<br />
end}}<br />
<br />
=== Start X at login ===<br />
<br />
Add the following to the bottom of your {{ic|~/.config/fish/config.fish}}.<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== Use liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt] is a popular "full-featured & carefully designed adaptive prompt for Bash & Zsh" and has no plans to make it compatible with fish [https://github.com/nojhan/liquidprompt/pull/230]. [https://github.com/wesbarnett/fish-lp This project] implements it for fish.<br />
<br />
=== Put git status in prompt ===<br />
<br />
If you would like fish to display the branch and dirty status when you are in a git directory, you can define the following {{ic|fish_prompt}} function:<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
<nowiki>function fish_prompt<br />
set -l last_status $status<br />
<br />
if not set -q __fish_git_prompt_show_informative_status<br />
set -g __fish_git_prompt_show_informative_status 1<br />
end<br />
if not set -q __fish_git_prompt_color_branch<br />
set -g __fish_git_prompt_color_branch brmagenta<br />
end<br />
if not set -q __fish_git_prompt_showupstream<br />
set -g __fish_git_prompt_showupstream "informative"<br />
end<br />
if not set -q __fish_git_prompt_showdirtystate<br />
set -g __fish_git_prompt_showdirtystate "yes"<br />
end<br />
if not set -q __fish_git_prompt_color_stagedstate<br />
set -g __fish_git_prompt_color_stagedstate yellow<br />
end<br />
if not set -q __fish_git_prompt_color_invalidstate<br />
set -g __fish_git_prompt_color_invalidstate red<br />
end<br />
if not set -q __fish_git_prompt_color_cleanstate<br />
set -g __fish_git_prompt_color_cleanstate brgreen<br />
end<br />
<br />
printf '%s%s %s%s%s%s ' (set_color $fish_color_host) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (__fish_git_prompt)<br />
<br />
if not test $last_status -eq 0<br />
set_color $fish_color_error<br />
end<br />
echo -n '$ '<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
However, this is now deprecated, see [https://github.com/fish-shell/fish-shell/blob/master/share/functions/__fish_git_prompt.fish fish-shell git].<br />
Alternatively, the [http://mariuszs.github.io/blog/2013/informative_git_prompt.html Informative Git Prompt] has now been built into fish and can be activated from fish_config if so desired.<br />
<br />
===Color the hostname in the prompt in SSH===<br />
To color the hostname in the prompt dynamically whenever connected through SSH, add the following lines in either the {{ic|fish_prompt}} function or the fish configuration file, here using the red color:<br />
<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
...<br />
if set -q SSH_TTY<br />
set -g fish_color_host brred<br />
end<br />
...}}<br />
<br />
=== Evaluate ssh-agent ===<br />
<br />
In fish, {{ic|eval (ssh-agent)}} generate errors due to how variables are set. To work around this, use the csh-style option {{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== The "command not found" hook ===<br />
<br />
[[pkgfile]] includes a "command not found" hook that will automatically search the official repositories, when entering an unrecognized command. This hook will be run by default if {{Pkg|pkgfile}} is installed.<br />
<br />
=== Remove a process from the list of jobs ===<br />
<br />
''fish'' terminates any jobs put into the background when fish terminates. To keep a job running after fish terminates, first use the {{ic|disown}} builtin. For example, the following starts {{ic|firefox}} in the background and then disowns it:<br />
<br />
$ firefox &<br />
$ disown<br />
<br />
This means firefox will not be closed when the fish process is closed. See {{man|1|disown|url=}} in ''fish'' for more details.<br />
<br />
=== Set a persistent alias ===<br />
<br />
To quickly make a persistent alias, one can simply use the method showed in this example:<br />
$ alias lsl "ls -l"<br />
$ funcsave lsl<br />
<br />
This will create the function:<br />
function lsl<br />
ls -l $argv<br />
end<br />
<br />
and will set the alias as a persistent shell function. To see all functions and/or edit them, one can simply use {{ic|fish_config}} and look into the ''Function'' tab in the web configuration page.<br />
<br />
For more detailed information, refer to [https://fishshell.com/docs/current/commands.html#alias fish - alias].<br />
<br />
== See also ==<br />
<br />
* http://fishshell.com/ - Home page<br />
* http://fishshell.com/docs/current/index.html - Documentation<br />
* http://hyperpolyglot.org/unix-shells - Shell grammar correspondence table<br />
* https://github.com/fish-shell/fish-shell - fish on GitHub</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572821
Fish (简体中文)
2019-05-09T12:57:36Z
<p>Liu-shuyuan: Deleted section 故障排除 according to the English version</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
=== 只把fish设为交互式shell ===<br />
<br />
如果不将fish设为默认shell,就能照常运行Bash的初始化脚本。这能够保证用户当前的环境变量不受影响并且在fish中也能使用,因为fish是作为Bash的子进程运行的。下面是几种只把fish设为交互式shell的方法。<br />
<br />
==== 通过.bashrc启动fish ====<br />
<br />
保持默认shell为Bash不变,然后添加一行{{ic|exec fish}}到合适的[[Bash#Configuration files|Bash配置文件]]中,比如{{ic|.bashrc}}。在这种方法中,Bash会正常执行{{ic|/etc/profile}}和{{ic|/etc/profile.d}}中的所有配置文件。相对于之后几种方法,这种是最通用的,因为这种方法在本机计算机和SSH远程计算机上都能使用。<br />
<br />
{{Tip|<br />
* 在这种配置下,要使用Bash而不是接着启动fish,需要使用{{ic|bash --norc}},以防止Bash加载{{ic|~/.bashrc}}并执行{{ic|exec fish}}。<br />
* 要让类似于{{ic|bash -c 'echo test'}}中的命令在Bash中执行而不是启动fish,你可以将{{ic|exec fish}}换为{{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}}。}}<br />
<br />
==== 使用终端模拟器的选项 ====<br />
<br />
另一种方法是在启动终端模拟器时通过添加命令行选项来启动fish。对于大部分的终端,这个选项是 {{ic|-e}}。比如,要打开gnome-terminal并运行fish,可以将gnome-terminal的快捷方式改为:<br />
<br />
gnome-terminal -e fish<br />
<br />
对于不支持设置shell的终端模拟器,比如{{aur|lilyterm-git}},则需要这样:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
另外,有些终端可以在设置或配置文件中将fish设为默认shell。<br />
<br />
==== 使用终端复用器的选项 ====<br />
<br />
要将fish设为[[tmux]]启动的默认shell,在{{ic|~/.tmux.conf}}中加入这行:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
当''tmux''启动时,就会自动进入fish。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}}。这个文件与 {{ic|.bashrc}}相似,当每次启动时,fish会执行这个文件中的命令。需要注意的是,如果需要设置长期保留的变量,应该将这个变量设为一个''全局变量'',而不是将它定义在这些配置脚本中。<br />
<br />
用户定义的函数保存在{{ic|~/.config/fish/functions}}中,文件名为{{ic|''函数名''.fish}}。<br />
<br />
=== 网页界面 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置fish的配色、提示符、函数、变量、历史记录和快捷键。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据生成自动补全规则。这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面的命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在{{ic|~/.config/fish/completions/}}中定义自己的自动补全规则。{{ic|/usr/share/fish/completions/}}中有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了——fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 命令替换 ===<br />
<br />
''fish''不包含Bash式的历史记录替换功能(如{{ic|sudo !!}})。fish的开发者在[http://fishshell.com/docs/current/faq.html#faq-history fish faq]中建议使用交互式的方式调用历史记录:{{ic|上}}方向键可回顾整条命令,而{{ic|Alt+上}}会回顾命令的单个参数。<br />
<br />
不过,[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C) fish wiki]中介绍了一些在fish中使用历史替换的办法。这种方法提供的历史替换并不完整,但可用的有{{ic|!!}}(替换上一条命令)和{{ic|!$}}(替换上一条命令的最后一个参数)。<br />
<br />
=== 串联命令 ===<br />
<br />
从3.0版本以后,fish不再提供串联命令符号{{ic|&&}}和{{ic|!!}}。在fish中,推荐使用{{ic|; and}}和{{ic|; or}}实现相似的效果。根据[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C)#getting--and- fish wiki]中的步骤,可以通过设置快捷键自动将{{ic|&&}}和{{ic|!!}}替换为{{ic|; and}}和{{ic|; or}}。<br />
<br />
=== 关闭问候语 ===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。要关闭问候语,可以在fish中运行:<br />
<br />
set -U fish_greeting<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt]是一个“用于Bash和Zsh的全功能的、经过仔细设计的、自适应的提示符”,但它目前没有计划兼容fish[https://github.com/nojhan/liquidprompt/pull/230]。 [https://github.com/wesbarnett/fish-lp 这个项目]提供了一种用于fish的实现。<br />
<br />
=== 在提示中增加git 状态 ===<br />
<br />
当你处在一个git目录中时,如果你想在fish的提示符中显示分支和修改的相关信息,可以仿照以下的例子编写{{ic|fish_prompt}}函数:<br />
<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
<nowiki>function fish_prompt<br />
set -l last_status $status<br />
<br />
if not set -q __fish_git_prompt_show_informative_status<br />
set -g __fish_git_prompt_show_informative_status 1<br />
end<br />
if not set -q __fish_git_prompt_color_branch<br />
set -g __fish_git_prompt_color_branch brmagenta<br />
end<br />
if not set -q __fish_git_prompt_showupstream<br />
set -g __fish_git_prompt_showupstream "informative"<br />
end<br />
if not set -q __fish_git_prompt_showdirtystate<br />
set -g __fish_git_prompt_showdirtystate "yes"<br />
end<br />
if not set -q __fish_git_prompt_color_stagedstate<br />
set -g __fish_git_prompt_color_stagedstate yellow<br />
end<br />
if not set -q __fish_git_prompt_color_invalidstate<br />
set -g __fish_git_prompt_color_invalidstate red<br />
end<br />
if not set -q __fish_git_prompt_color_cleanstate<br />
set -g __fish_git_prompt_color_cleanstate brgreen<br />
end<br />
<br />
printf '%s%s %s%s%s%s ' (set_color $fish_color_host) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (__fish_git_prompt)<br />
<br />
if not test $last_status -eq 0<br />
set_color $fish_color_error<br />
end<br />
echo -n '$ '<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
More explanations about the parameters can be found in the [https://github.com/fish-shell/fish-shell/blob/master/share/functions/__fish_git_prompt.fish fish-shell git].<br />
Alternatively, the [http://mariuszs.github.io/blog/2013/informative_git_prompt.html Informative Git Prompt] has now been built into fish and can be activated from fish_config if so desired.<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572814
Fish (简体中文)
2019-05-09T06:08:25Z
<p>Liu-shuyuan: Partially updated translation of Fish - Tips and Tricks /* 提示与技巧 */</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
=== 只把fish设为交互式shell ===<br />
<br />
如果不将fish设为默认shell,就能照常运行Bash的初始化脚本。这能够保证用户当前的环境变量不受影响并且在fish中也能使用,因为fish是作为Bash的子进程运行的。下面是几种只把fish设为交互式shell的方法。<br />
<br />
==== 通过.bashrc启动fish ====<br />
<br />
保持默认shell为Bash不变,然后添加一行{{ic|exec fish}}到合适的[[Bash#Configuration files|Bash配置文件]]中,比如{{ic|.bashrc}}。在这种方法中,Bash会正常执行{{ic|/etc/profile}}和{{ic|/etc/profile.d}}中的所有配置文件。相对于之后几种方法,这种是最通用的,因为这种方法在本机计算机和SSH远程计算机上都能使用。<br />
<br />
{{Tip|<br />
* 在这种配置下,要使用Bash而不是接着启动fish,需要使用{{ic|bash --norc}},以防止Bash加载{{ic|~/.bashrc}}并执行{{ic|exec fish}}。<br />
* 要让类似于{{ic|bash -c 'echo test'}}中的命令在Bash中执行而不是启动fish,你可以将{{ic|exec fish}}换为{{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}}。}}<br />
<br />
==== 使用终端模拟器的选项 ====<br />
<br />
另一种方法是在启动终端模拟器时通过添加命令行选项来启动fish。对于大部分的终端,这个选项是 {{ic|-e}}。比如,要打开gnome-terminal并运行fish,可以将gnome-terminal的快捷方式改为:<br />
<br />
gnome-terminal -e fish<br />
<br />
对于不支持设置shell的终端模拟器,比如{{aur|lilyterm-git}},则需要这样:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
另外,有些终端可以在设置或配置文件中将fish设为默认shell。<br />
<br />
==== 使用终端复用器的选项 ====<br />
<br />
要将fish设为[[tmux]]启动的默认shell,在{{ic|~/.tmux.conf}}中加入这行:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
当''tmux''启动时,就会自动进入fish。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}}。这个文件与 {{ic|.bashrc}}相似,当每次启动时,fish会执行这个文件中的命令。需要注意的是,如果需要设置长期保留的变量,应该将这个变量设为一个''全局变量'',而不是将它定义在这些配置脚本中。<br />
<br />
用户定义的函数保存在{{ic|~/.config/fish/functions}}中,文件名为{{ic|''函数名''.fish}}。<br />
<br />
=== 网页界面 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置fish的配色、提示符、函数、变量、历史记录和快捷键。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据生成自动补全规则。这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面的命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在{{ic|~/.config/fish/completions/}}中定义自己的自动补全规则。{{ic|/usr/share/fish/completions/}}中有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了——fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
==故障排除==<br />
===历史记录===<br />
Fish does not implement history substitution (e.g. {{ic|sudo !!}}), and the fish developers have said that they [http://fishshell.com/docs/current/faq.html#faq-history do not plan to]. Still, this is an essential piece of many users' workflow. Reddit user, [http://www.reddit.com/u/crossroads1112 crossroads1112], created a function that regains some of the functionality of history substitution and with another syntax. The function is on [https://gist.github.com/crossroads1112/77badb2c3455e23b873b github] and instructions are included as comments in it. There is a [https://gist.github.com/b-/981892a65837ab0a387e forked version] that is closer to the original syntax and allows for {{ic|command !!}} if you specify the command in the helper function.<br />
<br />
Other alternatives to regaining the {{ic|command !!}} syntax can be found on [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-History-Substitution-%28%21%21-and-%21%24%29 Fish' github wiki]. The examples here include e.g. the {{ic|bind_bang}} function which expands {{ic|!!}} to the latest command in the history (this will of course make it impossible to do to bangs in a row as they will expand). Another option is the command given on [https://github.com/fish-shell/fish-shell/issues/288#issuecomment-158704275 this github issue].<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 命令替换 ===<br />
<br />
''fish''不包含Bash式的历史记录替换功能(如{{ic|sudo !!}})。fish的开发者在[http://fishshell.com/docs/current/faq.html#faq-history fish faq]中建议使用交互式的方式调用历史记录:{{ic|上}}方向键可回顾整条命令,而{{ic|Alt+上}}会回顾命令的单个参数。<br />
<br />
不过,[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C) fish wiki]中介绍了一些在fish中使用历史替换的办法。这种方法提供的历史替换并不完整,但可用的有{{ic|!!}}(替换上一条命令)和{{ic|!$}}(替换上一条命令的最后一个参数)。<br />
<br />
=== 串联命令 ===<br />
<br />
从3.0版本以后,fish不再提供串联命令符号{{ic|&&}}和{{ic|!!}}。在fish中,推荐使用{{ic|; and}}和{{ic|; or}}实现相似的效果。根据[https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$-&&-%7C%7C)#getting--and- fish wiki]中的步骤,可以通过设置快捷键自动将{{ic|&&}}和{{ic|!!}}替换为{{ic|; and}}和{{ic|; or}}。<br />
<br />
=== 关闭问候语 ===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。要关闭问候语,可以在fish中运行:<br />
<br />
set -U fish_greeting<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt]是一个“用于Bash和Zsh的全功能的、经过仔细设计的、自适应的提示符”,但它目前没有计划兼容fish[https://github.com/nojhan/liquidprompt/pull/230]。 [https://github.com/wesbarnett/fish-lp 这个项目]提供了一种用于fish的实现。<br />
<br />
=== 在提示中增加git 状态 ===<br />
<br />
当你处在一个git目录中时,如果你想在fish的提示符中显示分支和修改的相关信息,可以仿照以下的例子编写{{ic|fish_prompt}}函数:<br />
<br />
{{hc|~/.config/fish/functions/fish_prompt.fish|<br />
<nowiki>function fish_prompt<br />
set -l last_status $status<br />
<br />
if not set -q __fish_git_prompt_show_informative_status<br />
set -g __fish_git_prompt_show_informative_status 1<br />
end<br />
if not set -q __fish_git_prompt_color_branch<br />
set -g __fish_git_prompt_color_branch brmagenta<br />
end<br />
if not set -q __fish_git_prompt_showupstream<br />
set -g __fish_git_prompt_showupstream "informative"<br />
end<br />
if not set -q __fish_git_prompt_showdirtystate<br />
set -g __fish_git_prompt_showdirtystate "yes"<br />
end<br />
if not set -q __fish_git_prompt_color_stagedstate<br />
set -g __fish_git_prompt_color_stagedstate yellow<br />
end<br />
if not set -q __fish_git_prompt_color_invalidstate<br />
set -g __fish_git_prompt_color_invalidstate red<br />
end<br />
if not set -q __fish_git_prompt_color_cleanstate<br />
set -g __fish_git_prompt_color_cleanstate brgreen<br />
end<br />
<br />
printf '%s%s %s%s%s%s ' (set_color $fish_color_host) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (__fish_git_prompt)<br />
<br />
if not test $last_status -eq 0<br />
set_color $fish_color_error<br />
end<br />
echo -n '$ '<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
More explanations about the parameters can be found in the [https://github.com/fish-shell/fish-shell/blob/master/share/functions/__fish_git_prompt.fish fish-shell git].<br />
Alternatively, the [http://mariuszs.github.io/blog/2013/informative_git_prompt.html Informative Git Prompt] has now been built into fish and can be activated from fish_config if so desired.<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572813
Fish (简体中文)
2019-05-09T05:42:36Z
<p>Liu-shuyuan: Updated translation of Fish - Configuration /* 配置 */</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
=== 只把fish设为交互式shell ===<br />
<br />
如果不将fish设为默认shell,就能照常运行Bash的初始化脚本。这能够保证用户当前的环境变量不受影响并且在fish中也能使用,因为fish是作为Bash的子进程运行的。下面是几种只把fish设为交互式shell的方法。<br />
<br />
==== 通过.bashrc启动fish ====<br />
<br />
保持默认shell为Bash不变,然后添加一行{{ic|exec fish}}到合适的[[Bash#Configuration files|Bash配置文件]]中,比如{{ic|.bashrc}}。在这种方法中,Bash会正常执行{{ic|/etc/profile}}和{{ic|/etc/profile.d}}中的所有配置文件。相对于之后几种方法,这种是最通用的,因为这种方法在本机计算机和SSH远程计算机上都能使用。<br />
<br />
{{Tip|<br />
* 在这种配置下,要使用Bash而不是接着启动fish,需要使用{{ic|bash --norc}},以防止Bash加载{{ic|~/.bashrc}}并执行{{ic|exec fish}}。<br />
* 要让类似于{{ic|bash -c 'echo test'}}中的命令在Bash中执行而不是启动fish,你可以将{{ic|exec fish}}换为{{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}}。}}<br />
<br />
==== 使用终端模拟器的选项 ====<br />
<br />
另一种方法是在启动终端模拟器时通过添加命令行选项来启动fish。对于大部分的终端,这个选项是 {{ic|-e}}。比如,要打开gnome-terminal并运行fish,可以将gnome-terminal的快捷方式改为:<br />
<br />
gnome-terminal -e fish<br />
<br />
对于不支持设置shell的终端模拟器,比如{{aur|lilyterm-git}},则需要这样:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
另外,有些终端可以在设置或配置文件中将fish设为默认shell。<br />
<br />
==== 使用终端复用器的选项 ====<br />
<br />
要将fish设为[[tmux]]启动的默认shell,在{{ic|~/.tmux.conf}}中加入这行:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
当''tmux''启动时,就会自动进入fish。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}}。这个文件与 {{ic|.bashrc}}相似,当每次启动时,fish会执行这个文件中的命令。需要注意的是,如果需要设置长期保留的变量,应该将这个变量设为一个''全局变量'',而不是将它定义在这些配置脚本中。<br />
<br />
用户定义的函数保存在{{ic|~/.config/fish/functions}}中,文件名为{{ic|''函数名''.fish}}。<br />
<br />
=== 网页界面 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置fish的配色、提示符、函数、变量、历史记录和快捷键。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据生成自动补全规则。这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面的命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在{{ic|~/.config/fish/completions/}}中定义自己的自动补全规则。{{ic|/usr/share/fish/completions/}}中有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了——fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
==故障排除==<br />
===历史记录===<br />
Fish does not implement history substitution (e.g. {{ic|sudo !!}}), and the fish developers have said that they [http://fishshell.com/docs/current/faq.html#faq-history do not plan to]. Still, this is an essential piece of many users' workflow. Reddit user, [http://www.reddit.com/u/crossroads1112 crossroads1112], created a function that regains some of the functionality of history substitution and with another syntax. The function is on [https://gist.github.com/crossroads1112/77badb2c3455e23b873b github] and instructions are included as comments in it. There is a [https://gist.github.com/b-/981892a65837ab0a387e forked version] that is closer to the original syntax and allows for {{ic|command !!}} if you specify the command in the helper function.<br />
<br />
Other alternatives to regaining the {{ic|command !!}} syntax can be found on [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-History-Substitution-%28%21%21-and-%21%24%29 Fish' github wiki]. The examples here include e.g. the {{ic|bind_bang}} function which expands {{ic|!!}} to the latest command in the history (this will of course make it impossible to do to bangs in a row as they will expand). Another option is the command given on [https://github.com/fish-shell/fish-shell/issues/288#issuecomment-158704275 this github issue].<br />
<br />
==提示与技巧==<br />
<br />
=== 不要把fish设为默认shell ===<br />
<br />
在Arch中,很多shell脚本都是为[[Bash]]而写的,并且与fish不兼容。这里不建议把fish设为默认shell,把bash设为默认shell可以使得那些为bash而写的脚本可以正常运行,确保系统环境正常初始化,环境变量正常配置。如果你把fish设为默认的shell,很可能会在启动shell时看到报错信息。<br />
<br />
下面是一些技巧,能够使得即使不把fish设为默认shell,也能够在登录的时候自动进入fish。<br />
<br />
==== 修改.bashrc来启动fish ====<br />
<br />
把bash设为你的默认shell,只需要在你的bash配置文件[[Bash#Configuration files]](一般是{{ic|.bashrc}})的最后一行加入 {{ic|exec fish}},即可在进入bash之后自动启动fish。这种做法使得Bash可以正常的运行 {{ic|/etc/profile}} 和 {{ic|/etc/profile.d}}下的配置。因为''fish''替代了bash 进程,退出 ''fish''也会自动退出终端。和下一个方法相比,这种做法更通用,因为它能够同时在本地和SSH远程连接时运作。<br />
<br />
{{Tip|如果你想进入bash而不是fish,使用命令 {{ic|bash --norc}} }}<br />
<br />
==== 设为默认终端模拟器shell ====<br />
<br />
另外一种自动启动fish的方法是专门针对终端模拟器设置默认解释器。对大多数终端模拟器来说,只需要{{ic|-e}} 选项即可完成配置修改。以gnome终端模拟器为例,修改使用fish的命令如下:<br />
<br />
gnome-terminal -e fish<br />
<br />
LilyTerm等轻量级的终端模拟器,不支持通过命令设置默认的解释器,这时候可以通过环境变量的方式:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
你也可以通过修改终端模拟器的配置文件来完成配置。<br />
<br />
这样,当你打开终端模拟器的时候,就会自动的进入fish。<br />
<br />
====设为默认终端服用器shell ====<br />
<br />
如果要为tmux设置默认的shell,只需要把下面这句话放到 {{ic|~/.tmux.conf}}:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
这样只要启动''tmux'',都会自动进入fish。<br />
<br />
===关闭问候语===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。你可以在fish的配置文件中增加 {{ic|set fish_greeting}}以关闭它。<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt] is a popular "full-featured & carefully designed adaptive prompt for Bash & Zsh" and has no plans to make it compatible with fish [https://github.com/nojhan/liquidprompt/pull/230]. [https://github.com/wesbarnett/fish-lp This project] implements it for fish.<br />
<br />
=== 在提示中增加git 状态 ===<br />
<br />
If you would like fish to display the branch and dirty status when you are in a git directory, you can add the following to your {{ic|~/.config/fish/config.fish}}:<br />
{{bc|<nowiki><br />
# fish git prompt<br />
set __fish_git_prompt_showdirtystate 'yes'<br />
set __fish_git_prompt_showstashstate 'yes'<br />
set __fish_git_prompt_showupstream 'yes'<br />
set __fish_git_prompt_color_branch yellow<br />
<br />
# Status Chars<br />
set __fish_git_prompt_char_dirtystate '⚡'<br />
set __fish_git_prompt_char_stagedstate '→'<br />
set __fish_git_prompt_char_stashstate '↩'<br />
set __fish_git_prompt_char_upstream_ahead '↑'<br />
set __fish_git_prompt_char_upstream_behind '↓'<br />
<br />
function fish_prompt<br />
set last_status $status<br />
set_color $fish_color_cwd<br />
printf '%s' (prompt_pwd)<br />
set_color normal<br />
printf '%s ' (__fish_git_prompt)<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572807
Fish (简体中文)
2019-05-09T03:53:24Z
<p>Liu-shuyuan: Updated translation of System integration</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
=== 只把fish设为交互式shell ===<br />
<br />
如果不将fish设为默认shell,就能照常运行Bash的初始化脚本。这能够保证用户当前的环境变量不受影响并且在fish中也能使用,因为fish是作为Bash的子进程运行的。下面是几种只把fish设为交互式shell的方法。<br />
<br />
==== 通过.bashrc启动fish ====<br />
<br />
保持默认shell为Bash不变,然后添加一行{{ic|exec fish}}到合适的[[Bash#Configuration files|Bash配置文件]]中,比如{{ic|.bashrc}}。在这种方法中,Bash会正常执行{{ic|/etc/profile}}和{{ic|/etc/profile.d}}中的所有配置文件。相对于之后几种方法,这种是最通用的,因为这种方法在本机计算机和SSH远程计算机上都能使用。<br />
<br />
{{Tip|<br />
* 在这种配置下,要使用Bash而不是接着启动fish,需要使用{{ic|bash --norc}},以防止Bash加载{{ic|~/.bashrc}}并执行{{ic|exec fish}}。<br />
* 要让类似于{{ic|bash -c 'echo test'}}中的命令在Bash中执行而不是启动fish,你可以将{{ic|exec fish}}换为{{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}}。}}<br />
<br />
==== 使用终端模拟器的选项 ====<br />
<br />
另一种方法是在启动终端模拟器时通过添加命令行选项来启动fish。对于大部分的终端,这个选项是 {{ic|-e}}。比如,要打开gnome-terminal并运行fish,可以将gnome-terminal的快捷方式改为:<br />
<br />
gnome-terminal -e fish<br />
<br />
对于不支持设置shell的终端模拟器,比如{{aur|lilyterm-git}},则需要这样:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
另外,有些终端可以在设置或配置文件中将fish设为默认shell。<br />
<br />
==== 使用终端复用器的选项 ====<br />
<br />
要将fish设为[[tmux]]启动的默认shell,在{{ic|~/.tmux.conf}}中加入这行:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
当''tmux''启动时,就会自动进入fish。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}},这个文件就和 {{ic|.bashrc}}一样。当启动终端时,fish会执行这个文件中的脚本。<br />
<br />
=== 网页配置接口 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置提示和颜色主题, 配置会保存到个人配置文件, 你也可以在浏览器中查看自己定义的函数和命令历史。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据,生成自动补全规则,这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在 {{ic|~/.config/fish/completions/}} 中定义自己的自动补全规则. {{ic|/usr/share/fish/completions/}} 有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了----fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
==故障排除==<br />
===历史记录===<br />
Fish does not implement history substitution (e.g. {{ic|sudo !!}}), and the fish developers have said that they [http://fishshell.com/docs/current/faq.html#faq-history do not plan to]. Still, this is an essential piece of many users' workflow. Reddit user, [http://www.reddit.com/u/crossroads1112 crossroads1112], created a function that regains some of the functionality of history substitution and with another syntax. The function is on [https://gist.github.com/crossroads1112/77badb2c3455e23b873b github] and instructions are included as comments in it. There is a [https://gist.github.com/b-/981892a65837ab0a387e forked version] that is closer to the original syntax and allows for {{ic|command !!}} if you specify the command in the helper function.<br />
<br />
Other alternatives to regaining the {{ic|command !!}} syntax can be found on [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-History-Substitution-%28%21%21-and-%21%24%29 Fish' github wiki]. The examples here include e.g. the {{ic|bind_bang}} function which expands {{ic|!!}} to the latest command in the history (this will of course make it impossible to do to bangs in a row as they will expand). Another option is the command given on [https://github.com/fish-shell/fish-shell/issues/288#issuecomment-158704275 this github issue].<br />
<br />
==提示与技巧==<br />
<br />
=== 不要把fish设为默认shell ===<br />
<br />
在Arch中,很多shell脚本都是为[[Bash]]而写的,并且与fish不兼容。这里不建议把fish设为默认shell,把bash设为默认shell可以使得那些为bash而写的脚本可以正常运行,确保系统环境正常初始化,环境变量正常配置。如果你把fish设为默认的shell,很可能会在启动shell时看到报错信息。<br />
<br />
下面是一些技巧,能够使得即使不把fish设为默认shell,也能够在登录的时候自动进入fish。<br />
<br />
==== 修改.bashrc来启动fish ====<br />
<br />
把bash设为你的默认shell,只需要在你的bash配置文件[[Bash#Configuration files]](一般是{{ic|.bashrc}})的最后一行加入 {{ic|exec fish}},即可在进入bash之后自动启动fish。这种做法使得Bash可以正常的运行 {{ic|/etc/profile}} 和 {{ic|/etc/profile.d}}下的配置。因为''fish''替代了bash 进程,退出 ''fish''也会自动退出终端。和下一个方法相比,这种做法更通用,因为它能够同时在本地和SSH远程连接时运作。<br />
<br />
{{Tip|如果你想进入bash而不是fish,使用命令 {{ic|bash --norc}} }}<br />
<br />
==== 设为默认终端模拟器shell ====<br />
<br />
另外一种自动启动fish的方法是专门针对终端模拟器设置默认解释器。对大多数终端模拟器来说,只需要{{ic|-e}} 选项即可完成配置修改。以gnome终端模拟器为例,修改使用fish的命令如下:<br />
<br />
gnome-terminal -e fish<br />
<br />
LilyTerm等轻量级的终端模拟器,不支持通过命令设置默认的解释器,这时候可以通过环境变量的方式:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
你也可以通过修改终端模拟器的配置文件来完成配置。<br />
<br />
这样,当你打开终端模拟器的时候,就会自动的进入fish。<br />
<br />
====设为默认终端服用器shell ====<br />
<br />
如果要为tmux设置默认的shell,只需要把下面这句话放到 {{ic|~/.tmux.conf}}:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
这样只要启动''tmux'',都会自动进入fish。<br />
<br />
===关闭问候语===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。你可以在fish的配置文件中增加 {{ic|set fish_greeting}}以关闭它。<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt] is a popular "full-featured & carefully designed adaptive prompt for Bash & Zsh" and has no plans to make it compatible with fish [https://github.com/nojhan/liquidprompt/pull/230]. [https://github.com/wesbarnett/fish-lp This project] implements it for fish.<br />
<br />
=== 在提示中增加git 状态 ===<br />
<br />
If you would like fish to display the branch and dirty status when you are in a git directory, you can add the following to your {{ic|~/.config/fish/config.fish}}:<br />
{{bc|<nowiki><br />
# fish git prompt<br />
set __fish_git_prompt_showdirtystate 'yes'<br />
set __fish_git_prompt_showstashstate 'yes'<br />
set __fish_git_prompt_showupstream 'yes'<br />
set __fish_git_prompt_color_branch yellow<br />
<br />
# Status Chars<br />
set __fish_git_prompt_char_dirtystate '⚡'<br />
set __fish_git_prompt_char_stagedstate '→'<br />
set __fish_git_prompt_char_stashstate '↩'<br />
set __fish_git_prompt_char_upstream_ahead '↑'<br />
set __fish_git_prompt_char_upstream_behind '↓'<br />
<br />
function fish_prompt<br />
set last_status $status<br />
set_color $fish_color_cwd<br />
printf '%s' (prompt_pwd)<br />
set_color normal<br />
printf '%s ' (__fish_git_prompt)<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572806
Fish (简体中文)
2019-05-09T03:52:39Z
<p>Liu-shuyuan: Undo revision 572805 by Liu-shuyuan due to misdeletion of the whole article except System integration (talk)</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}},这个文件就和 {{ic|.bashrc}}一样。当启动终端时,fish会执行这个文件中的脚本。<br />
<br />
=== 网页配置接口 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置提示和颜色主题, 配置会保存到个人配置文件, 你也可以在浏览器中查看自己定义的函数和命令历史。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据,生成自动补全规则,这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在 {{ic|~/.config/fish/completions/}} 中定义自己的自动补全规则. {{ic|/usr/share/fish/completions/}} 有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了----fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
==故障排除==<br />
===历史记录===<br />
Fish does not implement history substitution (e.g. {{ic|sudo !!}}), and the fish developers have said that they [http://fishshell.com/docs/current/faq.html#faq-history do not plan to]. Still, this is an essential piece of many users' workflow. Reddit user, [http://www.reddit.com/u/crossroads1112 crossroads1112], created a function that regains some of the functionality of history substitution and with another syntax. The function is on [https://gist.github.com/crossroads1112/77badb2c3455e23b873b github] and instructions are included as comments in it. There is a [https://gist.github.com/b-/981892a65837ab0a387e forked version] that is closer to the original syntax and allows for {{ic|command !!}} if you specify the command in the helper function.<br />
<br />
Other alternatives to regaining the {{ic|command !!}} syntax can be found on [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-History-Substitution-%28%21%21-and-%21%24%29 Fish' github wiki]. The examples here include e.g. the {{ic|bind_bang}} function which expands {{ic|!!}} to the latest command in the history (this will of course make it impossible to do to bangs in a row as they will expand). Another option is the command given on [https://github.com/fish-shell/fish-shell/issues/288#issuecomment-158704275 this github issue].<br />
<br />
==提示与技巧==<br />
<br />
=== 不要把fish设为默认shell ===<br />
<br />
在Arch中,很多shell脚本都是为[[Bash]]而写的,并且与fish不兼容。这里不建议把fish设为默认shell,把bash设为默认shell可以使得那些为bash而写的脚本可以正常运行,确保系统环境正常初始化,环境变量正常配置。如果你把fish设为默认的shell,很可能会在启动shell时看到报错信息。<br />
<br />
下面是一些技巧,能够使得即使不把fish设为默认shell,也能够在登录的时候自动进入fish。<br />
<br />
==== 修改.bashrc来启动fish ====<br />
<br />
把bash设为你的默认shell,只需要在你的bash配置文件[[Bash#Configuration files]](一般是{{ic|.bashrc}})的最后一行加入 {{ic|exec fish}},即可在进入bash之后自动启动fish。这种做法使得Bash可以正常的运行 {{ic|/etc/profile}} 和 {{ic|/etc/profile.d}}下的配置。因为''fish''替代了bash 进程,退出 ''fish''也会自动退出终端。和下一个方法相比,这种做法更通用,因为它能够同时在本地和SSH远程连接时运作。<br />
<br />
{{Tip|如果你想进入bash而不是fish,使用命令 {{ic|bash --norc}} }}<br />
<br />
==== 设为默认终端模拟器shell ====<br />
<br />
另外一种自动启动fish的方法是专门针对终端模拟器设置默认解释器。对大多数终端模拟器来说,只需要{{ic|-e}} 选项即可完成配置修改。以gnome终端模拟器为例,修改使用fish的命令如下:<br />
<br />
gnome-terminal -e fish<br />
<br />
LilyTerm等轻量级的终端模拟器,不支持通过命令设置默认的解释器,这时候可以通过环境变量的方式:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
你也可以通过修改终端模拟器的配置文件来完成配置。<br />
<br />
这样,当你打开终端模拟器的时候,就会自动的进入fish。<br />
<br />
====设为默认终端服用器shell ====<br />
<br />
如果要为tmux设置默认的shell,只需要把下面这句话放到 {{ic|~/.tmux.conf}}:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
这样只要启动''tmux'',都会自动进入fish。<br />
<br />
===关闭问候语===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。你可以在fish的配置文件中增加 {{ic|set fish_greeting}}以关闭它。<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt] is a popular "full-featured & carefully designed adaptive prompt for Bash & Zsh" and has no plans to make it compatible with fish [https://github.com/nojhan/liquidprompt/pull/230]. [https://github.com/wesbarnett/fish-lp This project] implements it for fish.<br />
<br />
=== 在提示中增加git 状态 ===<br />
<br />
If you would like fish to display the branch and dirty status when you are in a git directory, you can add the following to your {{ic|~/.config/fish/config.fish}}:<br />
{{bc|<nowiki><br />
# fish git prompt<br />
set __fish_git_prompt_showdirtystate 'yes'<br />
set __fish_git_prompt_showstashstate 'yes'<br />
set __fish_git_prompt_showupstream 'yes'<br />
set __fish_git_prompt_color_branch yellow<br />
<br />
# Status Chars<br />
set __fish_git_prompt_char_dirtystate '⚡'<br />
set __fish_git_prompt_char_stagedstate '→'<br />
set __fish_git_prompt_char_stashstate '↩'<br />
set __fish_git_prompt_char_upstream_ahead '↑'<br />
set __fish_git_prompt_char_upstream_behind '↓'<br />
<br />
function fish_prompt<br />
set last_status $status<br />
set_color $fish_color_cwd<br />
printf '%s' (prompt_pwd)<br />
set_color normal<br />
printf '%s ' (__fish_git_prompt)<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572805
Fish (简体中文)
2019-05-09T03:50:23Z
<p>Liu-shuyuan: Updated translation of System integration</p>
<hr />
<div>== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
=== 只把fish设为交互式shell ===<br />
<br />
如果不将fish设为默认shell,就能照常运行Bash的初始化脚本。这能够保证用户当前的环境变量不受影响并且在fish中也能使用,因为fish是作为Bash的子进程运行的。下面是几种只把fish设为交互式shell的方法。<br />
<br />
==== 通过.bashrc启动fish ====<br />
<br />
保持默认shell为Bash不变,然后添加一行{{ic|exec fish}}到合适的[[Bash#Configuration files|Bash配置文件]]中,比如{{ic|.bashrc}}。在这种方法中,Bash会正常执行{{ic|/etc/profile}}和{{ic|/etc/profile.d}}中的所有配置文件。相对于之后几种方法,这种是最通用的,因为这种方法在本机计算机和SSH远程计算机上都能使用。<br />
<br />
{{Tip|<br />
* 在这种配置下,要使用Bash而不是接着启动fish,需要使用{{ic|bash --norc}},以防止Bash加载{{ic|~/.bashrc}}并执行{{ic|exec fish}}。<br />
* 要让类似于{{ic|bash -c 'echo test'}}中的命令在Bash中执行而不是启动fish,你可以将{{ic|exec fish}}换为{{ic|if [ -z "$BASH_EXECUTION_STRING" ]; then exec fish; fi}}。}}<br />
<br />
==== 使用终端模拟器的选项 ====<br />
<br />
另一种方法是在启动终端模拟器时通过添加命令行选项来启动fish。对于大部分的终端,这个选项是 {{ic|-e}}。比如,要打开gnome-terminal并运行fish,可以将gnome-terminal的快捷方式改为:<br />
<br />
gnome-terminal -e fish<br />
<br />
对于不支持设置shell的终端模拟器,比如{{aur|lilyterm-git}},则需要这样:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
另外,有些终端可以在设置或配置文件中将fish设为默认shell。<br />
<br />
==== 使用终端复用器的选项 ====<br />
<br />
要将fish设为[[tmux]]启动的默认shell,在{{ic|~/.tmux.conf}}中加入这行:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
当''tmux''启动时,就会自动进入fish。</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572797
Fish (简体中文)
2019-05-09T00:19:10Z
<p>Liu-shuyuan: Completed translation update to 把fish设为默认shell /* 把fish设为默认shell */</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
下一步是把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
需要特别关注的是,在登录到fish中后,你需要尽快检查、调整环境变量{{ic|$PATH}}的内容。在fish中,{{ic|$PATH}}是一个''全局环境变量'',即它的作用范围包含所有函数,它在重启时会被清除,以及它对fish的所有子进程都是可见的(是一个''环境变量'')。向{{ic|$PATH}}添加长期使用的路径的推荐的方法,是将他们赋给{{ic|fish_user_paths}}这个全局变量。这个变量的内容重启时不会丢失,并会被自动添加到{{ic|$PATH}}中。比如,<br />
<br />
$ set -U fish_user_paths ''/第一个/路径'' ''/第二个/路径'' ''/第三个/路径''<br />
<br />
这三个路径就会一直保持在{{ic|$PATH}}中。这种方式比较简单,因为不需要修改配置文件。<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}},这个文件就和 {{ic|.bashrc}}一样。当启动终端时,fish会执行这个文件中的脚本。<br />
<br />
=== 网页配置接口 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置提示和颜色主题, 配置会保存到个人配置文件, 你也可以在浏览器中查看自己定义的函数和命令历史。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据,生成自动补全规则,这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在 {{ic|~/.config/fish/completions/}} 中定义自己的自动补全规则. {{ic|/usr/share/fish/completions/}} 有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了----fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
==故障排除==<br />
===历史记录===<br />
Fish does not implement history substitution (e.g. {{ic|sudo !!}}), and the fish developers have said that they [http://fishshell.com/docs/current/faq.html#faq-history do not plan to]. Still, this is an essential piece of many users' workflow. Reddit user, [http://www.reddit.com/u/crossroads1112 crossroads1112], created a function that regains some of the functionality of history substitution and with another syntax. The function is on [https://gist.github.com/crossroads1112/77badb2c3455e23b873b github] and instructions are included as comments in it. There is a [https://gist.github.com/b-/981892a65837ab0a387e forked version] that is closer to the original syntax and allows for {{ic|command !!}} if you specify the command in the helper function.<br />
<br />
Other alternatives to regaining the {{ic|command !!}} syntax can be found on [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-History-Substitution-%28%21%21-and-%21%24%29 Fish' github wiki]. The examples here include e.g. the {{ic|bind_bang}} function which expands {{ic|!!}} to the latest command in the history (this will of course make it impossible to do to bangs in a row as they will expand). Another option is the command given on [https://github.com/fish-shell/fish-shell/issues/288#issuecomment-158704275 this github issue].<br />
<br />
==提示与技巧==<br />
<br />
=== 不要把fish设为默认shell ===<br />
<br />
在Arch中,很多shell脚本都是为[[Bash]]而写的,并且与fish不兼容。这里不建议把fish设为默认shell,把bash设为默认shell可以使得那些为bash而写的脚本可以正常运行,确保系统环境正常初始化,环境变量正常配置。如果你把fish设为默认的shell,很可能会在启动shell时看到报错信息。<br />
<br />
下面是一些技巧,能够使得即使不把fish设为默认shell,也能够在登录的时候自动进入fish。<br />
<br />
==== 修改.bashrc来启动fish ====<br />
<br />
把bash设为你的默认shell,只需要在你的bash配置文件[[Bash#Configuration files]](一般是{{ic|.bashrc}})的最后一行加入 {{ic|exec fish}},即可在进入bash之后自动启动fish。这种做法使得Bash可以正常的运行 {{ic|/etc/profile}} 和 {{ic|/etc/profile.d}}下的配置。因为''fish''替代了bash 进程,退出 ''fish''也会自动退出终端。和下一个方法相比,这种做法更通用,因为它能够同时在本地和SSH远程连接时运作。<br />
<br />
{{Tip|如果你想进入bash而不是fish,使用命令 {{ic|bash --norc}} }}<br />
<br />
==== 设为默认终端模拟器shell ====<br />
<br />
另外一种自动启动fish的方法是专门针对终端模拟器设置默认解释器。对大多数终端模拟器来说,只需要{{ic|-e}} 选项即可完成配置修改。以gnome终端模拟器为例,修改使用fish的命令如下:<br />
<br />
gnome-terminal -e fish<br />
<br />
LilyTerm等轻量级的终端模拟器,不支持通过命令设置默认的解释器,这时候可以通过环境变量的方式:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
你也可以通过修改终端模拟器的配置文件来完成配置。<br />
<br />
这样,当你打开终端模拟器的时候,就会自动的进入fish。<br />
<br />
====设为默认终端服用器shell ====<br />
<br />
如果要为tmux设置默认的shell,只需要把下面这句话放到 {{ic|~/.tmux.conf}}:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
这样只要启动''tmux'',都会自动进入fish。<br />
<br />
===关闭问候语===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。你可以在fish的配置文件中增加 {{ic|set fish_greeting}}以关闭它。<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt] is a popular "full-featured & carefully designed adaptive prompt for Bash & Zsh" and has no plans to make it compatible with fish [https://github.com/nojhan/liquidprompt/pull/230]. [https://github.com/wesbarnett/fish-lp This project] implements it for fish.<br />
<br />
=== 在提示中增加git 状态 ===<br />
<br />
If you would like fish to display the branch and dirty status when you are in a git directory, you can add the following to your {{ic|~/.config/fish/config.fish}}:<br />
{{bc|<nowiki><br />
# fish git prompt<br />
set __fish_git_prompt_showdirtystate 'yes'<br />
set __fish_git_prompt_showstashstate 'yes'<br />
set __fish_git_prompt_showupstream 'yes'<br />
set __fish_git_prompt_color_branch yellow<br />
<br />
# Status Chars<br />
set __fish_git_prompt_char_dirtystate '⚡'<br />
set __fish_git_prompt_char_stagedstate '→'<br />
set __fish_git_prompt_char_stashstate '↩'<br />
set __fish_git_prompt_char_upstream_ahead '↑'<br />
set __fish_git_prompt_char_upstream_behind '↓'<br />
<br />
function fish_prompt<br />
set last_status $status<br />
set_color $fish_color_cwd<br />
printf '%s' (prompt_pwd)<br />
set_color normal<br />
printf '%s ' (__fish_git_prompt)<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572796
Fish (简体中文)
2019-05-08T23:26:21Z
<p>Liu-shuyuan: Updated translation of part of Setting fish as default shell</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“交互式的、对用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。fish的作者们认为POSIX中存在一些缺陷和矛盾,并通过fish简化的或不同的语法解决这些问题。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装{{Pkg|fish}}软件包。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入{{ic|fish}}即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入{{ic|help}}。文档将会在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 把fish集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,并在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
然后,把Bash的几个初始化脚本中现有的操作和配置写成fish的格式。这些脚本分别是{{ic|/etc/profile}}、{{ic|~/.bash_profile}}、{{ic|/etc/bash.bashrc}}和{{ic|~/.bashrc}}。<br />
<br />
In particular, the content of the {{ic|$PATH}} environment variable, once directly logged under fish, should be checked and adjusted to one's need. In fish, {{ic|$PATH}} is defined as a ''global environment variable'': it has a ''global'' scope across all functions, it is lost upon reboot and it is an ''environment variable'' which means it is exported to child processes.<br />
The recommended way of adding permanently additional locations to the path is by assigning them to the {{ic|fish_user_paths}} universal variable. This variable is automatically added to {{ic|$PATH}} and is preserved across restarts of the shell. For example by setting:<br />
<br />
$ set -U fish_user_paths ''/first/path'' ''/second/path'' ''/third/one''<br />
<br />
These three locations will be permanently prepended to the path. This is an easy way to complement the path without the need to add any instruction in scripts.<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}},这个文件就和 {{ic|.bashrc}}一样。当启动终端时,fish会执行这个文件中的脚本。<br />
<br />
=== 网页配置接口 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置提示和颜色主题, 配置会保存到个人配置文件, 你也可以在浏览器中查看自己定义的函数和命令历史。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据,生成自动补全规则,这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在 {{ic|~/.config/fish/completions/}} 中定义自己的自动补全规则. {{ic|/usr/share/fish/completions/}} 有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了----fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
==故障排除==<br />
===历史记录===<br />
Fish does not implement history substitution (e.g. {{ic|sudo !!}}), and the fish developers have said that they [http://fishshell.com/docs/current/faq.html#faq-history do not plan to]. Still, this is an essential piece of many users' workflow. Reddit user, [http://www.reddit.com/u/crossroads1112 crossroads1112], created a function that regains some of the functionality of history substitution and with another syntax. The function is on [https://gist.github.com/crossroads1112/77badb2c3455e23b873b github] and instructions are included as comments in it. There is a [https://gist.github.com/b-/981892a65837ab0a387e forked version] that is closer to the original syntax and allows for {{ic|command !!}} if you specify the command in the helper function.<br />
<br />
Other alternatives to regaining the {{ic|command !!}} syntax can be found on [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-History-Substitution-%28%21%21-and-%21%24%29 Fish' github wiki]. The examples here include e.g. the {{ic|bind_bang}} function which expands {{ic|!!}} to the latest command in the history (this will of course make it impossible to do to bangs in a row as they will expand). Another option is the command given on [https://github.com/fish-shell/fish-shell/issues/288#issuecomment-158704275 this github issue].<br />
<br />
==提示与技巧==<br />
<br />
=== 不要把fish设为默认shell ===<br />
<br />
在Arch中,很多shell脚本都是为[[Bash]]而写的,并且与fish不兼容。这里不建议把fish设为默认shell,把bash设为默认shell可以使得那些为bash而写的脚本可以正常运行,确保系统环境正常初始化,环境变量正常配置。如果你把fish设为默认的shell,很可能会在启动shell时看到报错信息。<br />
<br />
下面是一些技巧,能够使得即使不把fish设为默认shell,也能够在登录的时候自动进入fish。<br />
<br />
==== 修改.bashrc来启动fish ====<br />
<br />
把bash设为你的默认shell,只需要在你的bash配置文件[[Bash#Configuration files]](一般是{{ic|.bashrc}})的最后一行加入 {{ic|exec fish}},即可在进入bash之后自动启动fish。这种做法使得Bash可以正常的运行 {{ic|/etc/profile}} 和 {{ic|/etc/profile.d}}下的配置。因为''fish''替代了bash 进程,退出 ''fish''也会自动退出终端。和下一个方法相比,这种做法更通用,因为它能够同时在本地和SSH远程连接时运作。<br />
<br />
{{Tip|如果你想进入bash而不是fish,使用命令 {{ic|bash --norc}} }}<br />
<br />
==== 设为默认终端模拟器shell ====<br />
<br />
另外一种自动启动fish的方法是专门针对终端模拟器设置默认解释器。对大多数终端模拟器来说,只需要{{ic|-e}} 选项即可完成配置修改。以gnome终端模拟器为例,修改使用fish的命令如下:<br />
<br />
gnome-terminal -e fish<br />
<br />
LilyTerm等轻量级的终端模拟器,不支持通过命令设置默认的解释器,这时候可以通过环境变量的方式:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
你也可以通过修改终端模拟器的配置文件来完成配置。<br />
<br />
这样,当你打开终端模拟器的时候,就会自动的进入fish。<br />
<br />
====设为默认终端服用器shell ====<br />
<br />
如果要为tmux设置默认的shell,只需要把下面这句话放到 {{ic|~/.tmux.conf}}:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
这样只要启动''tmux'',都会自动进入fish。<br />
<br />
===关闭问候语===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。你可以在fish的配置文件中增加 {{ic|set fish_greeting}}以关闭它。<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt] is a popular "full-featured & carefully designed adaptive prompt for Bash & Zsh" and has no plans to make it compatible with fish [https://github.com/nojhan/liquidprompt/pull/230]. [https://github.com/wesbarnett/fish-lp This project] implements it for fish.<br />
<br />
=== 在提示中增加git 状态 ===<br />
<br />
If you would like fish to display the branch and dirty status when you are in a git directory, you can add the following to your {{ic|~/.config/fish/config.fish}}:<br />
{{bc|<nowiki><br />
# fish git prompt<br />
set __fish_git_prompt_showdirtystate 'yes'<br />
set __fish_git_prompt_showstashstate 'yes'<br />
set __fish_git_prompt_showupstream 'yes'<br />
set __fish_git_prompt_color_branch yellow<br />
<br />
# Status Chars<br />
set __fish_git_prompt_char_dirtystate '⚡'<br />
set __fish_git_prompt_char_stagedstate '→'<br />
set __fish_git_prompt_char_stashstate '↩'<br />
set __fish_git_prompt_char_upstream_ahead '↑'<br />
set __fish_git_prompt_char_upstream_behind '↓'<br />
<br />
function fish_prompt<br />
set last_status $status<br />
set_color $fish_color_cwd<br />
printf '%s' (prompt_pwd)<br />
set_color normal<br />
printf '%s ' (__fish_git_prompt)<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=Fish_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572783
Fish (简体中文)
2019-05-08T14:11:57Z
<p>Liu-shuyuan: Updated the translation of the first section (安装) and part of the second section (集成到系统中).</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Command shells (简体中文)]]<br />
[[en:Fish]]<br />
[[de:Fish]]<br />
[[ja:Fish]]<br />
[[ru:Fish]]<br />
{{TranslationStatus (简体中文)|Fish|2019-05-08|567009}}<br />
[https://fishshell.com fish]是“'''''f'''riendly '''i'''nteractive '''sh'''ell''”的缩写,是一个“为交互式使用而创建,用户友好的 [[command-line shell|命令行shell]]”。<br />
<br />
''fish''被有意设计成不完全与[[Wikipedia:POSIX|POSIX]]兼容。它旨在通过简化的或不同的语法来解决(其作者所认为的)POSIX中存在的缺陷。因此,即使简单的POSIX兼容的脚本也可能需要较多的修改,甚至完全重写,才能在fish中运行。<br />
<br />
== 安装 ==<br />
<br />
安装 {{Pkg|fish}}包 。也可以从AUR安装开发版的{{AUR|fish-git}}。<br />
<br />
安装完成后,输入 {{ic|fish}} 即可进入fish shell。<br />
<br />
要查看帮助文档,在fish中输入 {{ic|help}}。文档将自动在浏览器中打开。建议用户至少读完文档中“Syntax overview”这一节内容,因为fish的语法和其他shell的不太一样。<br />
<br />
== 集成到系统中 ==<br />
<br />
需要考虑的是:是把fish设置为默认shell,也就是用户登录时直接进入的shell,还是通过当前的默认shell启动fish,并只在交互模式下使用fish。这里,我们假设当前的默认shell是[[Bash (简体中文)|Bash]]。<br />
<br />
* 把fish设为'''默认shell''':这种方式需要用户对fish的运行机制及其脚本语言有些基本的了解。用户需要把当前的初始化脚本和环境变量移动到fish的环境中。[[#把fish设为默认shell]]中有具体的步骤。<br />
<br />
* 只把fish用作'''交互式shell''':这种方法“破坏性”较小。Bash会照常运行所有的初始化脚本,之后在此基础上启动fish。[[#只把fish设为交互式shell]]中有具体的步骤。<br />
<br />
=== 把fish设为默认shell ===<br />
<br />
如果你决定把fish设为默认的shell,首先你需要将你的用户的shell改为{{ic|/usr/bin/fish}}。参照[[Command-line shell#Changing your default shell]]中的步骤。<br />
<br />
然后,把Bash的几个初始化脚本中涉及的的操作和配置<br />
<br />
The next step is to port the current needed actions and configuration performed in the various Bash initialization scripts, namely {{ic|/etc/profile}}, {{ic|~/.bash_profile}}, {{ic|/etc/bash.bashrc}} and {{ic|~/.bashrc}}, into the fish framework.<br />
<br />
In particular, the content of the {{ic|$PATH}} environment variable, once directly logged under fish, should be checked and adjusted to one's need. In fish, {{ic|$PATH}} is defined as a ''global environment variable'': it has a ''global'' scope across all functions, it is lost upon reboot and it is an ''environment variable'' which means it is exported to child processes.<br />
The recommended way of adding permanently additional locations to the path is by assigning them to the {{ic|fish_user_paths}} universal variable. This variable is automatically added to {{ic|$PATH}} and is preserved across restarts of the shell. For example by setting:<br />
<br />
$ set -U fish_user_paths ''/first/path'' ''/second/path'' ''/third/one''<br />
<br />
These three locations will be permanently prepended to the path. This is an easy way to complement the path without the need to add any instruction in scripts.<br />
<br />
== 配置 ==<br />
<br />
fish的配置脚本保存在{{ic|~/.config/fish/config.fish}},这个文件就和 {{ic|.bashrc}}一样。当启动终端时,fish会执行这个文件中的脚本。<br />
<br />
=== 网页配置接口 ===<br />
<br />
通过下面命令即可用浏览器打开fish的配置页面。<br />
<br />
fish_config<br />
<br />
在浏览器中可以交互式配置提示和颜色主题, 配置会保存到个人配置文件, 你也可以在浏览器中查看自己定义的函数和命令历史。<br />
<br />
=== 命令补全 ===<br />
<br />
fish可以通过解析man的数据,生成自动补全规则,这些自动补全规则保存于{{ic|~/.config/fish/generated_completions/}}。可以运行下面命令更新自动补齐规则。<br />
<br />
fish_update_completions<br />
<br />
你也可以在 {{ic|~/.config/fish/completions/}} 中定义自己的自动补全规则. {{ic|/usr/share/fish/completions/}} 有更多的例子。<br />
<br />
对Arch Linux来说, ''pacman'', ''pacman-key'', ''makepkg'', ''cower'', ''pbget'', ''pacmatic''这些命令的自动补全规则已经在fish中内置了----fish在不同的发行版中内置了不同的命令补全规则。fish的内存管理足够智能,不会因为命令补全产生负面影响。<br />
<br />
==故障排除==<br />
===历史记录===<br />
Fish does not implement history substitution (e.g. {{ic|sudo !!}}), and the fish developers have said that they [http://fishshell.com/docs/current/faq.html#faq-history do not plan to]. Still, this is an essential piece of many users' workflow. Reddit user, [http://www.reddit.com/u/crossroads1112 crossroads1112], created a function that regains some of the functionality of history substitution and with another syntax. The function is on [https://gist.github.com/crossroads1112/77badb2c3455e23b873b github] and instructions are included as comments in it. There is a [https://gist.github.com/b-/981892a65837ab0a387e forked version] that is closer to the original syntax and allows for {{ic|command !!}} if you specify the command in the helper function.<br />
<br />
Other alternatives to regaining the {{ic|command !!}} syntax can be found on [https://github.com/fish-shell/fish-shell/wiki/Bash-Style-History-Substitution-%28%21%21-and-%21%24%29 Fish' github wiki]. The examples here include e.g. the {{ic|bind_bang}} function which expands {{ic|!!}} to the latest command in the history (this will of course make it impossible to do to bangs in a row as they will expand). Another option is the command given on [https://github.com/fish-shell/fish-shell/issues/288#issuecomment-158704275 this github issue].<br />
<br />
==提示与技巧==<br />
<br />
=== 不要把fish设为默认shell ===<br />
<br />
在Arch中,很多shell脚本都是为[[Bash]]而写的,并且与fish不兼容。这里不建议把fish设为默认shell,把bash设为默认shell可以使得那些为bash而写的脚本可以正常运行,确保系统环境正常初始化,环境变量正常配置。如果你把fish设为默认的shell,很可能会在启动shell时看到报错信息。<br />
<br />
下面是一些技巧,能够使得即使不把fish设为默认shell,也能够在登录的时候自动进入fish。<br />
<br />
==== 修改.bashrc来启动fish ====<br />
<br />
把bash设为你的默认shell,只需要在你的bash配置文件[[Bash#Configuration files]](一般是{{ic|.bashrc}})的最后一行加入 {{ic|exec fish}},即可在进入bash之后自动启动fish。这种做法使得Bash可以正常的运行 {{ic|/etc/profile}} 和 {{ic|/etc/profile.d}}下的配置。因为''fish''替代了bash 进程,退出 ''fish''也会自动退出终端。和下一个方法相比,这种做法更通用,因为它能够同时在本地和SSH远程连接时运作。<br />
<br />
{{Tip|如果你想进入bash而不是fish,使用命令 {{ic|bash --norc}} }}<br />
<br />
==== 设为默认终端模拟器shell ====<br />
<br />
另外一种自动启动fish的方法是专门针对终端模拟器设置默认解释器。对大多数终端模拟器来说,只需要{{ic|-e}} 选项即可完成配置修改。以gnome终端模拟器为例,修改使用fish的命令如下:<br />
<br />
gnome-terminal -e fish<br />
<br />
LilyTerm等轻量级的终端模拟器,不支持通过命令设置默认的解释器,这时候可以通过环境变量的方式:<br />
<br />
SHELL=/usr/bin/fish lilyterm<br />
<br />
你也可以通过修改终端模拟器的配置文件来完成配置。<br />
<br />
这样,当你打开终端模拟器的时候,就会自动的进入fish。<br />
<br />
====设为默认终端服用器shell ====<br />
<br />
如果要为tmux设置默认的shell,只需要把下面这句话放到 {{ic|~/.tmux.conf}}:<br />
<br />
set-option -g default-shell "/usr/bin/fish"<br />
<br />
这样只要启动''tmux'',都会自动进入fish。<br />
<br />
===关闭问候语===<br />
<br />
默认情况下,每次启动fish,fish都会打印问候语。你可以在fish的配置文件中增加 {{ic|set fish_greeting}}以关闭它。<br />
<br />
=== 配置su命令默认启动fish ===<br />
<br />
当你使用"su"用户切换到其他用户的时候,默认使用的shell是Bash,但是你可以在fish的配置文件中添加一个函数覆盖默认的"su"命令,使得你在使用"su"命令切换用户的时候会自动使用fish:<br />
<br />
function su<br />
/bin/su --shell=/usr/bin/fish $argv<br />
end<br />
<br />
=== 登录fish时自动开启X ===<br />
<br />
把下面配置添加到 {{ic|~/.config/fish/config.fish}},即可在你登录tty1的时候自动启动X。<br />
<br />
{{bc|1=<nowiki><br />
# Start X at login<br />
if status --is-login<br />
if test -z "$DISPLAY" -a $XDG_VTNR = 1<br />
exec startx -- -keeptty<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
=== 使用 liquidprompt ===<br />
<br />
[https://github.com/nojhan/liquidprompt Liquidprompt] is a popular "full-featured & carefully designed adaptive prompt for Bash & Zsh" and has no plans to make it compatible with fish [https://github.com/nojhan/liquidprompt/pull/230]. [https://github.com/wesbarnett/fish-lp This project] implements it for fish.<br />
<br />
=== 在提示中增加git 状态 ===<br />
<br />
If you would like fish to display the branch and dirty status when you are in a git directory, you can add the following to your {{ic|~/.config/fish/config.fish}}:<br />
{{bc|<nowiki><br />
# fish git prompt<br />
set __fish_git_prompt_showdirtystate 'yes'<br />
set __fish_git_prompt_showstashstate 'yes'<br />
set __fish_git_prompt_showupstream 'yes'<br />
set __fish_git_prompt_color_branch yellow<br />
<br />
# Status Chars<br />
set __fish_git_prompt_char_dirtystate '⚡'<br />
set __fish_git_prompt_char_stagedstate '→'<br />
set __fish_git_prompt_char_stashstate '↩'<br />
set __fish_git_prompt_char_upstream_ahead '↑'<br />
set __fish_git_prompt_char_upstream_behind '↓'<br />
<br />
function fish_prompt<br />
set last_status $status<br />
set_color $fish_color_cwd<br />
printf '%s' (prompt_pwd)<br />
set_color normal<br />
printf '%s ' (__fish_git_prompt)<br />
set_color normal<br />
end<br />
</nowiki>}}<br />
<br />
=== ssh-agent 问题 ===<br />
<br />
在fish中,{{ic|eval (ssh-agent)}}会因为变量的设置方式而报错。一个变通的方案是使用csh风格的选项{{ic|-c}}:<br />
<br />
$ eval (ssh-agent -c)<br />
<br />
=== "command not found" 钩子 ===<br />
<br />
[[pkgfile]] 包含了一个 "未找到命令"("command not found") 钩子,但你输入一个当前系统不存在的命令,pkgfile会自动从官方仓库中搜索哪个安装包有这个命令。只要你安装了[[pkgfile]],这个钩子就会自动启用。<br />
<br />
=== 从jobs中删除进程 ===<br />
<br />
当你退出''fish''的时候,所有后台进程也会终止。为了保持一个任务即使在fish退出了之后也继续运行,需要先输入{{ic|disown}}命令,再退出。举例来说,在后台启动firefox,然后退出fish,但firefox在后台继续运行:<br />
<br />
<br />
$ firefox &<br />
$ disown<br />
$ exit<br />
<br />
你会发现虽然你退出了fish,但firefox没有退出。请参阅{{man|1|disown|url=}}了解更多细节。<br />
<br />
=== 迅速设置别名 ===<br />
<br />
如果想要快速的设置一个持久化的别名(即使重启也不会失效),可以直接在fish下输入:<br />
{{bc|1=<nowiki><br />
$ alias FooAliasName "foo"<br />
$ funcsave FooAliasName<br />
</nowiki>}}<br />
这种做法会把你的别名设为fish的终端函数。如果你想看所有的函数,或者是编辑它们,你可以使用{{ic|fish_config}} ,然后在'''Function'''标签下进行配置。<br />
<br />
== 另请参阅 ==<br />
<br />
* http://fishshell.com/ - fish主页<br />
* http://fishshell.com/docs/current/index.html - 文档<br />
* http://hyperpolyglot.org/unix-shells - Shell 语法对照表</div>
Liu-shuyuan
https://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=572782
ArchWiki:Translation Team (简体中文)
2019-05-08T13:00:20Z
<p>Liu-shuyuan: Added Liu-shuyuan as translator of page Fish (简体中文)</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:ArchWiki (简体中文)]]<br />
[[ar:ArchWiki Translation Team]]<br />
[[cs:ArchWiki Translation Team]]<br />
[[el:ArchWiki Translation Team]]<br />
[[en:ArchWiki:Translation Team]]<br />
[[es:ArchWiki:Translation Team]]<br />
[[fr:ArchWiki Translation Team]]<br />
[[hr:ArchWiki Translation Team]]<br />
[[it:ArchWiki Translation Team]]<br />
[[ja:ArchWiki 翻訳チーム]]<br />
[[ko:ArchWiki Translation Team]]<br />
[[nl:ArchWiki Translation Team]]<br />
[[pl:ArchWiki Translation Team]]<br />
[[pt:ArchWiki:Translation Team]]<br />
[[ru:ArchWiki Translation Team]]<br />
[[sk:ArchWiki Translation Team]]<br />
[[zh-hant:ArchWiki:Translation Team]]<br />
Arch Wiki 上有许多中文页面,这其中大部分是从外文翻译过来的,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对Arch Wiki做贡献,参与Wiki建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
{{警告|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读 [[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin|登录]] 以进行编辑。<br />
# 选择要翻译的页面,例如从 [[Special:Random|随机页面]] 或[[#页面维护列表|页面维护列表]] 中选择一个未翻译完成的页面。假设要翻译 [[Some Page]].<br />
# 进入选择的英文页面,点击页面顶部的 '''编辑'''。<br />
# 添加要翻译文件的语言间链接, 简体中文的话加入<nowiki>[[zh-hans:Some Page]]</nowiki>,其它语言参见[[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 保存页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[Some Page (简体中文)]] : {{ic|<nowiki>https://wiki.archlinux.org/index.php/Some_Page_(</nowiki>''简体中文'')}}<br />
# 因为页面不存在,点击 '''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:Internationalization]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:Internationalization (简体中文)]]</nowiki>}},参阅[[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-hans}} 修改为 {{ic|en}},并将英文页面移到文章顶部。<br />
# 翻译页面,进行保存。<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
# 更新所有其它语言页面,加入刚翻译文章的语言间链接。<br />
# (可选)创建一个简体中文名称的页面,指向新创建的页面:访问 {{ic|<nowiki>https://wiki.archlinux.org/index.php/</nowiki>''页面的中文名称''}}.<br />
# (可选)建立新页面,并加入:{{bc|<nowiki>#REDIRECT [[Some Page (简体中文)</nowiki>]]}}<br />
<br />
== Templates ==<br />
<br />
{{Translateme (简体中文)|Not translated}}<br />
<br />
The following table lists the [[Help:Template (简体中文)|templates]] that should be translated and their Simplified Chinese equivalent.<br />
<br />
{| class=wikitable<br />
! English template || Simplified Chinese version<br />
|-<br />
! colspan=2| Article templates<br />
|-<br />
| [[Template:Related articles start]] || [[Template:Related articles start (简体中文)]]<br />
|-<br />
| [[Template:Yes]] || [[Template:是]]<br />
|-<br />
| [[Template:No]] || [[Template:否]]<br />
|-<br />
| [[Template:Tip]] || [[Template:提示]]<br />
|-<br />
| [[Template:Note]] || [[Template:注意]]<br />
|-<br />
| [[Template:Warning]] || [[Template:警告]]<br />
|-<br />
| [[Template:Dead link]] || [[Template:失效链接]]<br />
|-<br />
| [[Template:Broken package link]] || {{-}}<br />
|-<br />
! colspan=2| Translation status templates<br />
|-<br />
| [[Template:Bad translation]] || {{-}}<br />
|-<br />
| [[Template:Translateme]] || [[Template:Translateme (简体中文)]]<br />
|-<br />
| [[Template:TranslationStatus]] || [[Template:TranslationStatus (简体中文)]]<br />
|-<br />
! colspan=2| Special templates<br />
|-<br />
| [[Template:Cat main]] || {{-}}<br />
|-<br />
| [[Template:Template]] || {{-}}<br />
|}<br />
<br />
== 完善翻译 ==<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个页面] 包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
<br />
== 更新过期页面 == <br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模版,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 翻译任务 ==<br />
=== 模板 Article summary 变更为 Related ===<br />
因为 Summary 中的简介基本上和正文的介绍一样,所以页面左边的介绍栏进行了简化,只保留相关文章功能。英文页面正在进行大规模修改,相应的中文页面也需要同步更新。<br />
<br />
需要注意的地方:<br />
* 将第一行改成<br />
: <nowiki>{{Related articles start (简体中文)}}</nowiki><br />
* 如果英文的相关文章存在中文翻译,则替换为简体中文页面。示例:<br />
: <nowiki>{{Related2|Display Manager (简体中文)|显示管理器}}</nowiki><br />
* 示例:[https://wiki.archlinux.org/index.php?title=Start_X_at_Login&diff=0&oldid=270155 英文变更], [https://wiki.archlinux.org/index.php?title=Start_X_at_Login_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=285643&oldid=242662 对应的翻译]<br />
<br />
== 维护翻译 ==<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[[Special:WhatLinksHere/Template:TranslationStatus_(简体中文)|模板的反向链接]]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应{{ic|<nowiki>{{out of date}}</nowiki>}} 模版<br />
;未翻译:页面中含有英文内容,对应{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板<br />
;完成:页面已与英文页面同步<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[AMD Catalyst (简体中文)]]<br />
| 过期<br />
| Shibao Zhao<br />
| 无<br />
|-<br />
| [[acpid (简体中文)]]<br />
| 过期<br />
| Cael<br />
|<br />
|-<br />
| [[Advanced Linux Sound Architecture (简体中文)]]<br />
| 翻译中<br />
| ihonliu<br />
| 无<br />
|-<br />
| [[Arch based distributions (active) (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[ATI (简体中文)]]<br />
| 完成<br />
| skysailing<br />
| 无<br />
|-<br />
| [[AUR helpers (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 部分用词可能需要修改<br />
|-<br />
| [[awesome (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无<br />
|-<br />
| [[BIND (简体中文)]]<br />
| 完成<br />
| Dargasia<br />
|<br />
|-<br />
| [[Bumblebee (简体中文)]]<br />
| 完成<br />
| Peter<br />
| 无<br />
|-<br />
| [[Chromium (简体中文)]]<br />
| 完成<br />
| Bobby<br />
| 无<br />
|-<br />
| [[Ceph (简体中文)]]<br />
| 翻译中<br />
| Aaron Chen<br />
| 部分未翻译 <br />
|-<br />
| [[Cinnamon (简体中文)]]<br />
| 部分翻译 <br />
| Bobby<br />
| 部分未翻译 <br />
|- <br />
| [[Common Applications (简体中文)]]<br />
| 部分翻译 <br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Common Applications/Science (简体中文)]]<br />
| drop maintain<br />
| 更新,翻译中<br />
|<br />
|-<br />
| [[Compiz (简体中文)]]<br />
| 翻译中<br />
| xiii_1991<br />
| 20140813开始<br />
|-<br />
| [[Conky (简体中文)]]<br />
| 完成<br />
| upi<br />
| 无<br />
|-<br />
| [[Core utilities (简体中文)]]<br />
| 完成<br />
| rentaro, Arisaka<br />
| 无<br />
|-<br />
|-<br />
| [[Clover (简体中文)]]<br />
| 完成<br />
| Yume Kankawa<br />
| 无<br />
|-<br />
| [[Disk cloning (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Dynamic Kernel Module Support (简体中文)]]<br />
| 完成<br />
| Mithrandir<br />
| 完善中<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[File recovery (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Fish (简体中文)]]<br />
| 翻译中<br />
| Liu-shuyuan<br />
|<br />
|-<br />
| [[Font configuration (简体中文)]]<br />
| 翻译中<br />
| Jaurung<br />
| 完善中<br />
|-<br />
| [[Fonts (简体中文)]]<br />
| 翻译中<br />
| qqbzg<br />
| 无<br />
|-<br />
| [[GDM (简体中文)]]<br />
| 翻译中<br />
| Junjie Yuan<br />
| 绝大多数内容未翻译,重新进行翻译<br />
|-<br />
| [[GNOME (简体中文)]]<br />
| 完成<br />
| skywet<br />
| <br />
|-<br />
| [[KDE (简体中文)]]<br />
| 过期<br />
| <br />
| <br />
|-<br />
| [[LAMP (简体中文)]]<br />
| 完成<br />
| Liuzhengyi<br />
| 勘误中<br />
|-<br />
| [[LibreOffice (简体中文)]]<br />
| 完成<br />
| qqbzg<br />
| 勘误中<br />
|-<br />
| [[Libvirt (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 需要格式改进<br />
|-<br />
| [[Local Mirror (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|- <br />
| [[MATLAB (简体中文)]]<br />
| 部分翻译 <br />
| Liu Qinyang<br />
|<br />
|-<br />
| [[Minecraft (简体中文)]]<br />
| 完成 <br />
| Xavier Lau<br />
| 页面已经与英文版同步,长期维护中<br />
|-<br />
| [[NetworkManager (简体中文)]]<br />
| 翻译中 <br />
| Jack-lijing, leeking <br />
| 请优先翻译<br />
|-<br />
| [[Network Time Protocol daemon (简体中文)]]<br />
| 完成<br />
| sid<br />
| 完善中<br />
|-<br />
| [[OpenOffice (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Opera (简体中文)]]<br />
| 未翻译<br />
| Bobby<br />
| 请优先翻译此文 <br />
|-<br />
| [[Pacman GUI Frontends (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Pidgin (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无 <br />
|- <br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Raspberry Pi (简体中文)]]<br />
| 翻译中<br />
| Mithrandir<br />
| <br />
|-<br />
| [[Reporting bug guidelines (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[Secure Shell (简体中文)]]<br />
| 完成<br />
| Arisaka<br />
| 无<br />
|-<br />
| [[Smart Common Input Method platform (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Systemd-timesyncd (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[TLP (简体中文)]]<br />
| 完成<br />
| Skywet<br />
| 持续更新中 <br />
|-<br />
| [[Tomcat (简体中文)]]<br />
| 完成<br />
| Starwing117<br />
| 持续更新中 <br />
|-<br />
| [[Vim (简体中文)]]<br />
| 完成<br />
| 无<br />
| 无<br />
|-<br />
| [[VirtualBox (简体中文)]]<br />
| 翻译至 2017-10-15<br />
| [[User:5long]]<br />
|<br />
|-<br />
| [[VMware (简体中文)]]<br />
| 完成<br />
| ThomasWFan<br />
| 页面已经与英文版同步,长期维护中<br />
|- <br />
| [[Xfce (简体中文)]]<br />
| 完成 <br />
| 无<br />
| 无<br />
|-<br />
| [[Xmonad (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Xrandr (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Python打包指引 (简体中文)]]<br />
| 翻译中<br />
| SherlockHolo<br />
| 无<br />
|-<br />
| [[Java (简体中文)]]<br />
| 翻译中<br />
| CaCaCarrot<br />
| 无</div>
Liu-shuyuan