-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolkit.nu
executable file
·149 lines (113 loc) · 2.82 KB
/
toolkit.nu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
def --wrapped main [...rest] {
const pathToSelf = path self
let nameOfSelf = $pathToSelf | path parse | get stem
nu -c $'use ($pathToSelf); ($nameOfSelf) ($rest | str join (" "))'
}
export def update-readme [] {
$'
<p align="center">
<img src=".icon.png" alt="dotfiles icon" width="400" height="400"/>
</p>
# Dotfiles
<img alt="GitHub workflow status" src="https://img.shields.io/github/actions/workflow/status/NonlinearFruit/dotfiles/ci.yml">
A simple repo that elegantly manages my configs and scripts using `init.sh` and `map.sh`
## Setup on fresh OS
Might need to `sudo apt update && sudo apt upgrade` if some dependencies can not install
```sh
sudo apt update
sudo apt install -y git
git clone https://github.com/NonlinearFruit/dotfiles ~/projects/dotfiles
cd ~/projects/dotfiles
./init.sh common | sh
./map.sh common | sh
```
### OS Specific Setup and Mappings
For configuration specific to a particular OS, create setup and mappings for it. For instance, if you have a `setups/termux.sh` and a `mappings/wsl.json`, then you can:
```sh
./init.sh common termux | sh
./map.sh common wsl | sh
```
## Features
<details><summary>Configs</summary>
The actual dotfiles for various tools
(get-configs | each { { Config: $in } } | to md)
</details>
<details><summary>Scripts</summary>
Helpful automation for various tasks
(get-scripts | each { { Script: $in } } | to md)
</details>
<details><summary>Setups</summary>
Automation for initializing a fresh OS
(get-setups | each { { Setup: $in } } | to md)
</details>
<details><summary>Mappings</summary>
Symlink any config file to any location
(get-mappings | each { { Mapping: $in } } | to md)
</details>
<details><summary>Cheatsheets</summary>
Custom TLDR pages
(get-cheatsheets | each { { Cheatsheet: $in } } | to md)
</details>
## Formatting
```sh
~/.local/share/nvim/mason/bin/stylua --verify . # Lua
```
## Restarting
- Throw away current nvim config
```sh
rm ~/{.local/share,.config}/nvim/* -rf
```
'
| save -f README.md
}
def get-configs [] {
let not_configs = [
README, toolkit
cheatsheets, scripts
init, setups
map, mappings
]
ls
| get name
| path parse
| where stem not-in $not_configs
| get stem
| uniq
| sort
}
def get-scripts [] {
ls scripts
| get name
| path parse
| where ($it.extension | is-empty)
| get stem
| sort
}
def get-mappings [] {
ls mappings
| get name
| path parse
| get stem
| sort
}
def get-setups [] {
ls setups
| get name
| path parse
| get stem
| sort
}
def get-cheatsheets [] {
ls cheatsheets
| get name
| path parse
| get stem
| sort
}
# https://github.com/folke/lazy.nvim/discussions/1034#discussioncomment-7034355
export def update-nvim-packages [] {
^nvim --headless "+Lazy! sync" +qa
}
export def format [] {
^~/.local/share/nvim/mason/bin/stylua --verify . # Lua
}