Zimfw: Add environment WORDCHARS='' in default config

Created on 17 Aug 2017  路  3Comments  路  Source: zimfw/zimfw

Zim commit ref:   537f076
Zsh version:      zsh 5.2 (x86_64-apple-darwin16.0)
System info:      Darwin wweir.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

Description

We can use <ESC>b(f) to a backward(forward) word in bash and omz.
And it has a handy keymap in macOS terminal.app <option>+<left>(<right>)
The keymap is configurable in zsh itself

bindkey '^[[1;3D' backward-word
bindkey '^[[1;3C' forward-word

Zsh default behavior is deferent from bash/omz:
When I press b after a path in bash/omz, it will delete the last segment of the path
When I press b after a path in zsh, it will delete the whole path

Steps to reproduce

  1. press multi segment path in bash
  2. then press <ESC>b
    image
  3. press multi segment path in zsh
  4. then press <ESC>b
    image

Images or other information

This difference can be fixed by Adding WORDCHARS='' in the environment.

So, how about adding it in zim?

enhancement

Most helpful comment

From http://zsh.sourceforge.net/Guide/zshguide04.html

The default value for $WORDCHARS is

*?_-.[]~=/&;!#$%^(){}<>

Not sure what should be a "more sane default".

We can just remove the / using

WORDCHARS=${WORDCHARS//[\/]}

which is probably better. I agree with this, as I think it helps being able to delete individual path elements with backward-kill-word...

EDIT: I also think things like _-. should definitely be part of WORDCHARS...

All 3 comments

This difference has effect on <option>+<backspace> too.
That means we are not able to use the shortcut to delete the last directory of a path.

From http://zsh.sourceforge.net/Guide/zshguide04.html

The default value for $WORDCHARS is

*?_-.[]~=/&;!#$%^(){}<>

Not sure what should be a "more sane default".

We can just remove the / using

WORDCHARS=${WORDCHARS//[\/]}

which is probably better. I agree with this, as I think it helps being able to delete individual path elements with backward-kill-word...

EDIT: I also think things like _-. should definitely be part of WORDCHARS...

I like that approach.

Was this page helpful?
0 / 5 - 0 ratings