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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
|
# Dotfiles
<pre>
<p align="center">
██████╗ ██████╗ ████████╗███████╗██╗██╗ ███████╗███████╗
██╔══██╗██╔═══██╗╚══██╔══╝██╔════╝██║██║ ██╔════╝██╔════╝
██║ ██║██║ ██║ ██║ █████╗ ██║██║ █████╗ ███████╗
██║ ██║██║ ██║ ██║ ██╔══╝ ██║██║ ██╔══╝ ╚════██║
██████╔╝╚██████╔╝ ██║ ██║ ██║███████╗███████╗███████║
╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝
</p>
</pre>
<h3 align="center">
Welcome, and make yourself at $HOME
</h3>

> NOTE: Primarily for Linux but currently under work to make this as agnostic/cross-platform as possible
- - -
## Details
- **OS:** [Arch Linux](https://archlinux.org)
- **WM:** [bspwm](https://github.com/baskerville/bspwm)
- **Compositor:** [picom](https://github.com/yshui/picom)
- **Widgets:** [eww](https://github.com/elkowar/eww)
- Bar: [polybar](https://github.com/polybar/polybar)
- **Application Launcher:** [rofi](https://github.com/davatorium/rofi)
- **Shell:** [zsh] (https://zsh.org)
- **Terminal:** [wezterm](https://https://wezfurlong.org/wezterm)
- **Editor:** [neovim](https://neovim.io) and **Config:** [nvim](https://github.com/srdusr/nvim)
- **Fonts:**
* **Icons:** Whitesur
* **UI:** San Francisco
* **Terminal:** JetBrains Mono
- - -
### Installing onto a new system (bare git repository)
1. Avoid weird behaviour/recursion issues when .cfg tries to track itself
```bash
$ echo ".cfg" >> .gitignore
```
2. Clone this repo
```bash
$ git clone --bare https://github.com/srdusr/dotfiles.git $HOME/.cfg
```
3. Set up the alias 'config'
```bash
$ alias config='git --git-dir=$HOME/.cfg --work-tree=$HOME'
```
4. Set local configuration into .cfg to ignore untracked files
```bash
$ config config --local status.showUntrackedFiles no
```
5. Checkout
```bash
$ config checkout
```
---
## Dependencies
- curl
- git
- clang
- gcc
- make
- ninja
- cmake
- wmctrl
- xdo
- xdotool
- ripgrep
- fd
- tmux
- tree-sitter
- vim
- eww
- jgmenu
- xqp
- zsh
---
### Fzf
- Install Fzf
```
$ sudo git clone --depth 1 https://github.com/junegunn/fzf.git /usr/local/bin/fzf
```
- Put this into `.bashrc`/`.zshrc` or any similar shell configuration file to make it persistent across sessions
```bash
export PATH="$PATH:/usr/local/bin/fzf/bin"
export FZF_BASE="/usr/local/bin/fzf"
```
- Also put this in to load fzf keybindings and completions
```bash
# bash
source /usr/local/bin/fzf/shell/key-bindings.bash
source /usr/local/bin/fzf/shell/completion.bash
```
```bash
# zsh
source /usr/local/bin/fzf/shell/key-bindings.zsh
source /usr/local/bin/fzf/shell/completion.zsh
```
---
### Zsh plugins
- Install the plugins
```bash
# Clone zsh-you-should-use
$ git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ~/.config/zsh/plugins/zsh-you-should-use
# Clone zsh-syntax-highlighting
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.config/zsh/plugins/zsh-syntax-highlighting
# Clone zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.config/zsh/plugins/zsh-autosuggestions
```
- Put this into `.zshrc` (preferably at the very end of the file) to allow it to source the plugins across sessions
```bash
# Suggest aliases for commands
source ~/.config/zsh/plugins/zsh-you-should-use/you-should-use.plugin.zsh
# Load zsh-syntax-highlighting
source ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Load fish like auto suggestions
source ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
source ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
```
---
### Wezterm
- Make sure Rust is installed first
```bash
$ curl https://sh.rustup.rs -sSf | sh -s
```
- Install and build Wezterm
```bash
$ git clone --depth=1 --branch=main --recursive https://github.com/wez/wezterm.git
$ cd wezterm
$ git submodule update --init --recursive
$ ./get-deps
$ cargo build --release
$ cargo run --release --bin wezterm -- start
```
---
### Neovim
> Dependencies
| Platform | ninja-build | ninja | base-devel | build-base | coreutils | gmake | cmake | make | gcc | g++ | gcc-c++ | unzip | wget | curl | gettext | gettext-tools | gettext-tiny-dev | automake | autoconf | libtool | libtool-bin | pkg-config | pkgconfig | pkgconf | tree-sitter | patch | doxygen | sha | git | Pack Manager |
| ------------------ | ----------- | ----- | ---------- | ---------- | --------- | ----- | ----- | ---- | --- | --- | ------- | ----- | ---- | ---- | ------- | ------------- | ---------------- | -------- | -------- | ------- | ----------- | ---------- | --------- | ------- | ----------- | ----- | ------- | --- | --- | ------------ |
| Ubuntu/Debian | ✓ | | | | | | ✓ | | | ✓ | | ✓ | | ✓ | ✓ | | | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | ✓ | | | apt-get |
| CentOS/RHEL/Fedora | ✓ | | | | | | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | ✓ | | | ✓ | ✓ | ✓ | | | ✓ | | | ✓ | | | | dnf |
| openSUSE | | ✓ | | | | | ✓ | | | | ✓ | | | ✓ | | ✓ | | ✓ | ✓ | ✓ | | | | | | | | | | zypper |
| Arch Linux | | ✓ | ✓ | | | | ✓ | | | | | ✓ | | ✓ | | | | | | | | | | | ✓ | | | | | pacman |
| Alpine Linux | | | | | ✓ | | ✓ | | | | | ✓ | | ✓ | | | ✓ | ✓ | ✓ | ✓ | | | | ✓ | | | | | | apk |
| Void Linux | | | ✓ | ✓ | | | ✓ | | | | | | | ✓ | | | | | | | | | | | | | | | ✓ | xbps |
| FreeBSD | | | | | | ✓ | ✓ | | | | | ✓ | ✓ | ✓ | ✓ | | | | | ✓ | | | | ✓ | | | | ✓ | | pkg |
| OpenBSD | | | | | | ✓ | ✓ | | | | | ✓ | | ✓ | | ✓ | | ✓ | ✓ | ✓ | | | | | | | | | | pkg_add |
| macOS/Homebrew | | ✓ | | | | | ✓ | | | | | | | ✓ | ✓ | | | ✓ | | ✓ | | ✓ | | | | | | | | brew |
| macOS/MacPorts | | ✓ | | | | | ✓ | | | | | | | | ✓ | | | | | | | | | | | | | | | port |
- Install (default is nightly)
```bash
$ git clone https://github.com/neovim/neovim.git
$ cd neovim
```
- Optional install stable version
```bash
$ git checkout stable
```
- or specific version by tag
```bash
$ git checkout release-0.7
```
- Build nvim
```bash
$ make CMAKE_BUILD_TYPE=Release
$ sudo make install
```
- Install Packer (package manager)
```bash
$ git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim
```
- Post-installation:
- Install plugins
```vi
:PackerSync
```
- or save/write on .config/nvim/lua/user/pack.lua to automatically install plugins
```vi
:w
```
- Install language servers
```vi
:Mason
```
- Exit out of Mason with `q`, configured language servers should then install automatically
> NOTE: If any errors occur, npm needs to be installed and executable, complete **_Development Environment/Languages/Javascript_** section to install nvm/npm
- Reload nvim/config with `<leader><space>` where `<leader>` is `;`
- Uninstall:
```bash
$ sudo rm /usr/local/bin/nvim
$ sudo rm -r /usr/local/share/nvim/
```
---
### Gnome Custom Settings
- Run gnome custom settings script, located at `~/.scripts`:
```bash
$ gsettings.sh
```
---
## Development Environment
### Languages
#### Python
```bash
```
---
#### Java
Recommended to choose Openjdk 8 or 10 otherwise get an error when using Android tools
```bash
```
---
#### Rust
- Download and run rustup script
```bash
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
---
#### Go
```bash
```
---
#### Lua
- Download LuaRocks
```bash
$ git clone git://github.com/luarocks/luarocks.git
```
- Install and specify the installation directory to build and configure LuaRocks
```bash
$ ./configure --prefix=/usr/local/luarocks
$ make build
$ sudo make install
```
- Add LuaRocks to system's environment variables by running the following command or add it `.bashrc`/`.zshrc` or any similar shell configuration file to make it persistent across sessions
```bash
export PATH=$PATH:/usr/local/luarocks/bin
```
- Install Lua
```bash
$ luarocks install lua
```
---
#### PHP
- Install PHP
- Install Web server (Apache or Nginx)
- Install PHP extensions
```
php-apache php-cgi php-fpm php-gd php-embed php-intl php-redis php-snmp
mysql-server php8.1-mysql
phpmyadmin
```
- Install composer (Dependency Manager for PHP)
```bash
$ curl -sS https://getcomposer.org/installer | php
```
- Install laravel
```bash
$ composer global require laravel/installer
```
- Edit PHP config
```bash
$ sudoedit /etc/php/php.ini
```
- Enable PHP extensions, make sure these lines are uncommented (remove the `;` from each line)
```
extention=bcmath
extention=zip
extension=pdo_mysql
extension=mysqli
extension=iconv
extension=gd
extension=imagick
extension=pdo_pgsql
extension=pgsql
```
- Recommended to set correct timezone
```
date.timezone = <Continent/City>
```
- Display errors to debug PHP code
```
display_errors = On
```
- Allow paths to be accessed by PHP
```
open_basedir = /srv/http/:/var/www/:/home/:/tmp/:/var/tmp/:/var/cache/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/
```
---
#### Dart
- Install dart or skip and install flutter (recommended) that includes dart
```bash
$ curl -O "https://storage.googleapis.com/dart-archive/channels/be/raw/latest/sdk/dartsdk-linux-x64-release.zip"
$ unzip dartsdk-linux-x64-release.zip
$ sudo mv dart-sdk /usr/lib/dart
```
NOTE: If Dart SDK is downloaded separately, make sure that the Flutter version of dart is first in path, as the two versions might not be compatible. Use this command `which flutter dart` to see if flutter and dart originate from the same bin directory and are therefore compatible.
- Install flutter
```bash
$ git clone https://github.com/flutter/flutter.git -b stable
```
- Move flutter to the `/opt` directory
```bash
$ sudo mv flutter /opt/
```
- Export Flutter over Dart by putting this into `.bashrc`/`.zshrc` or any similar shell configuration file to make it persistent across sessions
```bash
# Flutter/dart path
export PATH="/opt/flutter:/usr/lib/dart/bin:$PATH"
# Flutter Web Support
export PATH=$PATH:/opt/google/chrome
```
- Set permissions since only Root has access
```bash
$ sudo groupadd flutterusers
$ sudo gpasswd -a $USER flutterusers
$ sudo chown -R :flutterusers /opt/flutter
$ sudo chmod -R g+w /opt/flutter/
```
- If still getting any permission denied errors then do this
```bash
$ sudo chown -R $USER /opt/flutter
```
- Continue to step **_Development Tools/Android Studio_** section to complete setup
---
#### Javascript
- nvm install/update script
```bash
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
```
- Put these lines into `.bashrc`/`.zshrc` or any similar shell configuration file to make it persistent across sessions
```bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
```
- Install node
```bash
$ nvm install node
```
- Install the latest version in order to make npm executable
```bash
$ nvm install --lts
```
---
### Development Tools
#### MySQL
- Install MySQL
- Ensure the MySQL service starts when reboot or startup machine.
```bash
$ sudo systemctl start mysqld
```
- Setup MySQL for use
```bash
$ sudo mysql_secure_installation
```
- To check its installed and working just open up mysql command prompt with
```
$ sudo mysql
```
---
#### Android Studio/SDK
> NOTE: Android Studio is an Integrated Development Environment (IDE) that provides a comprehensive set of tools for Android app development. It includes the Android SDK (Software Development Kit), which consists of various libraries, tools, and system images necessary for developing Android applications.
> The Android SDK can be installed separately without Android Studio, allowing you to use alternative text editors or IDEs for development. However, Android Studio provides a more streamlined and feature-rich development experience.
> Make sure to properly set the Java environment (either 8 or 10, eg., java-8-openjdk) otherwise android-studio will not start.
> If Android Studio shows up as a blank window try exporting `_JAVA_AWT_WM_NONREPARENTING=1`.
- Install android studio
- Directly from the official website
```bash
$ curl -L -o android-studio.tar.gz "$(curl -s "https://developer.android.com/studio#downloads" | grep -oP 'https://redirector\.gvt1\.com/[^"]+' | head -n 1)"
$ tar -xvzf android-studio.tar.gz
$ sudo mv android-studio /opt/
$ cd /opt/android-studio/bin script # Configure Android Studio by running this script
$ ./studio.sh
```
- Or optionally install jetbrains-toolbox that includes android-studio amongst many other applications/tools from jetbrains
```bash
$ latest_url=$(curl -sL "https://data.services.jetbrains.com/products/releases?code=TBA" | grep -oP 'https://download.jetbrains.com/toolbox/jetbrains-toolbox-\d+\.\d+\.\d+\.\d+\.tar\.gz' | head -n 1) && curl -L -o jetbrains-toolbox.tar.gz "$latest_url"
$ tar -xvzf jetbrains-toolbox.tar.gz
$ sudo mv jetbrains-toolbox /opt/jetbrains
```
- Complete the Android Studio Setup Wizard
- Click `Next` on the Welcome Window
- Click `Custom` and `Next`
- Make sure `/opt/android-sdk` directory exists otherwise create it by typing in the following command in a terminal
```bash
$ sudo mkdir /opt/android-sdk
```
- Click on the folder icon next to the SDK path field.
- In the file picker dialog, navigate to the /opt directory and select the android-sdk directory.
- Proceed with the setup wizard, following the remaining instructions to complete the installation.
- If already installed and prefer not to have a `$HOME/Android` directory but rather use `/opt/android-sdk`
- Launch Android Studio.
- Go to "File" > "Settings" (on Windows/Linux) or "Android Studio" > "Preferences" (on macOS) to open the settings.
- In the settings, navigate to "Appearance & Behavior" > "System Settings" > "Android SDK".
- In the "Android SDK Location" field, update the path to `/opt/android-sdk`.
- Click "Apply" or "OK" to save the settings.
- Put these lines into `.bashrc`/`.zshrc` or any similar shell configuration file to make it persistent across sessions
```
# Android Home
export ANDROID_HOME=/opt/android-sdk
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
# Android emulator PATH
export PATH=$ANDROID_HOME/emulator:$PATH
# Android SDK ROOT PATH
export ANDROID_SDK_ROOT=/opt/android-sdk
export PATH=$ANDROID_SDK_ROOT:$PATH
# Alias for android-studio
alias android-studio='/opt/android-studio/bin/studio.sh'
```
- Android SDK and tools installation
> NOTE: Can be installed either through Android Studio or separately.
- Android Studio Installed: Launch Android Studio and go to the "SDK Manager" (usually found under "Configure" or "Preferences" menu). From the SDK Manager, select the desired SDK components (platforms, build tools, system images, etc.) and click "Apply" to install them.
- To install Android SDK separately (without Android Studio):
```bash
$ curl -L -o commandlinetools.zip "$(curl -s "https://developer.android.com/studio#downloads" | grep -oP 'https://dl.google.com/android/repository/commandlinetools-linux-\d+_latest\.zip' | head -n 1)"
$ unzip commandlinetools.zip -d android-sdk
$ mkdir android-sdk/cmdline-tools/latest
$ sudo mv android-sdk /opt/
or
$ sudo mv android-sdk/cmdline-tools /opt/android-sdk/
```
- If Android SDK was installed separately then configure the user's permissions since android-sdk is installed in /opt/android-sdk directory
```bash
$ sudo groupadd android-sdk
$ sudo gpasswd -a $USER android-sdk
$ sudo setfacl -R -m g:android-sdk:rwx /opt/android-sdk
$ sudo setfacl -d -m g:android-sdk:rwX /opt/android-sdk
```
- If Android SDK has been installed separately then install platform-tools and build-tools like this:
- First list `sdkmanager`'s available/installed packages
```bash
$ sdkmanager --list
```
- Install platform-tools and build-tools
> NOTE: Replace <version> with the specific version number for platforms and build tools to install (e.g., "platforms;android-`33`" "build-tools;`34.0.0`").
```bash
$ sdkmanager "platform-tools" "platforms;android-<version>" "build-tools;<version>"
```
- Android emulator
- List of available android system images.
```bash
$ sdkmanager --list
```
- Install an android image of your choice. For example.
```bash
$ sdkmanager --install "system-images;android-29;default;x86"
```
- Then create an android emulator using Android Virtual Devices Manager
```bash
$ avdmanager create avd -n <name> -k "system-images;android-29;default;x86"
```
- Continuing from **_Dart(flutter)_** section
- Update Flutter Config SDK PATH for custom SDK PATH
```bash
$ flutter config --android-sdk /opt/android-sdk
```
- Accept all andfoid licenses with this command
```
$ flutter doctor --android-licenses
```
- If licenses are still not accepted even after running `flutter doctor --android-licenses` try these commands and then run `flutter doctor --android-licenses again`
```
$ sudo chown -R $(whoami) $ANDROID_SDK_ROOT
```
- Run this
```
$ flutter doctor
```
- Update emulator binaries
```bash
$ sdkmanager --sdk_root=${ANDROID_HOME} tools
```
- Accept emulator licenses
> NOTE: Required to accept the necessary license for each package installed.
```bash
$ sdkmanager --licenses
```
---
## Commands
---
#### Windows
- Install nvim natively to Windows
- First allow script execution, run the following command in PowerShell as an administrator:
```dos
Set-ExecutionPolicy RemoteSigned
# or
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
```
- Then run the script by using this command in the same existing directory:
```dos
./win-nvim.ps1
```
```dos
curl -o winget-cli.appxbundle https://aka.ms/winget-cli-appxbundle
powershell Add-AppxPackage -Path "winget-cli.appxbundle"
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
```
- Use `-y` or consider: choco feature enable -n allowGlobalConfirmation
```dos
choco install git
```
- Refresh the environment
```dos
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
refreshenv
```
```dos
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@example.com"
```
|