zsh-users
 help / color / mirror / code / Atom feed
* How to get syntax highlighting working??
@ 2010-12-25 13:16 Guido van Steen
  2010-12-25 18:09 ` Julien Nicoulaud
  0 siblings, 1 reply; 8+ messages in thread
From: Guido van Steen @ 2010-12-25 13:16 UTC (permalink / raw)
  To: zsh-users

Dear fellow Zsh users, 

First of all happy Christmas to all of you! 

Not so long ago there was a discussion on this mailing list on how to achieve 
syntax coloring like it is avaiable in Fish. 


This discussion evolved in some implementations e.g. the one on 
https://gist.github.com/754803 by x-way. 


However, for some reason I cannot get these script running from a simple .zshrc. 


Could someone explain to me how I could get it running from a fresh .zshrc ? 

Thanks in advance! 

Guido van Steen 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get syntax highlighting working??
  2010-12-25 13:16 How to get syntax highlighting working?? Guido van Steen
@ 2010-12-25 18:09 ` Julien Nicoulaud
  2011-01-02  9:25   ` Gour
  0 siblings, 1 reply; 8+ messages in thread
From: Julien Nicoulaud @ 2010-12-25 18:09 UTC (permalink / raw)
  To: Guido van Steen; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

Hi,
just to say I've created a repository and added everyone who made changes as
author: https://github.com/nicoulaj/zsh-syntax-highlighting

It will be easier than tracking the most up-to-date fork of the original
gist :)

May be you can open an issue here.

Cheers,
Julien

2010/12/25 Guido van Steen <gvsteen@yahoo.com>

> Dear fellow Zsh users,
>
> First of all happy Christmas to all of you!
>
> Not so long ago there was a discussion on this mailing list on how to
> achieve
> syntax coloring like it is avaiable in Fish.
>
>
> This discussion evolved in some implementations e.g. the one on
> https://gist.github.com/754803 by x-way.
>
>
> However, for some reason I cannot get these script running from a simple
> .zshrc.
>
>
> Could someone explain to me how I could get it running from a fresh .zshrc
> ?
>
> Thanks in advance!
>
> Guido van Steen
>
>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get syntax highlighting working??
  2010-12-25 18:09 ` Julien Nicoulaud
@ 2011-01-02  9:25   ` Gour
  2011-01-05  9:56     ` William
  0 siblings, 1 reply; 8+ messages in thread
From: Gour @ 2011-01-02  9:25 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

On Sat, 25 Dec 2010 19:09:37 +0100
>>>>>> "Julien" == <julien.nicoulaud@gmail.com> wrote:

Julien> Hi,
Julien> just to say I've created a repository and added everyone who
Julien> made changes as author:
Julien> https://github.com/nicoulaj/zsh-syntax-highlighting

Thanks a lot...Even reason less to switch to fish. ;)

Otoh, I wonder if it is going to be included as part of zsh?


Sincerely,
Gour

-- 

Gour  | Hlapicina, Croatia  | GPG key: CDBF17CA
----------------------------------------------------------------

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get syntax highlighting working??
  2011-01-02  9:25   ` Gour
@ 2011-01-05  9:56     ` William
  2011-01-05 10:35       ` Julien Nicoulaud
  0 siblings, 1 reply; 8+ messages in thread
From: William @ 2011-01-05  9:56 UTC (permalink / raw)
  To: Gour; +Cc: zsh-users

Hi,

I know this is a poor excuse for a patch, but access to git is blocked
from here.
To get this to work with my config, I had to change this line;
                        local aliased_command=${"$(alias $arg)"#*=}
to
                        local aliased_command="${"$(alias $arg)"#*=}"
in _zsh_highlight-zle-buffer, line 166 (in the current version anyway).

nice work btw!


On Sun, Jan 2, 2011 at 10:25, Gour <gour@atmarama.net> wrote:
> On Sat, 25 Dec 2010 19:09:37 +0100
>>>>>>> "Julien" == <julien.nicoulaud@gmail.com> wrote:
>
> Julien> Hi,
> Julien> just to say I've created a repository and added everyone who
> Julien> made changes as author:
> Julien> https://github.com/nicoulaj/zsh-syntax-highlighting
>
> Thanks a lot...Even reason less to switch to fish. ;)
>
> Otoh, I wonder if it is going to be included as part of zsh?
>
>
> Sincerely,
> Gour
>
> --
>
> Gour  | Hlapicina, Croatia  | GPG key: CDBF17CA
> ----------------------------------------------------------------
>



-- 
LIVE LIKE YOUR CAPS LOCK BUTTON IS JAMMED.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get syntax highlighting working??
  2011-01-05  9:56     ` William
