zsh

ZSH auto completion for git takes significant amount of time, can I turn it off or optimize it?

对着背影说爱祢 提交于 2019-12-03 03:42:04
问题 Git's tab autocompletion is useful for small projects, but I'm currently working on two big projects that use git and for these it's worse than useless. Whenever I type, say, git add forms<tab> , git takes 20 seconds or more to find the file (in this example, forms.py), and in this timespan I can't do anything else in the terminal. Is there any way to turn off the autocompletion feature, or somehow make it faster? 回答1: It's not git auto completing the file names, it's your shell. Do you have

RGB values of the colors in the Ansi extended colors index (17-255)

一曲冷凌霜 提交于 2019-12-03 03:17:53
问题 My question is in general shell scripting with ansi colors but for reference I am using an Apple Mac OS X 10.9 Mavericks. I use "iTerm" terminal app as my default terminal but also checked with the built in "terminal" app as well. I use ZSH (5.0.7) as my default shell but also checked in BASH (3.2.51). I have been trying to find out if there is a list of the RGB values for the 256 color indexed extended fore/background Ansi escape codes that are available using esc[38;5;xm and esc[48;5;xm

cd -1, -2, -3 etc in Z shell

青春壹個敷衍的年華 提交于 2019-12-03 03:13:49
问题 How do you set up the Z shell such that typing cd - gives you a list of previously visited paths, and cd -1, -2, -3, etc. will then take you to the directories? 回答1: If you have setopt AUTO_PUSHD in your .zshrc then cd will automatically do a pushd of each directory you change to. Taking the example from ZyX: $ setopt AUTO_PUSHD $ mkdir -p 1/2/3/4 $ cd 1 $ cd 2 $ cd 3 $ cd 4 You can see a list of the directories using dirs : $ dirs -v 0 ~/1/2/3/4 1 ~/1/2/3 2 ~/1/2 3 ~/1 4 ~ To be able to tab

Macbook 终极 Shell

一世执手 提交于 2019-12-03 03:09:15
主题设置: vi ~/.zshrc theme="edvardm" ####Cyper的抓屏: 以下是转载部分: ================================ 在开始今天的 MacTalk 之前,先问两个问题吧: 1、相对于其他系统,Mac 的主要优势是什么? 2、你们平时用哪种 Shell? …… 第一个童靴可以坐下了,Mac 的最大优势是 GUI 和命令行的完美结合,不要把所有注意力放在 Mac 性感的腰身和明媚的显示屏上好吧,这不是妹纸!第二个童靴你可以出去面壁了,讲了这么多期 MacTalk 你告诉我还在用 Windows 的 cmd, 你让 Mac 君情何以堪?哪怕你就说在用 Linux 的 Bash 我也就原谅你了,踢飞! 上次在「如何学习一门编程语言」里提到了 Shell,也有读者问到 Shell 的问题,所以这次给大家说说 Shell 的事。 我在「趣谈个人建站」里介绍过一点 Shell,自己的东西借用下不丢人,把扯淡的拿掉,干货留下,就是如下内容: Shell是Linux/Unix的一个外壳,你理解成衣服也行。它负责外界与Linux内核的交互,接收用户或其他应用程序的命令,然后把这些命令转化成内核能理解的语言,传给内核,内核是真正干活的,干完之后再把结果返回用户或应用程序。 Linux/Unix提供了很多种Shell,为毛要这么多Shell

how to get script directory in POSIX sh?

匿名 (未验证) 提交于 2019-12-03 02:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following code in my bash script. Now I wanna use it in POSIX sh. So how to convert it? thanks. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" 回答1: The POSIX-shell ( sh ) counterpart of $BASH_SOURCE is $0 . see bottom for background info Caveat : The crucial difference is that if your script is being sourced (loaded into the current shell with . ) , the snippets below will not work properly. explanation further below Note that I've changed DIR to dir in the snippets below, because it's better not to use all

Remove function definition (unalias equivalent) [duplicate]

情到浓时终转凉″ 提交于 2019-12-03 02:57:22
问题 This question already has an answer here : How do I delete a shell function? (1 answer) Closed 4 years ago . I'm currently building a program which adds to the current user's shell depending on the project he's working on, by defining per-project aliases and functions. These aliases and functions may and will certainly have the same name like for instance cdproj , which would cd to the project's root. I would like to remove previously defined aliases and functions when changing project

Command not found - Oh-My-Zsh

十年热恋 提交于 2019-12-03 02:49:58
I recently installed zsh and oh-my-zsh in my Mac. Now when I try to run a maven command from the terminal, I am getting the following error. $ mvn install zsh: command not found: mvn I have installed Apache maven in /Applications directory. Currently my .zshrc file looks like below. plugins=(git brew pip mvn mysql-macports python sublime tmux osx) # #################### # Maven Config Options # #################### export M2_HOME=/Applications/apache-maven-3.3.3 export PATH=$PATH:M2_HOME/bin As seen above, I appended location of maven installation to the path. But I am still getting errors.

Zsh: command not found: webpack

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm learning React and installed webpack through npm to my project directory but zsh is not finding the command even though I can see webpack installed in my project. I used npm init --yes followed by npm install --save webpack 回答1: Install it globally. npm i - g webpack If you will work with webpack, install webpack-dev-server too npm i - g webpack - dev - server I recommend you first learn a bit about npm and then webpack . You will struggle a lot. And then i recommend not using webpack at all. I found it redundant like bower. I

ZSH: How to time a block of code?

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In bash I am able to write a script that contains something like this: { time { #series of commands echo "something" echo "another command" echo "blah blah blah" } } 2> $LOGFILE In ZSH the equivalent code does not work and I can not figure out how to make it work for me. This code works but I don't exactly know how to get it to wrap multiple commands. { time echo "something" } 2>&1 I know I can create a new script and put the commands in there then time the execution properly, but is there a way to do it either using functions or a similar

Remnant characters when tab completing with ZSH

那年仲夏 提交于 2019-12-03 02:40:25
问题 I'm using oh-my-zsh in Arch linux with the robbyrussell theme loaded. When I try to tab complete I end up with remnant characters appended to the prompt. If I delete the auto-completed characters, the remnant characters do not delete. For example, if I type in: ~ /etc then tab, it turns to ~ /e/etc/ with a list of options below. Even if I delete /etc/ , the /e remains and I'm stuck with: ~ /e I can't delete the /e . I have to execute a command to get rid of the remnant character. Any idea