Skip to content

Conversation

shun-shobon
Copy link
Contributor

for syntax highlighting

@jeffreytse
Copy link
Owner

Hi @shun-shobon

Could you explain what does this change for?

Thanks and regards

@shun-shobon
Copy link
Contributor Author

@jeffreytse

I noticed that the text editor that can be started with vv in normal mode does not have syntax highlighting for zsh.
So, I added a .zsh extension to the temp file used by the editor so that it can recognize the file type.

@jeffreytse jeffreytse self-assigned this May 30, 2021
@jeffreytse jeffreytse added the enhancement New feature or request label May 30, 2021
Copy link
Owner

@jeffreytse jeffreytse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove mktemp command?

@shun-shobon
Copy link
Contributor Author

Because mktemp cannot specify a suffix.(mktemp can also dry-run with the -u option, but this is unsafe.)
So I used the process ID instead of mktemp.

@jeffreytse
Copy link
Owner

Thanks for the patch, I prefer to follow the file style of built-in widget edit-command-line (i.e. /tmp/zshXXXXXX). You can try it as below instructions.

autoload -Uz edit-command-line
zle -N edit-command-line
bindkey -M vicmd '!' edit-command-line

It follows the file style of zle built-in widget `edit-command-line`, and it
makes the external editor highlight the syntax correctly.
@jeffreytse jeffreytse merged commit ef1fdbe into jeffreytse:master May 30, 2021
@shun-shobon
Copy link
Contributor Author

shun-shobon commented May 30, 2021

I didn't know about edit-command-line.
Thank you for giving me a better solution!

@jeffreytse
Copy link
Owner

jeffreytse commented May 30, 2021

Now this PR has been adjusted and merged, thank you for your contribution to syntax highlighting to make this plugin better. Hope you have a good day! : )

@shun-shobon shun-shobon deleted the feature/add_zsh_ext branch May 30, 2021 16:06
jeffreytse added a commit that referenced this pull request May 30, 2021
It fixes a wrong change on escaping the control character `^@`,
and this bug is introduced by the PR #109.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants