Elvish: Porting 'Pure' prompt to elvish

Created on 9 Mar 2019  路  10Comments  路  Source: elves/elvish

Hello,
I'm working on a cross-shell port of pure prompt, initially designed by sindresorhus/pure.

I've written a concise configuration file for zsh, bash and fish shells to hook my scrpipt and now I'm looking to do this for elvish (with whom I`m not familiar).

What is the minimal configuration file required so a user can use my prompt?

question

All 10 comments

prompt.elv

edit:prompt = { python3 yourscript }

elvish doesnt have required facility to get status of previous command

Thanks @solitudeSF
where does the _prompt.elv_ file goes?
Is there there an environment variable to reference this path?

I reckon a can use this file to also define right prompt edit:rprompt.

to be able to use (import) module it has to be in ~/.elvish/lib or subdirectory. elvish dir always resides in $HOME.

elvish has builtin package manager, so one could do epm:install github.com/edouard-lopez/pure and then use github.com/edouard-lopez/pure/config/prompt without .elv. Always forget that you should omit extension.

@edouard-lopez Welcome to Elvish! I'm glad you are contributing the prompt. Mainly what @SolitudeSF said, just a couple of additional clarifications:

  • The epm:install github.com/edouard-lopez/pure command will clone your repo under ~/.elvish/lib/github.com/edouard-lopez/pure, so you will have there all the Python and other files from your repo.
  • Assuming you put the prompt.elv file under config/ in your repo, the command to load it would be use github.com/edouard-lopez/pure/config/prompt (without the .elv)
  • You can have a metadata.json file in the top directory of your repo to include information about the Elvish package (@xiaq: now that I think about it, for multi-purpose repos like this, it might make sense to allow the file to be named elvish-metadata.json or something like this).
  • You can find the full documentation about writing Elvish modules here: https://elv.sh/ref/epm.html, and about prompt themes here: https://elv.sh/ref/edit.html#prompts.

I'm looking forward to trying out your theme!

I created a pull request with the information you gave me.

The project is still in an early stage as I'm gathering information on the different shells and focusing on the Python part.
In the coming weeks, I will setup docker images for the various shells in order to get a complete pipeline to reproduce end-user env as it will help my dev and test more easily.

Feel free to play with it and report any issue :v:

It seems like this issue can be closed since Elvish now supports ANSI color sequences in the output of commands included in prompts and @edouard-lopez has merged support for Elvish into their project.

Agree that this can be closed. The Elvish support in pure-x is still imperfect though. @edouard-lopez I might take a stab a it this weekend and submit a PR to your project to improve it.

@edouard-lopez I've created https://github.com/edouard-lopez/pure-x/pull/32 to improve the existing Elvish integration of your theme.

Thanks for your feedback !
I will have a look at the PR this week

Was this page helpful?
0 / 5 - 0 ratings