Tag Info

Hot answers tagged

14

Add this to your ~/.zshrc alias sudo='nocorrect sudo'


13

If the characters on your command line are sometimes displayed at an offset, this is often because zsh has computed the wrong width for the prompt. The symptoms are that the display looks fine as long as you're adding characters or moving character by character but becomes garbled (with some characters appearing further right than they should) when you use ...


11

I am unable to give a detailed report of their differences but I can at least give a broad overview that may help to answer some basic questions and lead you to places where you can learn more. oh-my-zsh: Built-in plugin/theme system Auto updater for core, plugins, and themes Default behavior easily overridden or extended Widely popular (which means an ...


9

Add this to your .zshrc and ..[TAB] will complete to ../ as per bash. zstyle ':completion:*' special-dirs true


9

Thats three questions in one ;-) AUTO_CD Option and howto find it First of all the option you are looking for is AUTO_CD. You can easily find it by looking up man zshoptions. Use your pagers search function, usually you press / and enter the keyword. With n you jump to the next occurrence. This will bring up the following: [..] Changing Directories ...


5

The prompt escape sequence %~ (included in $current_dir) expands to the current directory, taking abbreviations into account. The abbreviations are: ~ for your home directory; ~joe for the home directory of user joe; ~foo for a named directory: the directory aliased to foo with hash -d foo=…; ~[bar] for a dynamic named directory. You can use %/ instead ...


5

Shell's prompt Inside your virtualenv environment is a file, bin/activate. You can edit this file to change your prompt to whatever you want it to look like. Specifically this section of the file: ... else PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" fi ... The variable PS1 is a special variable that controls what a shell's prompt will look like. Changing ...


5

There is a plugin that claims to do exactly what you are looking for, appropriately named per directory history plugin: https://github.com/jimhester/oh-my-zsh/commit/baa187e4b903f39422a84b580e6e617ec3738e09 "Per-directory-history - tracks previous command history both per current directory and globally, with the ability to switch between them on the fly, ...


5

_kadmin is probably a completer function for the kadmin tool - not a directory. If you attempt completion on something that zsh can't find as a command, a directory or a valid and known command argument completion, it then starts to offer completion functions as possible expansion candidates. By default, zsh comes with a lot of completers, many of which you ...


5

You've made grep an alias for grep $GREP_OPTIONS. Don't do that: the GNU grep command itself parses the GREP_OPTIONS environment variable. If you want to put options to a command in a variable, make that variable an array, and don't export it (you can't export arrays anyway, environment variables have string values only). LS_OPTIONS=(--color=auto -q) alias ...


4

The problem is in the order the files are sourced. LS_COLORS must be defined before you run zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}. You can fix this by renaming the files to something like 00theme-and-appearance.zsh and 01completion.zsh.


4

You tagged the question with oh-my-zsh, but did not mention it in the question. I suspect that oh-my-zsh is creating its own ls alias. If this happens after you define your alias, then it will override yours. You should probably uncomment DISABLE_LS_COLORS="true" in your .zshrc, or put your alias after the line that does source $ZSH/oh-my-zsh.sh.


4

To get back into the system you can boot into single user mode by appending the number 1 at the end of the linux kernel line within GRUB. The method for doing this is roughly outlined in this U&L Q&A titled: Can I launch a process as root without launching root's login shell?. Once you've done this you'll be dropped to a prompt as root from ...


4

The wording of your question is ambiguous, so I can't tell if you mean you want to stop using zsh or you want to stop using oh-my-zsh. I will cover both. Disabling zsh Simply run chsh and select whatever shell you were using before. If you don't know what shell you were using before, it is almost certainly bash. This command changes the "login shell" that ...


4

ZSH Config Switching If you want to test different zsh configuration frameworks (oh-my-zsh, zprezto, etc) and switch between them, your best bet is using symbolic links for ~/.zsh, ~/.zshrc, ~/.zlogin, ~/.zlogout, ~/.zprofile, and ~/.zshenv. You may want to create a shell scripts for each framework to create those symlinks for faster switching. Put your ...


4

zsh -x 2>zsh.trace exit grep 'alias.*subl' zsh.trace The -x option causes zsh to print out every command that it executes on stderr. Any command that was executed from reading a file has a prefix with the file name and line. So look for the alias definition in the trace file and you'll know where it was defined.