@ 2011-01-05 10:35       ` Julien Nicoulaud
  2011-01-05 11:08         ` Michel
  0 siblings, 1 reply; 8+ messages in thread
From: Julien Nicoulaud @ 2011-01-05 10:35 UTC (permalink / raw)
  To: William; +Cc: Gour, zsh-users

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

Thanks William,
I applied your fix:
https://github.com/nicoulaj/zsh-syntax-highlighting/commit/a640bb8b96fe95077b8a8ddc6a31f49912a060ee
.


2011/1/5 William <sirrobin2318@gmail.com>

> Hi,
>
> I know this is a poor excuse for a patch, but access to git is blocked
> from here.
> To get this to work with my config, I had to change this line;
>                        local aliased_command=${"$(alias $arg)"#*=}
> to
>                        local aliased_command="${"$(alias $arg)"#*=}"
> in _zsh_highlight-zle-buffer, line 166 (in the current version anyway).
>
> nice work btw!
>
>
> On Sun, Jan 2, 2011 at 10:25, Gour <gour@atmarama.net> wrote:
> > On Sat, 25 Dec 2010 19:09:37 +0100
> >>>>>>> "Julien" == <julien.nicoulaud@gmail.com> wrote:
> >
> > Julien> Hi,
> > Julien> just to say I've created a repository and added everyone who
> > Julien> made changes as author:
> > Julien> https://github.com/nicoulaj/zsh-syntax-highlighting
> >
> > Thanks a lot...Even reason less to switch to fish. ;)
> >
> > Otoh, I wonder if it is going to be included as part of zsh?
> >
> >
> > Sincerely,
> > Gour
> >
> > --
> >
> > Gour  | Hlapicina, Croatia  | GPG key: CDBF17CA
> > ----------------------------------------------------------------
> >
>
>
>
> --
> LIVE LIKE YOUR CAPS LOCK BUTTON IS JAMMED.
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get syntax highlighting working??
  2011-01-05 10:35       ` Julien Nicoulaud
@ 2011-01-05 11:08         ` Michel
  2011-01-05 20:20           ` Sorin Ionescu
  0 siblings, 1 reply; 8+ messages in thread
From: Michel @ 2011-01-05 11:08 UTC (permalink / raw)
  To: Julien Nicoulaud; +Cc: zsh-users

Thanks ! I haven't awser because I haven't network at home, but your
work is really nice.

Thank you very much to all contributors !
_____________________
Michel BARRET



2011/1/5 Julien Nicoulaud <julien.nicoulaud@gmail.com>:
> Thanks William,
> I applied your fix:
> https://github.com/nicoulaj/zsh-syntax-highlighting/commit/a640bb8b96fe95077b8a8ddc6a31f49912a060ee
> .
>
>
> 2011/1/5 William <sirrobin2318@gmail.com>
>
>> Hi,
>>
>> I know this is a poor excuse for a patch, but access to git is blocked
>> from here.
>> To get this to work with my config, I had to change this line;
>>                        local aliased_command=${"$(alias $arg)"#*=}
>> to
>>                        local aliased_command="${"$(alias $arg)"#*=}"
>> in _zsh_highlight-zle-buffer, line 166 (in the current version anyway).
>>
>> nice work btw!
>>
>>
>> On Sun, Jan 2, 2011 at 10:25, Gour <gour@atmarama.net> wrote:
>> > On Sat, 25 Dec 2010 19:09:37 +0100
>> >>>>>>> "Julien" == <julien.nicoulaud@gmail.com> wrote:
>> >
>> > Julien> Hi,
>> > Julien> just to say I've created a repository and added everyone who
>> > Julien> made changes as author:
>> > Julien> https://github.com/nicoulaj/zsh-syntax-highlighting
>> >
>> > Thanks a lot...Even reason less to switch to fish. ;)
>> >
>> > Otoh, I wonder if it is going to be included as part of zsh?
>> >
>> >
>> > Sincerely,
>> > Gour
>> >
>> > --
>> >
>> > Gour  | Hlapicina, Croatia  | GPG key: CDBF17CA
>> > ----------------------------------------------------------------
>> >
>>
>>
>>
>> --
>> LIVE LIKE YOUR CAPS LOCK BUTTON IS JAMMED.
>>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get syntax highlighting working??
  2011-01-05 11:08         ` Michel
