1

我使用以下绑定允许我按 Control-Z 来恢复我以前后台运行的程序。我histoptignorespace在前面设置并放置了一个空格,fg因此该命令不会保留在我的历史记录中。

但是,当我按向上箭头时,它仍然出现。有什么方法可以删除它吗?我想按向上箭头忽略fg曾经输入的事实。

# Allow Ctrl-z to toggle between suspend and resume                             
function Resume {                                                               
  zle push-input                                                                   
  BUFFER=" fg"                                                                     
  zle accept-line                                                                  
}                                                                                  
zle -N Resume                                                                                                                                                  
bindkey "^Z" Resume
4

1 回答 1

1

以下对我有用。它真的只是fg直接运行。其余的对于返回提示是必要的。

# Allow Ctrl-z to toggle between suspend and resume
function Resume {
  fg
  zle push-input
  BUFFER=""
  zle accept-line
}
zle -N Resume
bindkey "^Z" Resume
于 2016-03-08T18:09:27.063 回答