我在路径/测试中运行
rm -r *
Run Code Online (Sandbox Code Playgroud)
该教程说,我可以撤消的变化
如果这些花式编辑器命令之一以您不希望的方式更改了您的命令行,您可以使用 ˆ_ 撤消更改,如果您可以将其从键盘中取出,否则可以使用 ˆXˆU。
但是,我没有通过按 Ctrl-x Ctrl-u 或 Ctrl-xu 来取回文件。我也按 Shift-6 Shift-- 或 Shift-6-- 尝试 ^_ 失败。
如何在 Zsh 中撤消删除?
我正在mac osx上做一些rails dev.我有一个别名vim,调用自制的版本
vim: aliased to /usr/local/Cellar/vim/7.3.266/bin/vim
Run Code Online (Sandbox Code Playgroud)
但是如果我执行说git rebase -i [sha]然后它将调用与别名的vim不同的vim.它的召唤/usr/bin/vim不是我想要的.
我该如何解决?
让我说我有这个bash脚本(测试):
#!/usr/bin/env bash
source ~/.zshrc
Run Code Online (Sandbox Code Playgroud)
在我的.zshrc中,我有以下内容:
autoload -U compinit
compinit
Run Code Online (Sandbox Code Playgroud)
当我尝试从终端窗口(zsh)运行'bash test'时,我收到错误,说找不到autoload和compinit命令.如果我只是从命令行执行source~/.zshrc,它可以正常工作.
我正在尝试设置我的开发环境,类似于这个博客,但是当脚本尝试并获取.zshrc文件时,它会失败.
任何见解将不胜感激.
我试图将一些名称相同但大小写不同的文件复制到同一目录中。
请参阅以下步骤:
~/tmp $ echo "First" > test
~/tmp $ echo "Second" > Test
~/tmp $ ls
test
~/tmp $ cat test
Second
Run Code Online (Sandbox Code Playgroud)
这里发生了什么?
我正在尝试设置这个简单的别名:
alias git plog = git log --pretty=format:'%C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)'
Run Code Online (Sandbox Code Playgroud)
在我的 .zshrc 文件中。当我重新加载时,我得到了这个:
no matches found: git log --pretty=format:%C(yellow)%h%Cred%d%Creset
Run Code Online (Sandbox Code Playgroud)
如果我把它放在我的 .gitconfig 中
[alias]
ci = commit
plog = log --pretty=format:'%C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)'
Run Code Online (Sandbox Code Playgroud)
Zsh shell 每次都给我这个:
$git:(embedded_gifs) git plog
zsh: correct 'plog' to 'log' [nyae]? n
Run Code Online (Sandbox Code Playgroud)
任何想法来解决这个问题?
我想将mv/rm别名为'git mv'/'git rm',如果当前路径是一个git工作副本.否则mv/rm只是正常的mv/rm.
可以zsh存档吗?
我有一个具有这种命令的Makefile:
browserify:
rm -rf ./dist
mkdir dist
# Browserify
echo -n "/* ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} */" \
> dist/pica.js
Run Code Online (Sandbox Code Playgroud)
因此,当我这样做时make browserify,应该将注释输出到文件顶部而不是\n.但由于某些原因......输出看起来像这样
-n /* package 0.0.0 */
...more things...
Run Code Online (Sandbox Code Playgroud)
我在osx上使用zsh.
我在 zsh 上创建了一个空目录,并通过执行以下操作添加了一个名为 hello.rb 的文件:
echo 'Hello, world.' >hello.rb
如果我想使用终端在此文件中进行更改,那么在不使用 TextEditor 打开文件本身的情况下,正确的做法是什么?
我希望能够hello.rb使用我的 zsh 终端严格地对文件进行更改,这可能吗?
我偶然遇到了这个,因为它一直在唠叨我:
% setopt
alwaystoend
autocd
autonamedirs
...
sharehistory
shinstdin
zle
%
% setopt | grep zle
# nothing printed
%
% setopt | cat -vet
alwaystoend$
autocd$
autonamedirs$
...
sharehistory$
shinstdin$
# no zle here!
Run Code Online (Sandbox Code Playgroud)
正如你所看到的那样,grep未能检测到zle,并且为了检测任何不规则的字符(不是它会更有意义)setopt来管道输出cat,也没有zle显示!
实际上我正在写我的zshrc链接的这个函数:
function mgit {
string='github'
remote=$(git remote -v)
if [[ ${remote} == *${string}* ]]; then
git config --global user.name "name1"
git config --global user.email "email1@test.com"
else
git config --global user.name "name2"
git config --global user.email "email2@test.de"
fi
git "$@"
}
Run Code Online (Sandbox Code Playgroud)
如果我现在执行这工作得很好mgit --version,而不是git --version.
但有没有办法捕获真正的git命令并执行此功能?
因为现在我不能用我的别名,例如ga用于git add ....
而是它可能然后用像搬运工或别的东西所有的命令?