- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Bash 中,我们可以使用 Alt+number+. 来选择上一个参数的第 n 个参数命令,然后用 Alt+, 选择之前的命令。它们在历史中循环。
例如:
$ ls 1 2
$ echo 10 20
现在按住 Alt,然后按 0 然后点,它会显示“echo”。在不释放 Alt 的情况下,再次按 .,它将显示“ls”。在同一操作中使用 1 将显示 10 和 1,依此类推。按 Alt 和逗号可显示历史记录中的整个命令行。 Alt 和 . 显示历史命令的最后一个参数。
请注意,所有这些操作只是将参数(或整个命令行)插入到当前光标。它们不会更改当前命令行中已有的内容。
我正在使用 Zsh 和最新的 Oh-My-Zsh 包,但行为似乎有所不同:
Zsh 有 Alt+, 来显示命令的最后一个参数。
Alt+0+. 与 Bash 相同(显示comman),但是Alt+number+. 显示最后 nth 个参数,即 Alt +1+. 在上面案例显示 20 和 2。
Alt+, 不显示历史中的全部命令。
如何在 Zsh 中做同样的事情?谢谢。
最佳答案
我在寻找这个功能时遇到了 this blogpost作者:Christian Neukirchen:
1. You probably know M-. to insert the last argument of the previous line. Sometimes, you want to insert a different argument. There are a few options: Use history expansion, e.g. !:-2 for the third word on the line before (use TAB to expand it if you are not sure), or use M-. with a prefix argument: M-2 M-.
Much nicer however is:
autoload -Uz copy-earlier-word
zle -N copy-earlier-word
bindkey "^[m" copy-earlier-wordThen, M-m will copy the last word of the current line, then the second last word, etc. But with M-. you can go back in lines too! Thus:
% echo a b c
% echo 1 2 3
% echo <M-.><M-.><M-m>
% echo bMan, I wish I knew that earlier!
在本文中,M
指的是 Meta
键,又名 Alt
。所以理论上这应该开箱即用,正如克里斯蒂安所说。所以我去尝试了一下,是的,它确实开箱即用。
负责此行为的 zle 小部件是 insert-last-word
─ 即 ALT
+.
─ 和 digit -argument
─即 ALT
+Number
。
这是相关的 bindkey
输出:
$ bindkey -L | grep '\^\[[.0-9]'
bindkey "^[." insert-last-word
bindkey "^[0" digit-argument
bindkey "^[1" digit-argument
bindkey "^[2" digit-argument
bindkey "^[3" digit-argument
bindkey "^[4" digit-argument
bindkey "^[5" digit-argument
bindkey "^[6" digit-argument
bindkey "^[7" digit-argument
bindkey "^[8" digit-argument
bindkey "^[9" digit-argument
因此请检查这些是否出现并重试。您可以使用显示的 bindkey
命令的输出更新您的原始问题,以帮助缩小问题范围,或者直接在 oh-my-zsh 中打开一个问题。包含详细信息。
关于bash - Zsh 和 Bash 中的 Alt+数字+点和 Alt+逗号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34571398/
添加 null alt=""有什么好处?是为了通过验证还是有更多的理由 以及它应该怎么写? 像这样,没有空间 alt="" 或者这个有一个空格 alt=" " 最佳答案 其他答案已经指出了标准中的要求
抱歉,我忘了说我正在使用 Jeff Atwood 的 wasd 104 键代码键盘,并且“Mac 模式设置为开\我正在从 Windows 远程桌面连接到我的 Mac 计算机: 我正在尝试使用自动热键禁
我正在为所有图像添加 alt 属性以提高 SEO/屏幕阅读器性能。 根据最佳实践,纯美学图像应该有一个空的 alt 属性 alt="",以便屏幕阅读器跳过它们。我在 WordPress 中注意到它确实
基本上, 它的灵感来自 Vim 我想使用一个键(例如 Alt、F1)组合(+I J K L)来映射到箭头键 Autohotkey 中已经完成的工作 Ralt & j::send{Left} Ralt
我正在尝试文档页面中解释的示例代码 http://developers.itextpdf.com/content/itext-7-examples/converting-html-pdf/pdfhtm
我正在使用 goatslacker/alt 开发一个 flux 前端程序.我在触发商店更新操作时遇到问题。监听器未按预期运行。 我现在正在处理的代码非常复杂。我将尝试将我的问题简化为以下代码。我希望它
The MSDN page on DXGI提供有关如何处理不同于桌面分辨率的全屏分辨率的说明。它说在调用 IDXGISwapChain::SetFullscreenState() 之前先调用 IDXG
在 javascript Event 对象中,有一些 bool 值来检查修饰键是否被按下: ctrlKey:CTRL 键。 altKey:ALT 键。 altLeft:ALT 左键。仅适用于 IE。
我在cygwin/Xming下使用xterm。 Alt+B(向后跳一个字)和Alt-F(向前跳一个字)不起作用,而是显示一些变音字符或其他东西。 我在我的主目录中创建了一个文件 .Xresources
通过 Azure Bastion 连接时,我无法让 Windows Server 2019 数据中心识别 Alt Gr 键。该键被误认为是 Alt 键。我的本地操作系统是Windows 10,我的浏览
Windows 中的某些键盘布局(例如 US-QWERTY)将右 Alt 视为常规 Alt 键,而其他(例如 US International)将其视为 AltGr,并在按下时同时生成 Ctrl 和
通过 Azure Bastion 连接时,我无法让 Windows Server 2019 数据中心识别 Alt Gr 键。该键被误认为是 Alt 键。我的本地操作系统是Windows 10,我的浏览
我想使用 2 个快捷键显示 console.log():Alt+a 和 Alt+r 但事实并非如此工作,它没有向我显示任何消息。这就是代码 $(document).bind('keydown
我正在使用以下代码检测 alt。它有效,但是当我执行 alt-tab 切换到另一个程序时,我得到 keydown 18 (alt) 并且没有 keyup,并且 alt 保持按下状态。我该如何解决这个问
我想在 shell 终端中使用 ALT + d 来杀死一个单词。 问题是,如果我使用国家字符,即西里尔字母,在按下 ALT + CyrChar 后,我会在我调整的 xterm 上得到一个 CyrCha
$('input').keyup(function(){ $('div').html($(this).val()); }); http://jsfiddle.net/NMqhW/
我正在使用 DirectX 11 用 C++ 编写一个程序,我希望它能够在用户按下 Ctrl-Alt-Del 或 Alt-Tab 时最小化我的程序。 让窗口本身最小化是比较容易的部分,因为我所要做的就
我最近开始使用 alt.js 重写 Flux & React 应用程序,这使我可以在从服务器渲染时轻松地使用数据引导应用程序。 除了在客户端分派(dispatch)操作时我无法触发我的存储方法之外,其
Windows 下的 Eclipse 有一个非常烦人的问题。当我按下 Right Alt+ key。这让我查看了键绑定(bind)列表并删除了 Ctrl+Alt+key 的所有绑定(bind),我认为
我无法弄清楚两者之间的区别: alts! 和 alt! 在 Clojure 的 core.async . 最佳答案 alts!是 功能 它接受要从中获取的 channel 向量和/或带有要放置在其上的
我是一名优秀的程序员,十分优秀!