@ 2011-01-05 20:20           ` Sorin Ionescu
  2011-01-05 20:44             ` Julien Nicoulaud
  0 siblings, 1 reply; 8+ messages in thread
From: Sorin Ionescu @ 2011-01-05 20:20 UTC (permalink / raw)
  To: zsh-users

The 'Bind all ZLE events from zle -la to highlighting function.’ loop on line 216 is problematic. It overwrites existing bindings and conflicts with other scripts. For example, I have a vi-mode oh-my-zsh plugin that indicates when ZSH is in vicmd in ~/.oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh which I have pasted bellow.



# Allow command line editing in an external editor.
autoload -Uz edit-command-line

# If mode indicator wasn't setup by theme, define a default.
if [[ "$MODE_INDICATOR" == "" ]]; then
  MODE_INDICATOR="%{$fg_bold[red]%}<%{$reset_color%}%{$fg[red]%}<<%{$reset_color%}"
fi

function zle-line-init {
  zle reset-prompt
}

# If I am using vi keys, I want to know what mode I'm currently using.
# zle-keymap-select is executed every time KEYMAP changes.
# From http://zshwiki.org/home/examples/zlewidgets
rprompt_cached=$RPROMPT
function zle-line-init zle-keymap-select {
  RPROMPT="${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/$rprompt_cached}"
  zle reset-prompt
}

# Accept RETURN in vi command mode.
function accept_line {
  RPROMPT=$rprompt_cached
  builtin zle .accept-line
}

zle -N zle-line-init
zle -N zle-keymap-select
zle -N accept_line
zle -N edit-command-line

# Avoid binding ^J, ^M,  ^C, ^?, ^S, ^Q, etc.
bindkey -d # Reset to default.
bindkey -v # Use vi key bindings.
bindkey -M vicmd "^M" accept_line # Alow RETURN in vi command.
bindkey -M vicmd v edit-command-line # ESC-v to edit in an external editor.

bindkey ' ' magic-space 
bindkey -M vicmd "gg" beginning-of-history
bindkey -M vicmd "G" end-of-history
bindkey -M vicmd "k" history-search-backward
bindkey -M vicmd "j" history-search-forward
bindkey -M vicmd "?" history-incremental-search-backward
bindkey -M vicmd "/" history-incremental-search-forward

bindkey -M viins "^L" clear-screen
bindkey -M viins "^W" backward-kill-word
bindkey -M viins "^A" beginning-of-line
bindkey -M viins "^E" end-of-line


On 5 Jan 2011, at 06:08, Michel wrote:

