-
-
Notifications
You must be signed in to change notification settings - Fork 964
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
add write_perm
func and doc
#340
Changes from 4 commits
15b133e
c29b8f0
2fa3268
a98b1f1
18678ac
03e8804
dd75056
5a63d9d
dfe3e60
afa34d7
bd910dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,7 @@ Hostname is shown only when you're connected via SSH unless you change this beha | |
### Directory (`dir`) | ||
|
||
Directory is always shown and truncated to the value of `SPACESHIP_DIR_TRUNC`. While you are in repository, it shows only root directory and folders inside it. | ||
If current directory is write-protected or if current user has not enought rights to write in, a padlock (by default) s displayed as suffix. | ||
|
||
| Variable | Default | Meaning | | ||
| :------- | :-----: | ------- | | ||
|
@@ -135,7 +136,9 @@ Directory is always shown and truncated to the value of `SPACESHIP_DIR_TRUNC`. W | |
| `SPACESHIP_DIR_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after current directory | | ||
| `SPACESHIP_DIR_TRUNC` | `3` | Number of folders of cwd to show in prompt, 0 to show all | | ||
| `SPACESHIP_DIR_TRUNC_REPO` | `true` | While in `git` repo, show only root directory and folders inside it | | ||
| `SPACESHIP_DIR_COLOR` | `cyan` | Color of directory section | | ||
| `SPACESHIP_DIR_COLOR` | `cyan` | Color of directory section |'' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove empty string after the last column separator. |
||
| `SPACESHIP_DIR_LOCK_SYMBOL` | `🔒` | The symbol displayed if directory is write-protected | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space into the docs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry :/ |
||
| `SPACESHIP_DIR_LOCK_COLOR` | `red` | Color for the symbol | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the lock symbol |
||
|
||
### Git (`git`) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,4 +56,3 @@ | |
* [spaceship::displaytime](/docs/API.md#spaceshipdisplaytime-seconds) | ||
* [spaceship::union](/docs/API.md#spaceshipunion-arr1-arr2-) | ||
* [Troubleshooting](/docs/Troubleshooting.md) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not remove the last empty line. You can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted to original file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ SPACESHIP_DIR_SUFFIX="${SPACESHIP_DIR_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"} | |
SPACESHIP_DIR_TRUNC="${SPACESHIP_DIR_TRUNC=3}" | ||
SPACESHIP_DIR_TRUNC_REPO="${SPACESHIP_DIR_TRUNC_REPO=true}" | ||
SPACESHIP_DIR_COLOR="${SPACESHIP_DIR_COLOR="cyan"}" | ||
SPACESHIP_DIR_LOCK_SYMBOL="${SPACESHIP_DIR_LOCK_SYMBOL="🔒"}" | ||
SPACESHIP_DIR_LOCK_COLOR="${SPACESHIP_DIR_LOCK_COLOR=red}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please quote the color variable. |
||
|
||
# ------------------------------------------------------------------------------ | ||
# Section | ||
|
@@ -23,6 +25,8 @@ spaceship_dir() { | |
|
||
local dir | ||
|
||
[[ -w . ]] && SPACESHIP_WRITE_PERM_SYMBOL='' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line is not needed, right? |
||
|
||
# Threat repo root as a top-level directory or not | ||
if [[ $SPACESHIP_DIR_TRUNC_REPO == true ]] && spaceship::is_git; then | ||
local git_root=$(git rev-parse --show-toplevel) | ||
|
@@ -31,6 +35,10 @@ spaceship_dir() { | |
dir="%${SPACESHIP_DIR_TRUNC}~" | ||
fi | ||
|
||
if [[ ! -w . ]]; then | ||
SPACESHIP_DIR_SUFFIX="%F{$SPACESHIP_DIR_LOCK_COLOR} $SPACESHIP_DIR_LOCK_SYMBOL %f" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you are using this approach, I suggest these improvements:
So this line I guess should become something like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @phineas0fog I updated the last line ^^ a little after publishing, just so you know. For readability, I think this is the best:
|
||
fi | ||
|
||
spaceship::section \ | ||
"$SPACESHIP_DIR_COLOR" \ | ||
"$SPACESHIP_DIR_PREFIX" \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny: if current user has not enough
trights to write in it, a padlock (by default) is displayed as a suffix