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

Proposed enhancements to runcoms repo documentation #1540

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hlecuanda
Copy link

Mitigates #1535

Proposed Changes:
Detailed documentation for runcoms
Discussion about the most common pitfalls
(no screenshot available, it is a repo Markdown file...)


@hlecuanda hlecuanda mentioned this pull request Feb 1, 2018
@belak belak self-requested a review February 1, 2018 23:27
@belak
Copy link
Collaborator

belak commented Feb 1, 2018

To anyone interested in reviewing this, it's easiest to look at here: https://github.com/hlecuanda/prezto/blob/5d2b2a776e3ae1145c25d147869371c3ddf1b274/runcoms/README.md

Copy link
Collaborator

@belak belak left a comment

Choose a reason for hiding this comment

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

I've left quite a few comments on this, so this is meant to be a quick summary - I like the rundown of when all the files are loaded and what they should be used for. I think that's useful and should be kept/refined.

However, I don't think the commentary on runcoms belongs in the documentation. That should be discussed in a separate issue. I would be happy to accept a pull request which either adds support for .zlogin.local files (and equivalents for other runcoms) or which changes the recommendation to copying, as long as there's discussion among the other contributors and they're alright with it as well.

Thank-you for taking the time to submit this. There's a ton here which will be helpful.

EDIT: Additionally, minor copy-editing things like capitalization and such, I'd be happy to clean up, so don't worry too much about that. There's a ton of content here, so I think that should be the focus of this PR and any reviews.


### zpreztorc
| always runs | when `GLOBAL_RCS` is set | when `RCS` is set | Purpose | stuff that usually goes there, and notes |
Copy link
Collaborator

Choose a reason for hiding this comment

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

This table is a bit wide... I think we could probably drop a column by having File, and Triggers to replace always runs, when GLOBAL_RCS is set and when RCS is set because only one of those ever has data in it at once.

Copy link
Author

Choose a reason for hiding this comment

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

quite right! i thought so too. and good idea i'll make it so the headers go something lije this:

