Search code examples
windows-10zshwindows-subsystem-for-linux

Why won't .zshrc load?


I'm using cmder to run zsh on ubuntu on Windows 10. I'm trying to get Oh My Zsh themes going. For some reason my .zshrc file is not called. I've confirmed that zsh is actually running:

% zsh --version
zsh 5.1.1 (x86_64-ubuntu-linux-gnu)
% echo $0
zsh

I've confirmed that the vars don't exist:

% echo $ZSH_THEME
// blank line

If I run the contents of .zshrc line by line, the Oh My Zsh theme correctly loads:

% ZSH=/home/user/.oh-my-zsh
% ZSH_THEME="agnoster"
% plugins=(git)
% source $ZSH/oh-my-zsh.sh
% // theme shows up now

Not sure if this is a result of the latest Windows Subsystem for Linux install (fresh as of today) - the new install is in user\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79blahblah\LocalState\rootfs\home\user - or if I'm just out of my element here. Thanks in advance for your advice.

zsh -x output, per Gilles:

% zsh -x
+/etc/zsh/zshenv:15> [[ -z '// trimmed' == /bin:/usr/bin ]]
+/etc/zsh/zshrc:9> READNULLCMD=/usr/bin/pager
+/etc/zsh/zshrc:12> typeset -ga debian_missing_features
+/etc/zsh/zshrc:14> [[ -z '' ]]
+/etc/zsh/zshrc:15> [[ xterm-256color != emacs ]]
+/etc/zsh/zshrc:18> typeset -A key
+/etc/zsh/zshrc:19> key=( BackSpace  Home H End F Insert '' Delete '' Up A Down B Left D Right C PageUp '' PageDown '' )
+/etc/zsh/zshrc:53> bind2maps emacs -- BackSpace backward-delete-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=
+bind2maps:11> widget=backward-delete-char
+bind2maps:13> [[ -z  ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs  backward-delete-char
+/etc/zsh/zshrc:54> bind2maps viins -- BackSpace vi-backward-delete-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=
+bind2maps:11> widget=vi-backward-delete-char
+bind2maps:13> [[ -z  ]]
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins  vi-backward-delete-char
+/etc/zsh/zshrc:55> bind2maps vicmd -- BackSpace vi-backward-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=
+bind2maps:11> widget=vi-backward-char
+bind2maps:13> [[ -z  ]]
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd  vi-backward-char
+/etc/zsh/zshrc:56> bind2maps emacs -- Home beginning-of-line
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=H
+bind2maps:11> widget=beginning-of-line
+bind2maps:13> [[ -z H ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs H beginning-of-line
+/etc/zsh/zshrc:57> bind2maps viins vicmd -- Home vi-beginning-of-line
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=H
+bind2maps:11> widget=vi-beginning-of-line
+bind2maps:13> [[ -z H ]]
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins H vi-beginning-of-line
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd H vi-beginning-of-line
+/etc/zsh/zshrc:58> bind2maps emacs -- End end-of-line
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=F
+bind2maps:11> widget=end-of-line
+bind2maps:13> [[ -z F ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs F end-of-line
+/etc/zsh/zshrc:59> bind2maps viins vicmd -- End vi-end-of-line
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=F
+bind2maps:11> widget=vi-end-of-line
+bind2maps:13> [[ -z F ]]
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins F vi-end-of-line
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd F vi-end-of-line
+/etc/zsh/zshrc:60> bind2maps emacs viins -- Insert overwrite-mode
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=''
+bind2maps:11> widget=overwrite-mode
+bind2maps:13> [[ -z '' ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs '' overwrite-mode
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins '' overwrite-mode
+/etc/zsh/zshrc:61> bind2maps vicmd -- Insert vi-insert
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=''
+bind2maps:11> widget=vi-insert
+bind2maps:13> [[ -z '' ]]
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd '' vi-insert
+/etc/zsh/zshrc:62> bind2maps emacs -- Delete delete-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=''
+bind2maps:11> widget=delete-char
+bind2maps:13> [[ -z '' ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs '' delete-char
+/etc/zsh/zshrc:63> bind2maps viins vicmd -- Delete vi-delete-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=''
+bind2maps:11> widget=vi-delete-char
+bind2maps:13> [[ -z '' ]]
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins '' vi-delete-char
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd '' vi-delete-char
+/etc/zsh/zshrc:64> bind2maps emacs viins vicmd -- Up up-line-or-history
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=A
+bind2maps:11> widget=up-line-or-history
+bind2maps:13> [[ -z A ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs A up-line-or-history
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins A up-line-or-history
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd A up-line-or-history
+/etc/zsh/zshrc:65> bind2maps emacs viins vicmd -- Down down-line-or-history
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=B
+bind2maps:11> widget=down-line-or-history
+bind2maps:13> [[ -z B ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs B down-line-or-history
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins B down-line-or-history
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd B down-line-or-history
+/etc/zsh/zshrc:66> bind2maps emacs -- Left backward-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=D
+bind2maps:11> widget=backward-char
+bind2maps:13> [[ -z D ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs D backward-char
+/etc/zsh/zshrc:67> bind2maps viins vicmd -- Left vi-backward-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=D
+bind2maps:11> widget=vi-backward-char
+bind2maps:13> [[ -z D ]]
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins D vi-backward-char
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd D vi-backward-char
+/etc/zsh/zshrc:68> bind2maps emacs -- Right forward-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ emacs != -- ]]
+bind2maps:5> maps+=( emacs )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=C
+bind2maps:11> widget=forward-char
+bind2maps:13> [[ -z C ]]
+bind2maps:15> i=emacs
+bind2maps:16> bindkey -M emacs C forward-char
+/etc/zsh/zshrc:69> bind2maps viins vicmd -- Right vi-forward-char
+bind2maps:1> local i sequence widget
+bind2maps:2> local -a maps
+bind2maps:4> [[ viins != -- ]]
+bind2maps:5> maps+=( viins )
+bind2maps:6> shift
+bind2maps:4> [[ vicmd != -- ]]
+bind2maps:5> maps+=( vicmd )
+bind2maps:6> shift
+bind2maps:4> [[ -- != -- ]]
+bind2maps:8> shift
+bind2maps:10> sequence=C
+bind2maps:11> widget=vi-forward-char
+bind2maps:13> [[ -z C ]]
+bind2maps:15> i=viins
+bind2maps:16> bindkey -M viins C vi-forward-char
+bind2maps:15> i=vicmd
+bind2maps:16> bindkey -M vicmd C vi-forward-char
+/etc/zsh/zshrc:73> ((  1  ))
+/etc/zsh/zshrc:73> ((  1  ))
+/etc/zsh/zshrc:82> zle -N zle-line-init
+/etc/zsh/zshrc:83> zle -N zle-line-finish
+/etc/zsh/zshrc:91> unfunction bind2maps
+/etc/zsh/zshrc:95> zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
+/etc/zsh/zshrc:103> ((  1  ))
+/etc/zsh/zshrc:103> unalias run-help
+/etc/zsh/zshrc:104> autoload -Uz run-help
+/etc/zsh/zshrc:109> [[ -z '' ]]
+/etc/zsh/zshrc:110> autoload -U compinit
+/etc/zsh/zshrc:111> compinit
+compinit:70> emulate -L zsh
+compinit:71> setopt extendedglob
+compinit:73> typeset _i_dumpfile _i_files _i_line _i_done _i_dir _i_autodump=1
+compinit:74> typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name
+compinit:76> [[ 0 -gt 0 ]]
+compinit:108> typeset -gHA _comps _services _patcomps _postpatcomps
+compinit:113> typeset -gHA _compautos
+compinit:118> typeset -gHA _lastcomp
+compinit:121> [[ -n '' ]]
+compinit:125> typeset -g _comp_dumpfile=/home/user/.zcompdump
+compinit:130> typeset -gHa _comp_options
+compinit:131> _comp_options=( bareglobqual extendedglob glob multibyte multifuncdef nullglob rcexpandparam unset NO_allexport NO_aliases NO_cshnullglob NO_cshjunkiequotes NO_errexit NO_globassign NO_globsubst NO_histsubstpattern NO_ignorebraces NO_ignoreclosebraces NO_kshglob NO_ksharrays NO_kshtypeset NO_markdirs NO_octalzeroes NO_posixbuiltins NO_shwordsplit NO_shglob NO_warncreateglobal )
+compinit:167> typeset -gH _comp_setup='local -A _comp_caller_options;
             _comp_caller_options=(${(kv)options[@]});
             setopt localoptions localtraps localpatterns ${_comp_options[@]};
             local IFS=$'\'' \t\r\n\0'\''
             enable -p \| \~ \( \? \* \[ \< \^ \#
             exec </dev/null;
             trap - ZERR
             local -a reply
             local REPLY'
+compinit:180> typeset -ga compprefuncs comppostfuncs
+compinit:181> compprefuncs=( )
+compinit:182> comppostfuncs=( )
+compinit:186> : compinit /etc/zsh/zshrc
+compinit:435> typeset _i_wdirs _i_wfiles
+compinit:437> _i_wdirs=( )
+compinit:438> _i_wfiles=( )
+compinit:440> autoload -Uz compaudit
+compinit:441> [[ -n yes ]]
+compinit:442> typeset _i_q
+compinit:443> eval compaudit
+(eval):1> compaudit
+compaudit:174> compaudit
+compaudit:13> emulate -L zsh
+compaudit:14> setopt extendedglob
+compaudit:16> [[ -x /usr/bin/getent ]]
+compaudit:25> ((  0  ))
+compaudit:27> ((  30 == 0  ))
+compaudit:31> set -- // trimmed
+compaudit:38> ((  1  ))
+compaudit:44> fpath=( // trimmed )
+compaudit:49> ((  0  ))
+compaudit:50> local _compdir=''
+compaudit:51> [[ -z '' ]]
+compaudit:51> _compdir=/usr/local/share/zsh/site-functions
+compaudit:55> _i_wdirs=( )
+compaudit:56> _i_wfiles=( )
+compaudit:58> _i_files=( // trimmed )
+compaudit:59> [[ -n /usr/local/share/zsh/site-functions ]]
+compaudit:60> [[ 766 -lt 20 || /usr/local/share/zsh/site-functions == */Base || -d /usr/local/share/zsh/site-functions/Base ]]
+compaudit:82> [[ ask == use ]]
+compaudit:86> local _i_owners=u0u1000
+compaudit:89> local -a _i_exes
+compaudit:90> _i_exes=( /proc/8/exe /proc/8/object/a.out )
+compaudit:94> local _i_exe
+compaudit:99> _i_exe=/proc/8/exe
+compaudit:100> [[ -e /proc/8/exe ]]
+compaudit:101> zmodload -F zsh/stat b:zstat
+compaudit:102> local -A _i_stathash
+compaudit:103> zstat -H _i_stathash /proc/8/exe
+compaudit:104> [[ 0 -ne 0 ]]
+compaudit:108> break
+compaudit:121> _i_wdirs=( /usr/local/share/zsh/site-functions )
+compaudit:130> ((  1  ))
+compaudit:131> local GROUP GROUPMEM _i_pw _i_gid
+compaudit:132> (( UID == EUID  ))
+compaudit:133> IFS=: +compaudit:133> read GROUP _i_pw _i_gid GROUPMEM
+compaudit:133> getent group user
+compaudit:138> [[ user == user && -z '' ]]
+compaudit:140> _i_wdirs=( /usr/local/share/zsh/site-functions )
+compaudit:144> [[ -f /etc/debian_version ]]
+compaudit:146> local _i_ulwdirs
+compaudit:147> _i_ulwdirs=( /usr/local/share/zsh/site-functions )
+compaudit:148> _i_wdirs=( )
+compaudit:151> _i_wdirs=( )
+compaudit:152> _i_wfiles=( )
+compaudit:154> case 0:0 (0:0)
+compaudit:155> _i_q=''
+compaudit:161> [[ -n '' ]]
+compaudit:168> return 0
+compinit:468> autoload -Uz compdump compinstall
+compinit:472> _i_done=''
+compinit:474> [[ -f /home/user/.zcompdump ]]
+compinit:475> [[ -n yes ]]
+compinit:476> IFS='    ' +compinit:476> read -rA _i_line
+compinit:477> [[ _i_autodump -eq 1 && 766 -eq 766 && 5.1.1 == 5.1.1 ]]
+compinit:480> . /home/user/.zcompdump
+/home/user/.zcompdump:3> _comps=( // trimmed )
+/home/user/.zcompdump:1341> _services=( // trimmed )
+/home/user/.zcompdump:1384> _patcomps=( '*/(init|rc[0-9S]#).d/*' _init_d 'zf*' _zftp )
+/home/user/.zcompdump:1389> _postpatcomps=( // trimmed )
+/home/user/.zcompdump:1412> _compautos=( _call_program +X )
+/home/user/.zcompdump:1416> zle -C _bash_complete-word .complete-word _bash_completions
+/home/user/.zcompdump:1417> zle -C _bash_list-choices .list-choices _bash_completions
+/home/user/.zcompdump:1418> zle -C _complete_debug .complete-word _complete_debug
+/home/user/.zcompdump:1419> zle -C _complete_help .complete-word _complete_help
+/home/user/.zcompdump:1420> zle -C _complete_tag .complete-word _complete_tag
+/home/user/.zcompdump:1421> zle -C _correct_filename .complete-word _correct_filename
+/home/user/.zcompdump:1422> zle -C _correct_word .complete-word _correct_word
+/home/user/.zcompdump:1423> zle -C _expand_alias .complete-word _expand_alias
+/home/user/.zcompdump:1424> zle -C _expand_word .complete-word _expand_word
+/home/user/.zcompdump:1425> zle -C _history-complete-newer .complete-word _history_complete_word
+/home/user/.zcompdump:1426> zle -C _history-complete-older .complete-word _history_complete_word
+/home/user/.zcompdump:1427> zle -C _list_expansions .list-choices _expand_word
+/home/user/.zcompdump:1428> zle -C _most_recent_file .complete-word _most_recent_file
+/home/user/.zcompdump:1429> zle -C _next_tags .list-choices _next_tags
+/home/user/.zcompdump:1430> zle -C _read_comp .complete-word _read_comp
+/home/user/.zcompdump:1431> bindkey '^X^R' _read_comp
+/home/user/.zcompdump:1432> bindkey '^X?' _complete_debug
+/home/user/.zcompdump:1433> bindkey '^XC' _correct_filename
+/home/user/.zcompdump:1434> bindkey '^Xa' _expand_alias
+/home/user/.zcompdump:1435> bindkey '^Xc' _correct_word
+/home/user/.zcompdump:1436> bindkey '^Xd' _list_expansions
+/home/user/.zcompdump:1437> bindkey '^Xe' _expand_word
+/home/user/.zcompdump:1438> bindkey '^Xh' _complete_help
+/home/user/.zcompdump:1439> bindkey '^Xm' _most_recent_file
+/home/user/.zcompdump:1440> bindkey '^Xn' _next_tags
+/home/user/.zcompdump:1441> bindkey '^Xt' _complete_tag
+/home/user/.zcompdump:1442> bindkey '^X~' _bash_list-choices
+/home/user/.zcompdump:1443> bindkey '^[,' _history-complete-newer
+/home/user/.zcompdump:1444> bindkey '^[/' _history-complete-older
+/home/user/.zcompdump:1445> bindkey '^[~' _bash_complete-word
+/home/user/.zcompdump:1447> // trimmed
+/home/user/.zcompdump:1600> autoload -Uz +X _call_program
+/home/user/.zcompdump:1602> typeset -gUa _comp_assocs
+/home/user/.zcompdump:1603> _comp_assocs=( '' )
+compinit:481> _i_done=yes
+compinit:488> [[ -z yes ]]
+compinit:525> _i_line=complete-word
+compinit:528> zle -C complete-word .complete-word _main_complete
+compinit:525> _i_line=delete-char-or-list
+compinit:528> zle -C delete-char-or-list .delete-char-or-list _main_complete
+compinit:525> _i_line=expand-or-complete
+compinit:528> zle -C expand-or-complete .expand-or-complete _main_complete
+compinit:525> _i_line=expand-or-complete-prefix
+compinit:528> zle -C expand-or-complete-prefix .expand-or-complete-prefix _main_complete
+compinit:525> _i_line=list-choices
+compinit:528> zle -C list-choices .list-choices _main_complete
+compinit:525> _i_line=menu-complete
+compinit:528> zle -C menu-complete .menu-complete _main_complete
+compinit:525> _i_line=menu-expand-or-complete
+compinit:528> zle -C menu-expand-or-complete .menu-expand-or-complete _main_complete
+compinit:525> _i_line=reverse-menu-complete
+compinit:528> zle -C reverse-menu-complete .reverse-menu-complete _main_complete
+compinit:530> zle -la menu-select
+compinit:534> IFS='    ' +compinit:534> read -A _i_line
+compinit:534> bindkey '^i'
+compinit:535> [[ expand-or-complete == expand-or-complete ]]
+compinit:536> zstyle -a :completion: completer _i_line
+compinit:541> unfunction compinit compaudit
+compinit:542> autoload -Uz compinit compaudit
+compinit:544> return 0

per Gilles:

% ls -ld ~/.z*
+zsh:8> ls -ld /home/user/.zcompdump /home/user/.zcompdump-user-5.1.1 /home/user/.zsh_history /home/user/.zshrc /home/user/.zsh-update
-rw-rw-rw- 1 user user 39206 Apr 17 11:42 /home/user/.zcompdump
-rw-r--r-- 1 user user 39352 Apr 17 11:45 /home/user/.zcompdump-user-5.1.1
-rw------- 1 user user   596 Apr 17 14:09 /home/user/.zsh_history
---------- 1 user user  3132 Apr 17 13:42 /home/user/.zshrc
-rw-rw-rw- 1 user user    17 Apr 17 13:12 /home/user/.zsh-update

% head -n 1 ~/.z*
+zsh:9> head -n 1 /home/user/.zcompdump /home/user/.zcompdump-user-5.1.1 /home/user/.zsh_history /home/user/.zshrc /home/user/.zsh-update
==> /home/user/.zcompdump <==
#files: 766     version: 5.1.1

==> /home/user/.zcompdump-user-5.1.1 <==
#files: 766     version: 5.1.1

==> /home/user/.zsh_history <==
: 1523995979:0;chsh -s /usr/bin/zsh
head: cannot open '/home/user/.zshrc' for reading: Permission denied

==> /home/user/.zsh-update <==
LAST_EPOCH=17638

Based on the above output, I tried sudo chown -R user .zshrc which runs without error, but the file still remains unreadable.


Solution

  • There are many things that can go wrong, although each of them rarely does.

    Zsh reads a number of files when it starts. I won't repeat the whole list here; for interactive use, the list is:

    1. system zshenv
    2. user .zshenv
    3. system zshrc
    4. user .zshrc

    The system directory is /etc by default, but may be changed at compile time. It's /etc/zsh on Debian-based distributions, including Ubuntu, including WSL. The user directory is the value of the environment variable ZDOTDIR if set (it usually isn't), and the home directory otherwise.

    From within zsh, run echo $ZDOTDIR to see if ZDOTDIR is defined. If it is, use $ZDOTDIR instead of ~ in the following commands. If it isn't, check that your home directory is what you expect with echo $HOME. A mildly common problem with Unix layers on Windows (but not usually with WSL) is when your home directory isn't set to what you expect when the shell starts.

    Check what files zsh loaded from your home directory, and check their contents.

    ls -ld ~/.zsh(env|rc)
    less ~/.zsh(env|rc)
    

    Make sure that the file name is correct. It needs to start with a dot and be all-lowercase. Check that the content is what you expect.

    In your case, ls showed the problem: you didn't have read permissions on ~/.zshrc. You can fix this with

    chmod u+r ~/.zshrc
    

    although the broken permissions may be a sign of something wrong more generally with your WSL setup or with the application you saved the file in.

    Run zsh with the -x option to see a trace of everything it loads. This can be very big. From a Unix-like command line (sh, bash or zsh), you can redirect the trace to a file:

    zsh -x 2>zsh.err
    

    Press Ctrl+D to exit and look at the contents of zsh.err. This shows all the files that get loaded, e.g.

    +/etc/zsh/zshenv:15> [[ -z '// trimmed' == /bin:/usr/bin ]]
    +/etc/zsh/zshrc:9> READNULLCMD=/usr/bin/pager
    …
    

    One line of code in the zshenv was executed (the rest are blank, comments, or skipped due to conditional execution). There was no user .zshenv file, so the next line is from the system zshrc. The last thing in your trace

    +compinit:544> return 0
    

    is the last line from loading the completion system which is the last thing Debian/Ubuntu/WSL's system zshrc does. Therefore there was no user .zshrc (or more precisely there was no readable user .zshrc).