Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some times misses first character #169

Closed
oryband opened this issue May 3, 2015 · 18 comments
Closed

some times misses first character #169

oryband opened this issue May 3, 2015 · 18 comments
Labels

Comments

@oryband
Copy link

oryband commented May 3, 2015

Some time when I start typing a command, the first characters is ignored:

$ d ~/documents/  # i actually typed `cd ~/documents/`

This has started since I started using this plugin in two different machines, ubuntu and arch.

@danielshahaf
Copy link
Member

I presume this doesn't happen under zsh -f.

Do you any bindkey c … calls in your configuration? Do you source zsh-syntax-highlighting.zsh as the last thing in your .zshrc?

@oryband
Copy link
Author

oryband commented Sep 2, 2015

  • what is -f? couldn't find it in the man or web (never found a good way to search for -X arguments as google interprets it as "don't show 'X'"
  • now bindkeys at all
  • highlighting isn't sourced last, but somewhere in the middle
    here are my .zshrc, .zshenv, and .zlogin (i use arch so i startx through zlogin). they're not long, perhaps you can find the culprit

thanks a lot! :)

@danielshahaf
Copy link
Member

what is -f? couldn't find it in the man or web (never found a good way to search for -X arguments as google interprets it as "don't show 'X'"

It's "ignore (most) user and system dotfiles". See man zshoptions. Or make your search query "zsh -f" with quotes, in which case the first result gives the answer.

I'm not familiar with oh-my-zsh, but try making zsh-syntax-highlighting the last element of the plugins array.

@danielshahaf
Copy link
Member

I'm guessing this is resolved.

@oryband
Copy link
Author

oryband commented Oct 18, 2015

@danielshahaf sorry for late reply, but i can confirm that since sourcing the plugin last in the plugin list, this problem has gone away.

EDIT: forget what i said, the plugin was turned off. I'll get to this issue soon. Can you please re-open?

might be worth to mention it in the docs though, it's not obvious for newcomers.

@danielshahaf danielshahaf reopened this Oct 18, 2015
@danielshahaf
Copy link
Member

Reopened. I don't understand what docs change you are proposing?

@oryband
Copy link
Author

oryband commented Oct 18, 2015

@danielshahaf i meant emphasizing that the zsh-syntax-highlighter should be sourced after all other zsh plugins.

for example, i'm sourcing this plugin using oh-my-zsh. so i have this in my .zshrc:

plugins=(
    archlinux systemd
    python pip django celery virtualenv virtualenvwrapper
    npm
    go
    aws tugboat
    tmux
    docker
    colored-man colorize web-search
    history-substring-search
    zsh-syntax-highlighting # syntax-highlighting plugin must be sourced last
)

@danielshahaf
Copy link
Member

@oryband zsh-syntax-highlighting/README.md already says that (in the installation instructions, and reemphasized in the FAQ later in the file). What would you change / add?

@oryband
Copy link
Author

oryband commented Oct 18, 2015

@danielshahaf maybe be more direct. Write:

The plugin must be sourced last in the plugin list in `~/.zshrc`:

instead of:

Activate the plugin in ~/.zshrc (in last position):

@danielshahaf
Copy link
Member

@oryband Perhaps this?

diff --git a/README.md b/README.md
index cb22c37..c14c9df 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ How to install
         cd ~/.oh-my-zsh/custom/plugins
         git clone git://github.com/zsh-users/zsh-syntax-highlighting.git

-* Activate the plugin in `~/.zshrc` (in **last** position):
+* Activate the plugin in `~/.zshrc`:

         plugins=( [plugins...] zsh-syntax-highlighting)

@@ -47,6 +47,8 @@ How to install

         source ~/.zshrc

+Note that `zsh-syntax-highlighting` must be the last plugin sourced,
+so make it the last element of the `$plugins` array.

 FAQ
 ---

Incidentally, the 'at end of .zshrc' requirement may be removed some day, if/when the redrawhook work is merged.

@oryband
Copy link
Author

oryband commented Oct 18, 2015

@danielshahaf looks good 👍

@oryband
Copy link
Author

oryband commented Oct 18, 2015

keep this issue open though, i want to debug the missing char problem and haven't got to it yet

danielshahaf added a commit that referenced this issue Oct 18, 2015
Suggested-by: Ory Band
(on issue #169)
@danielshahaf
Copy link
Member

keep this issue open though, i want to debug the missing char problem and haven't got to it yet

Alright. I suspect history-substring-search might have something to do with it; it duplicates some code from zsh-syntax-highlighting.zsh: https://github.com/robbyrussell/oh-my-zsh/blob/aa15ebad3e9c86fbd8dd5f01803066f82ece9593/plugins/history-substring-search/history-substring-search.zsh#L180

@oryband
Copy link
Author

oryband commented Nov 1, 2015

@danielshahaf can these two plugins coexist together? history-substring-search says to source itself after zsh-syntax-highlighting. They're contradicting each other!

@danielshahaf
Copy link
Member

The documentation of h-s-s says it is compatible with z-sy-h. However, h-s-s relies on undocumented implementation details of z-sy-h (such as the existence of a _zsh_highlight function). That suggests using both at the same time is possible (since h-s-s's docs says so) but brittle (since h-s-s relies on z-sy-h implementation details which may change without notice).

While you're here, are you in contact with h-s-s's authors? The use of return true in their code could be a bug: that statement sets $? not to zero but to integer value of the shell parameter $true.

@oryband
Copy link
Author

oryband commented Nov 3, 2015

@danielshahaf i'm not in touch with them, just an observer. i actually don't know anything about the implementation. maybe ping them upstream?

@danielshahaf
Copy link
Member

It's already fixed upstream: zsh-users/zsh-history-substring-search@c61c995

What about your missing character problems, have you got to the bottom of them yet?

@oryband
Copy link
Author

oryband commented Nov 3, 2015

yup! thanks :)

@oryband oryband closed this as completed Nov 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants