summaryrefslogtreecommitdiff
path: root/Ports
diff options
context:
space:
mode:
authorFabian Dellwing <fabian.dellwing@gmail.com>2023-04-22 20:00:28 +0200
committerJelle Raaijmakers <jelle@gmta.nl>2023-04-25 20:48:51 +0200
commit6acf03d9a8ebbe5c2d39d489fc142ff4b50ad11a (patch)
tree377147a19fe7f4d97765a94255d6fb955f39fe0e /Ports
parent3d4d0a1243f319b6fa6c8ca15cd4fad87e6df57a (diff)
downloadserenity-6acf03d9a8ebbe5c2d39d489fc142ff4b50ad11a.zip
Ports: Add default zshrc
Previosly we had a very messed up PS1 as the Shell PROMPT is not unset correctly. We now provide a default `zshrc` file for the system that uses sane values for basic categories like aliases, autocompletion and history management to make the port more usable. It also forces the prompt to be the default zsh one.
Diffstat (limited to 'Ports')
-rw-r--r--Ports/zsh/.gitignore1
-rwxr-xr-xPorts/zsh/package.sh4
-rw-r--r--Ports/zsh/zshrc46
3 files changed, 51 insertions, 0 deletions
diff --git a/Ports/zsh/.gitignore b/Ports/zsh/.gitignore
new file mode 100644
index 0000000000..b3dc045a26
--- /dev/null
+++ b/Ports/zsh/.gitignore
@@ -0,0 +1 @@
+!zshrc
diff --git a/Ports/zsh/package.sh b/Ports/zsh/package.sh
index f8456eb880..c2aba2652d 100755
--- a/Ports/zsh/package.sh
+++ b/Ports/zsh/package.sh
@@ -13,3 +13,7 @@ pre_configure() {
post_configure() {
run_replace_in_file "s/define HAVE_PRCTL 1/undef HAVE_PRCTL/" config.h
}
+
+post_install() {
+ cp "${PORT_META_DIR}/zshrc" "${SERENITY_INSTALL_ROOT}/etc/"
+}
diff --git a/Ports/zsh/zshrc b/Ports/zsh/zshrc
new file mode 100644
index 0000000000..89b0c44154
--- /dev/null
+++ b/Ports/zsh/zshrc
@@ -0,0 +1,46 @@
+###############
+# Completions #
+###############
+
+# Completions
+autoload -U compinit
+compinit -C
+
+# Arrow key menu for completions
+zstyle ':completion:*' menu select
+
+# Case-insensitive (all),partial-word and then substring completion
+zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
+
+###########
+# Aliases #
+###########
+
+# Set up aliases
+alias ll='ls -l'
+
+# Autocomplete command line switches for aliases
+setopt completealiases
+
+###########
+# History #
+###########
+
+# number of lines kept in history
+HISTSIZE=1000
+# number of lines saved in the history after logout
+SAVEHIST=1000
+# location of history
+HISTFILE=~/.zsh_history
+# append command to history file once executed
+setopt inc_append_history
+# only show past commands that include the current input
+bindkey "^[[A" history-beginning-search-backward
+bindkey "^[[B" history-beginning-search-forward
+
+########
+# Misc #
+########
+
+# Set prompt
+PROMPT='%m%# '