From: TJ Luoma <luomat@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: compinit causes completion to fail?
Date: Mon, 30 Apr 2012 01:04:54 -0400 [thread overview]
Message-ID: <-840557096841281898@unknownmsgid> (raw)
In-Reply-To: <120429172415.ZM8837@torch.brasslantern.com>
On Apr 29, 2012, at 8:26 PM, Bart Schaefer <schaefer@brasslantern.com> wrote:
On Apr 29, 2:57am, TJ Luoma wrote:
}
} IFS='
} '
}
} is what was causing the problem.
Could you say a bit more about exactly how this caused a problem? In
normal circumstances the value of IFS shouldn't affect parsing of
scripts etc., it should only affect "read" and parameter substitution.
So I'm puzzled as to how you got the command-not-found symptom.
Well, I don't know exactly either. Here's what I did:
I had split my zshenv and zshrc files into several files. The
~/.zshenv was skeleton which sourced the other files as appropriate
(aside: it does seem faster this way).
But when I did that, completion broke with that "_normal not found" error.
So I removed the ~/.zshenv file, and completion worked (with no customizations).
{Note: by completion I mean just the basics: command completion and
'cd' completion.}
Then I started sourcing files one at a time and testing completion
(deleting ~/.zcompdump between each test by telling ~/.zlogout to
delete the file and exiting the shell after each one).
Completion broke ONLY when I added the explicit call to 'autoload'
completion stuff, which seemed completely nonsensical.
So I started all over again with a completely empty .zshenv EXCEPT for
the calls the source the various files. I thought it might have to do
with the *order* something was being loaded (bindkeys before setopts,
etc) so I organized my .zshenv to source the files in a way that I
thought made sense (i.e. environmental variables first, setting my
prompt last, etc).
I left everything commented out, and started un-commenting things one
at a time, from the bottom-up (I don't know why I chose the bottom-up,
it seemed like a good idea at the time).
So it went like this:
* uncomment last file-to-source from within .zshenv
* start a new shell
* test to see if command and 'cd' completion worked
* exit shell (deleting ~/.zcompdump)
* uncomment last-1 file-to-source from within .zshenv
* start a new shell
* test to see if command and 'cd' completion worked
* exit shell (deleting ~/.zcompdump)
and so on.
When I got to the top of the .zshenv file, I realized completion STILL
worked. So I looked at that .zshenv compared to the one I had used
earlier (Thank you, Dropbox versioning!)
The only difference was that the old .zshenv was that I had put in a
few settings that I thought were important at the top of the .zshenv,
including the IFS line.
When I had a giant .zshenv/.zshrc file, the IFS line was after the
completion stuff, but when I had broken it up into pieces, I thought
that I should put the IFS near the top because it seemed like
otherwise I might get inconsistent results. (Not sure if that would
have been a problem, but that was my thinking.)
I started adding those "odds and ends" back into the top of my
.zshenv, and then did the same logout/login.
Everything worked fine UNTIL I put the IFS line in at the top of the
.zshenv. When I did that, completion broke. When I took it out,
completion worked.
Truthfully, I forgot why I had the IFS line in there, so I had to go
back to Google (which wasn't easy) and realized that I had done that
for when I was running a command and capturing the output into an
array, and the output of the command might have newlines in it.
I went *back* to Google and looked for an alternative, assuming that
there was a better way.
That's when I learned about defining IFS at the front of the array, like this:
IFS=$'\n' array_of_lines=($(my_command))
or
array_of_lines=("${(@f)$(my_command)}")
(both of those examples gleaned from
http://unix.stackexchange.com/questions/29724/how-to-properly-collect-an-array-of-lines-in-zsh
FYI)
Then I went to the bash-to-zsh book and learned more about it, or tried to.
I think that's about all I can remember.
No, I don't think it makes sense either.
TjL
next prev parent reply other threads:[~2012-04-30 5:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-29 5:21 TJ Luoma
2012-04-29 6:57 ` TJ Luoma
2012-04-29 18:29 ` Peter Stephenson
2012-04-30 0:24 ` Bart Schaefer
2012-04-30 5:04 ` TJ Luoma [this message]
2012-04-30 14:37 ` Bart Schaefer
2012-04-30 14:50 ` TJ Luoma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=-840557096841281898@unknownmsgid \
--to=luomat@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).