Skip to content

Commit af429c2

Browse files
committed
new wiki
1 parent 7cdbe66 commit af429c2

File tree

6 files changed

+424
-6
lines changed

6 files changed

+424
-6
lines changed

.github/workflows/publish-wiki.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish wiki
2+
on:
3+
push:
4+
branches: [main]
5+
paths:
6+
- wiki/**
7+
- .github/workflows/publish-wiki.yml
8+
concurrency:
9+
group: publish-wiki
10+
cancel-in-progress: true
11+
permissions:
12+
contents: write
13+
jobs:
14+
publish-wiki:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: Andrew-Chen-Wang/github-wiki-action@v4

.gitmodules

Lines changed: 0 additions & 5 deletions
This file was deleted.

doc

Lines changed: 0 additions & 1 deletion
This file was deleted.

wiki/Home.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
home

wiki/bag-of-tricks.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Random bag of tricks
2+
3+
## Teach yourself quickly what package manager to use
4+
5+
```zsh
6+
NPM_PATH=$(which npm)
7+
npm () {
8+
if [ -e PNPM-lock.yaml ]
9+
then
10+
echo "Please use PNPM with this project"
11+
elif [ -e yarn.lock ]
12+
then
13+
echo "Please use Yarn with this project"
14+
else
15+
$NPM_PATH "$@"
16+
fi
17+
}
18+
19+
YARN_PATH=$(which yarn)
20+
yarn () {
21+
if [ -e PNPM-lock.yaml ]
22+
then
23+
echo "Please use PNPM with this project"
24+
elif [ -e package-lock.json ]
25+
then
26+
echo "Please use NPM with this project"
27+
else
28+
$YARN_PATH "$@"
29+
fi
30+
}
31+
```
32+
33+
## Git tricks
34+
35+
### Aliases
36+
37+
Aliases to easily update your main branch, e.g after PR was merged.
38+
It updates the branch in the background before switching to it, so that editor/tooling experience the least changes.
39+
40+
- `upc`: update specified branch (defaults to `main`), and switch to it
41+
- `upd`: update specified branch (defaults to `main`)
42+
43+
```
44+
[alias]
45+
upc = "!git updonly \"${1:-main}\" && git checkout \"${1:-main}\" || git pull #"
46+
upd = "!git updonly \"${1:-main}\" || git pull #"
47+
updonly = "!git fetch `git gitremote \"$1\"` \"$1\":\"$1\" #"
48+
gittrack = "!git for-each-ref --format='%(upstream:short)' $(git rev-parse --symbolic-full-name \"$1\") #"
49+
gitremote = "!git gittrack \"$1\" | sed 's@/.*@@' #"
50+
```
51+
52+
### Other recommendations
53+
54+
```
55+
[pull]
56+
rebase = true
57+
[rebase]
58+
autoStash = true
59+
[init]
60+
defaultBranch = main
61+
```
62+
63+
## Znap - Oh My Posh and pnpm auto completion support
64+
65+
Install oh-my-posh, install pnpm autocomple zsh, and use:
66+
67+
```zsh
68+
#znap
69+
# Download Znap, if it's not there yet.
70+
[[ -f ~/Git/zsh-snap/znap.zsh ]] ||
71+
git clone --depth 1 -- \
72+
https://github.com/marlonrichert/zsh-snap.git ~/Git/zsh-snap
73+
74+
source ~/Git/zsh-snap/znap.zsh # Start Znap
75+
76+
# `znap prompt` makes your prompt visible in just 15-40ms!
77+
#znap prompt sindresorhus/pure
78+
79+
# `znap source` automatically downloads and starts your plugins.
80+
znap source marlonrichert/zsh-autocomplete
81+
znap source zsh-users/zsh-autosuggestions
82+
znap source zsh-users/zsh-syntax-highlighting
83+
84+
# `znap eval` caches and runs any kind of command output for you.
85+
znap eval iterm2 'curl -fsSL https://iterm2.com/shell_integration/zsh'
86+
87+
# `znap function` lets you lazy-load features you don't always need.
88+
znap function _pyenv pyenv 'eval "$( pyenv init - --no-rehash )"'
89+
compctl -K _pyenv pyenv
90+
91+
znap eval ohmyposh 'oh-my-posh --init --shell zsh --config ~/jandedobbeleer.omp.json'
92+
znap prompt
93+
94+
source $XDG_CONFIG_HOME/tabtab/zsh/pnpm.zsh
95+
```

0 commit comments

Comments
 (0)