> Thanks ! I haven't awser because I haven't network at home, but your
> work is really nice.
> 
> Thank you very much to all contributors !
> _____________________
> Michel BARRET
> 
> 
> 
> 2011/1/5 Julien Nicoulaud <julien.nicoulaud@gmail.com>:
>> Thanks William,
>> I applied your fix:
>> https://github.com/nicoulaj/zsh-syntax-highlighting/commit/a640bb8b96fe95077b8a8ddc6a31f49912a060ee
>> .
>> 
>> 
>> 2011/1/5 William <sirrobin2318@gmail.com>
>> 
>>> Hi,
>>> 
>>> I know this is a poor excuse for a patch, but access to git is blocked
>>> from here.
>>> To get this to work with my config, I had to change this line;
>>>                        local aliased_command=${"$(alias $arg)"#*=}
>>> to
>>>                        local aliased_command="${"$(alias $arg)"#*=}"
>>> in _zsh_highlight-zle-buffer, line 166 (in the current version anyway).
>>> 
>>> nice work btw!
>>> 
>>> 
>>> On Sun, Jan 2, 2011 at 10:25, Gour <gour@atmarama.net> wrote:
>>>> On Sat, 25 Dec 2010 19:09:37 +0100
>>>>>>>>>> "Julien" == <julien.nicoulaud@gmail.com> wrote:
>>>> 
>>>> Julien> Hi,
>>>> Julien> just to say I've created a repository and added everyone who
>>>> Julien> made changes as author:
>>>> Julien> https://github.com/nicoulaj/zsh-syntax-highlighting
>>>> 
>>>> Thanks a lot...Even reason less to switch to fish. ;)
>>>> 
>>>> Otoh, I wonder if it is going to be included as part of zsh?
>>>> 
>>>> 
>>>> Sincerely,
>>>> Gour
>>>> 
>>>> --
>>>> 
>>>> Gour  | Hlapicina, Croatia  | GPG key: CDBF17CA
>>>> ----------------------------------------------------------------
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> LIVE LIKE YOUR CAPS LOCK BUTTON IS JAMMED.
>>> 
>> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get syntax highlighting working??
  2011-01-05 20:20           ` Sorin Ionescu
@ 2011-01-05 20:44             ` Julien Nicoulaud
  0 siblings, 0 replies; 8+ messages in thread
From: Julien Nicoulaud @ 2011-01-05 20:44 UTC (permalink / raw)
  To: Sorin Ionescu; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 4321 bytes --]

Hi Sorin, we know about it:
https://github.com/nicoulaj/zsh-syntax-highlighting/issues#issue/26 (by the
way, please try to use the project to report issues instead of the
mailing-list, because not all contributors watch it)
 <https://github.com/nicoulaj/zsh-syntax-highlighting/issues#issue/26>We
will try to fix this ASAP.


2011/1/5 Sorin Ionescu <sorin.ionescu@gmail.com>

