Merge branch 'master' of github.com:Lissy93/dotfiles into temp-work-in-progress

This commit is contained in:
Alicia Sykes 2022-08-28 13:12:04 +01:00
commit 05d971ba24
10 changed files with 729 additions and 58 deletions

588
.github/README.md vendored
View File

@ -1,98 +1,531 @@
``` <h1 align="center"><code>~/.Dotfiles</code></h1>
____ __ _____ __ <h2 align="center"><code>$HOME, sweet $HOME</code></h2>
/ __ \____ / /_/ __(_) /__ _____ <p align="center"><i>My dotfiles for configuring Vim, ZSH, Tmux, Git, etc</i></p>
/ / / / __ \/ __/ /_/ / / _ \/ ___/ <p align="center"><img width="400" src="https://i.ibb.co/rH30RbM/Dotfiles.png" /></p>
/ /_/ / /_/ / /_/ __/ / / __(__ )
/_____/\____/\__/_/ /_/_/\___/____/
```
- [Intro](#intro)
- [Setup](#setup) ## Contents
- [Configuring](#configuring) - [Introduction to Dotfiles](#intro)
- [Dependencies](#dependencies) - [What are dotfiles?](#what-are-dotfiles)
- [Documentation](#documentation) - [Dotfile Management Systems](#dotfile-management-systems)
- [Tmux](#tmux) - [So copy paste, right?](#so-copy-paste-right)
- [XDG Directories](#xdg-directories)
- [Applying Dotfiles](#applying-dotfiles)
- [Containerized Userspace](#containerized-userspace)
- [Security](#security)
- [My Dots](#my-dots)
- [Setup](#setup)
- [Aliases](#aliases)
- [Utilities](#utilities)
- [Packages](#packages)
- [ZSH](#zsh) - [ZSH](#zsh)
- [Vim](#vim) - [Vim](#vim)
- [Ranger](#ranger) - [Tmux](#tmux)
- [Git](#git)
- [Dependencies](#dependencies)
---
## Intro ## Intro
My personal dot files, that I use to quickly configure a Linux environment on desktop and server instances. ### What are dotfiles?
[Dotbot](https://github.com/anishathalye/dotbot) is being used to create symlinks in all the right places.
One of the beautiful things about Linux, is how easily customizable everything is. Usually these custom configurations are stored in files that start with a dot (hence dotfiles!), and typically located in your users home `~`, or better yet `~/.config` (even this can be customized, for apps that respect the XDG Base Directory spec). Some examples of dotfiles that you're likely already familiar with include `.gitconfig`, `.zshrc` or `.vimrc`.
You will often find yourself tweaking your configs over time, so that your system perfectly matches your needs. It makes sense to back these files up, so that you don't need to set everything up from scratch each time you enter a new environment. Git is a near-perfect system for this, as it allows for easy roll-backs, branches and it's well supported with plenty of hosting options (like here on GitHub).
Once everything's setup, you'll be able to SSH into a fresh system or reinstall your OS, then just run your script and go from zero to feeling at right at home within a minute or two.
It's not hard to create your own dotfile repo, it's great fun and you'll learn a ton along the way!
Tested and used on Ubuntu, Arch Linux and Manjaro.
--- ---
## Setup ### Dotfile Management Systems
To setup, just clone the repo, cd into it, and run the install script. You can make things simple, or complex as you like.
The two most common methods are either symlinking, or using a git bare repo, these are explained in more detail in the [Applying Dotfiles](#applying-dotfiles) section. You can either do things manually, write a simple script, or use a pre-build dotfile management system (like [dotbot](https://github.com/anishathalye/dotbot), [chezmoi](https://github.com/twpayne/chezmoi), [yadm](https://github.com/TheLocehiliosan/yadm) or [GNU Stow](https://www.gnu.org/software/stow/)).
In terms of managing dependencies, using either [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or [git subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) will let you keep dependencies in your project, while also separate from your own code and easily updatable.
---
### So copy paste, right?
Zach Holman wrote a great article titled [Dotfiles Are Meant to Be Forked](https://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/). I personally disagree with this, since your dotfiles are ususally highly personalized, so what's right for one developer, likely won't be what someone else is looking for. They're also usually something you build up over time, and althgouh some repos may provide a great starting point, it's really important to know what everything does, and how it works.
By all means feel free to take what you want from mine. I've taken care to ensure that each file is standalone, and well documented so that certain files can just be dropped into any system. But I cannot stress enough the importance of reading through files to ensure it's actually what you want.
If you're looking for some more example dotfile repos to get you started, I can highly recomend taking a look at: [holman](https://github.com/holman/dotfiles).
There's even more to check out at [webpro/awesome-dotfiles](https://github.com/webpro/awesome-dotfiles), [dotfiles.github.io](https://dotfiles.github.io/) and [r/unixporn](https://www.reddit.com/r/unixporn/).
---
### XDG Directories
One of my goals was to try and keep the top-level user home directory as clean as possible by honouring the [XDG base directory specification](https://specifications.freedesktop.org/basedir-spec), which lets you specify the locations for config, cache, data, log and other files. This is done by setting environmental variables within [`.zshenv`](https://github.com/Lissy93/dotfiles/blob/master/zsh/.zshenv).
You can modify any of these values, but by default the following paths are used:
Variable | Location
--- | ---
`XDG_CONFIG_HOME` | `~/.config`
`XDG_DATA_HOME` | `~/.local/share`
`XDG_BIN_HOME` | `~/.local/bin`
`XDG_LIB_HOME` | `~/.local/lib`
`XDG_CACHE_HOME` | `~/.local/var/cache`
---
### Applying Dotfiles
There are several different approaches to managing dotfiles. The two most common would be either symlinking, or git bare repo.
#### Option 1 - Symlinking
Symlinks let you maintain all your dotfiles in a working directory, and then link them to the appropriate places on disk, sort of like shortcuts.
For example, if your dotfiles are in `~/Documents/dotfiles`, you could create a zshrc file there, and link it with:
```bash
ln -s ~/Documents/dotfiles/zsh/.zshrc ~/.zshrc
``` ```
git clone git@github.com:Lissy93/dotfiles.git
cd dotfiles This would obviously get cumbersome very quickly if you had a lot of files, so you would really want to automate this process. You could either create your own script to do this, or use a tool specifically designed for this.
./install.sh
I personally use [Dotbot](https://github.com/anishathalye/dotbot), as it doesn't have any dependencies - just include it as a sub-module, define a list of links in a simple YAML file, and hit go.
[GNU Stow](https://www.gnu.org/software/stow/) is also a popular choice, and it's usage is explained well in [this article](https://alexpearce.me/2016/02/managing-dotfiles-with-stow/) by Alex Pearce.
There's many other tools which do a similar thing, like [Homesick](https://github.com/technicalpickles/homesick), [Rcm](https://github.com/thoughtbot/rcm), [dotdrop](https://github.com/deadc0de6/dotdrop) or [mackup](https://github.com/lra/mackup).
#### Option 2 - Git Bare Repo
Bare repositories let you add files from anywhere on your system, maintaining the original directory structure, and without the need for symlinks ([learn more](https://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/)). Just initiialize or clone using the [`--bare`](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---bare) flag, then add a global alias to manage files with git.
```bash
# Initialise a new repo, or clone an existing one with the --bare flag
git init --bare $HOME/dotfiles
# Next create an alias that sets the directory to your dotfile (add to .zshrc/ .bashrc)
alias dotfiles='$(where git) --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
# Hide untracked files
dotfiles config --local status.showUntrackedFiles no
```
Then, from anywhere in your system you can use your newly created alias to add, commit and push files to your repo using all the normal git commands, as well as pull them down onto another system.
```bash
dotfiles add ~/.config/my-file
dotfiles commit -m "A short message"
dotfiles push
```
Both [Chezmoi](https://github.com/twpayne/chezmoi/) and [YADM](https://github.com/TheLocehiliosan/yadm) are a dotfile management tools, which wrap bare git repo functionality, adding some additional QoL features.
To learn more, DistroTube made an excellent [video about bare git repos](https://www.youtube.com/watch?v=tBoLDpTWVOM), and Marcel Krčah has written [a post](https://marcel.is/managing-dotfiles-with-git-bare-repo/) outlining the benefits.
---
### Containerized Userspace
You can also containerize your dotfiles, meaning with a single command, you can spin up a fresh virtual environment on any system, and immediately feel right at home with all your packages and configurations.
This is awesome for a number of reasons: 1) Super minimal dependency installation on the host 2) Blazing fast, as you can pull your built image from a registry, instead of compiling everything locally 3) Cross-platform compatibility, whatever your host OS is, you can always have a familiar Linux system in the container 4) Security, you can control which host resources are accessible within each container
For this, I'm using an Alpine-based Docker container defined in the [`Dockerfile`](https://github.com/Lissy93/dotfiles/blob/master/Dockerfile), to try it out, just run `docker run lissy93/dotfiles`.
Other options could include spinning up VMs with a predefined config, either using something like [Vagrant](https://www.vagrantup.com/) or a [NixOS](https://nixos.org/)-based config.
---
### Security
Something that is important to keep in mind, is security. Often you may have some personal info included in some of your dotfiles. Before storing anything on the internet, double check there's no sensitive info, SSH keys, API keys or plaintext passwords. If you're using git, then any files you wouldn't want to be commited, can just be listed in your [`.gitignore`](https://git-scm.com/docs/gitignore). If any .gitignore'd files are imported by other files, be sure to check they exist, so you don't get errors when cloning onto a fresh system.
Another solution, is to encrypt sensitive info. A great tool for this is [`pass`](https://www.passwordstore.org/) as it makes GPG-encrypting passwords very easy ([this article](https://www.outcoldman.com/en/archive/2015/09/17/keep-sensitive-data-encrypted-in-dotfiles/) outlines how), or you could also just use plain old GPG (as outlined in [this article](https://www.abdullah.today/encrypted-dotfiles/)).
---
## My Dotfiles
### Setup
> **Warning**
> Prior to running the setup script, read through everything and confirm it's what you want.
To set everything up, just recursivley clone the repo, cd into it, allow execution of `install.sh` then run it to install.
```bash
git clone --recursive git@github.com:Lissy93/dotfiles.git ~/.dotfiles
chmod +x ~/.dotfiles/install.sh
~/.dotfiles/install.sh
``` ```
--- ---
## Configuring ### Configuring
Configuration is specified in `.install.conf.yaml` and managed with [Dotbot](https://github.com/anishathalye/dotbot). The locations for all symlinks are defined in [`.install.conf.yaml`](https://github.com/Lissy93/dotfiles/blob/master/.install.conf.yaml). These are managed using [Dotbot](https://github.com/anishathalye/dotbot), and will be applied whenever you run the [`install.sh`](https://github.com/Lissy93/dotfiles/blob/master/install.sh) script.
The bootstrap configurations are idempotent (and so the installer can be run multiple times without causing any problems). The bootstrap configurations are idempotent (and so the installer can be run multiple times without causing any problems). To only install certain parts of the config, pass the `--only` flag to the install.sh script, similarly `--except` can be used to exclude certain directives.
To only install certain parts of the config, pass the `--only` flag to the install.sh script, similarly `--except` can be used to exclude certain directives.
--- ---
## Dependencies ### Aliases
These dot files make use of the following packages, and hence they are required #### Into to Aliases
- [zsh](https://www.zsh.org/) - Interactive Shell An alias is simply a command shortcut. These are very useful for long or frequently used commands.
- [vim](https://www.vim.org/) - Fast, solid customizable text editor
- [tmux](https://github.com/tmux/tmux) - Detachable terminal multiplexer For example, if you frequently find yourself typing `git add .` you could add an alias like `alias gaa='git add .'`, then just type `gaa`. You can also override existing commands, for example to always show hidden files with `ls` you could set `alias ls='ls -a'`.
- [ranger](https://ranger.github.io/) - CLI-based file manager with VI bindings
- [git](https://git-scm.com/) - Version control system Aliases should almost always be created at the user-level, and then sourced from your shell config file (usually `.bashrc` or `.zshrc`). System-wide aliases would be sourced from `/etc/profile`. Don't forget that for your changes to take effect, you'll need to restart your shell, or re-source the file containing your aliases, e.g. `source ~/.zshrc`.
You can view a list of defined aliases by running `alias`, or search for a specific alias with `alias | grep 'search-term'`. The `unalias` command is used for removing aliases.
The following section lists the aliases used in my dotfiles.
<details>
<summary><b>Git Aliases</b></summary>
> [`zsh/aliases/git.zsh`](https://github.com/Lissy93/dotfiles/blob/master/zsh/aliases/git.zsh)
Alias | Description
---|---
`g` | git
`gs` | `git status` - List changed files
`ga` | `git add` - Add <files> to the next commit
`gaa` | `git add .` - Add all changed files
`grm` | `git rm` - Remove <file>
`gc` | `git commit` - Commit staged files, needs -m ""
`gcm` | `git commit` takes $1 as commit message
`gps` | `git push` - Push local commits to <origin> <branch>
`gpl` | `git pull` - Pull changes with <origin> <branch>
`gf` | `git fetch` - Download branch changes, without modifying files
`grb` | `git rebase` - Rebase the current HEAD into <branch>
`grba` | `git rebase --abort` - Cancel current rebase sesh
`grbc` | `git rebase --continue` - Continue onto next diff
`gm` | `git merge` - Merge <branch> into your current HEAD
`gi` | `git init` - Initiialize a new empty local repo
`gcl` | `git clone` - Downloads repo from <url>
`gch` | `git checkout` - Switch the HEAD to <branch>
`gb` | `git branch` - Create a new <branch> from HEAD
`gd` | `git diff` - Show all changes to untracked files
`gtree` | `git log --graph --oneline --decorate` # Show branch tree
`gl` | `git log`
`gt` | `git tag` - Tag the current commit, 1 param
`gtl` | `git tag -l` - List all tags, optionally with pattern
`gtlm` | `git tag -n` - List all tags, with their messages
`gtp` | `git push --tags` - Publish tags
`gr` | `git remote`
`grs` | `git remote show` - Show current remote origin
`grl` | `git remote -v` - List all currently configured remotes
`grr` | `git remote rm origin` - Remove current origin
`gra` | `git remote add` - Add new remote origin
`grurl` | `git remote set-url origin` - Sets URL of existing origin
`guc` | `git revert` - Revert a <commit>
`gu` | `git reset` - Reset HEAD pointer to a <commit>, perserves changes
`gua` | `git reset --hard HEAD` - Resets all uncommited changes
`gnewmsg` | `git commit --amend -m` - Update <message> of previous commit
`gclean` | `git clean -df` - Remove all untracked files
`glfsi` | `git lfs install`
`glfst` | `git lfs track`
`glfsls` | `git lfs ls-files`
`glfsmi` | `git lfs migrate import --include=`
`gplfs` | `git lfs push origin "$(git_current_branch)" --all` - Push LFS changes to current branch
`gj` | Find and cd into the root of your current project (based on where the .git directory
`clone` | Shorthand for clone, run `clone user/repo`, if user isn't specified will default to yourself
`gsync` | Sync fork against upstream repo
`gfrb` | Fetch, rebase and push updates to current branch. Optionally specify target, defaults to 'master'
`gignore` | Integrates with gitignore.io to auto-populate .gitignore file
`gho` | Opens the current repo + branch in GitHub
`ghp` | Opens pull request tab for the current GH repo
</details>
<details>
<summary><b>Flutter Aliases</b></summary>
> [`zsh/aliases/flutter.zsh`](https://github.com/Lissy93/dotfiles/blob/master/zsh/aliases/flutter.zsh)
Alias | Description
---|---
`fl` | flutter - Main fultter command
`flattach` | `flutter attach` - Attaches flutter to a running flutter application with enabled observatory
`flb` | `flutter build` - Build flutter application
`flchnl` | `flutter channel` - Switches flutter channel (requires input of desired channel)
`flc` | `flutter clean` - Cleans flutter project
`fldvcs` | `flutter devices` - List connected devices (if any)
`fldoc` | `flutter doctor` - Runs flutter doctor
`flpub` | `flutter pub` - Shorthand for flutter pub command
`flget` | `flutter pub get` - Installs dependencies
`flr` | `flutter run` - Runs flutter app
`flrd` | `flutter run --debug` - Runs flutter app in debug mode (default mode)
`flrp` | `flutter run --profile` - Runs flutter app in profile mode
`flrr` | `flutter run --release` - Runs flutter app in release mode
`flupgrd` | `flutter upgrade` - Upgrades flutter version depending on the current channel
</details>
<details>
<summary><b>Node.js Aliases</b></summary>
> [`zsh/aliases/node-js.zsh`](https://github.com/Lissy93/dotfiles/blob/master/zsh/aliases/node-js.zsh)
##### Yarn
Alias | Description
---|---
`ys` | `yarn start`
`yt` | `yarn test`
`yb` | `yarn build`
`yl` | `yarn lint`
`yd` | `yarn dev`
`yp` | `yarn publish`
`yr` | `yarn run`
`ya` | `yarn add`
`ye` | `yarn remove`
`yi` | `yarn install`
`yg` | `yarn upgrade`
`yu` | `yarn update`
`yf` | `yarn info`
`yz` | `yarn audit`
`yc` | `yarn autoclean`
`yk` | `yarn check`
`yh` | `yarn help`
`yarn-nuke` | Removes node_modules, yarn.lock, package-lock.json and does a full fresh reinstall of dependencies
`yv` | Prints out the current version of Node.js, Yarn, NPM, NVM and git
##### NPM
Alias | Description
---|---
`npmi` | `npm install`
`npmu` | `npm uninstall`
`npmr` | `npm run`
`npms` | `npm start`
`npmt` | `npm test`
`npml` | `npm run lint`
`npmd` | `npm run dev`
`npmp` | `npm publish`
`npmo` | Opens NPM docs, either for the current package, or a specific dependency passes as param
##### NVM
Alias | Description
---|---
`nvmi` | `nvm install`
`nvmu` | `nvm use`
`nvml` | `nvm ls`
`nvmr` | `nvm run`
`nvme` | `nvm exec`
`nvmw` | `nvm which`
`nvmlr` | `nvm ls-remote`
`nvmlts` | `nvm install --lts && nvm use --lts`
`nvmlatest` | `nvm install node --latest-npm && nvm use node`
`nvmsetup` | Runs the NVM installation script, and sets up the NVM environment
</details>
<details>
<summary><b>General Aliases</b></summary>
> [`zsh/aliases/general.zsh`](https://github.com/Lissy93/dotfiles/blob/master/zsh/aliases/general.zsh)
##### Single-Letter Frequently-Used Commands (only set if not already in use)
Alias | Description
---|---
`a` | alias`
`c` | `clear`
`d` | `date`
`e` | `exit`
`f` | `find`
`g` | `grep`
`h` | `history`
`i` | `id`
`j` | `jobs`
`l` | `ls`
`m` | `man`
`p` | `pwd`
`s` | `sudo`
`t` | `touch`
`v` | `vim`
##### File listing options
Alias | Description
---|---
`la` | `ls -A` - List all files/ includes hidden
`ll` | `ls -lAFh` - List all files, with full details
`lm` | `ls -tA -1` - List files sorted by last modified
`lb` | `ls -lhSA` - List all files sorted by biggest
`lr` | `ls -R` - List files in sub-directories, recursivley
`lf` | `ls -A \| grep` - Use grep to find files
`ln` | `find . -type f \| wc -l` - Shows number of files
`ld` | `ls -l \| grep "^d"` - List directories only
`la` | `exa -aF --icons` - List all files, including hidden (only if `exa` is installed)
`ll` | `exa -laF --icons` - Show files with all details (only if `exa` is installed)
`lm` | `exa -lahr --color-scale --icons -s=modified` - Sort by date modified, most revent first (only if `exa` is installed)
`lb` | `exa -lahr --color-scale --icons -s=size` - Sort by size largest first (only if `exa` is installed)
`tree` | `f() { exa -aF --tree -L=${1:-2} --icons };f` - List files as tree (only if `exa` is installed)
`lz` | List the contents of a specified compressed archive. Supported formats include zip, rar, tar, tar.gz and ace
##### Getting Around
Alias | Description
---|---
`mkcd` | Create new directory, and cd into it. Takes new directory name as param
`mkcp` | Copies a directory, and navigates into it
`mkmv` | Moves a directory, and navigates into it
# Getting outa directories
Alias | Description
---|---
`c~` | Navigate to ~
`c.` | Go up 1 directory
`c..` | Go up 2 directories
`c...` | Go up 3 directories
`c....` | Go up 4 directories
`c.....` | Go up 5 directories
`cg` | Navigate to base of git project
##### Finding files and directories
Alias | Description
---|---
`dud` | `du -d 1 -h` - List sizes of files within directory
`duf` | `du -sh *` - List total size of current directory
`ff` | `find . -type f -name` - Find a file by name within current directory
`fd` | `find . -type d -name` - Find direcroy by name
##### Command line history
Alias | Description
---|---
`h` | `history` - Shows full history
`h-search` | `fc -El 0 \| grep` - Searchses for a word in terminal history
`top-history` | `history 0 \| awk '{print $2}' \| sort \| uniq -c \| sort -n -r \| head` - Most used
##### Head / tail shortcuts
Alias | Description
---|---
`H` | `\| head` - Pipes output to head (the first part of a file)
`T` | `\| tail` - Pipes output to tail (the last part of a file)
`G` | `\| grep` - Pipes output to grep to search for some word
`L` | `\| less` - Pipes output to less, useful for paging
`M` | `\| most` - Pipes output to more, useful for paging
`LL` | `2>&1 \| less` - Writes stderr to stdout and passes it to less
`CA` | `2>&1 \| cat -A` - Writes stderr to stdout and passes it to cat
`NE` | `2> /dev/null` - Silences stderr
`NUL` | `> /dev/null 2>&1` - Silences both stdout and stderr
`P` | `2>&1\| pygmentize -l pytb` - Writes stderr to stdout, and passes to pygmentize
##### Find + manage aliases
Alias | Description
---|---
`al` | `alias \| less` - List all aliases
`as` | `alias \| grep` - Search aliases
`ar` | `unalias` - Remove given alias
##### System Monitoring
Alias | Description
---|---
`meminfo` | `free -m -l -t` - Show free and used memory
`memhog` | `ps -eo pid,ppid,cmd,%mem --sort=-%mem \| head` - Processes consuming most mem
`cpuhog` | `ps -eo pid,ppid,cmd,%cpu --sort=-%cpu \| head` - Processes consuming most cpu
`cpuinfo` | `lscpu` - Show CPU Info
`distro` | `cat /etc/*-release` - Show OS info
##### Utilities
Alias | Description
---|---
`myip` | `curl icanhazip.com` - Fetches and displays public IP
`weather` | `curl wttr.in` - Fetches and displays local weather
`weather-short` | `curl "wttr.in?format=3"`
`cheat` | `curl cheat.sh/` - Gets manual for a Linux command
`tinyurl` | `curl -s "http://tinyurl.com/api-create.php?url=` - URL shortening
`ports` | `netstat -tulanp` - List currently used ports
`crypto` | `cointop` - Launch cointop (only registered if installed)
`gto` | `gotop` - Launch gotop (only registered if installed)
##### Random lolz
Alias | Description
---|---
`cls` | `clear;ls` - Clear and ls
`plz` | `fc -l -1 | cut -d' ' -f2- | xargs sudo` - Re-run last cmd as root
`yolo` | `git add .; git commit -m "YOLO"; git push origin master` - Why not..
`when` | `date` - Show date
`whereami` | `pwd` - Just show current path
`dog` | `cat` - I don't know why...
`gtfo` | `exit` - This just feels better than exit
</details>
They can be easily installed/ updated with your package manger, e.g:
- Ubuntu Server: `sudo apt install -y zsh vim tmux ranger git`
- Arch Linux: `sudo pacman -S zsh vim tmux ranger git`
Depending on your setup, the following utils may also be required: `make`, `ctags`, `fzf` and `python3-pip`
--- ---
## Documentation
The following section briefly explains the configuration and plug-ins for the main components (Tmux, Vim and Zsh) ### Utilities
### Tmux
Fairly standard Tmux configuration, strongly based off Tmux-sensible. Configuration is defined in [`.tmux.conf`](https://github.com/Lissy93/dotfiles/blob/master/tmux/tmux.conf) // TODO
Tmux plugins are managed using [TMP](https://github.com/tmux-plugins/tpm) and defined in [`.tmux.conf`](https://github.com/Lissy93/dotfiles/blob/master/tmux/tmux.conf). To install them from GitHub, run `prefix` + <kbd>I</kbd> from within Tmux, and they will be cloned int `~/.tmux/plugins/`. ---
#### Plugins ### Packages
- **[Tmux-sensible](https://github.com/tmux-plugins/tmux-sensible)**: `tmux-plugins/tmux-sensible` - General, sensible Tmux config
- **[Tmux-continuum](https://github.com/tmux-plugins/tmux-continuum)**: `tmux-plugins/tmux-continuum` - Continuously saves and environment with automatic restore The dotfiles can also optionally install any packages that you may need. This is useful for quickly setting up new systems, but it's important that you remove / comment out any packages that you don't need.
- **[Tmux-yank](https://github.com/tmux-plugins/tmux-yank)**: `tmux-plugins/tmux-yank` - Allows access to system clipboard
- **[Tmux-prefix-highlight](https://github.com/tmux-plugins/tmux-prefix-highlight)**: `tmux-plugins/tmux-prefix-highlight` - Highlight Tmux prefix key when pressed The list of software is stored in the [`installs/`]() directory, and the file that's used will vary depending on the host operating system.
- **[Tmux-online-status](https://github.com/tmux-plugins/tmux-online-status)**: `tmux-plugins/tmux-online-status` - Displays network status
- **[Tmux-open](https://github.com/tmux-plugins/tmux-open)**: `tmux-plugins/tmux-open` - Bindings for quick opening selected path/ url - Arch (and Arch-based systems, like Manjaro) - []() uses pacman
- **[Tmux-mem-cpu-load](https://github.com/thewtex/tmux-mem-cpu-load)**: `thewtex/tmux-mem-cpu-load` - Shows system resources - Debian (and Debian-based systems, like Ubuntu) - []() uses apt
- Alpine - []() uses [apk](https://docs.alpinelinux.org/user-handbook/0.1a/Working/apk.html)
- Mac OS - [`.Brewfile`]() uses [Homebrew](https://brew.sh/)
- Windows - [`windows.sh`]() uses [winget](https://docs.microsoft.com/en-us/windows/package-manager/winget/) and [scoop](https://scoop.sh/)
---
### ZSH
// TODO
---
### Vim ### Vim
The entry point for the Vim config is the [`vimrc`](https://github.com/Lissy93/dotfiles/blob/master/vim/vimrc), but the main editor settings are defined in [`vim/editor.vim`](https://github.com/Lissy93/dotfiles/blob/master/vim/editor.vim) The entry point for the Vim config is the [`vimrc`](https://github.com/Lissy93/dotfiles/blob/master/vim/vimrc), but the main editor settings are defined in [`vim/editor.vim`](https://github.com/Lissy93/dotfiles/blob/master/vim/editor.vim)
#### Plugins ##### Plugins
Vim plugins are managed using [Plug](https://github.com/junegunn/vim-plug) defined in [`vim/plugins.vim`](https://github.com/Lissy93/dotfiles/blob/master/vim/plugins.vim). Vim plugins are managed using [Plug](https://github.com/junegunn/vim-plug) defined in [`vim/plugins.vim`](https://github.com/Lissy93/dotfiles/blob/master/vim/plugins.vim).
To install them from GitHub, run `:PlugInstall` (see [options](https://github.com/junegunn/vim-plug#commands)) from within Vim. To install them from GitHub, run `:PlugInstall` (see [options](https://github.com/junegunn/vim-plug#commands)) from within Vim.
Layout & Navigation: Layout & Navigation:
- **[Airline](https://github.com/vim-airline/vim-airline)**: `vim-airline/vim-airline` - A very nice status line at the bottom of each window, displaying useful info - **[Airline](https://github.com/vim-airline/vim-airline)**: `vim-airline/vim-airline` - A very nice status line at the bottom of each window, displaying useful info
- **[Nerd-tree](https://github.com/preservim/nerdtree)**: `preservim/nerdtree` - Alter files in larger projects more easily, with a nice tree-view pain - **[Nerd-tree](https://github.com/preservim/nerdtree)**: `preservim/nerdtree` - Alter files in larger projects more easily, with a nice tree-view pain
@ -139,3 +572,52 @@ File-Type Plugins:
- **[Nginx](https://github.com/chr4/nginx.vim)**:`chr4/nginx.vim` *(Nginx)* - Integer matching, hichlight syntax and IPv4/ IPv6, mark insecure protocols and more - **[Nginx](https://github.com/chr4/nginx.vim)**:`chr4/nginx.vim` *(Nginx)* - Integer matching, hichlight syntax and IPv4/ IPv6, mark insecure protocols and more
Themes: Themes:
---
### Tmux
Fairly standard Tmux configuration, strongly based off Tmux-sensible. Configuration is defined in [`.tmux.conf`](https://github.com/Lissy93/dotfiles/blob/master/tmux/tmux.conf)
Tmux plugins are managed using [TMP](https://github.com/tmux-plugins/tpm) and defined in [`.tmux.conf`](https://github.com/Lissy93/dotfiles/blob/master/tmux/tmux.conf). To install them from GitHub, run `prefix` + <kbd>I</kbd> from within Tmux, and they will be cloned int `~/.tmux/plugins/`.
##### Plugins
- [Tmux-sensible](https://github.com/tmux-plugins/tmux-sensible): `tmux-plugins/tmux-sensible` - General, sensible Tmux config
- [Tmux-continuum](https://github.com/tmux-plugins/tmux-continuum): `tmux-plugins/tmux-continuum` - Continuously saves and environment with automatic restore
- [Tmux-yank](https://github.com/tmux-plugins/tmux-yank): `tmux-plugins/tmux-yank` - Allows access to system clipboard
- [Tmux-prefix-highlight](https://github.com/tmux-plugins/tmux-prefix-highlight): `tmux-plugins/tmux-prefix-highlight` - Highlight Tmux prefix key when pressed
- [Tmux-online-status](https://github.com/tmux-plugins/tmux-online-status): `tmux-plugins/tmux-online-status` - Displays network status
- [Tmux-open](https://github.com/tmux-plugins/tmux-open): `tmux-plugins/tmux-open` - Bindings for quick opening selected path/ url
- [Tmux-mem-cpu-load](https://github.com/thewtex/tmux-mem-cpu-load): `thewtex/tmux-mem-cpu-load` - Shows system resources
---
### Git
// TODO
---
## Dependencies
These dot files make use of the following packages, and hence they are required
- [zsh](https://www.zsh.org/) - Interactive Shell
- [nvim](http://neovim.io/) - Extensible Vim-based text editor
- [tmux](https://github.com/tmux/tmux) - Detachable terminal multiplexer
- [ranger](https://ranger.github.io/) - CLI-based file manager with VI bindings
- [git](https://git-scm.com/) - Version control system
They can be easily installed/ updated with your package manger, e.g:
- Ubuntu Server: `sudo apt install -y zsh neovim tmux ranger git`
- Arch Linux: `sudo pacman -S zsh neovim tmux ranger git`
- Alpine: `apk add zsh neovim tmux ranger git`
- MacOS: `brew install zsh neovim tmux ranger git`
Depending on your setup, the following utils may also be required: `make`, `ctags`, `fzf` and `python3-pip`

8
configs/.curlrc Normal file
View File

@ -0,0 +1,8 @@
# Configuration for curl
# For more info, see: https://everything.curl.dev/
# When following a redirect, automatically set the previous URL as referrer
referer = ";auto"
# Wait 60 seconds before timing out
connect-timeout = 60

View File

@ -20,7 +20,7 @@ sudo scutil --set HostName "$COMPUTER_NAME"
sudo scutil --set LocalHostName "$COMPUTER_NAME" sudo scutil --set LocalHostName "$COMPUTER_NAME"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$COMPUTER_NAME" sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$COMPUTER_NAME"
# Set highlight color to aqua # Set highlight color
defaults write NSGlobalDomain AppleHighlightColor -string "${HIGHLIGHT_COLOR}" defaults write NSGlobalDomain AppleHighlightColor -string "${HIGHLIGHT_COLOR}"
# Configure sidebars, scrollbars and window resizers # Configure sidebars, scrollbars and window resizers
@ -202,6 +202,31 @@ defaults write com.apple.dock autohide-time-modifier -float 0.05
defaults write com.apple.dock showhidden -bool true defaults write com.apple.dock showhidden -bool true
defaults write com.apple.dock show-recents -bool false defaults write com.apple.dock show-recents -bool false
# If DockUtil installed, then use it to remove default dock items, and add useful ones
if hash dockutil 2> /dev/null; then
apps_to_remove_from_dock=(
'App Store' 'Calendar' 'Contacts' 'FaceTime'
'Keynote' 'Mail' 'Maps' 'Messages' 'Music'
'News' 'Notes' 'Numbers'
'Pages' 'Photos' 'Podcasts'
'Reminders' 'TV'
)
apps_to_add_to_dock=(
'iTerm' 'Firefox' 'Standard Notes' 'Visual Studio Code'
)
IFS=""
# Removes useless apps from dock
for app in ${apps_to_remove_from_dock[@]}; do
dockutil --remove ~/Applications/${app}.app
done
# Adds useful apps to dock, if installed
for app in ${apps_to_add_to_dock[@]}; do
if [[ -d "~/Applications/${app}.app" ]]; then
dockutil --add ~/Applications/${app}.app
fi
done
fi
# Add iOS & Watch Simulator to Launchpad # Add iOS & Watch Simulator to Launchpad
sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app"
sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app" sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app"

35
configs/.wgetrc Normal file
View File

@ -0,0 +1,35 @@
# Use the server-provided last modification date, if available
timestamping = on
# Do not go up in the directory structure when downloading recursively
no_parent = on
# Wait 60 seconds before timing out (DNS, connect and read)
timeout = 60
# Retry a few times when a download fails, but dont overdo it
tries = 3
# Retry even when the connection was refused
retry_connrefused = on
# Use the last component of a redirection URL for the local file name
trust_server_names = on
# Follow FTP links from HTML documents by default
follow_ftp = on
# Add extensions when missing, based on header type (e.g. text/html --> .html)
adjust_extension = on
# Use UTF-8 as the default system encoding
#local_encoding = UTF-8
# Ignore `robots.txt` and `<meta name=robots content=nofollow>`
robots = off
# Print the HTTP and FTP server responses
server_response = on
# Disguise as IE 9 on Windows 7
user_agent = Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

View File

@ -15,7 +15,7 @@ REPO_PATH="https://github.com/${REPO_NAME}.git"
CONFIG=".install.conf.yaml" CONFIG=".install.conf.yaml"
DOTBOT_DIR="dotbot" DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot" DOTBOT_BIN="bin/dotbot"
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CURRENT_DIR=$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)
DOTFILES_DIR="${DOTFILES_DIR:-$HOME/Documents/config/dotfiles}" DOTFILES_DIR="${DOTFILES_DIR:-$HOME/Documents/config/dotfiles}"
TITLE='🧰 Lissy93/Dotfiles Setup' TITLE='🧰 Lissy93/Dotfiles Setup'
@ -148,6 +148,10 @@ function install_packages () {
brew cleanup brew cleanup
fi fi
fi fi
# Windows (WIP)
if [ "$system_type" = "WindowsNT" ] || [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "cygwin" ]; then
"${DOTFILES_DIR}/installs/windows.sh"
fi
} }
# Updates current session, and outputs summary # Updates current session, and outputs summary

View File

@ -43,6 +43,7 @@ brew 'neofetch'
cask 'android-studio' cask 'android-studio'
cask 'boop' cask 'boop'
brew 'gradle' brew 'gradle'
# brew 'qemu'
cask 'iterm2' cask 'iterm2'
cask 'postman' cask 'postman'
cask 'sourcetree' cask 'sourcetree'
@ -63,11 +64,15 @@ brew 'nvm'
brew 'openjdk' brew 'openjdk'
brew 'python' brew 'python'
brew 'rust' brew 'rust'
cask 'android-sdk'
# Network and Security Testing # Network and Security Testing
cask 'wireshark' brew 'nmap'
brew 'wrk' brew 'wrk'
cask 'burp-suite'
cask 'metasploit'
cask 'owasp-zap' cask 'owasp-zap'
cask 'wireshark'
# Security Utilities # Security Utilities
brew 'bcrypt' brew 'bcrypt'
@ -80,11 +85,11 @@ tap 'homebrew/cask-fonts'
cask 'font-fira-code' cask 'font-fira-code'
cask 'font-hack' cask 'font-hack'
cask 'font-inconsolata' cask 'font-inconsolata'
cask 'font-meslo-lg-nerd-font'
# Mac OS Mods and Imrovments # Mac OS Mods and Imrovments
brew 'm-cli' brew 'm-cli'
cask 'alt-tab' cask 'alt-tab'
cask 'amethyst'
cask 'anybar' cask 'anybar'
cask 'coteditor' cask 'coteditor'
cask 'finicky' cask 'finicky'
@ -115,3 +120,4 @@ cask 'tresorit'
cask 'firefox' cask 'firefox'
cask 'chromium' cask 'chromium'
cask 'standard-notes' cask 'standard-notes'
cask 'signal'

77
installs/windows.sh Normal file
View File

@ -0,0 +1,77 @@
#!/usr/bin/env bash
# Apps and packages to be installed on Windows systems
# Apps are sorted by category, and arranged alphabetically
# Be sure to delete / comment out anything you do not need
set -e
# Apps to be installed via Winget
winget_apps=(
# Apps
'Mozilla.Firefox'
'StandardNotes.StandardNotes'
'Mozilla.Thunderbird'
'ProtonTechnologies.ProtonMailBridge'
'AgileBits.1Password'
'BraveSoftware.BraveBrowser'
'LibreOffice.LibreOffice'
'qBittorrent.qBittorrent'
# Development
'Microsoft.PowerToys'
'Docker.DockerDesktop'
'Oracle.VirtualBox'
'WinSCP.WinSCP'
'Postman.Postman'
'Arduino.Arduino'
'SQLiteBrowser.SQLiteBrowser'
'Notepad++.Notepad++'
# Utils
'Lexikos.AutoHotkey'
'REALiX.HWiNFO'
'GNURadio.GNURadio'
'Balena.Etcher'
# Security Utils
'Cryptomator.Cryptomator'
'Keybase.Keybase'
'KeePassXCTeam.KeePassXC'
# Netowking
'WiresharkFoundation.Wireshark'
'angryziber.AngryIPScanner'
# Media + Creativity
'Inkscape.Inkscape'
'darktable.darktable'
'Audacity.Audacity'
'GIMP.GIMP'
'VideoLAN.VLC'
'OBSProject.OBSStudio'
'Meltytech.Shotcut'
'BlenderFoundation.Blender'
'Ultimaker.Cura'
'Spotify.Spotify'
'Valve.Steam'
'thehandbraketeam.handbrake'
)
CYAN_B='\033[1;96m'
YELLOW_B='\033[1;93m'
RED_B='\033[1;31m'
GREEN_B='\033[1;32m'
RESET='\033[0m'
echo "${CYAN_B}Installing Windows Packages...${RESET}"
# Winget
if hash winget 2> /dev/null; then
for app in ${winget_apps[@]}; do
winget install --id=${app} -e
done
else
echo "${YELLOW_B}Winget not present, skipping${RESET}"
fi

View File

@ -46,3 +46,12 @@ export PYTHONIOENCODING='UTF-8';
if [ "$(uname -s)" = "Darwin" ] && [[ -d /opt/homebrew/bin ]]; then if [ "$(uname -s)" = "Darwin" ] && [[ -d /opt/homebrew/bin ]]; then
export PATH=/opt/homebrew/bin:$PATH export PATH=/opt/homebrew/bin:$PATH
fi fi
# And Android SDK to path, if within Library direcroty
if [ "$(uname -s)" = "Darwin" ] && [[ -d ~/Library/Android/ ]]; then
export PATH="/Users/alicia/Library/Android/sdk/emulator:${PATH}"
export ANDROID_HOME="~/Library/Android/sdk"
export ANDROID_SDK_ROOT="~/Library/Android/sdk"
export ANDROID_AVD_HOME="~/.android/avd"
export NODE_BINARY=node
fi

View File

@ -61,9 +61,32 @@ function gplfs() {
git lfs push origin "$(git_current_branch)" --all git lfs push origin "$(git_current_branch)" --all
} }
# Navigate back to project root (where .git is)
alias gx='cd $(git rev-parse --show-toplevel)' alias gx='cd $(git rev-parse --show-toplevel)'
# Navigate back to project root (where .git is)
function jump-to-git-root {
local _root_dir="$(git rev-parse --show-toplevel 2>/dev/null)"
if [[ $? -gt 0 ]]; then
>&2 echo '\033[1;93m Not a Git repo\033[0m'
exit 1
fi
local _pwd=$(pwd)
if [[ $_pwd = $_root_dir ]]; then
# Handle submodules
_root_dir="$(git -C $(dirname $_pwd) rev-parse --show-toplevel 2>/dev/null)"
if [[ $? -gt 0 ]]; then
echo "\033[0;96m Already at Git repo root.\033[0m"
return 0
fi
fi
# Make `cd -` work.
OLDPWD=$_pwd
echo "\033[0;96m Git repo root: $_root_dir\033[0m"
cd $_root_dir
}
alias gj='jump-to-git-root'
# Shorthand clone (e.g. $ clone lissy93/dotfiles) # Shorthand clone (e.g. $ clone lissy93/dotfiles)
function clone { function clone {
default_service='github.com' # Used if full URL isn't specified default_service='github.com' # Used if full URL isn't specified

View File

@ -126,6 +126,8 @@ install_nvm () {
fi fi
# All done, import / re-import NVM script # All done, import / re-import NVM script
source "${NVM_DIR}/nvm.sh" source "${NVM_DIR}/nvm.sh"
# Then install Node LTS
nvm install v16.16.0
} }
# NVM commands # NVM commands