zsh

vim + oh-my-zsh + git搭建开发环境

[亡魂溺海] 提交于 2019-12-07 13:17:26
vim + oh-my-zsh + git配置开发环境 vim配置 安装vundle 使用vundle作为插件管理器,使用前先安装vundle mkdir -p ~/.vim/bundle git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim 配置 .vimrc 编辑~/.vimrc文件,写入以下内容 set nocompatible set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' " code complete Plugin 'davidhalter/jedi-vim' Plugin 'ervandew/supertab' " syntastic check Plugin 'nvie/vim-flake8' Plugin 'scrooloose/syntastic' " colorscheme Plugin 'altercation/vim-colors-solarized' Plugin 'luochen1990/rainbow' , {'for': 'python'} Plugin 'morhetz/gruvbox' " code format Plugin

How do I get ZSH to display the current directory in the Terminal frame?

守給你的承諾、 提交于 2019-12-07 12:39:26
问题 I'm gradually switching from Bash to ZSH, and trying to learn by replicating features. Can't seem to find this one though. What should I put, and where should I put it? Is this even possible? Thanks. 回答1: Try this: settitle() { printf "\e]0;$@\a" } dir_in_title() { settitle $PWD } chpwd_functions=(dir_in_title) Now, your cd commands will run the dir_in_title function, which will print an escape sequence that asks Terminal.app to update the title. (Oddly enough, using an escape sequence that

Use preexec() to evaluate entered command

*爱你&永不变心* 提交于 2019-12-07 11:14:17
问题 I want to use preexec() to modify certain commands before they are run but I need to be able to evaluate the current entered command. Is there a variable that contains the entire command before it is executed? I know !! is the last command but I need the current line before it's saved to history. An example of what I want to do would probably help ls -l /root bitch And then I want preexec to see I wrote bitch at the end and replace it with sudo ls -l /root I think something like preexec() {

Trapping CHLD signal - ZSH works but ksh/bash/sh don't?

泄露秘密 提交于 2019-12-07 11:13:00
问题 Here's a sample code where a shell script launches a few jobs in the background and upon receiving the CHLD signal (i.e. the child process termination) it will take some actions... The problem is that if the parent shell script is a ZSH one, it works just fine and traps the CHLD signals, but other shells do not ! why is that? #! /bin/zsh - function foo() { echo "Trapped CHLD signal!" } trap 'foo' CHLD ./child-work1.sh & ./child-work2.sh & ./child-work3.sh & echo 'waiting for the children'

一个前端开发者的mac装机清单

送分小仙女□ 提交于 2019-12-07 01:13:50
我是一名前端开发工程师,最近入手了一台MacBook Pro,之前用的是win10,上面倒是跑着一个mac虚拟机。。对于mac的操作基本还是从零开始。趁机捂着脸赶紧捡起博客!!好久好久没写博客了。。真是要不得!! P.S. mac真心棒啊。。屏幕超级喜欢啊。。已经脱离鼠标啦。。可是也真是贵啊。。。-_- 装机必备软件 iTerm2 据说是mac下面最好用的命令行工具。 因为后面很多软件的安装要依赖命令行,所以把这个放前面了。个人使用感觉确实比自带的要方便。不过我主要用的也就是几个快捷键和 cmd + t 创建同窗口下的标签页。毕竟主要工作不是在终端下面,如果有显示器分屏的话应该还好些。我还从 这个 网站下了主题,,后来发现有了 oh-my-zsh 之后就用不上这个主题了。。 更多信息及快捷键请参考: 这个 Homebrew 包管理工具。类似于node下的npm。可以用来安装管理大部分的无界面的工具,如node,git,Python等。 摘自官网的安装命令: /usr/bin/ruby -e " $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install) " Homebrew Cask 相当于homebrew上面的一个扩展,装这个之后,能安装大部分有界面的软件,如QQ

zsh tab completion bug on ubuntu

与世无争的帅哥 提交于 2019-12-07 00:18:07
问题 I'm getting a really annoying bug here: % git s<TAB> becomes % git sgit s send-email -- send collection of patches as emails send-pack -- push objects over git protocol to another repository ... It just duplicates the command. If I resize the screen, it goes back to normal: git s How do I fix this? 回答1: I got it! Darn. It's my prompt instead of: PS1=$'%B%F{$fg[green]%}${PWD/#$HOME/~}%{$reset_color%} git-prompt ${VIMODE} ' I should just do PS1=$'%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color

Share history between panes/windows

醉酒当歌 提交于 2019-12-06 23:25:24
问题 Is there a way to share the shell command history between panes/windows in a tmux session? 回答1: shell history has precious little to do with tmux, it has to do with the shell you are using. So if you chose to use zsh it is enabled iirc by default. With bash you need to add some magic to your .bashrc export PROMPT_COMMAND="history -a; history -n" this appends your last command to history and reloads your history after each command. See this post for more information. 回答2: Add these options to

Why can't I get the cobalt2 zsh theme to work on my iTerm2?

纵然是瞬间 提交于 2019-12-06 20:44:25
I want to install this ZSH theme . I downloaded both the iTerm2 and ZSH themes. The iTerm theme was imported through the preferences. The ZSH theme was inserted into ~/.oh-my-zsh/themes along with all the other ZSH themes. When I open my .zshrc and change ZSH_THEME="bobbyrussell" to ZSH_THEME="cobalt2" nothing happens. I restart iTerm but the colors are not changed. Updated with Details: ~ echo $ZSH_THEME cobalt2 ~ echo $PROMPT %/ ~ File: ~/.zshrc # Path to your oh-my-zsh installation. export ZSH=/Users/username/.oh-my-zsh # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ #

oh-my-zsh plugins not working

亡梦爱人 提交于 2019-12-06 17:39:16
问题 I've just discovered oh-my-zsh, but I can't get it to work. While themes work just perfectly, plugins do not. I have some plugins selected, eg. macports, but neither I get port command completion nor do appropriate aliases work. Here's my .zshrc: # Path to your oh-my-zsh configuration. export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. export ZSH

How to iterate through string one word at a time in zsh

半腔热情 提交于 2019-12-06 16:50:34
问题 How do I modify the following code so that when run in zsh it expands $things and iterates through them one at a time? things="one two" for one_thing in $things; do echo $one_thing done I want the output to be: one two But as written above, it outputs: one two (I'm looking for the behavior that you get when running the above code in bash) 回答1: In order to see the behavior compatible with Bourne shell, you'd need to set the option SH_WORD_SPLIT : setopt shwordsplit # this can be unset by