> The 'Bind all ZLE events from zle -la to highlighting function.’ loop on
> line 216 is problematic. It overwrites existing bindings and conflicts with
> other scripts. For example, I have a vi-mode oh-my-zsh plugin that indicates
> when ZSH is in vicmd in ~/.oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh
> which I have pasted bellow.
>
>
>
> # Allow command line editing in an external editor.
> autoload -Uz edit-command-line
>
> # If mode indicator wasn't setup by theme, define a default.
> if [[ "$MODE_INDICATOR" == "" ]]; then
>
>  MODE_INDICATOR="%{$fg_bold[red]%}<%{$reset_color%}%{$fg[red]%}<<%{$reset_color%}"
> fi
>
> function zle-line-init {
>  zle reset-prompt
> }
>
> # If I am using vi keys, I want to know what mode I'm currently using.
> # zle-keymap-select is executed every time KEYMAP changes.
> # From http://zshwiki.org/home/examples/zlewidgets
> rprompt_cached=$RPROMPT
> function zle-line-init zle-keymap-select {
>  RPROMPT="${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/$rprompt_cached}"
>  zle reset-prompt
> }
>
> # Accept RETURN in vi command mode.
> function accept_line {
>  RPROMPT=$rprompt_cached
>  builtin zle .accept-line
> }
>
> zle -N zle-line-init
> zle -N zle-keymap-select
> zle -N accept_line
> zle -N edit-command-line
>
> # Avoid binding ^J, ^M,  ^C, ^?, ^S, ^Q, etc.
> bindkey -d # Reset to default.
> bindkey -v # Use vi key bindings.
> bindkey -M vicmd "^M" accept_line # Alow RETURN in vi command.
> bindkey -M vicmd v edit-command-line # ESC-v to edit in an external editor.
>
> bindkey ' ' magic-space
> bindkey -M vicmd "gg" beginning-of-history
> bindkey -M vicmd "G" end-of-history
> bindkey -M vicmd "k" history-search-backward
> bindkey -M vicmd "j" history-search-forward
> bindkey -M vicmd "?" history-incremental-search-backward
> bindkey -M vicmd "/" history-incremental-search-forward
>
> bindkey -M viins "^L" clear-screen
> bindkey -M viins "^W" backward-kill-word
> bindkey -M viins "^A" beginning-of-line
> bindkey -M viins "^E" end-of-line
>
>
> On 5 Jan 2011, at 06:08, Michel wrote:
>
> > Thanks ! I haven't awser because I haven't network at home, but your
> > work is really nice.
> >
> > Thank you very much to all contributors !
> > _____________________
> > Michel BARRET
> >
> >
> >
> > 2011/1/5 Julien Nicoulaud <julien.nicoulaud@gmail.com>:
> >> Thanks William,
> >> I applied your fix:
> >>
> https://github.com/nicoulaj/zsh-syntax-highlighting/commit/a640bb8b96fe95077b8a8ddc6a31f49912a060ee
> >> .
> >>
> >>
> >> 2011/1/5 William <sirrobin2318@gmail.com>
> >>
> >>> Hi,
> >>>
> >>> I know this is a poor excuse for a patch, but access to git is blocked
> >>> from here.
> >>> To get this to work with my config, I had to change this line;
> >>>                        local aliased_command=${"$(alias $arg)"#*=}
> >>> to
> >>>                        local aliased_command="${"$(alias $arg)"#*=}"
> >>> in _zsh_highlight-zle-buffer, line 166 (in the current version anyway).
> >>>
> >>> nice work btw!
> >>>
> >>>
> >>> On Sun, Jan 2, 2011 at 10:25, Gour <gour@atmarama.net> wrote:
> >>>> On Sat, 25 Dec 2010 19:09:37 +0100
> >>>>>>>>>> "Julien" == <julien.nicoulaud@gmail.com> wrote:
> >>>>
> >>>> Julien> Hi,
> >>>> Julien> just to say I've created a repository and added everyone who
> >>>> Julien> made changes as author:
> >>>> Julien> https://github.com/nicoulaj/zsh-syntax-highlighting
> >>>>
> >>>> Thanks a lot...Even reason less to switch to fish. ;)
> >>>>
> >>>> Otoh, I wonder if it is going to be included as part of zsh?
> >>>>
> >>>>
> >>>> Sincerely,
> >>>> Gour
> >>>>
> >>>> --
> >>>>
> >>>> Gour  | Hlapicina, Croatia  | GPG key: CDBF17CA
> >>>> ----------------------------------------------------------------
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> LIVE LIKE YOUR CAPS LOCK BUTTON IS JAMMED.
> >>>
> >>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-01-05 20:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-25 13:16 How to get syntax highlighting working?? Guido van Steen
2010-12-25 18:09 ` Julien Nicoulaud
2011-01-02  9:25   ` Gour
2011-01-05  9:56     ` William
2011-01-05 10:35       ` Julien Nicoulaud
2011-01-05 11:08         ` Michel
2011-01-05 20:20           ` Sorin Ionescu
2011-01-05 20:44             ` Julien Nicoulaud

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).