Skip to content

Commit

Permalink
✨ feat: added zsh-autosuggestions, zsh-syntax-highlighting and update…
Browse files Browse the repository at this point in the history
…d codebase #9 #4
  • Loading branch information
pnguyen215 committed Dec 30, 2023
1 parent 6df96d7 commit 00bdcac
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 16 deletions.
64 changes: 48 additions & 16 deletions assets/usage.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
[
{
"title": "Install Homebrew",
"title": "Homebrew Installation",
"key": "wsd_install_brew",
"link": ["https://brew.sh"],
"enabled": false
},
{
"title": "Uninstall Homebrew",
"title": "Homebrew Uninstallation",
"key": "wsd_uninstall_brew",
"link": ["https://brew.sh"],
"enabled": true
},
{
"title": "Install Git",
"title": "Git Installation",
"key": "wsd_install_git",
"link": [
"https://www.atlassian.com/git/tutorials/install-git#install-the-git-credential-osx"
],
"enabled": true
},
{
"title": "Configure Git credentials",
"title": "Git Credentials Configuration",
"key": "wsd_install_git_credentials",
"link": [
"https://www.atlassian.com/git/tutorials/install-git#install-the-git-credential-osx"
],
"enabled": true
},
{
"title": "List Git configs (globally)",
"title": "List Global Git Configurations",
"key": "wsd_list_git_configs",
"link": [
"https://www.atlassian.com/git/tutorials/install-git#install-the-git-credential-osx"
],
"enabled": true
},
{
"title": "Install Zsh",
"title": "Zsh Installation",
"key": "wsd_install_zsh",
"link": [
"https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/",
Expand All @@ -46,7 +46,7 @@
"enabled": true
},
{
"title": "Uninstall Zsh",
"title": "Zsh Uninstallation",
"key": "wsd_uninstall_zsh",
"link": [
"https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/",
Expand All @@ -56,37 +56,37 @@
"enabled": true
},
{
"title": "Add secret.dev",
"title": "Add a Secret to Configuration",
"key": "wsd_add_secret",
"link": [],
"enabled": true
},
{
"title": "Get secret.dev",
"title": "Retrieve a Secret",
"key": "wsd_get_secret",
"link": [],
"enabled": true
},
{
"title": "Get all secret.dev",
"title": "Retrieve All Secrets",
"key": "wsd_get_all_secret",
"link": [],
"enabled": true
},
{
"title": "Remove secret.dev",
"title": "Remove a Secret",
"key": "wsd_remove_secret",
"link": [],
"enabled": true
},
{
"title": "Backup secret.dev",
"title": "Backup Secrets",
"key": "wsd_bak_secret",
"link": [],
"enabled": true
},
{
"title": "Install Java JDK(8)",
"title": "Java JDK(8) Installation",
"key": "wsd_install_jdk8",
"link": [
"https://mkyong.com/java/how-to-install-java-on-mac-osx/#homebrew-install-a-specified-java-adoptopenjdk-on-macos",
Expand All @@ -95,7 +95,7 @@
"enabled": true
},
{
"title": "Uninstall Java JDK(8)",
"title": "Java JDK(8) Uninstallation",
"key": "wsd_uninstall_jdk8",
"link": [
"https://mkyong.com/java/how-to-install-java-on-mac-osx/#homebrew-install-a-specified-java-adoptopenjdk-on-macos",
Expand All @@ -104,7 +104,7 @@
"enabled": true
},
{
"title": "Install Oh-My-Zsh",
"title": "Oh-My-Zsh Installation",
"key": "wsd_install_oh_my_zsh",
"link": [
"https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/",
Expand All @@ -114,13 +114,45 @@
"enabled": true
},
{
"title": "Uninstall Oh-My-Zsh",
"title": "Oh-My-Zsh Uninstallation",
"key": "wsd_uninstall_oh_my_zsh",
"link": [
"https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/",
"https://magz.techover.io/2020/02/29/cai-thien-terminal-mac-dinh-cua-macos-voi-zsh-va-zsh-autosuggestions/",
"https://dev.to/devsk1207/how-to-setup-zsh-on-mac-terminal-37dj"
],
"enabled": true
},
{
"title": "Zsh Autosuggestions Installation (Optional)",
"key": "wsd_install_zsh_autosuggestions",
"link": [
"https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md",
"https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/",
"https://magz.techover.io/2020/02/29/cai-thien-terminal-mac-dinh-cua-macos-voi-zsh-va-zsh-autosuggestions/",
"https://dev.to/devsk1207/how-to-setup-zsh-on-mac-terminal-37dj"
],
"enabled": true
},
{
"title": "Zsh Syntax Highlighting Installation (Optional)",
"key": "wsd_install_zsh_syntax_highlighting",
"link": [
"https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md",
"https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/",
"https://magz.techover.io/2020/02/29/cai-thien-terminal-mac-dinh-cua-macos-voi-zsh-va-zsh-autosuggestions/",
"https://dev.to/devsk1207/how-to-setup-zsh-on-mac-terminal-37dj"
],
"enabled": true
},
{
"title": "PowerLevel10k Oh-My-Zsh Customization (Optional)",
"key": "wsd_customize_theme_oh_my_zsh",
"link": [
"https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/",
"https://magz.techover.io/2020/02/29/cai-thien-terminal-mac-dinh-cua-macos-voi-zsh-va-zsh-autosuggestions/",
"https://dev.to/devsk1207/how-to-setup-zsh-on-mac-terminal-37dj"
],
"enabled": true
}
]
24 changes: 24 additions & 0 deletions src/h.sh
Original file line number Diff line number Diff line change
Expand Up @@ -643,3 +643,27 @@ function editor() {
fi
}
alias ide="editor"

# open_link function
# Open a URL in the default web browser.
#
# Usage:
# open_link <url>
#
# Parameters:
# - <url>: The URL to be opened.
#
# Example usage:
# open_link "https://www.example.com"
#
# Instructions:
# 1. Run the 'open_link' function with the desired URL.
function open_link() {
if [ -z "$1" ]; then
echo "Usage: open_link <url>"
return 1
fi
local url="$1"
wsd_exe_cmd open "$url"
}
alias openlink="open_link"
17 changes: 17 additions & 0 deletions src/plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,20 @@ function uninstall_oh_my_zsh_if_needed() {
echo "🍺 Oh My Zsh is not installed. Nothing to uninstall."
fi
}

function manual_zsh_autosuggestions_if_needed() {
loading_spinner 2
open_link "https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md"
}

function manual_zsh_syntax_highlighting_if_needed() {
loading_spinner 2
open_link "https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md"
}

function manual_customize_theme_oh_my_zsh_if_needed() {
echo "🚀 Clone repository"
wsd_exe_cmd_hook git clone https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
echo "🔧 Edit file .zshrc"
wsd_exe_cmd_hook "ZSH_THEME="powerlevel10k/powerlevel10k""
}
9 changes: 9 additions & 0 deletions src/wsdkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ function wsdkit() {
"wsd_uninstall_oh_my_zsh")
uninstall_oh_my_zsh_if_needed
;;
"wsd_install_zsh_autosuggestions")
manual_zsh_autosuggestions_if_needed
;;
"wsd_install_zsh_syntax_highlighting")
manual_zsh_syntax_highlighting_if_needed
;;
"wsd_customize_theme_oh_my_zsh")
manual_customize_theme_oh_my_zsh_if_needed
;;
*)
echo "❓ Unsupported function."
;;
Expand Down

0 comments on commit 00bdcac

Please sign in to comment.