zsh

Zsh Docker Plugin not Working

一曲冷凌霜 提交于 2019-12-12 07:39:32
问题 I have been using oh-my-zsh for a while now and the docker plugin as recently stopped working for me for some reason. I checked my ~/.zshrc file and the plugin is included plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting docker) I checked the ~/.oh-my-zsh/plugins/docker directory and there is a _docker file in there. Yet when I type docker and press Tab, I get none of the autocomplete shortcuts that I used to get. I can confirm that

amended line ending with Vagrant & ZSH

≡放荡痞女 提交于 2019-12-12 04:31:52
问题 I have a vagrant box where I change the default Ubuntu shell to oh-my-zsh . I have a shared folder containing a .zshrc that I copy to the vagrant home folder during provisioning. At some point the line ending for one line in the .zshrc has ^M appended to it so I get the following error when I vagrant ssh : /home/vagrant/.zshrc:source:4: no such file or directory: /home/vagrant/.oh-my-zsh/oh-my-zsh.sh^M The ^M is not visible in the .zshrc file. If I use vim in the vagrant box and re-write the

zsh: command not found: modernizr

ぐ巨炮叔叔 提交于 2019-12-12 03:22:19
问题 I installed modernizr: npm install -g modernizr Everything went well without errors: /Users/myusername/npm/bin/modernizr -> /Users/myusername/npm/lib/node_modules/modernizr/bin/modernizr /Users/myusername/npm/lib After install running: modernizr I get: zsh: command not found: modernizr In my .zshrc file I have: export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" After googling around find this post: Bower: "command not found" after installation and added this line to my .zshrc file:

Redirect / pipe into read command

醉酒当歌 提交于 2019-12-12 02:04:32
问题 This is a follow-up to my previous question on SO. I am still trying to command a script deepScript from within another script shallowScript and process its output before display on terminal. Here is a code sample: deepScript.sh #!/bin/zsh print "Hello - this is deepScript" read "ans?Reading : " print $ans shallowScript.sh #!/bin/zsh function __process { while read input; do echo $input | sed "s/e/E/g" done } print "Hello - this is shallowScript" . ./deepScript.sh |& __process (edited :

Command Prompt Directory Styling

无人久伴 提交于 2019-12-11 20:33:07
问题 I have a particular need for adjusting the command prompt. At the moment i am using Holmans Dotfiles and I want to further customize it in order to create a prompt that's more readable and clear. What I would like is described below using image, plz note that these are photoshopped in order to look as i want them to ;). This is also an issue on github, with inline images! Let's say you have this file structure as in this image: At the moment, when I am in lets say map3 my prompt only shows: I

How to treat 2 Directories as one in the command line

落花浮王杯 提交于 2019-12-11 20:17:41
问题 I have a script, which takes a list of directories and compares their number of files. What I would like is to sometimes group two or more directories to be treated as one by the script. Of course I could modify the script but I would prefer to do this grouping in the command line. $ ./myscript.sh {dir1 dir2} dir3 dir4 ... should be treated as if {dir1 dir2} was the (mathematical) union of the elements of both directories. How to achieve this? 回答1: You can use an array of directories for this

Mac定制终端:iTerm2 + zsh + powerline

孤街浪徒 提交于 2019-12-11 19:06:04
原始界面: 配置后的界面: 安装iTerm2 可以直接去官网下载: https://www.iterm2.com/ 下载后直接安装即可 安装主题 所有主题: https://iterm2colorschemes.com/ 我使用的是吸血鬼主题,具体下载方式,去官网: https://draculatheme.com/ 找到iTerm 点进去以后会教你如何操作 有git的话,就clone项目下来,如果没有用git就下载zip文件。 然后在打开iTerm2 > Preferences > Profiles > Colors选项卡 安装powerline 通常可以使用pip来安装,没有pip的先安装个python pip install --user powerline-status 安装对应的字体 链接: https://github.com/powerline/fonts/blob/master/Meslo%20Slashed/Meslo%20LG%20M%20Regular%20for%20Powerline.ttf 下载字体后,直接安装就行 安装oh my zsh 安装方法有两种,可以使用curl或wget,看自己环境或喜好(当然,curl或者wget都可以通过homebrew来安装,如果没有的话): # curl 安装方式 sh -c "$(curl -fsSL https:/

draw grid with cells of specific size over an image

给你一囗甜甜゛ 提交于 2019-12-11 17:06:19
问题 How can I draw a grid, 1px black borders no fill, over an image? Each section of the grid should be 480x360px. E.g., given this 1440x1080px solid white input: It should have a 3x3 grid drawn onto it (because 9 480x360px rectangles fit into it) to make an output kind of like this: That's not as accurate as I'd like the command to be (I was just drawing rectangles by eye), but I hope it illustrates what I'm after. 回答1: Here is a command that will read an input image, create a 480x360

Portable array indexing in both bash and zsh

♀尐吖头ヾ 提交于 2019-12-11 15:31:12
问题 Array indexing is 0 -based in bash , and 1 -based in zsh (unless option KSH_ARRAYS is set). As an example: To access the first element of an array, is there something nicer than: if [ -n $BASH_VERSION ]; then echo ${array[0]} else echo ${array[1]} fi 回答1: TL;DR: To always get consistent behaviour, use: ${array[@]:offset:length} Explanation For code which works in both bash and zsh , you need to use the offset:length syntax rather than the [subscript] syntax. Even for zsh -only code, you'll

“Pipe stderr, and not stdout” not working in Zsh

风流意气都作罢 提交于 2019-12-11 15:27:18
问题 How to pipe stderr, and not stdout? perfecly captures my problem, and the first answer is exactly how I initially tried to solve it: (echo stdout; echo 1>&2 stderr) 2>&1 >/dev/null | less (The subshell command with echos is a minimal placeholder thanks to user1934428 to demonstrate the issue; my actual problem has a more useful command, but one that everyone else can't run.) However, it doesn't work: It's showing both stdout and stderr together. If I remove the pipe, it works as expected,