system/site config (/etc/zsh/*) User's config (${ZDOTDIR:-$HOME}) Purpose Example/Notes
stuff ,+stuff stuff even more stuff
more stuff user stuff Purpose stuff example stuff

|------------------|-----------------------------------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `/etc/zshenv` | | | system provided minimal environment | Always runs! should be minimal set ZDOTDIR, minimal environment. system paths
| | | `${ZDOTDIR:-$HOME}/.zshenv` | user environment overrides non-interactive, non-login shells (when invoked via shebang in a script or via `zsh -c [script]` or when invoked by `make` | personal environment overrides, such as `MANPATH`, `TERM`, `fpath` *non interactive scripts should have their environment completly set up here* )
| | `/etc/zshprofile` | | system profile for login shells (`zsh -ls zsh - or via _ssh forced command_`) | minimal system paths for remote interaction, site `fpath`, site `$LOCALE`, lang.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The man pages I looked at refer to this as /etc/zprofile

Copy link
Author

Choose a reason for hiding this comment

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

O.o indeed... my mistake. i was having tunnel vision or "shop" blindness because i dint catch it even on proofbreading.. haha 😮

| `/etc/zshenv` | | | system provided minimal environment | Always runs! should be minimal set ZDOTDIR, minimal environment. system paths
| | | `${ZDOTDIR:-$HOME}/.zshenv` | user environment overrides non-interactive, non-login shells (when invoked via shebang in a script or via `zsh -c [script]` or when invoked by `make` | personal environment overrides, such as `MANPATH`, `TERM`, `fpath` *non interactive scripts should have their environment completly set up here* )
| | `/etc/zshprofile` | | system profile for login shells (`zsh -ls zsh - or via _ssh forced command_`) | minimal system paths for remote interaction, site `fpath`, site `$LOCALE`, lang.
| | | `${ZDOTDIR:-$HOME}/.zshprofile` | personal preferences for interactive login shells | your preferred `$LOCALE`, `$LANG`, `readlne` config, `cdpath`, session managers, additional `fpath` ) login shells (but non necessarily **ineractive** as when invoked via _ssh remote cmd_ ) will read config up to this point
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similarly, this was ~/.zprofile

| | | `${ZDOTDIR:-$HOME}/.zshprofile` | personal preferences for interactive login shells | your preferred `$LOCALE`, `$LANG`, `readlne` config, `cdpath`, session managers, additional `fpath` ) login shells (but non necessarily **ineractive** as when invoked via _ssh remote cmd_ ) will read config up to this point
| | `/etc/zshrc` | | system provided startup script, for interactive shells, (local shells that live in an `XTerm`, `URxvt`, `gnome-terminal`) or subshells (like running `xterm` from the command prompt of a _login xterm_, | site login accounting, security monitors, site command logging policy
| | | `${ZDOTDIR:-$HOME}/.zshrc` | user customization of their *interactive* environment for terminals | sourcing custom completions (`gcloud.comp.inc`), custom user frameworks (zprezto is invoked here), additional path required by custom software installed in `/opt/*`
| | `/etc/zshlogin` | | additional customization for interactive **login** shells, such as those accessed via ssh | tmux attach to existing session
Copy link
Collaborator

Choose a reason for hiding this comment

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

/etc/zlogin

| | `/etc/zshrc` | | system provided startup script, for interactive shells, (local shells that live in an `XTerm`, `URxvt`, `gnome-terminal`) or subshells (like running `xterm` from the command prompt of a _login xterm_, | site login accounting, security monitors, site command logging policy
| | | `${ZDOTDIR:-$HOME}/.zshrc` | user customization of their *interactive* environment for terminals | sourcing custom completions (`gcloud.comp.inc`), custom user frameworks (zprezto is invoked here), additional path required by custom software installed in `/opt/*`
| | `/etc/zshlogin` | | additional customization for interactive **login** shells, such as those accessed via ssh | tmux attach to existing session
| | | `${ZDOTDIR:-$HOME}/.zshlogin` | user script for *login shell startup* (this shell is a session leader, and allocates a `ptty` | aliases, keybindings, personal startup programs, time tracking apps, session managers, quote of the day, fortunes
Copy link
Collaborator

Choose a reason for hiding this comment

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

~/.zlogin

you would call `xterm -e zsh -ls` on tmux you may add one of the following
lines to your `.tmux.conf`:

```config
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume this is meant to be bash, similar to the second block.

set $XTERM_CMD='xterm -e zsh -ls`
bind $mod+x $XTERM_CMD
...
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a nit-pick, but I prefer to see new-lines between paragraphs, even if it's just a code block.

Copy link
Author

@hlecuanda hlecuanda Feb 8, 2018

Choose a reason for hiding this comment

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

in the end i decided to drop the indent and make the example more concise. In this case, purposely added something that looked like ellipsis ( . . . ) to mean that we were only looking at a section of thee file and that further lines followed, as well as more lines before...

maybe using ellipsis is not as common a convention as i thought it was... 🤔

set -g default-shell '/usr/bin/zsh -ls'
```

Here is an examplefor *i3wm* on ubuntu
Copy link
Collaborator

Choose a reason for hiding this comment

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

examplefor should be two words.

Copy link
Author

Choose a reason for hiding this comment

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

plus, should be backwards... u.u

end up with bloated shells on non-interactive environments. Perhaps desktop
workstation users will not notice any difference, but in resource-constrained
environments it may be significant in terms of execution time and energy
consumption (v.gr when running a Raspberry PI on batteries or on a cell
Copy link
Collaborator

Choose a reason for hiding this comment

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

v.gr?

Copy link
Author

Choose a reason for hiding this comment

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

v.gr : shorthand of verbi gratia / "for example" although literal latin translation would be "for the sake of a word"... she's Q.E.D.'s (Quod Erat Demostrandum) ugly cousin... 😺

distributed *runcoms* **as is** which is a terrible idea, since doing
`git pull` to update your distribution will clobber your customizations.

it’s a better idea to *copy* the distributed *runcoms* to your `$ZDOTDIR` a
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit of a larger discussion. There have been talks about adding zlogin.local (and equivalents for the other files) which would be automatically sourced in the official prezto runcoms... and there's been talk of copying rather than symlinking. There hasn't been a general consensus yet, but that's mostly because noone has really taken the initiative to push a change like that through. I would be fine with either solution.

The original workflow with prezto was essentially fork the repo and make your own tweaks and changes there... which I understand, but I think it does the opposite of what was intended - a smaller amount of useful changes make it back into the main repo. I believe this is the reason the runcoms are symlinked. It also removes one step of debugging if you're using the official runcoms... because we don't need to go through all the zsh startup files and figure out where loading prezto went wrong.

I don't know what to do here, but I'd be happy to see a larger discussion come from this (Probably in a new issue)... however, even if I don't agree with it, I don't think documentation included with the prezto repo should be saying that the official recommendation (at least what we're currently recommending) is a "terrible idea" and that it's a better idea to do something different from what we suggest in the main README.

That being said, there are a number of easy to make mistakes, so providing a list of potential pitfalls and how to avoid them would be useful.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your feedback! I'll try and incorporate your observations, and yup there are a bunch of typos and dyslexyc mistakes. let's see how the second round comes up. =)

Also, modified wording to avoid disparraging efforts on
configuration style before the team addresses them
Copy link
Author

@hlecuanda hlecuanda left a comment

Choose a reason for hiding this comment

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

I believe i've addressed most of your concerns. Thank you for your valuable feedback =)

|------------------|-----------------------------------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `/etc/zshenv` | | | system provided minimal environment | Always runs! should be minimal set ZDOTDIR, minimal environment. system paths
| | | `${ZDOTDIR:-$HOME}/.zshenv` | user environment overrides non-interactive, non-login shells (when invoked via shebang in a script or via `zsh -c [script]` or when invoked by `make` | personal environment overrides, such as `MANPATH`, `TERM`, `fpath` *non interactive scripts should have their environment completly set up here* )
| | `/etc/zshprofile` | | system profile for login shells (`zsh -ls zsh - or via _ssh forced command_`) | minimal system paths for remote interaction, site `fpath`, site `$LOCALE`, lang.
Copy link
Author

Choose a reason for hiding this comment

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

O.o indeed... my mistake. i was having tunnel vision or "shop" blindness because i dint catch it even on proofbreading.. haha 😮

@hlecuanda
Copy link
Author

I believe you're quite right, sometimes less is more.. If however you feel the longer writeup could be valuable for users and the team, I'd be glad to post it perhaps in the project's wiki? I've incorporated your remarks. This new version touches on the issues of configuration in a way that is positive for both schools of thought regarding copying or merging of runcoms; without digressing on the finer points of bootstrapping flows and how parameters affect them 😆 (i admit i get carried away) Now, back to holiday in MX hehe.

@belak
Copy link
Collaborator

belak commented Feb 7, 2018

Any chance you could allow maintainer edits? I've got a few smaller things I'd like to fix up before merging this in.

@hlecuanda
Copy link
Author

um.... unless i'm missing something, maintainers should be able to edit... the "allow edits from maintainers" option is ticked on this screen... =)

@belak
Copy link
Collaborator

belak commented Feb 8, 2018

Hm, might be something on my end then. Thanks for checking.

@belak
Copy link
Collaborator

belak commented Feb 9, 2018

Unfortunately, only sorin has admin access to the repo, so I don't think I can actually enable the wiki without him getting involved, so I'd rather avoid that for now.

With triaging issues and PRs, I'd be happy to have some additional help. I've been very slowly going through them in my spare time, but I haven't much lately. The ones that are left are (for the most part) issues that I'm not sure what to do about, but there's definitely still stuff to do. There are a few things to keep in mind, though: new themes and modules can be pointed at the contrib repo (we're trying to avoid merging those in here for now) and any large/breaking changes need to have a really good reason. This is still sorin's project and one of his goals was to avoid this turning into a giant mess with hundreds of modules. Thanks for offering to help!

Additionally, I'm going to be out for at least the weekend so it might be a while until I make my way back to this.

@hlecuanda
Copy link
Author

agreed! i guess the rule of thumb is, universal features such as syntax highlighting or performance enhancements (such as troubleshooting compdumps should live here, in core. Vertical, narrow functionality (say bindings and aliases for Ansible) clearly should resde in "/contrib" i'll see what i can do regardng some issues that can be resolved as support issues,,,

@hlecuanda
Copy link
Author

Sorry didnt realise I made a horrible mes with the table. Fixed it and some embarrasing typos...
here is the link to the write-up: https://github.com/hlecuanda/prezto/blob/5ec8ce51751673bbb4e3f1c1d84858ea48fd21e5/runcoms/README.md

contain.
```bash
if [[ -n $ZDOTDIR ]]; then
DOTFILES_PATH=$ZDOTDIR
Copy link

Choose a reason for hiding this comment

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

Minor nit: can you remove a space from the beginning here to be consistent with the else branch?

| system/site config </br> (`/etc/zsh/**`) [2] | User configuration </br>(`${ZDOTDIR:-$HOME}`) [3] | Purpose | stuff that usually goes there, and notes |
|----------------------------------------------|---------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `/zshenv` [1] | | system provided minimal environment | Should be minimal set ZDOTDIR, minimal environment. system paths |
| | `.zshenv` | user environment overrides non-interactive, non-login shells (when invoked via _shebang_ in a script or via `zsh -c [script]` or when invoked by `make` | Personal environment overrides, such as `MANPATH`, `TERM`, `fpath` (*non interactive scripts should have their environment completly set up here* ) |
Copy link

Choose a reason for hiding this comment

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

s/completly/completely

| `/zlogin` | | additional customization for interactive **login** shells, such as those accessed via ssh | `tmux attach` to existing session |
| | `.zlogin` | user script for *login shell startup* (this shell is a session leader, and allocates a `ptty`) | aliases, keybindings, personal startup programs, time tracking apps, session managers, quote of the day, fortunes |
| ... your shell.. | ..session... | ..happens... | ..here ... |
| | `.zlogout` | personal cleanup tasks | unmounting your *fuse* personal fylesystems, async encryption of sensitive directoriesm backup kickoff, setting personal `crontabs` or `at` tasks, logging checout to your time tracking software, fortune to say goodbye. |
Copy link

Choose a reason for hiding this comment

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

Looks like a few typos here: "fylesystems", "directoriesm", "checout"

necessary. So, with this in mind you have the flexibility to adapt the `zsh`
features that prezto surfaces to your workload and tastes, ranging from the
prompt theme, shortcut keys, favorite editor and pager, aliases and even
syntax highlighting.! **Prezto is designed in such a way to allow you to
Copy link

Choose a reason for hiding this comment

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

Either . or ! is needed; both is extra.

syntax highlighting.! **Prezto is designed in such a way to allow you to
configure other aspects of your shell in the appropriate files wthout breaking
the framework** or forcing you to write your preferences in a particular
plugin structure. In the end, its a matter of editing one ofthe files
Copy link

Choose a reason for hiding this comment

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

s/its/it's, s/ofthe/of the


That being said, you can use the runcoms files _as-is_, replacing your old
files with prezto's baseline, or you can merge your customizations with
prezto's runcoms.!
Copy link

Choose a reason for hiding this comment

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

Same comment about .!

be set, if that is not the case, check the above discussion, you can
'replace' your shell _in situ_ by issuing the command `exec zsh -l`

you can configure your graphical environment or `tmux` to lauch nteractive
Copy link

Choose a reason for hiding this comment

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

s/lauch/launch, s/nteractive/interactive

# LINES! or you may end up
# with nested shells
```
Here is an examplefor *i3wm* on ubuntu
Copy link

Choose a reason for hiding this comment

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

s/examplefor/example for

use your computer. It even offers _feature parity_ between different OSs, as
long as they run `zsh`

So, depending on the way you are connected or using yor computer, you'd need
Copy link

Choose a reason for hiding this comment

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

s/yor/your

probably don't need aliases or keybindings, but a human user will certainly
appreciate it, as shortcuts can make you more productive. When Logging via an
XTerminal or remotely logging in using ssh may look like similar tasks, but
resource and configuration-wise they are worlds appart. So, so far we already
Copy link

Choose a reason for hiding this comment

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

s/appart/apart

## Make Prezto your own: Configuration and personal preferences

That is quite a few files to configure a shell. Why so many? Mostly to
accomodate different roles for shell software. Automated Shell scripts
Copy link

Choose a reason for hiding this comment

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

s/accomodate/accommodate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants