date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,517,332,876,000 |
I use netcat to do the traffic forwarding during 3 machine(A->B->C) ssh tunneling. The proxy command from host A running on host B is like:
/usr/bin/ssh host_B nc localhost 19999
And there exists a tunnel between host_B:19999 and host_C:22
I would like to know what has been done by netcat. Where is the netcat log fil... |
Netcat doesn't log anything.
Redirecting the output of netcat to a file breaks your setup because that output is supposed to go to the ssh process. With the redirection you set up, the data sent by the remote host ends up in log.txt instead of being sent to the client. If you only want to log errors, use 2>log.txt.
If... | How to check the log of netcat during ssh tunnel |
1,517,332,876,000 |
I use nc as part of a verification script, and check the output of each nc command listed against what the expected output should be.
e.g.,
nc -zvw1 serv1.host.com 443 | gawk '{print $7}'
Expected output: succeeded!
The problem I'm facing is if I want to check a range of ports, while some tests may in fact return suc... |
This could probably work:
seq 443 445 \
| xargs -n1 sh -c 'nc -zvw1 serv1.host.com $0 >/dev/null 2>&1 || (echo error! && exit 255)' 2>/dev/null \
&& echo succeeded!
It basicly emulates port ranges with seq and xargs and utilizes nc's return value to either echo error! and setting exit 255 to abort xargs or echo succe... | Can you force netcat to succeed only if all ports in port range succeed? |
1,517,332,876,000 |
I tried to make server client model as below
on one shell
nc -l -p 8080 this works as a server
and on another
nc 127.0.0.1 8080 and this works as a client
all of this is fine ... the problem that if I closed the client the server closes also .. how can I keep server working after terminating client ??
|
netcat has a -k option that does what the OP wanted a year ago:
From the man pages:
-k Forces nc to stay listening for another connection after its
current connection is completed. It is an error to use this option with‐
out the -l option.
So this should work:
nc -lk -p 8080
| net cat client and server model |
1,517,332,876,000 |
Currently I'm using the standard netcat -e /bin/sh to provide a remote shell for other computers to access.
The problem is however that this shell is rather terrible, since it has limited output. For example if I send some invalid command xxxxx, I will get no response from the machine, but on the machine there will be... |
Creating a "custom application" would be re-implementing telnet / ssh. This is, of course, possible, but not necessary.
If there is sshd (or telnetd) on the host you can start it from your netcat-shell session with e.g. /usr/sbin/sshd -p <port> -D 2>&1 and then do ssh -p <port> root@<host> on your client. You might ne... | Getting more output from NetCat |
1,517,332,876,000 |
I have this nginx custom configuration:
server {
listen 8080;
server_name subdomain.domain.my.id;
location /vless-ws { # Consistent with the path of V2Ray configuration
if ($http_upgrade != "websocket") { # Return 404 error when WebSocket upgrading negotiate failed
return 404;
}
... |
Closest Websocat command line is something like this:
websocat --restrict-uri /vless-ws -bE ws-l:0.0.0.0:8080 --binary-prefix B --text-prefix T ws://127.0.0.1:19002
But there are many imperfections:
Disconnections get detected late
Ping replies get replied by Websocat, not by final endpoint
Message size is limited b... | websocat command argument equivalent for this nginx custom configuration? |
1,398,580,032,000 |
Googling this didn't show up any results. Here's what I mean: I have a binary file named x in my path (not the current folder, but it is in the PATH), and also a folder with the same name in the current working directory. If I type x, I want the binary to execute, but instead it cd's into that folder. How do I fix thi... |
TL; DR
Add this line to your ~/.zshrc:
unsetopt autocd
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. Thi... | How to disable "auto cd" in zsh with oh-my-zsh |
1,398,580,032,000 |
I was trying new dev environments including zsh and oh-my-zsh. Now that I have installed oh-my-zsh, it starts by default on my terminals (iTerm2 and terminal) always start with zsh and with the settings on from oh-my-zsh. I was wondering if it was possible to "disable" or stop using zsh and its setup with oh-my-zsh wi... |
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 ... | How do you "disable" oh-my-zsh (and zsh) without uninstalling it? |
1,398,580,032,000 |
I'm using virtualenv, virtualenvwrapper, zsh, oh-my-zsh, terminator, on Crunchbang.
I'm trying to display the name of the current virtualenv like so
workon example
(example)...
I've tried many solutions none seems to work, here's my .zshrc file, I know it's no big deal to fix it but I can't find the right solution. ... |
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 s... | How to display the name of the current Virtualenv? |
1,398,580,032,000 |
I want to be able to start zsh with a custom rc file similar to the command: bash --rc-file /path/to/file
If this is not possible, then is it possible to start zsh, run source /path/to/file, then stay in the same zsh session?
Note: The command zsh --rcs /path/to/file does not work, at least not for me...
EDIT: In its... |
From the man pages:
STARTUP/SHUTDOWN FILES
Commands are first read from /etc/zshenv; this cannot be overridden. Subsequent be‐
haviour is modified by the RCS and GLOBAL_RCS options; the former affects all startup
files, while the second only affects global startup files (those shown here with ... | Start zsh with a custom zshrc |
1,398,580,032,000 |
I'm using macOS 10.15.2 with iTerm2, zsh 5.7.1 and oh-my-zsh (theme robbyrussell).
I noticed that the prompt print is slightly slow respect to the bash one. For example, if I press enter, cursor initially goes at the beginning of the next line then, after a little while, the shell prompt comes in and the cursor is mo... |
I don't know what oh-my-zsh puts in the prompt by default. Maybe it tries to identify the version control status, that's a very popular prompt component which might be time-consuming.
To see what's going on, turn on command traces with set -x.
→ ~
→ ~ set -x
trace of the commands that are executed to calculate the p... | oh-my-zsh's prompt is slow: how to fix this |
1,398,580,032,000 |
The first two chars were repeated while I use Tab to do completion. In the screenshot below, cd is repeated.
I have tried rxvt-unicdoe, xterm, terminator. All these terminal emulators have this issue.
Zsh version 5.0.2, config file on-my-zsh
|
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 furth... | First characters of the command repeated in the display when completing |
1,398,580,032,000 |
I installed oh-my-zsh to make terminal use a bit easier. One thing that bugs me though is the prolific aliases added by it, like "ga", "gap", "gcmsg", "_", which are harder to remember than the original command, and pollutes the command hash table.
So is there a way to disable aliases altogether? Or a way to clear all... |
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 alia... | Clear or disable aliases in zsh |
1,398,580,032,000 |
I am having a problem I'm not sure how to get around.
Somehwhere on my system, I have an alias defined as such:
alias subl=\''/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'\'
I am not sure what file this is in, and I want to change (or actually remove) it.
I could just unalias it in my .zshrc, but t... |
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.
| how to find file defining an alias |
1,398,580,032,000 |
When I try to login as root, this warning comes up.
luvpreet@DHARI-Inspiron-3542:/$ sudo su
Password:
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
If I say yes, it simply logs in, and my shell changes from bash to zsh.
If I say no, i... |
You can list those insecure folders by:
compaudit
The root cause of "insecure" is these folders are group writable.
There's a one line solution to fix that:
compaudit | xargs chmod g-w
Please see zsh, Cygwin and Insecure Directories and zsh compinit: insecure directories for reference.
| zsh compinit: insecure directories, run compaudit for list |
1,398,580,032,000 |
I use vi-mode in oh-my-zsh with the af-magic theme.
I want the cursor style to indicate whether I am in normal mode (block) or insert mode (beam), both in zsh and in vim.
This is what I have so far:
In my ~/.zshrc:
# vim mode config
# ---------------
# Activate vim mode.
bindkey -v
# Remove mode... |
I think it's better to use precmd() instead of preexec():
# .zshrc
_fix_cursor() {
echo -ne '\e[5 q'
}
precmd_functions+=(_fix_cursor)
This way:
you don't have to change .vimrc
cursor is fixed also when you create a new prompt without executing a command
you don't have to write echo -ne '\e[5 q' twice in your .... | Changing cursor style based on mode in both zsh and vim |
1,398,580,032,000 |
In bash, I can use tab-completion to move one directory up and descend down again another path. For example, suppose I'm in $HOME/folder1, and I want to cd to $HOME/folder2. $HOME only has the two child directories folder1 and folder2.
In bash, I could just type
cd ..[TAB]f[TAB]2
and would end up in $HOME/folder2. I... |
Add this to your .zshrc and ..[TAB] will complete to ../ as per bash.
zstyle ':completion:*' special-dirs true
| Tab completion of "../" in zsh |
1,398,580,032,000 |
Now I'm on the oh-my-zsh, but I'm not sure that it is perfect choice. What is the key difference between grml zsh config (github repo) and oh-my-zsh config? In which case should I prefer grml or oh-my-zsh?
|
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 ext... | What is the key difference between grml zsh config and oh-my-zsh config |
1,398,580,032,000 |
I am happily using zsh since a while now, and I am quite satisfied with my history settings, which are:
# Write to history immediately
setopt inc_append_history
# History shared among terminals
setopt share_history
# Save extended info in history
setopt extended_history
# Ignore duplicates
setopt hist_ignoredups
But ... |
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 abil... | Per-directory history in zsh |
1,398,580,032,000 |
I have zsh and oh-my-zsh with default values and can't figure out how to turn off autocorrection for specific commands, that I often use, such as: sudo mc or sudo gem update. The thing is that I have .mc directory and .gem directory and zsh proposes autocorrections (zsh: correct 'mc' to '.mc' [nyae]).
Generally I woul... |
Add this to your ~/.zshrc
alias sudo='nocorrect sudo'
| How to disable autocorrection for sudo [command] in zsh? |
1,398,580,032,000 |
I'm using Mac, and I'm trying to time the command execution.
If I do
time echo
it doesn't have any output
But If I do
time ls
it does give me the output of time function
Any idea why that happens?
Update: turns out it's cuz I'm using zsh, with oh-my-zsh installed. It works well in bash, but no output in zsh. Any ide... |
In zsh, the time keyword has no effect on builtins (or other similar shell-internal constructs). From this mailing list post:
Additional note: The time builtin applied to any construct that is
executed in the current shell, is silently ignored. So although it's
syntactically OK to put an opening curly or a repe... | `time echo` got no output |
1,398,580,032,000 |
I've installed Oh My Zsh with a few custom plugins, such as zsh-autosuggestions. Now while Oh My Zsh supports automatic updates, this doesn't apply to custom plugins (installed to the custom/ subdirectory). How can I make Oh My Zsh update those as well?
|
Oh My Zsh upgrades are handled by the $ZSH/tools/upgrade.sh script. To update any custom plugins (assuming those are Git clones), you can add these lines to the end of the script before the exit command:
printf "\n${BLUE}%s${RESET}\n" "Updating custom plugins"
cd custom/plugins
for plugin in */; do
if [ -d "$plugin... | How to auto-update custom plugins in Oh My Zsh? |
1,398,580,032,000 |
I set my $HISTFILE env var to something custom, and my zsh is indeed writing to the new histfile.
But when using up-arrow or other history-searching capabilities, it still reads from ~/.zsh_history.
Ie if I open a new shell, and press up-arrow directly, I will get the last line written to ~/.zsh_history :(
I use oh-my... |
Setting HISTFILE in your zsh configuration really should change to where the history is written and from where it is read. It is likely that oh-my-zsh sets HISTFILE=~/.zsh_history before you set it, in which case the history has already been read from ~/.zsh_history.
Looking at the oh-my-zsh code, there are two ways t... | zsh HISTFILE - still read from ~/.zsh_history |
1,398,580,032,000 |
Context
zsh shell,
oh-my-zsh framework,
no special zsh's configuration (same problem with or without zsh-completions): see .zshrc at the end.
Trouble
If a directory contains:
a makefile with targets: hello, hello.o and main.o,
say, 3 files foo, bar and baz,
invoking make + ↹ displays as completion:
bar baz ... |
You can ask zsh to only display targets tag for the make command completion with
zstyle ':completion:*:*:make:*' tag-order 'targets'
Add above code somewhere after the line
autoload -U compinit && compinit
| Prevent completion of files for 'make' command in zsh shell |
1,398,580,032,000 |
How can I configure Bash, Zsh or Tmux to complete the last matching identifier on the screen? Consider this common scenario:
$ git fetch
remote: Counting objects: 16, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 9 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (9/9), done.
From /opt/git/th... |
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 counterp... | Completion of words on the screen as in VIM (Bash or Tmux) |
1,398,580,032,000 |
Not a duplicate:
I'm not looking for a way to complete directory names or execute scripts from a fixed directory. The issue I'm trying to solve is to get completion for the current directory without pressing /
I want zsh to tab-complete . to ./ like bash.
With bash I'm used to press .TABTAB to see all files in th... |
Great challenge!
Try this on the commandline, if it works add it to ~/.zshrc
bindkey '^I' dotcomplete
zle -N dotcomplete
function dotcomplete() {
if [[ $BUFFER =~ ^'\.'$ ]]; then
BUFFER='./'
CURSOR=2
zle list-choices
else
zle expand-or-complete
fi
} ... | zsh tab complete . to ./ |
1,398,580,032,000 |
I am using this configuration on my mac(unix) to customize my shell. I am using zsh instead of bash and there are too many things along with zsh. This .dotfile configuration contains vim, zsh, git, homebrew, nvm, nginx, neovim and there respective themes and configurations. With Oh-my-zsh I can customize so many theme... |
when you're done editing your ~/.zshrc, in a shell prompt run the command source ~/.zshrc.
it will read the config from ~/.zshrc and it will apply it, it's like reload your config.
| How to change theme with zsh |
1,398,580,032,000 |
I am using zsh and oh-my-zsh on Arch Linux. I am not able to make directory using mkdir
edward@ArchLinux ~ $ sudo mkdir -p /samba/raspberry
[sudo] password for edward:
sudo: nocorrect: command not found
I know it has to do something with auto-completion feature of zsh and alias defined but can't figure out.
|
I have this alias alias sudo='sudo 'defined in a file which I sourced at the end of ~/.zshrc file which overwrote alias sudo='nocorrect sudo' which is defined in .oh-my-zsh/lib/correction.zsh
alias sudo='nocorrect sudo' is required by zsh's auto-completion feature to work
More: How to disable autocorrection for sudo [... | sudo: nocorrect: command not found |
1,398,580,032,000 |
I would like to alias my ls command, but there is a previously defined alias for it which I believe gets invoked first before my definition! I am using .zshrc to define my alias, and here is what I did:
alias ls="ls --classify --almost-all --group-directories-first"
And here is the alias command output:
$ alias | grep... |
The alias command overrides a previous alias by the same name. So generally, if you want your aliases to override the ones defined by a zsh framework, put them at the end of your .zshrc. The same goes for other things such as function definitions, variable assignments, key bindings, etc. Generally speaking, the latest... | How to overwrite aliases in my shell (Oh My Zsh)? |
1,398,580,032,000 |
I have recently switched from bash to zsh and now when I type
ls *
It does not simply list all files in this directory, but shows a tree of two levels.
Also
rm -rf somepath/*
fails with the output zsh: no matches found:
This used to work just fine with bash. Can anyone help me to get this behaviour back?
I do have o... |
ls * would have the same effect in bash. No matter what the shell is, what happens is that the shell first expands the wildcards, and then passes the result of the expansion to the command. For example, suppose the current directory contains four entries: two subdirectories dir1 and dir2, and two regular files file1 a... | How to get asterisk '*' in zsh to have same behaviour as bash? |
1,398,580,032,000 |
I've installed zsh and oh-my-zsh on my Mac terminal, then CTRL+U cut everything I input, no matter where the cursor is.
If it's a common case, how can I set the CTRL+U to the original behavior?
|
Execute, or most likely add it in your ~/.zshrc to always have it:
bindkey "^U" backward-kill-line
| Why does CTRL+U clear everything with zsh, not only the text before cursor, as expected |
1,398,580,032,000 |
UPDATE 3 I've worked out that these annoying autocomplete options are actually usernames. I.e. they exist in /etc/passwd I have users such as _kadmin_admin and _kadmin_changepw and many others starting with an underscore. This may be specific to OSX.
Oh-my-zsh is autocompleting with these usernames when it can't find ... |
_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 wit... | Why is zsh (oh-my-zsh) completing directories that don't exist? |
1,398,580,032,000 |
As the title says most of the question, how can we run windows executables without specifying the explicit .exe suffix at the end.
For example reducing the call like explorer.exe . to explorer ., or notepad.exe file to notepad file, or docker.exe ps to docker ps, etc.
I was wondering is there's native way to do so, o... |
Following the idea given by @DavidG. I have made this, hopefully this will make someone's day :)
The following script will create missing directory, symlinks for all the executables in windows if it does not exists:
#!/usr/bin/zsh
mkdir -p $HOME/.windows_binaries
cd $HOME/.windows_binaries
for ext in $( echo ${PATHE... | How to run windows executables from terminal without the explicitly specifying the .exe extension? |
1,398,580,032,000 |
Could someone please give me the name of the default ZSH theme that Kali uses? Also, if you could please provide a link to it.
|
Kali Linux does not use a separate theme file for its zsh customizations. So you cannot download the Kali Linux zsh theme, drop it in themes/, and set ZSH_THEME to its name as you usually can in Oh My Zsh. Instead, the customizations are made to .zshrc directly. You can inspect .zshrc which is included into Kali Linux... | What ZSH theme does Kali use? |
1,398,580,032,000 |
When I try to autocomplete files (with vim as argument 0):
vim ~/.conf <TAB>
It shows:
_arguments:450: _vim_files: function definition file not found
_arguments:450: _vim_files: function definition file not found
_arguments:450: _vim_files: function definition file not found
It was working fine before!
Other command... |
Turns out that removing all ~/.zcompdump files solved it:
rm -r ~/.zcompdump*
| zsh fails at path completition when command is vim |
1,398,580,032,000 |
so I am currently using manjaro linux and I am using urxvt as my terminal which I love so before all this starts switching the terminal is not an option, sorry if I am being rude.
I installed zsh to it as my default shell and added the theme robbyrussell throught oh-my-zsh. At first it was all fine and everything was ... |
First of all, there is a significant difference between the terminals types rxvt and unicode-rxvt (often abbreviated to urxvt). You have indicated that the terminal you are using is "URXVT Version 9.22", so to avoid confusion, please use the correct name which is not rxvt but urxvt.
As Mikel has pointed out, the Xres... | Zsh icons broke in urxvt |
1,398,580,032,000 |
I don't want to see colors in the suggestions of zsh tab-completion. They make the reading harder for me. How can I do that?
Here is my .zshrc:
# _
# _______| |__
# |_ / __| _ \
# / /\__ \ | | |
# /___|___/_| |_|
#
# install oh-my-zsh
[ ! -d ~/.oh-my-zsh ] && git clone https://github.com/robbyrussel... |
With pure zsh:
zstyle ':completion:*' list-colors
Conversely, to use the same colors as the ls command:
eval "$(dircolors)"
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
This should work even with oh-my-zsh, but oh-my-zsh sometimes has its own way of doing things and I haven't tested with oh-my-zsh.
| Remove colors from zsh tab-completion |
1,398,580,032,000 |
This works
Normally, zsh's tab completion works well.
$ touch foo-1-bar foo-2-bar
$ touch f<Tab>
$ touch foo--bar
^ cursor here
Pressing Tab again brings up a menu from which I can select files.
$ touch foo--bar
foo-1-bar foo-2-bar
This doesn't
However, this doesn't seem to work with strings where the b... |
As per the comments, I tried disabling oh-my-zsh, which fixed this problem. I then went through the oh-my-zsh source, selectively disabling modules.
I previously had CASE_SENSITIVE="true", but commenting out this line fixed it for me. Apparently it's a known bug.
To fix it, I could put the following line in ~/.zshrc a... | How can I get zsh's completion working in the middle of the filename? |
1,398,580,032,000 |
I have configured some directories alias via hash -d hashname=/path/to/directory command.
Completion for that aliases works for a long time like this:
% hashn<TAB> # becomes hashname, pressing <ENTER> works like cd /path/to/directory
Some times ago this has stopped to work. Now that aliases are completable only if st... |
You had the options auto_cd and cdable_vars turned on. With auto_cd, if you type a directory as a command name, the cd command is implied. With cdable_vars, if a directory doesn't exist, or a command doesn't exist with auto_cd, then the name is looked up in the directory hash table.
As long as you're using the “new-st... | Zsh: hash directory completion |
1,398,580,032,000 |
I am using zsh with oh-my-zsh. Unfortunately, oh-my-zsh does not use file ~/.ssh/config for hostname auto-completion (see Issue #1009, for instance).
This could easily archived by the following code:
[ -r ~/.ssh/config ] && _ssh_config=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) || _ssh_config=()
zstyle ':compl... |
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
| How to append / extend zshell completions? |
1,398,580,032,000 |
I have the following personalized theme activated with oh-my-zsh (latest version of zsh and oh-my-zsh):
local return_code="%(?..%{$fg[red]%}%? %{$reset_color%})"
local user_host='%{$terminfo[bold]$fg[green]%}%n @ %m%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[cyan]%} %~%{$reset_color%}'
local rvm_ruby='... |
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 nam... | Preventing zsh from using aliases in CWD (prompt) |
1,398,580,032,000 |
zsh has a great feature of autosuggestion (through a plugin) which remembers as one type in the terminal and then helps out during next instance of typing the same command.
I have around 1000 lines of commands stored in a notepad which will be useful for all my projects.
Is there a way that I can manually add all thes... |
Make sure you've configured Zsh to keep enough history entries. On the command line, do
echo $HISTSIZE $SAVEHIST
If the numbers reported are well above 1000, then you're fine. If not, add the following to your .zshrc:
HISTSIZE=20000
SAVEHIST=10000
Find out what the location of your history file is, by doing
ech... | How to manually add the commands to autosuggestion plugin of zsh? |
1,579,159,590,000 |
For example, when I just want to make cfiles without makefile:
$ make a<tab>
a1.c a2.c a3.c ...
but seems that zsh would detect the command then completes nothing when I hit tab.
It works fine on bash that just lists everything.
Is there the ways like bash do?
My OS is macOS mojave with zsh 5.7.1.
|
From the zsh FAQ:
Add this line to your .zshrc
zstyle ':completion:*' completer _complete _ignored _files
This will perform standard bash file completion if zsh completion fails. You may also need to add
autoload -U compinit && compinit
to you .zshrc file after setting the completer configuration.
| Zsh: complete the files in current directory no matter what command is |
1,579,159,590,000 |
I use ZSH with "OH MY ZSH".
In "OH MY ZSH" variable $GREP_OPTIONS exports with multiple value:
$ echo $GREP_OPTIONS
--color=auto --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn
But when I try use grep I am seeing help for grep.
If I set $GREP_OPTIONS with single value is all work good
$ exp... |
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 on... | Export multiple options in $GREP_OPTIONS |
1,579,159,590,000 |
I am not able to properly display autocompleted filenames that contain accented characters like ã in my shell configuration of zsh and oh-my-zsh.
I've created a filename cão.txt to demonstrate this issue. If you're interested, that means dog in Portuguese.
So, when I try to autocomplete like cat c<tab>, this happens... |
This looks like normal default zsh behavior. Whether combining characters are displayed combined during autocompletion is controlled by the combining_chars shell option. To have it complete to cão, put this in your ~/.zshrc file.
setopt combining_chars
I can't reproduce your behavior where this is the default for non... | Tab autocompletion of accented characters with oh-my-zsh doesn't work |
1,579,159,590,000 |
When I call cd /Users/mu3/apps the prompt simplifies it like this:
mu3 [~/apps]:
Is this possible to do the same for custom path like cd /Users/mu3/Development/Web/test:
mu3 [DEV/test]:
I'm using iTerm + oh-my-zsh.
UPD: I wasn't specific enough and also discovered some new information.
Since I use agnoster theme fo... |
The standard way to define directory abbreviations for the prompt is to use named directories. Named directories are used when expanding the %~ prompt escape sequence, generalizing ~ to abbreviate your home directory and ~bob to abbreviate Bob's home directory.
mu3 [~]: cd /Users/mu3/Development/Web/test
mu3 [~/Develo... | Prompt: replace custom path with a short word like ~ for home |
1,579,159,590,000 |
The find command is not working as expected on my OSX with oh-my-zsh. A few examples:
$ find . -name test
find: .: Invalid argument
$ find
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
$ find --version
find: illegal option -- -... |
That is because you are trying to use the GNU find, which is default in Linux, but Mac OS X comes with BSD find which has many differences.
To install GNU find you will need Homebrew, pretty easy to install, just follow http://brew.sh/
After that you can install findutils:
brew install findutils
More info and other t... | Find not working |
1,579,159,590,000 |
I'm on a system running OS X 10.8.5.
I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon performing which ls, I found out that it's already being aliased to ls -G.
This isn't behaviour I ever set up. Is there any wa... |
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 d... | zsh alias being overridden somehow |
1,579,159,590,000 |
I am setting up ZSH with oh-my-zsh, and I want to preserve my .bashrc and .bash_aliases configurations.
From ~/.zshrc I read that:
Aliases can be placed here, though oh-my-zsh users are encouraged to
define aliases within the ZSH_CUSTOM folder.
In the $ZSH_CUSTOM folder I find an example.zsh file that says:
You c... |
Files you create in $ZSH_CUSTOM need to have a file extension of .zsh, according to the documentation:
oh-my-zsh's internals are defined in its lib directory. To change them, just create a file inside the custom directory (its name doesn't matter, as long as it has a .zsh ending)
If you just copied .bashrc and .bash... | Files in $ZSH_CUSTOM not loaded by oh-my-zsh |
1,579,159,590,000 |
I just installed the colored-man-pages zsh plugin.
It works well, but I have an ugly color output on the bottom message:
What is the proper way to personalize the color of the plugins without overwriting everything? It seems the color are set up directly during the plugin activation.
Or maybe it's a bug with my syste... |
The format of man pages (groff) doesn't allow colors explicitly, but utilizes a few text decorations like bold or underlines, which in turn can be re-interpreted by a viewer to show colors. And this is exactly what linked plugin is doing, so I suggest to remove this plugin and instead set the colors directly in .zshrc... | Personalize colored-man-pages zsh plugin colors |
1,579,159,590,000 |
I'd like to define a function that is called, whenever a shell-user types a command that does not exist. In my case I'd like to log the errors and try alternative commands.
currently, when typing e.g. dgfgsdjagfghsdg the error zsh: command not found: dgfgsdjagfghsdg is shown.
Is there a way to define a function, that ... |
Yes.
In the Z shell it is a function named command_not_found_handler.
In the Bourne Again shell it is a function named command_not_found_handle.
Further reading
Intercept "command not found" error in zsh
how to locally redefine 'command_not_found_handle'?
(2x) zsh: command not found
No command 'bla' found, did you ... | How to define a function that handles `command not found`? |
1,579,159,590,000 |
So, I started using zsh and oh-my-zsh recently. I am using the pure (refined) theme and the prompt shows extra info above the prompt.
When I clear the Terminal with Ctrl + L, the whole Terminal gets cleared but the line before the prompt that shows the current directory and git information also get cleared. When I typ... |
Most likely those extra lines are output by precmd, the hook that is run after each command and before the prompt. It is not called automatically upon clear-screen (bound on ^L).
You could redefine clear-screen so it calls it though:
clear-screen() { echoti clear; precmd; zle redisplay; }
zle -N clear-screen
| Keep the whole prompt while clearing zsh terminal with oh-my-zsh |
1,579,159,590,000 |
I trying to install the symfony2 and git plugin for zsh in my docker container.
FROM php:7-fpm
# Install Packages
RUN apt-get update && apt-get install -y vim zsh git
RUN docker-php-ext-install pdo pdo_mysql mysqli zip mbstring
# Instal Oh my Zsh
RUN bash -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-m... |
You append plugins=(git symfony2) to your zshrc, which will then look like this:
source $ZSH/oh-my-zsh.sh
plugins=(git symfony2)
For the plugins to get loaded, you need to define the array before including oh-my-zsh.sh, i.e. swap the lines above. Instead of doing echo and append, you can echo to file(or use ADD), con... | Enable a Plugin for Oh my Zsh in Docker |
1,579,159,590,000 |
I recently switched to zsh from bash, and I'm using oh-my-zsh. There's a completion behaviour I don't want: in any directory, the list of autocompletion candidates seems to include the names of all users' home directories.
I wasn't able to find the right zsh option to disable this behaviour out of the hundreds that ex... |
The option responsible for this behaviour is `cdable_vars'. It's not enabled by default.
See the Manual's chapter about Options for details.
| oh-my-zsh completion on home directory names |
1,579,159,590,000 |
I did the auto-upgrade of oh-my-zsh a few days ago. Now my filtered history (type a few letters and up arrow) no longer works. I did not realize how dependent I became on it.
EDIT:
For example, I used to type a few letters of the command and press up arrow to search my history:
➜ scratch git:(develop) up # press ↑... |
There are two de facto standard escape sequences for cursor keys; different terminals, or even the same terminal in different modes, can send one or the other. For example, xterm sends \eOA for Up in “application cursor mode” and \e[A otherwise. For Down you can encounter both \e[B and \eOB, etc.
One solution is to du... | Broken history search after upgrade of oh-my-zsh |
1,579,159,590,000 |
I am experience some problem in my zsh configuration which is based on oh-my-zsh, which I have described at Physical buffer in terminal is getting misaligned with display in oh-my-zsh configuration.
What I need to know if there is some kind of logging mode in which zsh can produce some information on what is happening... |
You have several options.
First of all, you can setopt xtrace or set -x to get trace info on all calls in the current shell or use zsh -x to start a new shell with that option set. This generates a lot of debug info, though. Plus, it might not even include all the things you are interested in.
If you know more specifi... | Does zsh have some kind of diagnostic mode? |
1,579,159,590,000 |
I tried googling about this but couldn't find any clue: Why does oh-my-zsh pick .zhistory instead of .zsh_history for the value of HISTFILE? Seems like .zsh_history is what more people would expect.
|
Although the ultimate decision comes from the software developer, this seems to be more in line with files zsh uses (from the man page):
$ZDOTDIR/.zshenv
$ZDOTDIR/.zprofile
$ZDOTDIR/.zshrc
$ZDOTDIR/.zlogin
$ZDOTDIR/.zlogout
${TMPPREFIX}* (default is /tmp/zsh*)
/etc/zshenv
/etc/zprofile
/et... | Why does oh-my-zsh pick .zhistory instead of .zsh_history for the value of HISTFILE? |
1,579,159,590,000 |
This is more of a long shot, but here we go:
I use oh-my-zsh with the vcs-plugins git and svn on. I now started on a project where it would be most convenient to use sshfs. The problem that now comes up with that is the following: the git plugin runs git stat after every command, which has a terrible performance in a ... |
A "plugin" in OMZ is just a script. You can't disable part of it without modifying the script.
A workaround would be to use Antigen or Zgen, copy the script to some other location, modify it accordingly, and load it as a separate bundle. Both Antigen and Zgen are designed to support OMZ so you won't have to change any... | Can I conditionally turn certain oh-my-zsh plugins off? |
1,579,159,590,000 |
I've been having an issue with zsh completion that's becoming a rather large annoyance. It's completing options beyond where there is ambiguity. For example, in a directory with these files:
tilertest1x1-00_1408311424.log
tilertest1x1-00_1408311424.root
tilertest2x2-00_1408311501.log
tilertest2x2-00_1408311501.root
t... |
The option that controls a part of this behavior is menu_complete. So, you need:
unsetopt menu_complete
(but it appears that oh-my-zsh already does this). If this isn't sufficient, in case oh-my-zsh does anything special, you may also try:
zstyle ':completion:*' completer _complete
bindkey '\t' expand-or-complete
Yo... | zshell is tab-completing ambiguous options |
1,579,159,590,000 |
My zsh autocompletion is broken in a strange way. For clean logins everything works but after some time I will get seemingly random autocompletion errors, for different "kinds" of autocompletion. Sometimes ls foo<tab> works but rm foo<tab> won't. I am completely lost on how to debug this.
I could not find a pattern to... |
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 s... | ZSH autocompletion gives seemingly random errors after some time |
1,579,159,590,000 |
I use ZSH with Oh My Zsh and I am trying to define a function called git, as such:
function git() { echo "I'm happy because I am executed!" }
I have placed the function definition in $ZSH/custom/general.zsh.
Everything else in this file works (I have a bunch of aliases there) except this function.
Running which git o... |
You probably installed scm_breeze, and my theory is that in your .zshrc the sourcing of scm_breeze.sh is preceeded by oh-my-zsh.sh. And if you put your git function definition at the very end of .zshrc, then you probably exceed the scm_breeze.sh, so that's the reason why it works.
Try to move the line that sources o... | Oh-My-Zsh overriding my function? |
1,579,159,590,000 |
I am using zsh and oh-my-zsh on Ubuntu.
To change into the recent directory in the past there was an alias set to - which is the same as cd -. Somehow the alias disappeared at my machine. This might have happened due to updates I pulled from the oh-my-zsh repository.
Now, I would like to add this alias to my own dotfi... |
The alias was removed in this commit.
To add it back:
alias -- -='cd -'
Most of POSIX shells need -- for this alias work, only dash doesn't:
$ dash
$ alias -='echo 1'
$ -
1
| How to create hyphen alias for zsh? |
1,579,159,590,000 |
Whenever I create a new window in gnu screen I usually give it a name which persists between disconnects, but I notice that with oh-my-zsh distribution of zsh the title gets reset when I run a command in the window. Basically it gets reset to (x* ~) where x is the window number.
Not only that when I run a command in r... |
It can be disabled in .zshrc by uncommenting the line:
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
It is applied in the functions omz_termsupport_precmd and omz_termsupport_preexec, which are in ~/.oh-my-zsh/lib/termsupport.zsh
| How can I stop zsh (oh-my-zsh) from resetting screen window titles? |
1,579,159,590,000 |
This question is basically a duplicate of this: https://askubuntu.com/questions/91740/how-to-move-all-files-in-current-folder-to-subfolder
But instead I'm asking how to do it in the Mac OS X terminal with oh-my-zsh.
My issue with the solutions given is they don't seem to work in my terminal (replacing the folder "new"... |
!(pattern) is a ksh glob operator. shopt is a builtin command of the bash shell to enable one of its options (the ones that are not enabled with set -o). bash's extglob option enables a subset of ksh extended glob operators.
In zsh, negation is with the ^ extendedglob operator as @mdmay74 has already shown and zsh has... | How to move all files in a folder to a sub folder in zsh w/ Mac OS X? |
1,579,159,590,000 |
I had several Aliases defined on my terminal Zsh (Mac OSx), after installing Oh My Zsh I cannot execute my old aliases, and by running the alias I see a list of many new aliases added by Oh My Zsh. Does this mean it overrode my old ones? Is it possible to recover the old aliases?
|
Unless you installed it in a extremely unconventional way, the aliases that were in ~/.zshrc are now in ~/.zshrc.pre-oh-my-zsh. You can copy them from there.
| Lost my Aliases after installing Oh my Zsh |
1,579,159,590,000 |
Say I have written the following command but haven't yet pressed enter to execute it:
$ ls dir1 dir2 dir3
Is there a way to replace given characters without manually changing them in every location they are? For example, I'd like to press some shortcut, enter string to be replaced (say, dir) and then enter another st... |
There's a replace-string autoloadable widget for that. Add to your ~/.zshrc:
autoload replace-string
zle -N replace-string
zle -N replace-string-again
bindkey '\eg' replace-string-again
bindkey '\er' replace-string
Then press Alt+r to invoke. Alt+g to repeat the last substitution. See info zsh replace-string for deta... | Replace string in command to be executed in zsh |
1,579,159,590,000 |
I customized the directory and file colors for ls and cd + TAB. Here is my configuration.
My configuration
My system environment.
Ubuntu 10.10
zsh 4.3.10 (x86_64-unknown-linux-gnu)
oh-my-zsh // http://git://github.com/robbyrussell/oh-my-zsh.git
Terminal
My .zshrc in $HOME.
// .zshrc
echo "Sourcing $0."
ZSH=$HOME/.o... |
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.
| Terminal does not source .zshrc with custom colors for ls and cd command |
1,579,159,590,000 |
When I use bash in ubuntu and I type aa wrong command, it can guess for me, which correct common I could use:
bash:
haochen@ubuntu-dd:~$ aptget
No command 'aptget' found, did you mean:
Command 'apt-get' from package 'apt' (main)
oh-my-zsh:
# haochen @ ubuntu-dd in ~ [9:13:14] C:100
$ aptget
zsh: command not found: a... |
Enable command-not-found plugin from oh-my-zsh
Refer to https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
| oh-my-zsh can't guess correct command |
1,579,159,590,000 |
I have got used to using tab-autocompleting inside braces without expanding in zsh. This was possible, while I used zsh with a basic grml-config. Since I migrated to oh-my-zsh, I can't reproduce this behaviour.
Example:
$ touch dir/{some_file,other_f<TAB>}
The behaviour I want:
$ touch dir/{some_file,other_file}
The... |
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... | Change completion behaviour with brace expansion in zsh |
1,579,159,590,000 |
I have zsh set up with Oh-My-Zsh.
The z plugin allows me to jump to recently used directories.
When I type z name<TAB>, it autocompletes name from the list of recently visited dirs by matching name against the list.
Sometimes the result contains only a single entry, when I know there should be multiple. I have debugg... |
Add this to your .zshrc file, after sourcing Oh-My-Zsh:
bindkey '\t' menu-complete
Now Tab will behave exactly the same as ShiftTab, but in the opposite direction.
Alternatively, for more control over how completion behaves, install my Zsh Autocomplete plugin.
| How to make `zsh` immediately show all completions, without first inserting the common prefix? |
1,579,159,590,000 |
In my screenshot, the section headers ("recent branches", "local head", etc.) are visually indistinguishable from the completion suggestions.
compinstall doesn't seem to be able to change the styling.
How can I, for example, set the section headers in bold or invert fg/bg colors?
|
See info zsh format (you may need to install a zsh-doc package or equivalent).
You can set the format zstyle for completions:
zstyle ':completion:*' format '%K{blue}%F{yellow}Completing %d:%k%f'
Would show the completion headers as something like Completing recent branches: in yellow over a blue background.
You'll fi... | How can I style the zsh completion section headers? |
1,453,653,909,000 |
In bash, I can put set -P in my .bashrc, and to use absolute paths. That is, if I change to a directory through a symbolic link, and then use cd .., it takes me to that directory's canonical parent, not the directory containing the symbolic link.
How can I configure zsh to always use absolute paths?
|
From zshoptions(1)
CHASE_LINKS (-w)
Resolve symbolic links to their true values when changing direc-
tory. This also has the effect of CHASE_DOTS, i.e. a `..' path
segment will be treated as referring to the physical parent,
even if the preceding path segment is a symb... | How can I set zsh to use physical paths? |
1,453,653,909,000 |
One point in time, I tried oh my zsh but it causes a lot of issues so I'm back at bash. I'm trying to clean up some files and notice there is a oh my zsh folder. The github instructions tell me to run uninstall oh my zsh but I don't see that script in my folder.
Is it safe to remove .oh-my-zsh folder?
|
.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 ~/.... | Is it safe to remove the .oh-my-zsh directory? |
1,453,653,909,000 |
My Oh-my-zsh does the following:
When I run the git log --pretty --oneline command, it shows me a long list of commits, as expected.
As soon as I hit q, it suddenly disappears with the below output:
$ git log --pretty --oneline
FAIL: 141
Why is this happening, and how do I fix it?
|
The number after “FAIL” is the process's exit status. A process's exit status, as reported by the shell, is generally¹:
0 if the program exited normally and reported a success.
1 to 125 if the program exited normally and reported an error.
128+s if the program was killed by signal s, where s is a small integer.
141 ... | Oh-my-zsh deletes output of successful command with "FAIL: 141" |
1,453,653,909,000 |
I was wondering whether it is possible to open python files in vim, without typing "vim" in front of it. For example:
Instead of:
vim filename.py
simply
$ filename.py
Would open the file in vim.
I believe it is not upto .vimrc but .bashrc or .zshrc (in my case), which would interpret the .py files to be executable w... |
To my personal surprise, yes, there's a way in zsh. This question led me to this answer talking about "suffix aliases" in zsh. Not that yours is a duplicate -- The first question was about a bash way to do it; the other answer was just about "favorite zsh features".
To do it with a suffix alias:
alias -s py=vim
Add... | Opening py files in vim by default without having to type "vim filename.py" |
1,453,653,909,000 |
If I have the string and copy that with CTRL+SHIFT+C
https://test.invalid/?foo=bar()&baz=$quz{}
And I paste that into the terminal I see the following,
https://test.invalid/\?foo\=bar\(\)\&baz\=$quz\{\}
However, I don't want the ?, (, ), {, }, and = escaped, as I'm using the paste string to fill out curl,
curl "CT... |
The problem isn't kitty. If you run /bin/sh and paste you can test that. The problem, in my case, was actually zsh. And specifically oh-my-zsh which has this in the ~/.zshrc conf,
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
Uncommenting that fixed my prob... | How can I disable kitty's paste from escaping? |
1,453,653,909,000 |
Recently installed zsh and oh my zsh but when i open a terminal nothing changes, the bar keeps looking as always but it changes only when i log as root doing sudo su, I have tried almost everyting but nothing changed.
I am using alacritty.
Thanks for your help.
|
Most likely you installed it for root, not your own user.
Read Documentation: Installing OH-MY-ZSH.
Troubleshooting steps:
1. Are your user (not root) using ZSH really? In your user:
% echo $SHELL
/usr/bin/zsh
If not, chsh -s $(which zsh) NO SUDO!
2. Install Oh-My-Zsh without SUDO
sh -c "$(curl -fsSL https://raw.gith... | Oh my zsh is only working when i log in as root |
1,453,653,909,000 |
I am setting up a zsh shell environment and I wanted to try writing a simple function for my own learning purposes:
# ~/.zsh-extensions/conda_which
# get version in conda env
function conda_which {
# this comes from Flament's answer below
readonly env=${1:?"The environment must be specified."}
readonly pk... |
Grep doesn't have color by default. Instead, the colors can be enabled by the user. Many modern Linux systems ship with grep aliased to grep --color. For example, on my Arch:
$ type grep
grep is aliased to `grep --color'
Now, GNU grep is clever enough to detect when its output is being piped and will disable color un... | How to retain color output with custom zsh function? |
1,453,653,909,000 |
everyone!
In my iterm2 (with zsh, oh-my.zsh and powerline2) terminal if I go to certain directories I have a prompt like this:
$ pokemon/electric/pichu/pikachu/raichu
I'd like to have a shorter, but still complete, path representation like this:
$ P/E/P/P/raichu
I have seen this kind of configuration but I haven't b... |
We need to edit the .p10k.zsh file
(in my case, I am using powerlevel10k on zsh/oh-my-zsh/iTerm)
nano .p10k.zsh
(or use any other editor of your choice).
We search for the line typeset -g POWERLEVEL9K_SHORTEN_STRATEGY
and add the value as follows:
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_from_right
We sea... | How to get a shorter Path prompt in powerline10k / zsh? |
1,453,653,909,000 |
Oh-my-zsh has the take command which creates a directory and enters into it in one step. Is there an equivalent command for the fish shell?
I do know that I can do it with mkdir newDir && cd newDir, but I like the shorter, more convenient version that Oh-my-zsh provides.
|
Not built-in, but very easy to reproduce:
function take
mkdir -p "$argv[1]"; and cd "$argv[1]"
end
funcsave take
This will create a lazy-load function in $HOME/.config/fish/functions/take.fish. By "lazy-load", we mean that the function isn't loaded when Fish starts, but only the first time you run the take comm... | Oh-my-zsh "take" command - Is there an equivalent in Fish? |
1,453,653,909,000 |
I'm trying to add auto-completion for some custom ant parameters. However, it seems to be overwriting the existing oh my zsh ant plugin auto-completions which I'd like to keep. Is there a simple way to have both the oh my zsh plugin and my custom ant auto-completion live in harmony?
Here's the existing plugin at ~/.oh... |
I think the best way to do it is to extend completion function. Here is how you can do it:
https://unix.stackexchange.com/a/450133
First you would need to find the name of your existing function, to do it, you can bind _complete_help to CTRL-h (or any other shortcut), then type your command and look for completion fun... | How to extend existing zsh completion functions? |
1,453,653,909,000 |
I recently switched to oh-my-zsh and I can't get used to the way the arrow up key works. When I enter ssh for example and press up, it only shows me commands starting with ssh while I'd prefer it to show me previous command instead. How could I make it behave the way Bash does, which is what I am already accustomed to... |
Non-solution
Ironically, the answer in the question that people are proposing as a duplicate … bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward … is exactly the wrong answer. It ensures that your terminal's control sequences for the arrow editing keys are mapped by ZLE ... | How to make oh-my-zsh history behavior similar to Bash's? |
1,453,653,909,000 |
In bash, when I type screen -x and press tab twice, I get a list of all the running sessions.
In zsh, when I type screen -ls and press tab twice, I get a list of all the running sessions and can tab through them, eventually select one when pressing enter, but this then executes screen -ls session-name when pressing en... |
The code is in _screen (completion is provided natively by zsh, it's not an additional plugin). Zsh completes all sessions for -ls but only attached sessions for -x.
-x is intended to “Attach to a not detached screen session” (per the manual). But it also works if the session is detached. So both behaviors make sense.... | zsh gnu-screen tab completion for `-x` flag similar to `-ls` |
1,453,653,909,000 |
I'm trying to create an alias on ZSH.
The aim of the alias is to activate a python virtualenv.
I've put a line in my .zshrc
alias SOU="source /home/andykw/.zshrc && source $(setopt extendedglob && ls -d .^git/)/bin/activate"
Often I need to change virtual environment with activating a virtual environment in one of t... |
If all you want is an alias that finds the single ./.*/bin/activate file in the current directory tree and sources it, then all you need is:
alias SOU='source. */bin/activate'
If the glob .*/bin/activate matches multiple files, only the first one will be sourced. Your ~/.zshrc file should be sourced every time you op... | create an alias on ZSH but need to type it twice |
1,453,653,909,000 |
I'm trying zsh on Ubuntu 20.04 from Putty. One good feature I like is that zsh automatically show the running command on window title, which is good for forgetful me who forget what is running.
Nonetheless, I would like to append username and hostname to the running command.
As the screenshot shows, what I'm running ... |
One good feature I like is that zsh automatically show the running command on window title
That's actually Oh-My-Zsh that does that, not Zsh itself.
To get the behavior you want:
From the Oh-My-Zsh file lib/termsupport.zsh, copy the function omz_termsupport_preexec to your .zshrc file
Change the last line (title '$... | How to keep hostname on title when I run commands |
1,453,653,909,000 |
I am having oh-my-zsh installed but the prompt is not showing the proper arrow which I Was expecting . I setup the arch linux from very scratch but I think I am missing those fonts. I am not sure which one is it . Can someone help me how to get this
What I am getting currently is this -
|
The issue of not showing the expected icon is because
You do not have the required fonts ( in this case the '->')
install powerline fonts with your package manager. (debian)
PS: After installation it is required to reset the font cache so that
it can then be reflected in your system.
sudo apt-get install powerline
sud... | zsh prompt isn't showing the arrow key due to font issues |
1,453,653,909,000 |
While working on a project, I often have to run these commands sequentially git add --all; git commit -m "some commit message"; git push to push the recent work to the remote repository.
I thought it would be better to write a function, that encapsulates these three commands and put that in my .zshrc file, so it is av... |
function-name() command
is one of several function definition syntaxes supported by zsh, the one from the Bourne shell from the early 80s, so that part of your code is fine.
If you get a parse error near `()' error on that, it's likely because from the start the parser is not expecting a function definition.
For inst... | correct way of writing functions in zsh |
1,453,653,909,000 |
I'm using git aliases from zsh plugins: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git
So it has git aliases like:
gst # git status
ga # git add
gc "commit" # git commit -v "commit"
...
...and I'm also using git bare repo to backup all my dotfiles: https://github.com/Anthonyive/dotfiles/blob/0706bc81daa3a... |
The associative array aliases contains all alias definitions.
for name in "${(@k)aliases}"; do
if [[ $name == g* && $aliases[$name] == 'git '* ]]; then
alias d${name#g}="dotfiles ${aliases[$name]#git }"
fi
done
Alternatively, you could change the d alias to a function that expects a following git command, but... | Create new set of aliases based on current set of aliases (eg. gst -> dst)? |
1,453,653,909,000 |
When I switch from powerlevel9k to powerlevel10k, some extra space appears at the end of each line.
How can I remove this space?
|
According to this GitHub issue:
This difference is due to a bug Powerlevel9k that is too severe to
emulate in Powerlevel10k.
If you want your right prompt to be at the edge of the screen without
indentation, add ZLE_RPROMPT_INDENT=0 to your ~/.zshrc and restart
zsh. The default value of this parameter is 1, hen... | Upgrading to Powerlevel10k - Extra space at the end of line |
1,453,653,909,000 |
Is it possible to achieve the following
➜ ag editNote
src/store/actions.js
8:const editNote = ({ commit }, e) => {
26: editNote,
src/components/Editor.vue
5: @input="editNote"
22: 'editNote',
/frontend on master [✘!?]
➜ vi Ed
For example I would like to start typing vi Edit and... |
The shell, whether bash or zsh, does not have access to the terminal scroll back buffer. While ag was running, output from it goes direct to the terminal and can't be intercepted by the shell.
Depending on what your terminal is, it may be possible to capture the contents of the scroll-back buffer. rxvt-unicode can be ... | ZSH - Autosuggest for the values output in the terminal window? |
1,453,653,909,000 |
I'm a long-time bash user just getting used to running zsh, oh-my-zsh, and powerline. I like the setup very much, but have one frustration I can't figure out how to solve.
I occasionally need to copy & paste terminal sessions into emails, text documents, etc. With the default powerline setup, the special characters ca... |
You should be able to source the ascii theme, then unset or clear the RPROMPT variable. So something like
source ~/.oh-my-zsh/themes/my-plain-ascii.zsh-theme
unset RPROMPT
<your work for copying and pasting>
source <powerline-install-directory>/bindings/zsh/powerline.zsh
Of course, you could always just add the unset... | Interactively switching zsh themes while running powerline |
1,453,653,909,000 |
I'm on freebsd (TrueOS, to be exact) and want to change my ZSH theme. ZSH was installed as binary package. I cloned the commonly known oh-my-zsh git repo, to gain themes, but want to stay with grml zsh config, which I downloaded from grml.org and placed into /usr/local/etc/zsh.
I'm sourcing /usr/local/etc/zsh/zshrc fr... |
Depending on the theme this can be rather tedious. Since they can depend on OMZ.
But luckily the theme you mentioned doesn't seem to be depending on any other code.
Just download the the theme from the Github page, save it under .zsh/themes, and add
source ~/.zsh/themes/agnoster.zsh-theme
to your .zshrc and it shoul... | apply zsh themes manually |
1,453,653,909,000 |
What exactly is the difference, operationally, between plugins and themes in oh-my-zsh? I.e. how would things break (if at all) if a plugin were instead put among the themes, or a theme among the plugins? Or is the distinction purely organizational?
|
Both the theme and the plugins are sourced in oh-my-zsh/oh-my-zsh.sh, so technically there should be no difference.
But a theme should only be used to change the appearance and a plugin is there to add new functionality.
With appearance I mean setting the values of $PS1, $PS2, $RPS1 and etc.
There are some plugins wh... | difference between omz "plugins" and "themes"? |
1,453,653,909,000 |
I'm using ohmyzsh. I'm trying to load a diff themes base on the current directory path (pwd)
Logics
If pwd in or contain sustring /Sites/work/ load af-magic, else load robbyrussell.
.zshrc
I've tried
STR=$(pwd)
SUB='/Users/john/Sites/work'
if [[ "$STR" =~ .*"$SUB".* ]]; then
echo "It's there."
ZSH_THEME="af-magic... |
If you look at the oh-my-zsh code, that ZSH_THEME variable is used by the oh-my-zsh initialisation code to source a per-theme file.
So if you want the theme to change whenever the current working directory lands in some directory, you need:
to change that variable whenever the current directory changes
reproduce tha... | Load specific ZSH_THEME base on specific directory contain specific string |
1,453,653,909,000 |
Consider the following screenshot
I'm using oh-my-zsh for shell customization. But due to the longer paths , I am unable to write longer linux commands. I want to change the prompt that only showing me the current directly keeping everything to the same.
Theme
ZSH_THEME="powerlevel9k/powerlevel9k"
Please help !
|
Powerlevel9k has been discontinued, see the note at the top of https://github.com/powerlevel9k/powerlevel9k. It's highly recommended to upgrade to Powerlevel10k.
Here's how to upgrade:
Add powerlevel10k to the list of Oh My Zsh themes.
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/them... | Customize Shell Prompt Oh-my-zsh |
1,453,653,909,000 |
I am using oh-my-zsh and in oh-my-zsh there is a plugin called colord-manpages in the listing -
┌─[shirish@debian] - [~/.oh-my-zsh/plugins] - [10199]
└─[$] ll | grep colored
drwxr-xr-x 2 shirish shirish 4096 2015-12-30 14:27 colored-man-pages
This is the output of .zshrc -
─[$] grep -Ev '#' .zshrc
export ZSH=/home/... |
Just add the plugin to the plugins definition in .zshrc:
plugins=(last-working-dir colored-man-pages)
Then start a new shell and you'll see the plugin activated.
| How do I add colored-manpages plugin to my zsh profile (using oh-my-zsh)? |
1,453,653,909,000 |
#Get client IP base on current logged in user
if [ $USER == 'root' ]
then
ip="$(last | awk 'NR==1 {print $3}')"
else
ip="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
fi
/root/.bashrc:157: = not found
Line 157
Note
I appended this line source ~/.bashrc to my .zshrc to
vi .zshrc
source ~/.bashrc # import all... |
In zsh, =cmd is a filename expansion operator that expands to the path of the cmd command. =cmd is similar to $commands[cmd].
So here, with == in one of the arguments of the [ command, that expands it to the path of the = command. As there's no command called = in your $PATH, that causes an error.
Compare:
$ echo =ls
... | /root/.bashrc:157: = not found |
1,453,653,909,000 |
When i installed zsh and add oh-my-zsh i cant execute command like ifconfig and services.
To install zsh i execute this commands:
$ sudo apt-get install zsh
$ wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
$ chsh -s `which zsh`
My .zshrc look like this:
# If you come from bash y... |
Solution for this problem:
Change this in your zsh config file ~/.zshrc
export PATH=$HOME/bin:/usr/local/bin:$PATH
to this:
export PATH=$HOME/bin:/usr/local/bin:/sbin:/usr/sbin:$PATH
Save and reboot for sure.
| zsh: command not found: services |
1,453,653,909,000 |
I use ZSH with Oh My Zsh. I would like each new ZSH shell to start with an empty history. Commands typed in one shell should never show up in the history of another shell. How can I achieve this?
I've tried appending the following to my ~/.zshrc to no avail:
setopt no_share_history
unsetopt share_history
unsetopt inc_... |
The zsh history is only saved if you set both the HISTFILE variable (to the path of the history file) and SAVEHIST variable (to the amount of entries to store there).
So it should only be a matter of removing those variable definitions from wherever they're being set (probably your ~/.zshrc or any file included from t... | How can I configure ZSH to start each shell with an isolated, empty history? |
1,453,653,909,000 |
So today I wanted to add some extra alias to zsh.
I did the usual
nano ~/.zshrc
and added my alias
ex:
alias desktop="cd desktop"
(I've doubled checked that all variables for typos)
Ctrl+O to save and Ctrl+X to exit.
After getting out I run:
source ~/.zshrc
And get the following error:
/Users/fridavbg/.zshrc:116:... |
Your error message is not unmatched, it is unmatched ", as in there is an unmatched quote character, ".
The part /Users/fridavbg/.zshrc:116 exlains that this error was detected in file /Users/fridavbg/.zshrc on line 116.
So you should look at that file around the indicated line for unmatched quotes. Note that sometime... | zsh: When running source I get zshrc:116: unmatched |
1,486,900,441,000 |
Yank doesn't clear the killring, so it gets cluttered after a while. Can I clear it?
I'm using Oh My Zsh.
|
The size of the kill ring is determined by the length of the killring array. This is 8 by default.
The variable is only available in zle widgets, so you can't manipulate it on the command line, you have to define a widget and invoke it either through a key binding or through M-x. Here's an example of a widget that bla... | can I clear current killring in zsh? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.