zsh

Simple ZSH function and files with spaces in their name

血红的双手。 提交于 2019-12-14 03:59:00
问题 I have put the following function into my ~/.zshrc file: function note() { vim $HOME/Dropbox/$1.md } When I call it with note "20150209-132501-Recx-new note today.md" for example it creates a new file but with the file name "20150209-132501-Recx-new". I realise this is a simple question but how do I get it to create the note with the full name? 回答1: The shell performs parameter substitution and word-splitting in this order. This means you eventually execute vim /home/username/Dropbox/20150209

How do I convert this zsh function to fish shell?

时间秒杀一切 提交于 2019-12-14 02:30:43
问题 I have this function which works great in zsh, but I want to convert it to fish shell and I can't get it working. function ogf () { echo "Cloning, your editor will open when clone has completed..." source <(TARGET_DIRECTORY=~/students EDITOR=$EDITOR clone_git_file -ts "$1") } 回答1: First of all, since fish's syntax differs from zsh, you also have to change the output of clone_git_file to source it. For example, if clone_git_file is something like: #!/bin/bash echo "FOO=$TARGET_DIRECTORY" echo

如何解决 vscode 中的 terminal 乱码

心不动则不痛 提交于 2019-12-13 17:50:26
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 适用场景 系统安装并使用 oh-my-zsh ; 使用 zsh 主题 「 agnoster 」,并安装了所需的扩展字体「for powerline 」; 问题描述 当使用 control + shift + ~ 或菜单「Terminal > New Terminal」打开 TERMINAL 控制台后,路径提示显示如下乱码: 解决 进入 vscode 设置页,搜索栏输入 terminal font ,修改 Font Family 的值为系统中安装的扩展字体,如下图: 设置后,即时生效。 来源: oschina 链接: https://my.oschina.net/u/2276973/blog/3061006

Adding an alias for Sublime Text to zshrc

别来无恙 提交于 2019-12-13 12:01:37
问题 Just have a quick question on how to add an alias for SublimeText to my ZSH. I've been to their site where they tell you how to do it within bash, but I don't understand how to do it within ZSH. It has been killing me, I just want to open text files from my command prompt. Anyone out there have experience with ZSH where they have created aliases? 回答1: Aliases in zsh are created in the same manner as in bash . alias somealias='something longer' Now somealias will expand to 'something longer'

Backslash disappears in zsh when I echo a raw variable

孤者浪人 提交于 2019-12-13 07:41:44
问题 When I read in raw mode in bash: read -r v now typing 5 characters (quote, backslash, backslash, x, quote): "\\x" and I do a echo $v it displays "\\x" This is what I expect: Because of the -r switch, I get back what I had put in. When I do exactly the same in zsh, echo $v would display "\x" instead. From the manpage zshbuiltins : -r : Raw mode: a `\' at the end of a line does not signify line continuation and backslashes in the line don't quote the following character and are not removed. So

How do I use bundle exec in Aptana Studio 3.0.9 to run the debugger?

▼魔方 西西 提交于 2019-12-13 07:16:23
问题 Aptana seems to start in the sh shell. So I'm trying to switch to zsh , and execute commands to start a rails app. I've changed my debug executable so that it runs a unix executable with the following contents: #!/usr/bin/env ruby exec("zsh | (echo $SHELL && [[ -s '$HOME/.rvm/scripts/rvm' ]] && source '$HOME/.rvm/scripts/rvm' && rvm use 1.8.7@tinderbox && (bundle exec script/server -p3001 &))") So, when I click my debug executable from the debug menu on the toolbar, the debug perspective

Correct usage of ~ parameter expansion flag?

淺唱寂寞╮ 提交于 2019-12-13 04:52:37
问题 According to man zshexpn (5.0.2): ~ Force string arguments to any of the flags below that follow within the parentheses to be treated as patterns. For example, using the s flag to perform field splitting requires a string argument: % print -l ${(s:9:):-"foo893bar923baz"} foo8 3bar 23baz My reading of the ~ flag suggests that I should be able to specify a pattern in place of a literal string to split on, so that the following % print -l ${(~s:<->:):-"foo893bar923baz"} should produce foo bar

Zsh completion inside quotes

不羁岁月 提交于 2019-12-13 04:30:42
问题 Here is my completion function: f() { reply=('ok') } compctl -K f c Then I do c tab c ok Something works. Then I do tab after b c ok "a b" and nothing happens. I expect a b to be replaced with ok (as it does in bash). How could I achieve it? I really need to do completions inside quotes. Typical launch of my program looks like this: c 'a, &b, c[d]' 'a < 1 and b == "2013"' 回答1: This has nothing to do with the use of quotes. zsh doesn't offer ok as a completion in your second case because it

How to let shell_exec act like if commands are running inside mac terminal?

跟風遠走 提交于 2019-12-12 20:00:29
问题 When I am running command inside a php script echo shell_exec("which php"); I am getting the following output: /usr/bin/php However when running the same command inside mac terminal which php i am getting the following output php: aliased to /Applications/MAMP/bin/php/php5.5.10/bin/php my question is how to let shell_exec act like if commands are running inside mac terminal? note: that i have ZSH installed 回答1: Short answer: This will not work (reliably). Long answer: The problem is threefold

Unable to bind HJKL to DLTH in Screen's C-A Esc -mode

五迷三道 提交于 2019-12-12 19:36:14
问题 I want my Zsh to be Dvorak friendly in Screen. I am trying to make the following bindings in Zsh such that I can use them in Ctl-a Esc mode in moving h => d j => l k => t l => n I have not yet found any ways to do that. How can you make the following keybindings in Screen , such that I can use them in the mode C-A Esc? 回答1: Screen has a markkeys configuration option that lets you remap the keys used in scrollback mode. The following code makes Screen Dvorak friendly in .screenrc markkeys h=d