with which command do i activate and make it default at startup?:
chsh -s $(which zsh)
or
chsh -s /bin/zsh
would using zsh give me troubles once i need to use TTY,or is it disabled over there?
with which command do i activate and make it default at startup?:
chsh -s $(which zsh)
or
chsh -s /bin/zsh
would using zsh give me troubles once i need to use TTY,or is it disabled over there?
run chsh -l
and pick in list
why a problem with tty ? zsh is good (sometime we can have a problem with prompt font but is for zsh as bash)
i have
/bin/zsh
/usr/bin/zsh
but i saw the 2 commands i mentionned suggested for activating it,
so i wanted to know which one should i use in manjaro if that even matters.
i think i recall seeing TTY/zsh issues while learning about zsh.(i might got confused)
can use /bin
but /bin
and /usr/bin/
for manjaro is the same
ls -l /bin
lrwxrwxrwx 1 root root 7 31 mai 02:39 /bin -> usr/bin
no problems with zsh ! tty, terminal or ssh (zsh is the default shell for manjaro gnome and archlinux)
if you have any doubt, it is easy to run zsh
in tty for test
Activating zsh will activate it in all tty-sessions. But this is no problem. I do use zsh on all of my manjaro systems as default shell (even for root). And there are very good helpers for zsh. For example oh my zsh
i found an answer to my first question:
" chsh
→ change shell
-s
→ specify which shell
$(which zsh)
→ run command which zsh
and return it as operand to chsh -i
some distributions store binarys (like your shell) in different locations. so there is no one-fits-all tutorial for chsh. to make sure you give a valid path to chsh, you can search for zsh. this are 2 steps, combined in one command. 1. search for zsh (“which zsh is provided by system to me”) 2. set it as your shell. the given command is failsafe and works on every linux (and unix) whith chsh and zsh installed, no matter in which directory/path it is installed."
i successfully switched to it;
do i need to do something in order to add;
zsh autosuggestions/completions/syntax-highlighting/powerlevel10k theme/manjaro-zsh-config ?
i don’t see auto-suggestions for example.
they are already installed.
Add the plugins you installed to your .zshrc like so:
plugins=(git zsh-autosuggestions zsh-syntax-highlighting sudo)
I assume you are using oh-my-zsh though.
i didn’t install them;they are installed by default
# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
source /usr/share/zsh/manjaro-zsh-config
fi
# Use manjaro zsh prompt
if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
source /usr/share/zsh/manjaro-zsh-prompt
fi
so in the next line i should add what you said?i thought manjaro-zsh-config would take care of that.
i don’t use oh-my-zsh.
Follow the installation guide (manual), here is the one for zsh-autosuggestions:
it’s already installed by Manjaro and i don’t want to use oh-my-zsh.
how do i activate it,make it work?
I think you’ll have to add this line to your .zshrc file:
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
Save and exit and source your .zshrc:
source ~/.zshrc
thanks for the suggestions,
I’ll wait and see if a Manjaro member can answer with a definitive answer.
I have the package zsh-autosuggestions
installed and this in my .zshrc.
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
More information:
i see i could add those lines to .zhsrc:
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
but if you look in /usr/share/zsh/manjaro-zsh-config file,
it seems it’s all already there,just needs to be somehow activated.
that’s what i understand.
/usr/share/zsh/manjaro-zsh-config
is not the config file ~/.zshrc
What’s the output of these commands?
ls -l ~/.zshrc
cat ~/.zshrc
-rw-r--r-- 1 username username 256 Sep 19 2020 /home/username/.zshrc
# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
source /usr/share/zsh/manjaro-zsh-config
fi
# Use manjaro zsh prompt
if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
source /usr/share/zsh/manjaro-zsh-prompt
fi
Then, I think, it should be working.
Just checked /usr/shar/zhs/manjaro-zsh-config
on my system and it doesn’t seem to contain:
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
in mine neither, but i do have
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
so maybe i should add it to that file?
i wonder if it’ll stick after the next update.
here’s how my file looks;
## Options section
setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing. Allows using regular expressions with *
setopt nocaseglob # Case insensitive globbing
setopt rcexpandparam # Array expension with parameters
setopt nocheckjobs # Don't warn about running processes when exiting
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nobeep # No beep
setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups # If a new command is a duplicate, remove the older one
setopt autocd # if only directory path is entered, cd there.
setopt inc_append_history # save commands are added to the history immediately, otherwise only when shell exits.
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
zstyle ':completion:*' rehash true # automatically find new executables in path
# Speed up completions
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
#export EDITOR=/usr/bin/nano
#export VISUAL=/usr/bin/nano
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word
## Keybindings section
bindkey -e
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[H' beginning-of-line # Home key
if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
fi
bindkey '^[[8~' end-of-line # End key
bindkey '^[[F' end-of-line # End key
if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
fi
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[C' forward-char # Right key
bindkey '^[[D' backward-char # Left key
bindkey '^[[5~' history-beginning-search-backward # Page up key
bindkey '^[[6~' history-beginning-search-forward # Page down key
# Navigate words with ctrl+arrow keys
bindkey '^[Oc' forward-word #
bindkey '^[Od' backward-word #
bindkey '^[[1;5D' backward-word #
bindkey '^[[1;5C' forward-word #
bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace
bindkey '^[[Z' undo # Shift+tab undo last action
## Alias section
alias cp="cp -i" # Confirm before overwriting something
alias df='df -h' # Human-readable sizes
alias free='free -m' # Show sizes in MB
alias gitu='git add . && git commit && git push'
# Theming section
autoload -U compinit colors zcalc
compinit -d
colors
# Color man pages
export LESS_TERMCAP_mb=$'\E[01;32m'
export LESS_TERMCAP_md=$'\E[01;32m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;47;34m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;36m'
export LESS=-R
## Plugins section: Enable fish style features
# Use syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Use history substring search
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
# bind UP and DOWN arrow keys to history substring search
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# Offer to install missing package if command is not found
if [[ -r /usr/share/zsh/functions/command-not-found.zsh ]]; then
source /usr/share/zsh/functions/command-not-found.zsh
export PKGFILE_PROMPT_INSTALL_MISSING=1
fi
# Set terminal window and tab/icon title
#
# usage: title short_tab_title [long_window_title]
#
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
# Fully supports screen and probably most modern xterm and rxvt
# (In screen, only short_tab_title is used)
function title {
emulate -L zsh
setopt prompt_subst
[[ "$EMACS" == *term* ]] && return
# if $2 is unset use $1 as default
# if it is set and empty, leave it as is
: ${2=$1}
case "$TERM" in
xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*)
print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name
;;
screen*|tmux*)
print -Pn "\ek${1:q}\e\\" # set screen hardstatus
;;
*)
# Try to use terminfo to set the title
# If the feature is available set title
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
echoti tsl
print -Pn "$1"
echoti fsl
fi
;;
esac
}
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m:%~"
# Runs before showing the prompt
function mzc_termsupport_precmd {
[[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
# Runs before executing the command
function mzc_termsupport_preexec {
[[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
emulate -L zsh
# split command into array of arguments
local -a cmdargs
cmdargs=("${(z)2}")
# if running fg, extract the command from the job description
if [[ "${cmdargs[1]}" = fg ]]; then
# get the job id from the first argument passed to the fg command
local job_id jobspec="${cmdargs[2]#%}"
# logic based on jobs arguments:
# http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
# https://www.zsh.org/mla/users/2007/msg00704.html
case "$jobspec" in
<->) # %number argument:
# use the same <number> passed as an argument
job_id=${jobspec} ;;
""|%|+) # empty, %% or %+ argument:
# use the current job, which appears with a + in $jobstates:
# suspended:+:5071=suspended (tty output)
job_id=${(k)jobstates[(r)*:+:*]} ;;
-) # %- argument:
# use the previous job, which appears with a - in $jobstates:
# suspended:-:6493=suspended (signal)
job_id=${(k)jobstates[(r)*:-:*]} ;;
[?]*) # %?string argument:
# use $jobtexts to match for a job whose command *contains* <string>
job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
*) # %string argument:
# use $jobtexts to match for a job whose command *starts with* <string>
job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
esac
# override preexec function arguments with job command
if [[ -n "${jobtexts[$job_id]}" ]]; then
1="${jobtexts[$job_id]}"
2="${jobtexts[$job_id]}"
fi
fi
# cmd name only, or if this is sudo or ssh, the next cmd
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
local LINE="${2:gs/%/%%}"
title '$CMD' '%100>...>$LINE%<<'
}
autoload -U add-zsh-hook
add-zsh-hook precmd mzc_termsupport_precmd
add-zsh-hook preexec mzc_termsupport_preexec