Skip to content

Commit

Permalink
update packages and zsh plugins, add dependabot auto-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruzzy77 committed Apr 12, 2024
1 parent 170aba6 commit 7f49992
Show file tree
Hide file tree
Showing 14 changed files with 688 additions and 473 deletions.
2 changes: 2 additions & 0 deletions .config/coverage.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#:schema https://json.schemastore.org/pyproject

# Coverage configuration
[tool.coverage]
[tool.coverage.paths]
Expand Down
126 changes: 99 additions & 27 deletions .config/extras/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,54 @@ ZSH_THEME="powerlevel10k/powerlevel10k"
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
branch
command-not-found
colorize
fd
fig
fzf
jsontools
nmap
nvm
poetry
poetry-env
safe-paste
sudo
ssh-agent
systemadmin
themes
ufw
history
last-working-dir
per-directory-history
zsh-interactive-cd
zsh-history-substring-search
zsh-completions
zsh-syntax-highlighting
zsh-autosuggestions
######################################
history
jsontools
safe-paste
copypath
######################################
command-not-found
sudo
systemadmin
ssh-agent
######################################
colorize
themes
######################################
git
branch
nvm
poetry
######################################
ufw
nmap
######################################
ubuntu
######################################
last-working-dir
per-directory-history
######################################
zsh-completions
zsh-interactive-cd
zsh-navigation-tools
zsh-autosuggestions
zsh-syntax-highlighting
fast-syntax-highlighting
zsh-history-substring-search # load after zsh-syntax-highlighting
######################################
fig
fzf
######################################
auto-color-ls
autoupdate # upgrade_oh_my_zsh_custom
zsh-bat
zsh-safe-rm
######################################
)

# zsh-completions
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src

source $ZSH/oh-my-zsh.sh

# User configuration
Expand All @@ -136,13 +156,28 @@ source $ZSH/oh-my-zsh.sh
#
# Example aliases
alias zshconfig="nano ~/.zshrc"
alias zshenv="nano ~/.zshenv"
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

##############################################################################################
# Plugins

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src

# autoupdate
UPDATE_ZSH_DAYS=1
# ZSH_CUSTOM_AUTOUPDATE_QUIET=true

# colorls
source $(dirname $(gem which colorls))/tab_complete.sh
alias lc='colorls -lA --sd'
alias ls='colorls'

##############################################################################################
# Custom Environments

# NVM
export NVM_DIR="$HOME/.nvm"
Expand All @@ -161,5 +196,42 @@ if [ -z "$SSH_AUTH_SOCK" ]; then
eval `cat $HOME/.ssh/ssh-agent`
fi

##############################################################################################
# History

[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTORY_IGNORE="(l|ls|ls *|la|la *|lc|cd|cd -|cd *|pwd|exit|history|history-delete|hsd)"

setopt HIST_IGNORE_DUPS # don't record an entry that was just recorded again.
setopt HIST_IGNORE_SPACE # remove command line from history when first character is a space
setopt HIST_REDUCE_BLANKS # remove unnecessary blanks
setopt HIST_EXPIRE_DUPS_FIRST # delete duplicates first when HISTSIZE is exceeded
setopt HIST_SAVE_NO_DUPS # don't write duplicate entries in the history file
setopt INC_APPEND_HISTORY_TIME # append command to history file immediately after execution
setopt EXTENDED_HISTORY # record command start time
setopt EXTENDED_GLOB

# https://github.com/junegunn/fzf/issues/3522#issuecomment-1872415948
history-delete() {
local +h HISTORY_IGNORE=
local -a ignore
fc -pa "$HISTFILE"
selection=$(fc -rl 1 |
awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0}' |
fzf --multi --bind 'enter:become:echo {+f1}' --header="Tab: select, Enter: confirm delete, Esc: quit" --prompt="Search: " --no-sort --cycle
)
if [ -n "$selection" ]; then
while IFS= read -r line; do ignore+=("${(b)history[$line]}"); done < "$selection"
HISTORY_IGNORE="(${(j:|:)ignore})"
# Write history excluding lines that match `$HISTORY_IGNORE` and read new history.
fc -W && fc -p "$HISTFILE"
else
echo "nothing deleted from history"
fi
}
alias hsd=history-delete

##############################################################################################

# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"
2 changes: 2 additions & 0 deletions .config/pytest.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#:schema https://json.schemastore.org/pyproject

# Configuration for pytest
#
# https://docs.pytest.org/en/latest/reference.html#ini-options-ref
Expand Down
38 changes: 35 additions & 3 deletions .config/scripts/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ sudo apt-get upgrade -y