3

.oh-my-zsh isn't used by anything but oh-my-zsh. If you use bash, you can just remove it. The instructions tell you to run the command uninstall_oh_my_zsh. This is a function that you can invoke from zsh running oh-my-zsh. If you aren't running oh-my-zsh, you can run tools/uninstall.sh, but all it does is: remove ~/.oh-my-zsh, which you were going to do ...


3

This could be a consequence of running some code that clobbers the variable FPATH or fpath. Check the value of either of these variables; it should be a list of directories where zsh loads functions. The variables FPATH and fpath are tied (like PATH and path): changing one affects the other. The uppercase FPATH is a string which contains a colon-separated ...


3

I think that feature that OP is looking for is called dabbrev-expand in Emacs world: Expand the word in the buffer before point as a dynamic abbrev, by searching in the buffer for words starting with that abbreviation (v-expand). xterm also has dabbrev-expand feature but it's a bit less smart than Emacs counterpart but it's very useful to me and ...


3

The . command searches for the file in your $path, it does not by default search in the current directory. That is why it works when you give the absolute path ("$(pwd)"/.zshrc). From the zsh manual about the . command: . file [ arg ... ] Read commands from file and execute them in the current shell environment. If file does not contain a ...


3

The option responsible for this behaviour is `cdable_vars'. It's not enabled by default. See the Manual's chapter about Options for details.


3

For this: /Users/jack/.zshrc:source:34: no such file or directory: /Users/jack/.oh-my-zsh/oh-my-zsh.sh The problem is this line: source $ZSH/oh-my-zsh.sh You don't have a file called oh-my-zsh.sh in /Users/jack/.oh-my-zsh For this: /Users/jack/.zshrc:source:38: no such file or directory: .bashrc The problem is the same as above; essentially, you ...


3

while with ZDOTDIR, you can tell zsh to interpret a file called .zshrc in any directory of your choosing, having it interpret any file of your choosing (not necessarily called .zshrc) proves quite difficult. In sh or ksh emulation, zsh evaluates $ENV; so you could add emulate zsh at the top of your /path/to/file and do: ssh -t host 'zsh -c "ARGV0=sh ...


3

You can use unalias with -m option: unalias -m '*' to delete all defined aliases


3

If you don't want any of oh-my-zsh's aliases, but you want to keep other aliases, you can save the aliases before loading oh-my-zsh save_aliases=$(alias -L) and restore them afterwards. eval $save_aliases; unset save_aliases If you want to remove all aliases at some point, you can use unalias -m '*' (remove all aliases matching *, i.e. all of them). ...


3

I looked through the .zshrc and /etc/zshrc of my systems. From experimenting, to expand /v/L/S/c to /var/log/squid/cache.log, I needed three settings: # These two initialize the completion system, # providing the case-sensitive expansion autoload -U compinit compinit # This sets the case insensitivity zstyle ':completion:*' matcher-list '' ...


3

According to the zsh user guide, aliases should be defined in ~/.zshrc: You may be able to think of some aliases you want to define in your startup files; .zshrc is probably the right place. It also has a tip for keeping your ~/.zshrc clean: I only tend to use aliases in interactive shells, so I define them from .zshrc, but you may want to use ...


2

I think you need to retrieve the existing items and append yours. zstyle -s ':completion:*:hosts' hosts _ssh_config [[ -r ~/.ssh/config ]] && _ssh_config+=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) zstyle ':completion:*:hosts' hosts $_ssh_config


2

As Thor pointed out in his comment, the autocompletion in braces only works, until you put the closing brace. So: touch dir/{some_file,other_f<TAB>(without the closing brace!) autocompletes the filename, so you get touch dir/{some_file,other_file touch dir/{some_file,other_f<TAB>}(with the closing brace!) expands the braces first, so you get ...


2

Ignoring directory patterns is fairly painless. You can add the following to your ~/.zshrc. The first line ignores .mc and .gem patterns after issuing cd [TAB]. The next line ignores them after issuing sudo [TAB]. zstyle ':completion:*:cd:*' ignored-patterns '(*/)#.mc' '(*/)#.gem' zstyle ':completion:*:sudo:*' ignored-patterns '(*/)#.mc' '(*/)#.gem'



Only top voted, non community-wiki answers of a minimum length are eligible