Favicon
Gravatar

Re: Arrays with each item on one line

On Tue, 31 Jan 2012, TJ Luoma wrote:

> I don't understand arrays very well and am trying to learn.
>
> I keep trying to do things like this:
>
> FILES=("$HOME/Library/Application Support/Keyboard Maestro"
> "$HOME/Library/Preferences/com.stairways.keyboardmaestro.editor.plist"
> "$HOME/Library/Preferences/com.stairways.keyboardmaestro.engine.plist"
> "$HOME/Library/Preferences/com.stairways.keyboardmaestro.plist")
>
> for F in $FILES
> do
>
> command ls -ld "$F"
>
> done
>
> but instead of $F being each line for 4 iterations of the loop, I get 
> all 4 lines x 4 times.
>
> [...]
>
> Can someone tell me what I'm missing?
>
> [...]
>
> Zsh version 4.3.11 on Mac OS X/10.7

Your example works fine for me using Zsh version 4.3.11 under OSX 10.7.
(Continue reading)

TJ Luoma | 1 Feb 03:28
Picon
Gravatar

Re: Arrays with each item on one line

On Tue, Jan 31, 2012 at 7:48 PM, Benjamin R. Haskell <zsh <at> benizi.com> wrote:
> What do you get from running 'setopt'? I get:

autocd
extendedglob
nofunctionargzero
interactive
listpacked
login
promptsubst
pushdignoredups
shinstdin

Favicon
Gravatar

Re: Arrays with each item on one line

On Tue, 31 Jan 2012, TJ Luoma wrote:

> On Tue, Jan 31, 2012 at 7:48 PM, Benjamin R. Haskell <zsh <at> benizi.com> wrote:
>> What do you get from running 'setopt'? I get:
>
> autocd
> extendedglob
> nofunctionargzero
> interactive
> listpacked
> login
> promptsubst
> pushdignoredups
> shinstdin

Even with that set of options, I don't get the behavior you described. 
Maybe I'm misunderstanding your explanation?  It seems more likely that 
you're not posting the actual code you're using.  Running the code you posted:

 	FILES=("$HOME/Library/Application Support/Keyboard Maestro"
 	"$HOME/Library/Preferences/com.stairways.keyboardmaestro.editor.plist"
 	"$HOME/Library/Preferences/com.stairways.keyboardmaestro.engine.plist"
 	"$HOME/Library/Preferences/com.stairways.keyboardmaestro.plist")

 	for F in $FILES
 	do
 		command ls -ld "$F"
 	done

on the OSX machine I have access to, I get (as expected, since the files 
(Continue reading)

TJ Luoma | 1 Feb 03:59
Picon
Gravatar

Re: Arrays with each item on one line

ARGH.

Sorry.

PEBKAC.

(I was using $FILES instead of $F inside the loop.)

Leander Jedamus | 9 Feb 19:37
Picon

issue with cursor down bindkey setting

Hi!

I have some problems setting the arrow keys inside zsh. What I do is:
$ bindkey "$terminfo[cuu1]" history-substring-search-up
$ bindkey "$terminfo[cud1]" history-substring-search-down

The first command works as expected, the second does not, because 
$terminfo[cud1] is bound to ^J, not to ^[[B

$ bindkey "$terminfo[cuu1]"
"^[[A" history-substring-search-up
$ bindkey "$terminfo[cud1]"
"^J" history-substring-search-down

So where is the assoziative array terminfo set? Can I change that?

Thanks in advance
Leander Jedamus

Mikael Magnusson | 9 Feb 20:08
Picon

Re: issue with cursor down bindkey setting

On 9 February 2012 19:37, Leander Jedamus <ljedamus <at> web.de> wrote:
> Hi!
>
> I have some problems setting the arrow keys inside zsh. What I do is:
> $ bindkey "$terminfo[cuu1]" history-substring-search-up
> $ bindkey "$terminfo[cud1]" history-substring-search-down
>
> The first command works as expected, the second does not, because
> $terminfo[cud1] is bound to ^J, not to ^[[B
>
> $ bindkey "$terminfo[cuu1]"
> "^[[A" history-substring-search-up
> $ bindkey "$terminfo[cud1]"
> "^J" history-substring-search-down
>
> So where is the assoziative array terminfo set? Can I change that?

http://zshwiki.org/home/zle/bindkeys

(you're using the wrong keys (array keys), it should be kcu?1)

--

-- 
Mikael Magnusson

Javier Marcet | 12 Feb 18:21
Picon
Gravatar

Cursor position in shell history

Hi,

Last month I set up an Ubuntu based system, where I use zsh, as in all
the unix systems I manage. There is one thing which is driving me mad.
When I use the 'up arrow' to move through shell's history, the cursor is
placed at the start of the line instead of at the end. This only happens
in Ubuntu.

I use the same .zsh folder with my settings and neither the global profile
nor the global zsh settings  (/etc/zsh) contain anything which me causing
it.

In readline there is a setting, history-preserve-point, which changes this.

What would be the best way to change this behavior?

Frank Terbeck | 12 Feb 22:27
Favicon

Re: Cursor position in shell history

Javier Marcet wrote:
> Last month I set up an Ubuntu based system, where I use zsh, as in all
> the unix systems I manage. There is one thing which is driving me mad.
> When I use the 'up arrow' to move through shell's history, the cursor is
> placed at the start of the line instead of at the end. This only happens
> in Ubuntu.

Yes. Ubuntu basically uses the package from debian, which causes this.

> I use the same .zsh folder with my settings and neither the global profile
> nor the global zsh settings  (/etc/zsh) contain anything which me causing
> it.

Oh but it does. It's the global zshrc:

[...]
[[ -z "$terminfo[cuu1]" ]] || bindkey -M viins "$terminfo[cuu1]" vi-up-line-or-history
[[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history
[...]

There is more of this stuff in there. Change it to your liking.

FWIW, there is a bug about this in Debian's BTS:

  <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=383737>

The position of the maintenance team so far is: It was changed to more
vi-ish, and up to that point *two* people bothered to tell the
maintainer. So it stays.

(Continue reading)

@@@ | 12 Feb 23:26
Picon
Favicon

Quoting instead of escaping completed filenames

How can I tell the completion system to always use double-quotes around
filenames with space (and other characters, as needed), instead of escaping the
spaces with backslash?

Daniel | 12 Feb 23:34
Picon
Favicon

Re: Quoting instead of escaping completed filenames

Sorry, I realize now that I already asked this a while ago :)


Gmane