# Install common packages
sudo apt-get install -y \
shc # Shell script compiler
shc `# Shell script compiler` \
bat `# cat clone with syntax highlighting` \
ruby-full `# Ruby`

# locale
sudo locale-gen ${LANG:-ko_KR.UTF-8}
Expand Down Expand Up @@ -88,9 +90,14 @@ if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightin
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
fi

# Install fast-syntax-highlighting
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting" ]; then
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
fi

# Install zsh-completions
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-completions" ]; then
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions
fi

# Install zsh-history-substring-search
Expand All @@ -100,7 +107,32 @@ fi

# Install Powerlevel10k
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k" ]; then
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
fi

# Install zsh-safe-rm
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-safe-rm" ]; then
git clone https://github.com/mattmc3/zsh-safe-rm ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-safe-rm
fi

# Install zsh-bat
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-bat" ]; then
git clone https://github.com/fdellwing/zsh-bat.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-bat
fi

# Install autoupdate
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/autoupdate" ]; then
git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/autoupdate
fi

# Install auto-color-ls
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/auto-color-ls" ]; then
git clone https://github.com/gretzky/auto-color-ls ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/auto-color-ls
fi

# Install colorls dependency (ruby gem)
if ! command -v colorls &>/dev/null; then
sudo gem install colorls
fi

# Change the default shell to zsh
Expand Down
19 changes: 1 addition & 18 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,7 @@
"esbenp.prettier-vscode",
"tamasfe.even-better-toml",
"IronGeek.vscode-env",
"foxundermoon.shell-format",
"GitHub.copilot",
"mhutchie.git-graph",
"aaron-bond.better-comments",
"maptz.regionfolder",
"njpwerner.autodocstring",
"streetsidesoftware.code-spell-checker",
"yzhang.markdown-all-in-one",
"bierner.markdown-checkbox",
"bierner.markdown-emoji",
"bierner.markdown-footnotes",
"bierner.markdown-preview-github-styles",
"bierner.emojisense",
"usernamehw.errorlens",
"natqe.reload",
"mutantdino.resourcemonitor",
"IBM.output-colorizer",
"jerrygoyal.shortcut-menu-bar"
"foxundermoon.shell-format"
]
}
}
Expand Down
34 changes: 26 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,30 @@

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
- package-ecosystem: devcontainers
directory: /
schedule:
interval: weekly
timezone: Asia/Seoul
target-branch: devcontainer
labels:
- "dependencies"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: weekly
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
timezone: Asia/Seoul
target-branch: devcontainer
labels:
- "dependencies"
# open-pull-requests-limit: 3

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
timezone: Asia/Seoul
target-branch: devcontainer
labels:
- "dependencies"
30 changes: 30 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
25 changes: 20 additions & 5 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@
"singleAttributePerLine": false,

"plugins": ["prettier-plugin-multiline-arrays"],
"multilineArraysWrapThreshold": 0,

"overrides": [
{
"files": ["*.ini", "*.cfg"],
"files": ["*.yml", "*.yaml"],
"options": {
"iniSpaceAroundEquals": true,
"parser": "ini",
"printWidth": 80,
"plugins": ["prettier-plugin-ini"]
"tabWidth": 2,
"parser": "yaml"
}
},
{
"files": "*.md",
"options": {
"printWidth": 200,
"tabWidth": 2
}
},
{
Expand All @@ -26,6 +32,15 @@
"parser": "jsonc",
"trailingComma": "none"
}
},
{
"files": ["*.ini", "*.cfg"],
"options": {
"iniSpaceAroundEquals": true,
"parser": "ini",
"printWidth": 80,
"plugins": ["prettier-plugin-ini"]
}
}
]
}
20 changes: 20 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"recommendations": [
"GitHub.copilot",
"mhutchie.git-graph",
"aaron-bond.better-comments",
"maptz.regionfolder",
"njpwerner.autodocstring",
"streetsidesoftware.code-spell-checker",
"yzhang.markdown-all-in-one",
"bierner.markdown-preview-github-styles",
"davidanson.vscode-markdownlint",
"bierner.emojisense",
"usernamehw.errorlens",
"natqe.reload",
"mutantdino.resourcemonitor",
"IBM.output-colorizer",
"jerrygoyal.shortcut-menu-bar",
"redhat.vscode-yaml"
]
}
Loading

0 comments on commit 7f49992

Please sign in to comment.