Compare commits

..

36 Commits

Author SHA1 Message Date
Ismo Vuorinen
6395895beb nvim: Update 2023-03-27 10:01:02 +03:00
Ismo Vuorinen
fa3dc531a0 Tweaks & EOL's added 2023-03-27 10:01:02 +03:00
bb7ba3c919 Currect GOPATH, added the right git-profile package 2023-03-26 23:43:29 +00:00
53d91f8248 dotbot: Removed some gh plugins 2023-03-27 02:31:43 +03:00
745fc9b737 Moved dotbot plugins to root 2023-03-19 03:32:03 +02:00
dbe5ea3ce0 tweaks, antigen.zsh server version 2023-03-19 02:59:04 +02:00
761671e7f7 dfm: install nvm 2023-03-19 02:57:52 +02:00
f4df8623b0 bin: old scripts 2023-03-19 02:56:54 +02:00
03aacb0639 dotbot: fix glob error in python < v3.5 2023-03-19 02:10:04 +02:00
04c85245cc dfm: starship install dir fix 2023-03-19 01:37:17 +02:00
2ccb74422c configuration fixes 2023-03-19 01:28:28 +02:00
3c87ed4d2b dotbot: config, ifplatform, formatting 2023-03-19 01:14:14 +02:00
4e4ff92ae5 dotbot: config, ifplatform, formatting 2023-03-19 00:52:43 +02:00
ef9bf3864b meta: add dotbot-ifplatform, update astronvim cfg 2023-03-19 00:46:49 +02:00
cfb9aa696e gh: switched gh from ssh to https 2023-03-18 01:51:20 +02:00
1c75e7a53f nvim: updates 2023-03-18 01:10:36 +02:00
6e8875e734 git: brew path to gh 2023-03-17 19:51:09 +02:00
70a9237166 Switched git submodules to https 2023-03-17 19:43:32 +02:00
59b08f8d1f README fixes and ssh/config cleanup 2023-03-17 14:08:59 +02:00
c9bc6e597a host-* to hosts/*, dfm rework, renaming and stuff 2023-03-17 13:37:58 +02:00
5cd720cc4d Moved $HOME root dotfiles to base folder 2023-03-17 10:54:58 +02:00
e618f64cf5 Tweak configurations 2023-03-17 10:34:31 +02:00
fed9769640 dotbot config, submodules and cleanup 2023-03-17 08:52:24 +02:00
renovate[bot]
95e213d407 chore(deps): update actions/checkout action to v3 (#3)
Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-13 00:24:23 +02:00
renovate[bot]
29a289bc7b chore(deps): add renovate.json (#2)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-13 00:21:08 +02:00
9f133469e0 linux: fixes to everything when using linux 2023-03-10 15:07:44 +02:00
ba90a2e6eb nvim: update user config 2023-03-09 08:17:02 +02:00
Ismo Vuorinen
af32dd6bf3 Formatting, updated user config, tweaks 2023-03-08 09:24:36 +02:00
Ismo Vuorinen
e519d98a68 zshrc: op and ansible config locations 2023-03-07 10:49:19 +02:00
cde571de69 zsh: iterm2 shell integration 2023-03-05 18:53:48 +02:00
b563ba5cd0 starship: git branch truncation 2023-03-04 22:10:36 +02:00
f357d23559 zsh: export GEM_PATH and WAKATIME_HOME 2023-03-03 16:10:50 +02:00
Ismo Vuorinen
b183fcbdb2 nvim: update astronvim 2023-02-27 10:20:58 +02:00
17ce1c6ee6 zshrc: More configurations! 2023-02-27 03:34:33 +02:00
66de4b3323 zsh: Update main and lakka zshrc 2023-02-27 02:04:41 +02:00
b55c1a17ba dfm: Reset nvim command fixes 2023-02-27 01:35:54 +02:00
74 changed files with 1369 additions and 678 deletions

View File

@@ -8,5 +8,12 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.lua]
insert_final_newline = true
[*.yaml,*.yml]
indent_size = 2
insert_final_newline = true
[local/bin/antigen.zsh]
ignore = true

View File

@@ -5,7 +5,7 @@ jobs:
name: Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: GitHub Actions
uses: reviewdog/action-actionlint@v1

2
.gitignore vendored
View File

@@ -1,3 +1,3 @@
Brewfile.lock.json
*.log
*-secret

39
.gitmodules vendored
View File

@@ -1,12 +1,43 @@
[submodule "dotbot"]
path = dotbot
url = https://github.com/anishathalye/dotbot.git
ignore = dirty
[submodule "dotbot-brew"]
path = dotbot-brew
url = https://github.com/wren/dotbot-brew.git
ignore = dirty
[submodule "dotbot-if"]
path = dotbot-if
url = https://github.com/wonderbeyond/dotbot-if.git
ignore = dirty
[submodule "dotbot-ifplatform"]
path = dotbot-ifplatform
url = https://github.com/ssbanerje/dotbot-ifplatform.git
ignore = dirty
[submodule "dotbot-gh-extension"]
path = dotbot-gh-extension
url = https://github.com/fundor333/dotbot-gh-extension.git
ignore = dirty
[submodule "dotbot-golang"]
path = dotbot-golang
url = https://github.com/delicb/dotbot-golang.git
ignore = dirty
[submodule "config/nvim"]
path = config/nvim
url = git@github.com:AstroNvim/AstroNvim.git
url = https://github.com/AstroNvim/AstroNvim.git
ignore = dirty
branch = v3
branch = main
update = checkout
[submodule "config/astronvim/lua/user"]
path = config/astronvim/lua/user
url = git@github.com:ivuorinen/astronvim_config.git
url = https://github.com/ivuorinen/astronvim_config.git
update = rebase
branch = main
ignore = dirty

View File

@@ -1,8 +1,9 @@
# .dotfiles
Welcome to [ivuorinen](https://github.com/ivuorinen)'s .dotfiles repository. It's a hodgepodge of scripts
and configurations, tests and mistakes I'm not aware of yet. As I find more interesting tools, configs and
other stuff, this repository will live accordingly.
Welcome to [ivuorinen](https://github.com/ivuorinen)'s .dotfiles repository.
It's a hodgepodge of scripts and configurations, tests and mistakes I'm not
aware of yet. As I find more interesting tools, configs and other stuff,
this repository will live accordingly.
Please for the love of everything good do not use these 1:1 as your own dotfiles,
fork or download the repo as a zip and go from there with your own configs.
@@ -12,42 +13,34 @@ fork or download the repo as a zip and go from there with your own configs.
### First time setup
1. Clone this repository to `$HOME/.dotfiles`
2. `bash $HOME/.dotfiles/scripts/settler.sh`
2. `./install`
3. ???
4. Profit
Note: there's a bit chicken/egg situation, because settler assumes you don't have git,
and you need git to clone the repo. This will change soon&trade;.
## Interesting files and locations
### Special folders
### Interesting folders
| Path | Description |
|--------------------|-------------------------------------------------------------------------------------|
| `.github` | GitHub Repository configuration files. Not part of the dotfiles per se. |
| `host-{hostname}/` | Host specific dotfiles. Configurations that should apply to that host only. |
| `local/bin` | Helper scripts that I've collected or wrote to make life easier. |
| `scripts` | Setup scripts. Some can be run many times, some are meant only for the first round. |
| Path | Description |
| ------------------- | -------------------------------------------- |
| `.github` | GitHub Repository configuration files. |
| `hosts/{hostname}/` | Configs that should apply to that host only. |
| `local/bin` | Helper scripts that I've collected or wrote. |
| `scripts` | Setup scripts. |
### dotfile folders
| Repo | Destination | Description |
|-----------|-------------|------------------------------------------------------------------|
| `config/` | `.config/` | Configurations for applications. |
| `local/` | `.local/` | XDG Base folder, contains `bin`, `share` and `state` for example |
| `ssh/` | `.ssh/` | SSH Configurations. |
| Repo | Destination | Description |
| --------- | ----------- | ------------------------------------------- |
| `base/` | `.*` | `$HOME` level files. |
| `config/` | `.config/` | Configurations for applications. |
| `local/` | `.local/` | XDG Base folder: `bin`, `share` and `state` |
| `ssh/` | `.ssh/` | SSH Configurations. |
### dfm - the dotfiles manager
`.local/bin/dfm` is a shell script that has some tools that help with dotfiles management.
### `scripts/install-dotfiles.sh` - dotfiles linker
The `scripts/install-dotfiles.sh` is a `rcm` generated shell script that does all the necessary linking.
To refresh the file, you can run `dfm dotfiles update`
## Configuration
The folder structure follows [XDG Base Directory Specification][xdg] where possible.
@@ -55,29 +48,37 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
### XDG Variables
| Var | Default |
|--------------------|----------------------|
| Executables | `$HOME/.local/bin` |
| ------------------ | -------------------- |
| `$XDG_DATA_HOME` | `$HOME/.local/share` |
| `$XDG_STATE_HOME` | `$HOME/.local/state` |
| `$XDG_CONFIG_HOME` | `$HOME/.config` |
| `$XDG_BIN_HOME` | `$HOME/.local/bin` |
- `$XDG_BIN_HOME` is a custom `env` for `.local/bin` folder.
- `$XDG_DATA_HOME` defines the base directory relative to which user-specific data
files should be stored. If `$XDG_DATA_HOME` is either not set or empty,
a default equal to `$HOME/.local/share` should be used.
- `$XDG_CONFIG_HOME` defines the base directory relative to which user-specific configuration
files should be stored. If `$XDG_CONFIG_HOME` is either not set or empty,
a default equal to `$HOME/.config` should be used.
- `$XDG_STATE_HOME` defines the base directory relative to which user-specific state files should be stored.
If `$XDG_STATE_HOME` is either not set or empty, a default equal to `$HOME/.local/state` should be used.
- The `$XDG_STATE_HOME` contains state data that should persist between (application) restarts,
but that is not important or portable enough to the user that it should be stored in `$XDG_DATA_HOME`.
- `$XDG_STATE_HOME` defines the base directory relative
to which user-specific state files should be stored.
If `$XDG_STATE_HOME` is either not set or empty, a default
equal to `$HOME/.local/state` should be used.
- The `$XDG_STATE_HOME` contains state data that should persist
between (application) restarts,
but that is not important or portable enough to the user that
it should be stored in `$XDG_DATA_HOME`.
It may contain:
- actions history (logs, history, recently used files, …)
- current state of the application that can be reused on a restart (view, layout, open files, undo history, …)
- User-specific executable files may be stored in `$HOME/.local/bin`. Distributions should ensure this
directory shows up in the UNIX `$PATH` environment variable, at an appropriate place.
- `$XDG_DATA_DIRS` defines the preference-ordered set of base directories to search for data files in addition
to the `$XDG_DATA_HOME` base directory. The directories in `$XDG_DATA_DIRS` should be seperated with a colon ':'.
- actions history (logs, history, recently used files, …)
- current state of the application that can be reused
on a restart (view, layout, open files, undo history, …)
- User-specific executable files may be stored in `$HOME/.local/bin`.
Distributions should ensure this directory shows up in the UNIX `$PATH`
environment variable, at an appropriate place.
- `$XDG_DATA_DIRS` defines the preference-ordered set of base directories
to search for data files in addition to the `$XDG_DATA_HOME` base directory.
The directories in `$XDG_DATA_DIRS` should be seperated with a colon ':'.
[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
@@ -85,12 +86,9 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
### Interesting dotfiles repos
- https://dotfiles.github.io/inspiration/
- https://github.com/frdmn/dotfiles - Ansible-based dotfile setup for macOS
- https://github.com/mvdan/dotfiles - Here be dragons
- https://github.com/vsouza/dotfiles - 🏡 My dotfiles
- https://github.com/freekmurze/dotfiles - My personal dotfiles
### Interesting dotfiles tools
- https://github.com/zero-sh/zero.sh - Radically simple personal bootstrapping tool for macOS.
- [dotfiles.github.io/inspiration/](https://dotfiles.github.io/inspiration)
- [frdmn/dotfiles](https://github.com/github.com/frdmn/dotfiles) - Ansible-based
dotfile setup for macOS
- [mvdan/dotfiles](https://github.com/mvdan/dotfiles) - Here be dragons
- [vsouza/dotfiles](https://github.com/vsouza/dotfiles) - 🏡 My dotfiles
- [freekmurze/dotfiles](https://github.com/freekmurze/dotfiles) - My personal dotfiles

7
add-submodules.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git dotbot-brew
git submodule add --name dotbot-gh-extension -f https://github.com/fundor333/dotbot-gh-extension.git dotbot-gh-extension
git submodule add --name dotbot-golang -f https://github.com/delicb/dotbot-golang.git dotbot-golang
git submodule add --name dotbot-if -f https://github.com/wonderbeyond/dotbot-if.git dotbot-if
git submodule add --name dotbot-ifplatform -f https://github.com/ssbanerje/dotbot-ifplatform.git dotbot-ifplatform

113
base/bashrc Normal file
View File

@@ -0,0 +1,113 @@
# shellcheck shell=bash
# Defaults
export DOTFILES="$HOME/.dotfiles"
# Explicitly set XDG folders
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_BIN_HOME="$HOME/.local/bin" # this one is custom
# Homebrew configuration
export HOMEBREW="/opt/homebrew"
export HOMEBREW_BIN="$HOMEBREW/bin"
export HOMEBREW_SBIN="$HOMEBREW/sbin"
export HOMEBREW_PKG="$HOMEBREW/opt"
export HOMEBREW_NO_ENV_HINTS=1
export PATH="$XDG_BIN_HOME:$HOMEBREW_BIN:$HOMEBREW_SBIN:/usr/local/sbin:$PATH"
# brew, https://brew.sh
if command -v brew &> /dev/null; then
BREW_BIN=$(brew --prefix)/bin
BREW_SBIN=$(brew --prefix)/sbin
BREW_PYTHON=$(brew --prefix python@3.8)/bin
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
BREW_RUBY=$(brew --prefix ruby)/bin
BREW_GEMS=$(gem environment gemdir)/bin
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$BREW_BIN:$BREW_SBIN:$PATH"
fi
# nvm, the node version manager
export NVM_LAZY_LOAD=true
export NVM_COMPLETION=true
export NVM_AUTO_USE=true
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
# If we have go packages, include them to the PATH
if command -v go &> /dev/null; then
export GOPATH=$(go env GOPATH);
if [ -d "$GOPATH/bin" ]; then
export PATH="$GOPATH/bin:$PATH"
fi
fi
if command -v nvim &> /dev/null; then
export EDITOR="nvim"
fi
# z, https://github.com/rupa/z
export _Z_DATA="$XDG_STATE_HOME/z"
# composer, https://getcomposer.org/
if command -v composer &> /dev/null; then
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
export PATH="$COMPOSER_BIN:$PATH"
fi
# gem, rubygems
if command -v gem &>/dev/null; then
export GEM_HOME="$XDG_STATE_HOME/gem"
export GEM_PATH="$XDG_STATE_HOME/gem"
fi
# wakatime, https://github.com/wakatime/wakatime-cli
export WAKATIME_HOME="$XDG_STATE_HOME/wakatime"
# Run x-load-configs in your terminal to reload the files.
function x-load-configs()
{
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file"
[ -r "$file-secret" ] && [ -f "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
[ -r "$file-$HOSTNAME-secret" ] && [ -f "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
done
}
x-load-configs
# Import ssh keys in keychain
ssh-add -A 2>/dev/null;
# op (1Password cli) is present
if hash op 2>/dev/null; then
export OP_CACHE="$XDG_STATE_HOME/1password"
mkdir -p "$OP_CACHE";
eval "$(op completion zsh)"; compdef _op op
fi
# Ansible configuration
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html
if hash ansible 2>/dev/null; then
export ANSIBLE_HOME="$XDG_STATE_HOME/ansible"
mkdir -p "$ANSIBLE_HOME"
fi
# gcloud is present
#if hash gcloud 2>/dev/null; then
# GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
# [[ -f "$GCLOUD_LOC/path.zsh.inc" ]] && builtin source "$GCLOUD_LOC/path.zsh.inc"
# [[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
#fi
# Load iterm2 shell integration
# https://iterm2.com/documentation-shell-integration.html
[[ -f "$XDG_BIN_HOME/iterm2_shell_integration.zsh" ]] && source "$XDG_BIN_HOME/iterm2_shell_integration.zsh"

View File

View File

@@ -5,3 +5,4 @@ export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
alias php="php -d error_reporting=22527"

View File

View File

@@ -1,36 +1,53 @@
# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
# this is my zsh config. there are many like it, but this one is mine.
# shellcheck shell=bash
autoload -U colors zsh/terminfo
colors
export HOMEBREW="/opt/homebrew"
# Defaults
export DOTFILES="$HOME/.dotfiles"
export PATH="$HOMEBREW/opt/ruby/bin:$HOMEBREW/bin:$HOMEBREW/sbin:/usr/local/sbin:$PATH"
export HOMEBREW_NO_ENV_HINTS=1
# Explicitely set XDG folders
# Explicitly set XDG folders
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_BIN_HOME="$HOME/.local/bin" # this one is custom
# Homebrew configuration
export HOMEBREW="/opt/homebrew"
export HOMEBREW_BIN="$HOMEBREW/bin"
export HOMEBREW_SBIN="$HOMEBREW/sbin"
export HOMEBREW_PKG="$HOMEBREW/opt"
export HOMEBREW_NO_ENV_HINTS=1
export PATH="$XDG_BIN_HOME:$HOMEBREW_BIN:$HOMEBREW_SBIN:/usr/local/sbin:$PATH"
# brew, https://brew.sh
if [ command -v brew &> /dev/null ]; then
BREW_BIN=$(brew --prefix)/bin
BREW_SBIN=$(brew --prefix)/sbin
BREW_BIN=$(brew --prefix)/bin
BREW_SBIN=$(brew --prefix)/sbin
BREW_PYTHON=$(brew --prefix python@3.8)/bin
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
BREW_RUBY=$(brew --prefix ruby)/bin
BREW_GEMS=$(gem environment gemdir)/bin
BREW_PYTHON=$(brew --prefix python@3.8)/bin
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
BREW_RUBY=$(brew --prefix ruby)/bin
BREW_GEMS=$(gem environment gemdir)/bin
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$BREW_BIN:$BREW_SBIN:$PATH"
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$BREW_BIN:$BREW_SBIN:$PATH"
fi
# nvm, the node version manager
export NVM_LAZY_LOAD=true
export NVM_COMPLETION=true
export NVM_AUTO_USE=true
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
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# If we have go packages, include them to the PATH
if command -v go &> /dev/null; then
export GOPATH=$(go env GOPATH);
export GOPATH="$XDG_DATA_HOME/go";
mkdir -p "$GOPATH"
if [ -d "$GOPATH/bin" ]; then
export PATH="$GOPATH/bin:$PATH"
fi
@@ -40,22 +57,31 @@ if command -v nvim &> /dev/null; then
export EDITOR="nvim"
fi
LOCAL_BIN="$HOME/.local/bin"
COMPOSER_DIR="$HOME/.composer/vendor/bin"
export PATH="$LOCAL_BIN:$COMPOSER_DIR:$PATH"
# z, https://github.com/rupa/z
export _Z_DATA="$XDG_STATE_HOME/z"
export NVM_DIR="$HOME/.nvm"
export NVM_LAZY_LOAD=true
export NVM_COMPLETION=true
export NVM_AUTO_USE=true
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
# composer, https://getcomposer.org/
if command -v composer &> /dev/null; then
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
export PATH="$COMPOSER_BIN:$PATH"
fi
# gem, rubygems
if command -v gem &>/dev/null; then
export GEM_HOME="$XDG_STATE_HOME/gem"
export GEM_PATH="$XDG_STATE_HOME/gem"
fi
# wakatime, https://github.com/wakatime/wakatime-cli
export WAKATIME_HOME="$XDG_STATE_HOME/wakatime"
# Run x-load-configs in your terminal to reload the files.
function x-load-configs()
{
# Load the shell dotfiles, and then some:
for file in ~/.dotfiles/config/{exports,alias,functions}; do
for file in $DOTFILES/config/{exports,alias,functions}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file"
[ -r "$file-secret" ] && [ -f "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
@@ -67,15 +93,19 @@ x-load-configs
# Import ssh keys in keychain
ssh-add -A 2>/dev/null;
# Antigen configuration
# https://github.com/zsh-users/antigen/wiki/Configuration
export ADOTDIR="$XDG_DATA_HOME/antigen"
export ANTIGEN_SYSTEM_RECEIPT_F=".local/share/antigen/antigen_system_lastupdate"
export ANTIGEN_PLUGIN_RECEIPT_F=".local/share/antigen/antigen_plugin_lastupdate"
# Try to load antigen, if present
[[ -f "$HOME/.local/bin/antigen.zsh" ]] && source "$HOME/.local/bin/antigen.zsh"
[[ -f "$XDG_BIN_HOME/antigen.zsh" ]] && source "$XDG_BIN_HOME/antigen.zsh"
# antigen is present
if command -v antigen &> /dev/null; then
antigen use oh-my-zsh
# antigen theme oskarkrawczyk/honukai-iterm-zsh honukai
antigen bundle ssh-agent
antigen bundle colored-man-pages
antigen bundle jreese/zsh-titles
@@ -84,16 +114,13 @@ if command -v antigen &> /dev/null; then
antigen bundle MichaelAquilina/zsh-you-should-use
antigen bundle unixorn/autoupdate-antigen.zshplugin
antigen bundle Sparragus/zsh-auto-nvm-use
# antigen bundle git-auto-fetch
hash php 2>/dev/null && antigen bundle php
hash nvm 2>/dev/null && antigen bundle nvm
hash docker 2>/dev/null && antigen bundle docker
# hash ruby 2>/dev/null && antigen bundle ruby
# hash python 2>/dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
hash python 2>/dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
hash jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
# antigen bundle voronkovich/phpcs.plugin.zsh
# Platform dependant bundles
if [[ $(uname) == 'Linux' ]]; then
@@ -113,9 +140,18 @@ fi
# op (1Password cli) is present
if hash op 2>/dev/null; then
export OP_CACHE="$XDG_STATE_HOME/1password"
mkdir -p $OP_CACHE;
eval "$(op completion zsh)"; compdef _op op
fi
# Ansible configuration
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html
if hash ansible 2>/dev/null; then
export ANSIBLE_HOME="$XDG_STATE_HOME/ansible"
mkdir -p "$ANSIBLE_HOME"
fi
# gcloud is present
#if hash gcloud 2>/dev/null; then
# GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
@@ -123,7 +159,9 @@ fi
# [[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
#fi
# Load iterm2 shell integration
# https://iterm2.com/documentation-shell-integration.html
[[ -f "$XDG_BIN_HOME/iterm2_shell_integration.zsh" ]] && source "$XDG_BIN_HOME/iterm2_shell_integration.zsh"
eval "$(starship init zsh)"
# 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"

View File

@@ -1,8 +0,0 @@
# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/bash_profile.pre.bash" ]] && builtin source "$HOME/.fig/shell/bash_profile.pre.bash"
# shellcheck shell=bash
export PATH="$HOME/.local/bin:/usr/local/sbin:$PATH"
# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/bash_profile.post.bash" ]] && builtin source "$HOME/.fig/shell/bash_profile.post.bash"

14
bashrc
View File

@@ -1,14 +0,0 @@
# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/bashrc.pre.bash" ]] && builtin source "$HOME/.fig/shell/bashrc.pre.bash"
# shellcheck shell=bash
PHP_PATH=$(brew --prefix php)/bin
export PATH="$PHP_PATH:$HOME/.composer/vendor/bin/:/usr/local/opt/ruby/bin:/usr/local/sbin:$PATH"
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/bashrc.post.bash" ]] && builtin source "$HOME/.fig/shell/bashrc.post.bash"

View File

@@ -4,36 +4,38 @@
# Get installed php versions from brew and setup aliases
function x-set-php-aliases
{
local php_versions=()
while IFS="" read -r line; do php_versions+=("$line"); done < <(brew list | grep '^php')
if command -v brew &> /dev/null; then
local php_versions=()
while IFS="" read -r line; do php_versions+=("$line"); done < <(brew list | grep '^php')
php_error_reporting='-d error_reporting=22527'
php_error_reporting='-d error_reporting=22527'
for version in "${php_versions[@]}"; do
# drop the dot from version (8.0 -> 80)
local php_abbr="${version//\./}"
# replace "php@" with "p" so "php@80" becomes "p80"
local php_alias="${php_abbr//php@/p}"
for version in "${php_versions[@]}"; do
# drop the dot from version (8.0 -> 80)
local php_abbr="${version//\./}"
# replace "php@" with "p" so "php@80" becomes "p80"
local php_alias="${php_abbr//php@/p}"
# Skip php = php aliasing
# if [[ "$php_abbr" == "$php_alias" ]]; then continue; fi;
# Skip php = php aliasing
# if [[ "$php_abbr" == "$php_alias" ]]; then continue; fi;
# Fetch the exec path once
php_exec="$(brew --prefix "$version")/bin/php"
# Fetch the exec path once
php_exec="$(brew --prefix "$version")/bin/php"
# Raw PHP without error_reporting flag.
# shellcheck disable=SC2139
alias ${php_alias}r="$php_exec"
# PHP with error_reporting flag.
# shellcheck disable=SC2139
alias $php_alias="$php_exec $php_error_reporting"
# Local PHP Server.
# shellcheck disable=SC2139
alias ${php_alias}s="$php_exec -S localhost:9000"
# Use composer with specific PHP and error_reporting flag on.
# shellcheck disable=SC2139
alias ${php_alias}c="$php_exec $php_error_reporting $(which composer)"
done
# Raw PHP without error_reporting flag.
# shellcheck disable=SC2139
alias "${php_alias}"r="$php_exec"
# PHP with error_reporting flag.
# shellcheck disable=SC2139
alias "$php_alias"="$php_exec $php_error_reporting"
# Local PHP Server.
# shellcheck disable=SC2139
alias "${php_alias}"s="$php_exec -S localhost:9000"
# Use composer with specific PHP and error_reporting flag on.
# shellcheck disable=SC2139
alias "${php_alias}"c="$php_exec $php_error_reporting $(which composer)"
done
fi
}
if [[ $(uname) == 'Darwin' ]]; then

View File

@@ -5,7 +5,9 @@ export HIST_STAMPS="yyyy-mm-dd"
# Larger bash history (allow 32³ entries; default is 500)
export HISTSIZE=32768
export HISTFILESIZE=$HISTSIZE
export HISTCONTROL=ignoredups
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
export HISTCONTROL=ignoreboth
# Make some commands not show up in history
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
@@ -21,3 +23,9 @@ export MANPAGER="less -X"
# Always enable colored `grep` output
export GREP_OPTIONS="--color=auto"
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

View File

@@ -65,3 +65,4 @@ function silent
{
"$@" >&/dev/null
}

View File

@@ -1 +1 @@
git_protocol: ssh
git_protocol: https

View File

@@ -52,4 +52,4 @@
branch = yellow black bold ul
[submodule]
recurse = true
recurse = true

View File

@@ -13,8 +13,8 @@ disabled = true
[git_branch]
symbol = '🌱 '
truncation_length = 4
truncation_symbol = ''
truncation_length = 20
truncation_symbol = ''
ignore_branches = ['master', 'main']
[git_status]

1
dotbot Submodule

Submodule dotbot added at 328bcb3259

1
dotbot-brew Submodule

Submodule dotbot-brew added at 98e346360b

1
dotbot-gh-extension Submodule

Submodule dotbot-gh-extension added at 037994ef28

1
dotbot-golang Submodule

Submodule dotbot-golang added at 4fa60bd487

1
dotbot-if Submodule

Submodule dotbot-if added at 2b4dc56943

1
dotbot-ifplatform Submodule

Submodule dotbot-ifplatform added at e35b5c0d71

View File

@@ -1,33 +0,0 @@
PATH=$HOME/.local/bin:$HOME/bin:$HOME/.gem/bin:$HOME/.rvm/bin:/usr/local/bin:/usr/sbin:/usr/bin:$PATH
export LC_ALL=fi_FI.utf8
source $HOME/.local/bin/antigen
antigen use oh-my-zsh
antigen bundle git
antigen bundle php
# antigen bundle rvm
antigen bundle autojump
antigen bundle command-not-found
antigen bundle jreese/zsh-titles
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-completions
antigen bundle unixorn/rvm-plugin
antigen bundle unixorn/autoupdate-antigen.zshplugin
antigen theme oskarkrawczyk/honukai-iterm-zsh honukai
antigen apply
alias t='tail -f'
alias logrotate='/usr/sbin/logrotate -s $HOME/logs/state'
alias dn='du -chd1'
alias nano='nano -wS -$'
alias cat=bat
alias gpg=gpg2
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" ]] # Load RVM into a shell session *as a function*
. "/home/users/viir/.acme.sh/acme.sh.env"

View File

@@ -1,3 +1,3 @@
# .dotfiles/host-air
# .dotfiles/hosts/air
This is my home computer.

72
hosts/lakka/zshrc Normal file
View File

@@ -0,0 +1,72 @@
# Lakka zsh configuration.
#
# shellcheck shell=bash
export PATH="/usr/local/bin:/usr/bin:/usr/sbin:$PATH"
# Defaults
export DOTFILES="$HOME/.dotfiles"
# Explicitly set XDG folders
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_BIN_HOME="$HOME/.local/bin" # this one is custom
# z, https://github.com/rupa/z
export _Z_DATA="$XDG_STATE_HOME/z"
# composer, https://getcomposer.org/
if command -v composer &> /dev/null; then
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
export PATH="$COMPOSER_BIN:$PATH"
fi
# gem, rubygems
if command -v gem &>/dev/null; then
export GEM_HOME="$XDG_STATE_HOME/gem"
export PATH="$GEM_HOME/bin:$PATH"
fi
export PATH="$XDG_BIN_HOME:$HOME/bin:$HOME/.rvm/bin:$PATH"
export LC_ALL=fi_FI.utf8
# Antigen configuration
# https://github.com/zsh-users/antigen/wiki/Configuration
export ADOTDIR="$XDG_DATA_HOME/antigen"
export ANTIGEN_SYSTEM_RECEIPT_F=".local/share/antigen/antigen_system_lastupdate"
export ANTIGEN_PLUGIN_RECEIPT_F=".local/share/antigen/antigen_plugin_lastupdate"
# Try to load antigen, if present
[[ -f "$XDG_BIN_HOME/antigen.zsh" ]] && source "$XDG_BIN_HOME/antigen.zsh"
# If antigen was loaded
if command -v antigen &> /dev/null; then
antigen use oh-my-zsh
hash git 2>/dev/null && antigen bundle git
hash php 2>/dev/null && antigen bundle php
antigen bundle autojump
antigen bundle command-not-found
antigen bundle jreese/zsh-titles
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-completions
antigen bundle unixorn/rvm-plugin
antigen bundle unixorn/autoupdate-antigen.zshplugin
antigen theme oskarkrawczyk/honukai-iterm-zsh honukai
antigen apply
fi
alias t='tail -f'
alias logrotate='/usr/sbin/logrotate -s $HOME/logs/state'
alias dn='du -chd1'
alias nano='nano -wS -$'
alias gpg=gpg2
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" ]] # Load RVM into a shell session *as a function*
. "$HOME/.acme.sh/acme.sh.env"

118
hosts/tunkki/bashrc Normal file
View File

@@ -0,0 +1,118 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi

View File

@@ -1,3 +1,3 @@
# .dotfiles/host-v
# .dotfiles/hosts/v
This is my work computer.

View File

@@ -72,3 +72,4 @@
[submodule]
recurse = true

23
install Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e
CONFIG="install.conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$BASEDIR"
git submodule sync --quiet --recursive
git submodule update --init --recursive
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
-d "${BASEDIR}" \
--plugin-dir=dotbot-brew \
--plugin-dir=dotbot-gh-extension \
--plugin-dir=dotbot-golang \
--plugin-dir=dotbot-if \
--plugin-dir=dotbot-ifplatform \
-c "${CONFIG}" \
"${@}"

26
install-without-plugins Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
CONFIG="install.conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$BASEDIR"
git submodule sync --quiet --recursive
git submodule update --init --recursive
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
-d "${BASEDIR}" \
-c "${CONFIG}" \
"${@}"
# --plugin-dir=dotbot-plugins/dotbot-brew \
# --plugin-dir=dotbot-plugins/dotbot-gh-extension \
# --plugin-dir=dotbot-plugins/dotbot-golang \
# --plugin-dir=dotbot-plugins/dotbot-if \
# --plugin-dir=dotbot-plugins/dotbot-ifplatform \
# -p dotbot-plugins/dotbot-if/if.py \

117
install.conf.yaml Normal file
View File

@@ -0,0 +1,117 @@
---
- defaults:
brewfile:
stderr: true
stdout: true
create:
mode: 755
link:
create: true
relink: true
- clean:
~/:
~/.config:
recursive: true
~/.local:
recursive: true
- create:
~/.config:
~/.local:
~/.local/share:
~/.local/state:
~/.ssh:
mode: 700
~/Code:
- link:
~/.config/:
glob: true
path: config/*
~/.local/bin/:
glob: true
path: local/bin/*
~/.ssh/:
force: true
glob: true
mode: 600
path: ssh/*
~/:
force: true
glob: true
path: base/*
prefix: "."
- shell:
- [git submodule update --init --recursive --force]
- [bash scripts/install-npm-packages.sh]
- ifmacos:
- shell:
- [bash scripts/set-macos-defaults.sh]
- brewfile:
- Brewfile
# hosts: air
- if:
- cond: "[[ $(hostname) = air ]]"
met:
- go:
- github.com/skx/sysbox@latest
- github.com/dotzero/git-profile
# hosts: v
- if:
- cond: "[[ $(hostname) = v ]]"
met:
- link:
~/.config/:
glob: true
force: true
path: hosts/v/config/**
- go:
- github.com/skx/sysbox@latest
- github.com/dotzero/git-profile
# hosts tunkki
- if:
- cond: "[[ $(hostname) = tunkki ]]"
met:
- go:
- github.com/skx/sysbox@latest
- github.com/dotzero/git-profile
# hosts: lakka
- if:
- cond: "[[ $(hostname) = lakka ]]"
met:
- link:
~/.irssi/*:
force: true
glob: true
path: hosts/lakka/irssi/**
~/.zshrc:
force: true
path: hosts/lakka/zshrc
# GitHub CLI Extensions
- ghe:
# GitHub CLI extension for generating a report on repository dependencies.
- andyfeller/gh-dependency-report
# GitHub CLI extension to generate montage from GitHub user avatars
- andyfeller/gh-montage
# An opinionated GitHub Cli extension for creating
# changelogs that adhere to the keep a changelog specification.
- chelnak/gh-changelog
# Safely deletes local branches with no upstream and no un-pushed commits
- davidraviv/gh-clean-branches
# A beautiful CLI dashboard for GitHub 🚀
- dlvhdr/gh-dash
# A github-cli extension script to clone all repositories
# in an organization, optionally filtering by topic.
- matt-bartel/gh-clone-org
# being an extension to view the overall health of
# an organization's use of actions
- rsese/gh-actions-status
#

View File

@@ -25,9 +25,9 @@ Some problematic code has been fixed per `shellcheck` suggestions.
| `x-when-up` | skx/sysadmin-util |
- Sources:
- [skx/sysadmin-utils](https://github.com/skx/sysadmin-util/)
- Tools for Linux/Unix sysadmins.
- [Licence](https://github.com/skx/sysadmin-util/blob/master/LICENSE)
- onnimonni
- https://gist.github.com/onnimonni/b49779ebc96216771a6be3de46449fa1
- [mvdan/dotfiles](https://github.com/mvdan/dotfiles)
- [skx/sysadmin-utils](https://github.com/skx/sysadmin-util/)
- Tools for Linux/Unix sysadmins.
- [Licence](https://github.com/skx/sysadmin-util/blob/master/LICENSE)
- [onnimonni](https://github.com/onnimonni)
- [validate_sha256sum](https://gist.github.com/onnimonni/b49779ebc96216771a6be3de46449fa1)
- [mvdan/dotfiles](https://github.com/mvdan/dotfiles)

View File

@@ -24,7 +24,7 @@ if [[ $ANTIGEN_CACHE != false ]]; then
for config in $ANTIGEN_CHECK_FILES; do
if [[ "$config" -nt "$config.zwc" ]]; then
# Flag configuration file as newer
{ zcompile "$config"; } &!
{ zcompile "$config" } &!
# Kill cache file in order to force full loading (see a few lines below)
[[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE"
fi
@@ -151,7 +151,7 @@ antigen () {
# String if record is found
-antigen-find-record () {
local bundle=$1
if [[ $# -eq 0 ]]; then
return 1
fi
@@ -255,7 +255,7 @@ antigen () {
return 0
}
# This function check ZSH_EVAL_CONTEXT to determine if running in interactive shell.
# This function check ZSH_EVAL_CONTEXT to determine if running in interactive shell.
#
# Usage
# -antigen-interactive-mode
@@ -283,7 +283,7 @@ antigen () {
# Branch name
-antigen-parse-branch () {
local url="$1" branch="$2" branches
local match mbegin mend MATCH MBEGIN MEND
if [[ "$branch" =~ '\*' ]]; then
@@ -466,7 +466,7 @@ antigen () {
# Compatibility with oh-my-zsh themes.
-antigen-set-default _ANTIGEN_THEME_COMPAT true
# Add default built-in extensions to load at start up
-antigen-set-default _ANTIGEN_BUILTIN_EXTENSIONS 'lock parallel defer cache'
@@ -555,7 +555,7 @@ antigen () {
if [[ $#list == 0 ]]; then
return 1
fi
# Using a for rather than `source $list` as we need to check for zsh-themes
# In order to create antigen-compat file. This is only needed for interactive-mode
# theme switching, for static loading (cache) there is no need.
@@ -643,7 +643,7 @@ antigen () {
shift
done
# Check if url is just the plugin name. Super short syntax.
if [[ "${args[url]}" != */* ]]; then
case "$ANTIGEN_DEFAULT_REPO_URL" in
@@ -728,13 +728,13 @@ antigen () {
# if it's local then path is just the "url" argument, loc remains the same
args[dir]=${args[url]}
fi
# Escape url and branch (may contain semver-like and pipe characters)
args[url]="${(qq)args[url]}"
if [[ -n "${args[branch]}" ]]; then
args[branch]="${(qq)args[branch]}"
fi
# Escape bundle name (may contain semver-like characters)
args[name]="${(qq)args[name]}"
@@ -821,7 +821,7 @@ antigen-bundle () {
printf "Seems %s is already installed!\n" ${bundle[name]}
return 1
fi
# Clone bundle if we haven't done do already.
if [[ ! -d "${bundle[dir]}" ]]; then
if ! -antigen-bundle-install ${(kv)bundle}; then
@@ -835,7 +835,7 @@ antigen-bundle () {
printf "Antigen: Failed to load %s.\n" ${bundle[btype]} >&2
return 1
fi
# Only add it to the record if it could be installed and loaded.
_ANTIGEN_BUNDLE_RECORD+=("$record")
}
@@ -1326,7 +1326,7 @@ antigen-update () {
local url=""
local make_local_clone=""
local start=$(date +'%s')
if [[ $# -eq 0 ]]; then
printf "Antigen: Missing argument.\n" >&2
return 1
@@ -1340,14 +1340,14 @@ antigen-update () {
url="$(echo "$record" | cut -d' ' -f1)"
make_local_clone=$(echo "$record" | cut -d' ' -f4)
local branch="master"
if [[ $url == *\|* ]]; then
branch="$(-antigen-parse-branch ${url%|*} ${url#*|})"
fi
printf "Updating %s... " $(-antigen-bundle-short-name "$url" "$branch")
if [[ $make_local_clone == "false" ]]; then
printf "Bundle has no local clone. Will not be updated.\n" >&2
return 1
@@ -1358,7 +1358,7 @@ antigen-update () {
printf "Error! Activate logging and try again.\n" >&2
return 1
fi
local took=$(( $(date +'%s') - $start ))
printf "Done. Took %ds.\n" $took
}
@@ -1410,7 +1410,7 @@ typeset -g _ANTIGEN_EXTENSIONS; _ANTIGEN_EXTENSIONS=()
# -antigen-add-hook antigen-apply antigen-apply-hook ["replace"|"pre"|"post"] ["once"|"repeat"]
antigen-add-hook () {
local target="$1" hook="$2" type="$3" mode="${4:-repeat}"
if (( ! $+functions[$target] )); then
printf "Antigen: Function %s doesn't exist.\n" $target
return 1
@@ -1428,7 +1428,7 @@ antigen-add-hook () {
fi
_ANTIGEN_HOOKS_META[$hook]="target $target type $type mode $mode called 0"
# Do shadow for this function if there is none already
local hook_function="${_ANTIGEN_HOOK_PREFIX}$target"
if (( ! $+functions[$hook_function] )); then
@@ -1441,7 +1441,7 @@ antigen-add-hook () {
return \$?
}"
fi
return 0
}
@@ -1454,7 +1454,7 @@ antigen-add-hook () {
typeset -a pre_hooks replace_hooks post_hooks;
typeset -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]})
typeset -A meta;
for hook in $hooks; do
meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]})
@@ -1500,7 +1500,7 @@ antigen-add-hook () {
[[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret
fi
done
if [[ $replace_hook == 0 ]]; then
WARN "${_ANTIGEN_HOOK_PREFIX}$target $args"
noglob ${_ANTIGEN_HOOK_PREFIX}$target $args
@@ -1514,7 +1514,7 @@ antigen-add-hook () {
noglob $hook $args
[[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret
done
LOG "Return from hook ${target} with ${ret}"
return $ret
@@ -1533,7 +1533,7 @@ antigen-remove-hook () {
hooks[$hooks[(I)$hook]]=()
fi
_ANTIGEN_HOOKS[${target}]="${(j|:|)hooks}"
if [[ $#hooks == 0 ]]; then
# Destroy base hook
eval "function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)"
@@ -1554,7 +1554,7 @@ antigen-remove-hook () {
eval "function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)"
unfunction -- "${_ANTIGEN_HOOK_PREFIX}$target" 2> /dev/null
done
_ANTIGEN_HOOKS=()
_ANTIGEN_HOOKS_META=()
_ANTIGEN_EXTENSIONS=()
@@ -1570,14 +1570,14 @@ antigen-ext () {
eval $func
local ret=$?
WARN "$func return code was $ret"
if (( $ret == 0 )); then
if (( $ret == 0 )); then
LOG "LOADED EXTENSION $ext" EXT
-antigen-$ext-execute && _ANTIGEN_EXTENSIONS+=($ext)
else
WARN "IGNORING EXTENSION $func" EXT
return 1
fi
else
printf "Antigen: No extension defined or already loaded: %s\n" $func >&2
return 1
@@ -1617,7 +1617,7 @@ antigen-ext-init () {
return -1 # Stop right there
}
antigen-add-hook antigen-bundle antigen-bundle-defer replace
# Hooks antigen-apply in order to release hooked functions
antigen-apply-defer () {
WARN "Defer pre-apply" DEFER PRE-APPLY
@@ -1639,14 +1639,14 @@ antigen-ext-init () {
# Default lock path.
-antigen-set-default ANTIGEN_LOCK $ADOTDIR/.lock
typeset -g _ANTIGEN_LOCK_PROCESS=false
# Use env variable to determine if we should load this extension
-antigen-set-default ANTIGEN_MUTEX true
# Set ANTIGEN_MUTEX to false to avoid loading this extension
if [[ $ANTIGEN_MUTEX == true ]]; then
return 0;
fi
# Do not use mutex
return 1;
}
@@ -1714,7 +1714,7 @@ antigen-ext-init () {
else
WARN "Bundle ${bundle[name]} already cloned locally." PARALLEL
fi
repositories+=(${bundle[url]})
done
@@ -1734,7 +1734,7 @@ antigen-ext-init () {
for bundle in ${_PARALLEL_BUNDLE[@]}; do
antigen-bundle $bundle
done
WARN "Parallel install done" PARALLEL
}
@@ -1751,7 +1751,7 @@ antigen-ext-init () {
antigen-add-hook antigen-bundle antigen-bundle-parallel replace
}
antigen-add-hook antigen-apply antigen-apply-parallel pre once
antigen-apply-parallel-execute () {
WARN "Parallel replace-apply" PARALLEL REPLACE-APPLY
antigen-remove-hook antigen-bundle-parallel
@@ -1872,14 +1872,14 @@ EOC
# Cache auto config files to check for changes (.zshrc, .antigenrc etc)
-antigen-set-default ANTIGEN_AUTO_CONFIG true
# Default cache path.
-antigen-set-default ANTIGEN_CACHE $ADOTDIR/init.zsh
-antigen-set-default ANTIGEN_RSRC $ADOTDIR/.resources
if [[ $ANTIGEN_CACHE == false ]]; then
return 1
fi
return 0
}
@@ -1911,21 +1911,21 @@ EOC
antigen-remove-hook -antigen-load-source-cached
antigen-remove-hook antigen-bundle-cached
}
antigen-add-hook antigen-apply antigen-apply-cached post once
# Defer antigen-bundle.
antigen-bundle-cached () {
_ZCACHE_CAPTURE_BUNDLE+=("${(j: :)${@}}")
}
antigen-add-hook antigen-bundle antigen-bundle-cached pre
# Defer loading.
-antigen-load-env-cached () {
local bundle
typeset -A bundle; bundle=($@)
local location=${bundle[dir]}/${bundle[loc]}
# Load to path if there is no sourceable
if [[ ${bundle[loc]} == "/" ]]; then
_ZCACHE_BUNDLE_SOURCE+=("${location}")
@@ -1935,13 +1935,13 @@ EOC
_ZCACHE_BUNDLE_SOURCE+=("${location}")
}
antigen-add-hook -antigen-load-env -antigen-load-env-cached replace
# Defer sourcing.
-antigen-load-source-cached () {
_ZCACHE_BUNDLE_SOURCE+=($@)
}
antigen-add-hook -antigen-load-source -antigen-load-source-cached replace
return 0
}

View File

@@ -11,40 +11,13 @@
: "${DOTFILES:=$HOME/.dotfiles}"
: "${INSTALL_SCRIPT:=$DOTFILES/scripts/install-dotfiles.sh}"
: "${BREWFILE:=$DOTFILES/Brewfile}"
: "${HOSTFILES:=$DOTFILES/hosts}"
SCRIPT=$(basename "$0")
# shellcheck source=./../../scripts/shared.sh
source "$DOTFILES/scripts/shared.sh"
function section_reset
{
USAGE_PREFIX="$SCRIPT reset"
case "$1" in
all)
msg_ok "Running all reset commands"
$0 reset nvim
;;
nvim)
rm -rf ~/.local/share/nvim ~/.local/state/nvim ~/.cache/nvim ~/.config/astronvim ~/.config/nvim
msg_done "Deleted old nvim files"
ln -s ~/.dotfiles/config/astronvim ~/.config/astronvim
ln -s ~/.dotfiles/config/nvim ~/.config/nvim
msg_done "Linked nvim and astronvim"
$0 install brew
$0 install ext_go
$0 install ext_npm
msg_done "Installed brew, and packages for go and npm"
nvim --headless -c 'autocmd User PackerComplete quitall'
msg_done "Installed nvim packages and we are now ready"
;;
*)
menu_section "$USAGE_PREFIX" "all | nvim"
menu_item "all" "Reset everything, runs all configured reset actions"
menu_item "nvim" "Resets nvim. Deletes caches, removes nvim folders and relinks nvim folders"
;;
esac
}
function section_install
{
USAGE_PREFIX="$SCRIPT install"
@@ -52,40 +25,35 @@ function section_install
case "$1" in
all)
$0 install antigen
$0 install starship
$0 install nvm
$0 install macos
$0 install brew
$0 install ext_gh
$0 install ext_go
$0 install npm
;;
antigen)
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!"
;;
brew)
brew bundle install --file="$BREWFILE" && msg_done "🎉 macOS Defaults set!"
starship)
curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin && msg_done "🎉 starship installed!"
;;
nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash && msg_done " ^=^n^i nvm installed!"
;;
macos)
bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!"
;;
ext_go)
bash "$DOTFILES/scripts/install-go-packages.sh" && msg_done "🎉 Go packages have been installed!"
;;
ext_gh)
bash "$DOTFILES/scripts/install-gh-extensions.sh" && msg_done "🎉 Extensions for GitHub CLI have been installed!"
;;
ext_npm)
npm)
bash "$DOTFILES/scripts/install-npm-packages.sh" && msg_done "NPM Packages have been installed!"
;;
settler)
bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Settler has been run!"
;;
*)
menu_section "$USAGE_PREFIX" "all | antigen | brew | ext_gh | ext_go | ext_npm | macos | settler"
menu_item "all" "Installs antigen, macos, brew, ext_gh and ext_go"
menu_section "$USAGE_PREFIX" "all | antigen | starship | npm | macos | settler"
menu_item "all" "Installs antigen, macos, brew and ext_gh"
menu_item "antigen" "Updates the antigen.zsh file"
menu_item "brew" "Install Brewfile contents"
menu_item "ext_gh" "Install GitHub CLI Extensions"
menu_item "ext_go" "Install Go Packages"
menu_item "ext_npm" "Install NPM Packages"
menu_item "starship" "Install starship.rs"
menu_item "npm" "Install NPM Packages"
menu_item "macos" "Setup nice macOS defaults"
menu_item "settler" "Runs the WIP settler.sh"
;;
@@ -97,37 +65,36 @@ function section_brew
USAGE_PREFIX="$SCRIPT brew"
if ! command -v brew &> /dev/null; then
echo "brew could not be found, please install it first"
exit
menu_section "$USAGE_PREFIX" "brew not available on this system"
else
case "$1" in
install)
brew bundle install --file="$BREWFILE" && msg_done "🎉 Done!"
;;
update)
brew update && brew outdated && brew upgrade && brew cleanup
msg_done "🎉 Done!"
;;
updatebundle)
# Updates .dotfiles/Brewfile with descriptions
brew bundle dump \
--force \
--file="$BREWFILE" \
--describe && msg_done "🎉 Done!"
;;
autoupdate)
brew autoupdate delete
brew autoupdate start 43200 --upgrade --cleanup --immediate
;;
*)
menu_section "$USAGE_PREFIX" "install | update | updatebundle | autoupdate"
menu_item "install" "Installs items defined in Brewfile"
menu_item "update" "Updates and upgrades brew packages"
menu_item "updatebundle" "Updates Brewfile with descriptions"
menu_item "autoupdate" "Setups brew auto-update and runs it immediately"
;;
esac
fi
case "$1" in
install)
brew bundle install --file="$BREWFILE" && msg_done "🎉 Done!"
;;
update)
brew update && brew outdated && brew upgrade && brew cleanup
msg_done "🎉 Done!"
;;
updatebundle)
# Updates .dotfiles/Brewfile with descriptions
brew bundle dump \
--force \
--file="$BREWFILE" \
--describe && msg_done "🎉 Done!"
;;
autoupdate)
brew autoupdate delete
brew autoupdate start 43200 --upgrade --cleanup --immediate
;;
*)
menu_section "$USAGE_PREFIX" "install | update | updatebundle | autoupdate"
menu_item "install" "Installs items defined in Brewfile"
menu_item "update" "Updates and upgrades brew packages"
menu_item "updatebundle" "Updates Brewfile with descriptions"
menu_item "autoupdate" "Setups brew auto-update and runs it immediately"
;;
esac
}
function section_dotfiles
@@ -135,35 +102,64 @@ function section_dotfiles
USAGE_PREFIX="$SCRIPT dotfiles"
case "$1" in
link)
rcup -B "$HOSTNAME" -f -v && msg_done "🎉 dotfiles have been linked!"
reset_all)
msg_ok "Running all reset commands"
$0 dotfiles reset_nvim
;;
update)
# Updates .dotfiles/scripts/install.sh and formats it
rcup -B 0 -g \
| tee "$INSTALL_SCRIPT" 1> /dev/null \
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \
&& sed -i '' "s|install.sh|$(basename "$INSTALL_SCRIPT")|g" "$INSTALL_SCRIPT"
$0 dotfiles shfmt
$0 dotfiles link
msg_done "🎉 dotfiles updated and linked!"
reset_nvim)
rm -rf \
~/.local/share/nvim \
~/.local/state/nvim \
~/.cache/nvim \
~/.config/astronvim \
~/.config/nvim
msg_ok "Deleted old nvim files"
ln -s ~/.dotfiles/config/astronvim ~/.config/astronvim
ln -s ~/.dotfiles/config/nvim ~/.config/nvim
msg_ok "Linked nvim and astronvim"
hash npm 2>/dev/null && $0 install npm
msg_ok "Installed packages"
msg_done "...and we are done!"
;;
shfmt)
# Format shell scripts according to following rules.
find "$DOTFILES" \
\( -name '*.sh' -or -name '*.zsh' -or -name 'x-*' -or -not '*.pl' \) \
\( -name '*.sh' -or -name '*.zsh' -or -name 'x-*' \) \
-exec shfmt -fn -l -w -i 2 -ci -sr -bn {} \;
msg_done "🎉 dotfiles have been formatted!"
;;
*)
menu_section "$USAGE_PREFIX" "link | update | shfmt"
menu_item "link" "Use rcrc to update dotfile links"
menu_item "update" "Updates dotfile links (scripts/install.sh), formats it and runs it."
menu_section "$USAGE_PREFIX" "reset_all | reset_nvim | shfmt"
menu_item "reset_all" "Reset everything, runs all configured reset actions"
menu_item "reset_nvim" "Resets nvim. Deletes caches, removes nvim folders and relinks nvim folders"
menu_item "shfmt" "Run shfmt to all dotfiles"
;;
esac
}
function section_check
{
USAGE_PREFIX="$SCRIPT check"
X_HOSTNAME=$(hostname)
X_ARCH=$(uname)
case "$1" in
a|arch)
[[ "$2" = "" ]] && echo "$X_ARCH" && exit 0
[[ $X_ARCH = "$2" ]] && exit 0 || exit 1
;;
h|host|hostname)
[[ "$2" = "" ]] && echo "$X_HOSTNAME" && exit 0
[[ $X_HOSTNAME = "$2" ]] && exit 0 || exit 1
;;
*)
menu_section "$USAGE_PREFIX" "arch | host"
menu_item "arch <arch>" "Empty returns current. Exit code 0 when match, 1 when not."
menu_item "host <host>" "Empty returns current. Exit code 0 when match, 1 when not."
;;
esac
}
# Secret menu for visual tests
function section_tests
{
@@ -192,24 +188,25 @@ function section_tests
function usage
{
echo ""
menu_section "Usage: $SCRIPT" "install | reset | brew | dotfiles"
menu_section "Usage: $SCRIPT" "install | reset | brew | check | dotfiles"
echo $" All commands have their own subcommands."
echo ""
section_install
echo ""
section_reset
echo ""
section_brew
echo ""
section_check
echo ""
section_dotfiles
}
# The main loop. first keyword after $0 triggers section, or help.
case "$1" in
install) section_install "$2" ;;
reset) section_reset "$2" ;;
brew) section_brew "$2" ;;
check) section_check "$2" ;;
dotfiles) section_dotfiles "$2" ;;
tests) section_tests "$2" ;;
*) usage && exit 1 ;;
*) usage && exit 0 ;;
esac

View File

@@ -80,3 +80,4 @@ trap 'case $? in
esac' EXIT
gitdirtyrepos "$GIT_DIRTY_DIR"

View File

@@ -0,0 +1,178 @@
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
if [[ -o interactive ]]; then
if [ "${ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX-}""$TERM" != "tmux-256color" -a "${ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX-}""$TERM" != "screen" -a "${ITERM_SHELL_INTEGRATION_INSTALLED-}" = "" -a "$TERM" != linux -a "$TERM" != dumb ]; then
ITERM_SHELL_INTEGRATION_INSTALLED=Yes
ITERM2_SHOULD_DECORATE_PROMPT="1"
# Indicates start of command output. Runs just before command executes.
iterm2_before_cmd_executes() {
if [ "$TERM_PROGRAM" = "iTerm.app" ]; then
printf "\033]133;C;\r\007"
else
printf "\033]133;C;\007"
fi
}
iterm2_set_user_var() {
printf "\033]1337;SetUserVar=%s=%s\007" "$1" $(printf "%s" "$2" | base64 | tr -d '\n')
}
# Users can write their own version of this method. It should call
# iterm2_set_user_var but not produce any other output.
# e.g., iterm2_set_user_var currentDirectory $PWD
# Accessible in iTerm2 (in a badge now, elsewhere in the future) as
# \(user.currentDirectory).
whence -v iterm2_print_user_vars > /dev/null 2>&1
if [ $? -ne 0 ]; then
iterm2_print_user_vars() {
true
}
fi
iterm2_print_state_data() {
local _iterm2_hostname="${iterm2_hostname-}"
if [ -z "${iterm2_hostname:-}" ]; then
_iterm2_hostname=$(hostname -f 2>/dev/null)
fi
printf "\033]1337;RemoteHost=%s@%s\007" "$USER" "${_iterm2_hostname-}"
printf "\033]1337;CurrentDir=%s\007" "$PWD"
iterm2_print_user_vars
}
# Report return code of command; runs after command finishes but before prompt
iterm2_after_cmd_executes() {
printf "\033]133;D;%s\007" "$STATUS"
iterm2_print_state_data
}
# Mark start of prompt
iterm2_prompt_mark() {
printf "\033]133;A\007"
}
# Mark end of prompt
iterm2_prompt_end() {
printf "\033]133;B\007"
}
# There are three possible paths in life.
#
# 1) A command is entered at the prompt and you press return.
# The following steps happen:
# * iterm2_preexec is invoked
# * PS1 is set to ITERM2_PRECMD_PS1
# * ITERM2_SHOULD_DECORATE_PROMPT is set to 1
# * The command executes (possibly reading or modifying PS1)
# * iterm2_precmd is invoked
# * ITERM2_PRECMD_PS1 is set to PS1 (as modified by command execution)
# * PS1 gets our escape sequences added to it
# * zsh displays your prompt
# * You start entering a command
#
# 2) You press ^C while entering a command at the prompt.
# The following steps happen:
# * (iterm2_preexec is NOT invoked)
# * iterm2_precmd is invoked
# * iterm2_before_cmd_executes is called since we detected that iterm2_preexec was not run
# * (ITERM2_PRECMD_PS1 and PS1 are not messed with, since PS1 already has our escape
# sequences and ITERM2_PRECMD_PS1 already has PS1's original value)
# * zsh displays your prompt
# * You start entering a command
#
# 3) A new shell is born.
# * PS1 has some initial value, either zsh's default or a value set before this script is sourced.
# * iterm2_precmd is invoked
# * ITERM2_SHOULD_DECORATE_PROMPT is initialized to 1
# * ITERM2_PRECMD_PS1 is set to the initial value of PS1
# * PS1 gets our escape sequences added to it
# * Your prompt is shown and you may begin entering a command.
#
# Invariants:
# * ITERM2_SHOULD_DECORATE_PROMPT is 1 during and just after command execution, and "" while the prompt is
# shown and until you enter a command and press return.
# * PS1 does not have our escape sequences during command execution
# * After the command executes but before a new one begins, PS1 has escape sequences and
# ITERM2_PRECMD_PS1 has PS1's original value.
iterm2_decorate_prompt() {
# This should be a raw PS1 without iTerm2's stuff. It could be changed during command
# execution.
ITERM2_PRECMD_PS1="$PS1"
ITERM2_SHOULD_DECORATE_PROMPT=""
# Add our escape sequences just before the prompt is shown.
# Use ITERM2_SQUELCH_MARK for people who can't mdoify PS1 directly, like powerlevel9k users.
# This is gross but I had a heck of a time writing a correct if statetment for zsh 5.0.2.
local PREFIX=""
if [[ $PS1 == *"$(iterm2_prompt_mark)"* ]]; then
PREFIX=""
elif [[ "${ITERM2_SQUELCH_MARK-}" != "" ]]; then
PREFIX=""
else
PREFIX="%{$(iterm2_prompt_mark)%}"
fi
PS1="$PREFIX$PS1%{$(iterm2_prompt_end)%}"
ITERM2_DECORATED_PS1="$PS1"
}
iterm2_precmd() {
local STATUS="$?"
if [ -z "${ITERM2_SHOULD_DECORATE_PROMPT-}" ]; then
# You pressed ^C while entering a command (iterm2_preexec did not run)
iterm2_before_cmd_executes
if [ "$PS1" != "${ITERM2_DECORATED_PS1-}" ]; then
# PS1 changed, perhaps in another precmd. See issue 9938.
ITERM2_SHOULD_DECORATE_PROMPT="1"
fi
fi
iterm2_after_cmd_executes "$STATUS"
if [ -n "$ITERM2_SHOULD_DECORATE_PROMPT" ]; then
iterm2_decorate_prompt
fi
}
# This is not run if you press ^C while entering a command.
iterm2_preexec() {
# Set PS1 back to its raw value prior to executing the command.
PS1="$ITERM2_PRECMD_PS1"
ITERM2_SHOULD_DECORATE_PROMPT="1"
iterm2_before_cmd_executes
}
# If hostname -f is slow on your system set iterm2_hostname prior to
# sourcing this script. We know it is fast on macOS so we don't cache
# it. That lets us handle the hostname changing like when you attach
# to a VPN.
if [ -z "${iterm2_hostname-}" ]; then
if [ "$(uname)" != "Darwin" ]; then
iterm2_hostname=`hostname -f 2>/dev/null`
# Some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option.
if [ $? -ne 0 ]; then
iterm2_hostname=`hostname`
fi
fi
fi
[[ -z ${precmd_functions-} ]] && precmd_functions=()
precmd_functions=($precmd_functions iterm2_precmd)
[[ -z ${preexec_functions-} ]] && preexec_functions=()
preexec_functions=($preexec_functions iterm2_preexec)
iterm2_print_state_data
printf "\033]1337;ShellIntegrationVersion=14;shell=zsh\007"
fi
fi

25
local/bin/x-backup-folder.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
DIRECTORY=$1
FILENAME=$2
if [ -z "${DIRECTORY}" ]; then
echo "DIRECTORY (first argument) is missing"
echo "Usage: $0 folder_to_backup"
exit
fi
if [ -z "${FILENAME}" ]; then
FILENAME=$DIRECTORY
fi
FILENAME=${FILENAME} | \
tr '/' _ | \
iconv -t ascii//TRANSLIT | \
sed -r s/[^a-zA-Z0-9]+/_/g | \
sed -r s/^_+\|-+$//g
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
FILENAME_TIMESTAMP="${FILENAME}_${TIMESTAMP}"
tar cvzf "${FILENAME_TIMESTAMP}.tar.gz" "${DIRECTORY}/"

View File

@@ -35,9 +35,10 @@ TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
FILENAME_TIMESTAMP="${DATABASE}_${FILENAME}_${TIMESTAMP}.sql"
mysqldump \
${DATABASE} \
"${DATABASE}" \
"$(
echo "show tables like '${PREFIX}%';" \
| mysql ${DATABASE} \
| mysql "${DATABASE}" \
| sed '/Tables_in/d'
)" > "${FILENAME_TIMESTAMP}"

View File

@@ -6,7 +6,7 @@
if ! command -v git &> /dev/null; then
echo "git could not be found, please install it first"
exit
exit 1
fi
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
@@ -17,3 +17,4 @@ if [[ "$missing_attributes" ]]; then
else
echo "All files have a corresponding rule in .gitattributes"
fi

View File

@@ -206,3 +206,4 @@ sub parsedOptions
return (%vars);
}

View File

@@ -14,3 +14,4 @@ for dir in $($cmd); do
eval "$@" # allow multiple commands like "foo && bar"
)
done

166
local/bin/x-git-largest-files.py Executable file
View File

@@ -0,0 +1,166 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
# The MIT License (MIT)
# Copyright (c) 2015 Nick Kocharhook
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from subprocess import check_output, CalledProcessError, Popen, PIPE
import argparse
import signal
import sys
sortByOnDiskSize = False
def main():
global sortByOnDiskSize
signal.signal(signal.SIGINT, signal_handler)
args = parseArguments()
sortByOnDiskSize = args.sortByOnDiskSize
sizeLimit = 1024*args.filesExceeding
if args.filesExceeding > 0:
print "Finding objects larger than {}kB…".format(args.filesExceeding)
else:
print "Finding the {} largest objects…".format(args.matchCount)
blobs = getTopBlobs(args.matchCount, sizeLimit)
populateBlobPaths(blobs)
printOutBlobs(blobs)
def getTopBlobs(count, sizeLimit):
sortColumn = 4
if sortByOnDiskSize:
sortColumn = 3
verifyPack = "git verify-pack -v `git rev-parse --git-dir`/objects/pack/pack-*.idx | grep blob | sort -k{}nr".format(sortColumn)
output = check_output(verifyPack, shell=True).split("\n")[:-1]
blobs = dict()
compareBlob = Blob("a b {} {} c".format(sizeLimit, sizeLimit)) # use __lt__ to do the appropriate comparison
for objLine in output:
blob = Blob(objLine)
if sizeLimit > 0:
if compareBlob < blob:
blobs[blob.sha1] = blob
else:
break
else:
blobs[blob.sha1] = blob
if len(blobs) == count:
break
return blobs
def populateBlobPaths(blobs):
if len(blobs):
print "Finding object paths…"
# Only include revs which have a path. Other revs aren't blobs.
revList = "git rev-list --all --objects | awk '$2 {print}'"
allObjectLines = check_output(revList, shell=True).split("\n")[:-1]
outstandingKeys = blobs.keys()
for line in allObjectLines:
cols = line.split()
sha1, path = cols[0], " ".join(cols[1:])
if (sha1 in outstandingKeys):
outstandingKeys.remove(sha1)
blobs[sha1].path = path
# short-circuit the search if we're done
if not len(outstandingKeys):
break
def printOutBlobs(blobs):
if len(blobs):
csvLines = ["size,pack,hash,path"]
for blob in sorted(blobs.values(), reverse=True):
csvLines.append(blob.csvLine())
p = Popen(["column", "-t", "-s", "','"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate("\n".join(csvLines)+"\n")
print "\nAll sizes in kB. The pack column is the compressed size of the object inside the pack file.\n"
print stdout.rstrip('\n')
else:
print "No files found which match those criteria."
def parseArguments():
parser = argparse.ArgumentParser(description='List the largest files in a git repository')
parser.add_argument('-c', '--match-count', dest='matchCount', type=int, default=10,
help='The number of files to return. Default is 10. Ignored if --files-exceeding is used.')
parser.add_argument('--files-exceeding', dest='filesExceeding', type=int, default=0,
help='The cutoff amount, in KB. Files with a pack size (or pyhsical size, with -p) larger than this will be printed.')
parser.add_argument('-p', '--physical-sort', dest='sortByOnDiskSize', action='store_true', default=False,
help='Sort by the on-disk size of the files. Default is to sort by the pack size.')
return parser.parse_args()
def signal_handler(signal, frame):
print('Caught Ctrl-C. Exiting.')
sys.exit(0)
class Blob(object):
sha1 = ''
size = 0
packedSize = 0
path = ''
def __init__(self, line):
cols = line.split()
self.sha1, self.size, self.packedSize = cols[0], int(cols[2]), int(cols[3])
def __repr__(self):
return '{} - {} - {} - {}'.format(self.sha1, self.size, self.packedSize, self.path)
def __lt__(self, other):
if (sortByOnDiskSize):
return self.size < other.size
else:
return self.packedSize < other.packedSize
def csvLine(self):
return "{},{},{},{}".format(self.size/1024, self.packedSize/1024, self.sha1, self.path)
# Default function is main()
if __name__ == '__main__':
main()

View File

@@ -226,3 +226,4 @@ sub parsedOptions
return (%vars);
}

View File

@@ -3,6 +3,7 @@
# List open (listened) ports, without the crud that
# usually comes with `lsof -i`
#
# Modified by: Ismo Vuorinen <https://github.com/ivuorinen> 2020
# Originally from: https://www.commandlinefu.com/commands/view/8951
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
#
@@ -18,3 +19,4 @@ lsof -i 4 -P -n +c 0 \
| uniq
echo ""

85
local/bin/x-quota-usage.php Executable file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/env php
<?php
error_reporting(E_ALL);
$debug = false;
$quota = '';
$output = [];
$fsCharLenght = 0;
if ($debug) {
$quota = "Disk quotas for user viir (uid 2913):
Filesystem blocks quota limit grace files quota limit grace
10.0.0.89:/www/webroots/2 8277615 52428800 52428800 0 0 0
10.0.0.179:/users1/users/2 1999431 52428800 52428800 0 0 0
10.0.0.90:/siilo/2 24835106 524288000 524288000 0 0 0";
} else {
// $quota = system("quota -w");
$quota = shell_exec("quota -w");
}
function pad($i, $n = 3, $p = ' ') {
return str_pad($i, $n, $p, STR_PAD_LEFT);
}
if (empty($quota)) {
var_dump($quota);
die("quota was empty\n");
}
$quota = explode("\n", $quota);
$quota = array_map('trim', $quota);
foreach ($quota as $lineNum => $line) {
if ($lineNum < 2) {
continue;
}
$values = array_filter(explode(" ", $line));
if (count($values) != 4) {
continue;
}
$result = array_combine(['fs', 'used', 'quota', 'limit'], $values);
$result['used_percentage'] = round($result['used'] / $result['quota'] * 100, 3);
$result['used_gb'] = round($result['used'] / 1024 / 1024, 2);
$result['quota_gb'] = round($result['quota'] / 1024 / 1024, 2);
$char = strlen($result['fs']);
if ($char > $fsCharLenght) {
$fsCharLenght = $char;
}
$output[] = $result;
}
if (!empty($output)) {
$header = sprintf("%s | %s | %s | %s",
str_pad("Mount", $fsCharLenght),
'Usage%',
'Used/Total',
'Bar'
);
$headerWidth = strlen($header);
echo "\n" . $header . "\n";
echo str_repeat('-', $headerWidth + 24) . "\n";
foreach ($output as $i) {
$barUsed = round($i['used_percentage']) / 4;
echo sprintf(
"%s | %s | %s | [%s]",
str_pad($i['fs'], $fsCharLenght),
str_pad(round($i['used_percentage'], 1) . '%', 6, ' ', STR_PAD_LEFT),
str_pad($i['used_gb'] . '/' . $i['quota_gb'], 10, ' ', STR_PAD_LEFT),
str_pad(str_repeat('#', $barUsed), 25, '_')
) . "\n";
}
echo "\n\n";
}

View File

@@ -4,37 +4,27 @@
# -----
# Check the expiry date of the SSL certificate on the given host.
#
#
# License
# -------
#
# Copyright (c) 2013-2015 by Steve Kemp. All rights reserved.
#
# This script is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself.
#
# The LICENSE file contains the full text of the license.
#
#
#
# Simple function to show usage information, and exit.
#
# Simple function to show usage information, and exit.
usage()
{
echo "Usage: $0 [-d] [-p 443] domain1.org domain2.com .. domainN"
exit 0
}
#
# Default settings for flags set by the command-line arguments
#
# Default settings for flags set by the command-line arguments
days=0
port=443
#
# Parse the argument(s) - i.e. look for "-d" / "-p 443".
#
# Parse the argument(s) - i.e. look for "-d" / "-p 443".
while getopts "h?dp:" opt; do
case $opt in
h)
@@ -53,21 +43,15 @@ while getopts "h?dp:" opt; do
done
shift $((OPTIND - 1))
#
# Ensure we have some arguments
#
# Ensure we have some arguments
if [ "$#" = "0" ]; then
usage
fi
#
# For each domain-name on the command-line.
#
for name in "$@"; do
#
# Make a temporary file
#
# Make a temporary file
# Test if we have BSD or GNU version of mktemp
if (strings "$(which mktemp)" | grep -q GNU); then
# We have the GNU version
@@ -77,27 +61,19 @@ for name in "$@"; do
tmp=$(mktemp -t tmp)
fi
#
# Download the certificate
#
if (! echo "" | openssl s_client -connect $name:$port > $tmp 2> /dev/null); then
# Download the certificate
if (! echo "" | openssl s_client -connect "$name:$port" > "$tmp" 2> /dev/null); then
echo "Failed to get cert from https://$name:$port/"
exit 3
fi
#
# Get the expiry date
#
# Get the expiry date
date=$(openssl x509 -in "$tmp" -noout -enddate | awk -F= '{print $2}')
#
# Remove the temporary file
#
# Remove the temporary file
rm -f "$tmp"
#
# Convert the expiry date + todays date to seconds-past epoch
#
# Convert the expiry date + todays date to seconds-past epoch
# Check if we have the BSD or the GNU version of date
if (strings "$(which date)" | grep -q GNU); then
# We have GNU this is easy
@@ -115,15 +91,11 @@ for name in "$@"; do
now=$(date +%s)
#
# Day diff
#
# Day diff
diff=$(("$then" - "$now"))
diff=$($diff / 86400)
#
# All done
#
# All done
if [ "$days" = "1" ]; then
echo "${name}: ${diff}"
else
@@ -132,3 +104,4 @@ for name in "$@"; do
echo " Days: ${diff}"
fi
done

View File

@@ -3,13 +3,11 @@
# About
# -----
# Repeat the command until it fails - always run at least once.
#
"$@"
#
# If the status code was zero then repeat.
#
# If the status code was zero then repeat.
while [ $? -eq 0 ]; do
"$@"
done

View File

@@ -14,17 +14,12 @@
# the same terms as Perl itself.
#
# The LICENSE file contains the full text of the license.
#
#
#
# Run the first time.
#
# Run the first time.
"$@"
#
# If the status code was not zero then repeat.
#
# If the status code was not zero then repeat.
while [ $? -ne 0 ]; do
"$@"
done

View File

@@ -50,3 +50,4 @@ elif [ "$(get_sha256sum "$filename")" = "$file_hash" ]; then
else
error "$filename doesn't match provided sha256sum"
fi

View File

@@ -24,9 +24,10 @@ echo "Waiting for $HOST to get down..."
true
while [ $? -ne 1 ]; do
ping -c 1 -W 1 $HOST > /dev/null
ping -c 1 -W 1 "$HOST" > /dev/null
done
shift
"$@"

View File

@@ -22,7 +22,7 @@ if [ $# -lt 2 ]; then
exit 1
fi
if [ $1 = "ssh" ]; then
if [ "$1" = "ssh" ]; then
HOST=$2
else
HOST=$1
@@ -30,16 +30,17 @@ fi
echo "Waiting for $HOST to come online..."
ping -c 1 -W 1 $HOST > /dev/null
ping -c 1 -W 1 "$HOST" > /dev/null
while [ $? -ne 0 ]; do
sleep 1
ping -c 1 -W 1 $HOST > /dev/null
ping -c 1 -W 1 "$HOST" > /dev/null
done
# By the time we reach here the ping-command has completed successfully
# so we can launch the command we were given - along with any arguments.
if [ $1 != "ssh" ]; then
if [ "$1" != "ssh" ]; then
shift
fi
"$@"

2
rcrc
View File

@@ -1,2 +0,0 @@
EXCLUDES="*.md *.sh *.lock.json Brewfile scripts *-secret xbar .github"
HOSTNAME=$(hostname -s)

6
renovate.json Normal file
View File

@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>ivuorinen/.github:renovate-config"
]
}

View File

@@ -1,151 +0,0 @@
#!/bin/sh
#
# Usage:
#
# sh install-dotfiles.sh
#
# Environment variables: VERBOSE, CP, LN, MKDIR, RM, DIRNAME.
#
# env VERBOSE=1 sh install-dotfiles.sh
#
# DO NOT EDIT THIS FILE
#
# This file is generated by rcm(7) as:
#
# rcup -B 0 -g
#
# To update it, re-run the above command.
#
: ${VERBOSE:=0}
: ${CP:=/bin/cp}
: ${LN:=/bin/ln}
: ${MKDIR:=/bin/mkdir}
: ${RM:=/bin/rm}
: ${DIRNAME:=/usr/bin/dirname}
verbose() {
if [ "$VERBOSE" -gt 0 ]; then
echo "$@"
fi
}
handle_file_cp() {
if [ -e "$2" ]; then
printf "%s " "overwrite $2? [yN]"
read overwrite
case "$overwrite" in
y)
$RM -rf "$2"
;;
*)
echo "skipping $2"
return
;;
esac
fi
verbose "'$1' -> '$2'"
$MKDIR -p "$($DIRNAME "$2")"
$CP -R "$1" "$2"
}
handle_file_ln() {
if [ -e "$2" ]; then
printf "%s " "overwrite $2? [yN]"
read overwrite
case "$overwrite" in
y)
$RM -rf "$2"
;;
*)
echo "skipping $2"
return
;;
esac
fi
verbose "'$1' -> '$2'"
$MKDIR -p "$($DIRNAME "$2")"
$LN -sf "$1" "$2"
}
handle_file_ln "$HOME/.dotfiles/bash_profile" "$HOME/.bash_profile"
handle_file_ln "$HOME/.dotfiles/bashrc" "$HOME/.bashrc"
handle_file_ln "$HOME/.dotfiles/config/alias" "$HOME/.config/alias"
handle_file_ln "$HOME/.dotfiles/config/astronvim/lua/user/LICENSE" "$HOME/.config/astronvim/lua/user/LICENSE"
handle_file_ln "$HOME/.dotfiles/config/astronvim/lua/user/init.lua" "$HOME/.config/astronvim/lua/user/init.lua"
handle_file_ln "$HOME/.dotfiles/config/exports" "$HOME/.config/exports"
handle_file_ln "$HOME/.dotfiles/config/flipperdevices.com/qFlipper.ini" "$HOME/.config/flipperdevices.com/qFlipper.ini"
handle_file_ln "$HOME/.dotfiles/config/functions" "$HOME/.config/functions"
handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml"
handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config"
handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore"
handle_file_ln "$HOME/.dotfiles/config/nvim/LICENSE" "$HOME/.config/nvim/LICENSE"
handle_file_ln "$HOME/.dotfiles/config/nvim/config.ld" "$HOME/.config/nvim/config.ld"
handle_file_ln "$HOME/.dotfiles/config/nvim/init.lua" "$HOME/.config/nvim/init.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/autocmds.lua" "$HOME/.config/nvim/lua/core/autocmds.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/bootstrap.lua" "$HOME/.config/nvim/lua/core/bootstrap.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/icons/nerd_font.lua" "$HOME/.config/nvim/lua/core/icons/nerd_font.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/icons/text.lua" "$HOME/.config/nvim/lua/core/icons/text.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/lazy.lua" "$HOME/.config/nvim/lua/core/lazy.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/mappings.lua" "$HOME/.config/nvim/lua/core/mappings.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/options.lua" "$HOME/.config/nvim/lua/core/options.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/buffer.lua" "$HOME/.config/nvim/lua/core/utils/buffer.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/ffi.lua" "$HOME/.config/nvim/lua/core/utils/ffi.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/git.lua" "$HOME/.config/nvim/lua/core/utils/git.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/init.lua" "$HOME/.config/nvim/lua/core/utils/init.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/lsp.lua" "$HOME/.config/nvim/lua/core/utils/lsp.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/mason.lua" "$HOME/.config/nvim/lua/core/utils/mason.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/status.lua" "$HOME/.config/nvim/lua/core/utils/status.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/ui.lua" "$HOME/.config/nvim/lua/core/utils/ui.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/core/utils/updater.lua" "$HOME/.config/nvim/lua/core/utils/updater.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/lazy_snapshot.lua" "$HOME/.config/nvim/lua/lazy_snapshot.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/alpha.lua" "$HOME/.config/nvim/lua/plugins/alpha.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/cmp.lua" "$HOME/.config/nvim/lua/plugins/cmp.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/alpha.lua" "$HOME/.config/nvim/lua/plugins/configs/alpha.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/guess-indent.lua" "$HOME/.config/nvim/lua/plugins/configs/guess-indent.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/heirline.lua" "$HOME/.config/nvim/lua/plugins/configs/heirline.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/lspconfig.lua" "$HOME/.config/nvim/lua/plugins/configs/lspconfig.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/lspkind.lua" "$HOME/.config/nvim/lua/plugins/configs/lspkind.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/luasnip.lua" "$HOME/.config/nvim/lua/plugins/configs/luasnip.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/mason-lspconfig.lua" "$HOME/.config/nvim/lua/plugins/configs/mason-lspconfig.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/mason-null-ls.lua" "$HOME/.config/nvim/lua/plugins/configs/mason-null-ls.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/mason-nvim-dap.lua" "$HOME/.config/nvim/lua/plugins/configs/mason-nvim-dap.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/mason.lua" "$HOME/.config/nvim/lua/plugins/configs/mason.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/notify.lua" "$HOME/.config/nvim/lua/plugins/configs/notify.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/nvim-autopairs.lua" "$HOME/.config/nvim/lua/plugins/configs/nvim-autopairs.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/nvim-dap-ui.lua" "$HOME/.config/nvim/lua/plugins/configs/nvim-dap-ui.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/nvim-treesitter.lua" "$HOME/.config/nvim/lua/plugins/configs/nvim-treesitter.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/nvim-web-devicons.lua" "$HOME/.config/nvim/lua/plugins/configs/nvim-web-devicons.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/telescope.lua" "$HOME/.config/nvim/lua/plugins/configs/telescope.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/configs/which-key.lua" "$HOME/.config/nvim/lua/plugins/configs/which-key.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/core.lua" "$HOME/.config/nvim/lua/plugins/core.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/dap.lua" "$HOME/.config/nvim/lua/plugins/dap.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/git.lua" "$HOME/.config/nvim/lua/plugins/git.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/heirline.lua" "$HOME/.config/nvim/lua/plugins/heirline.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/lsp.lua" "$HOME/.config/nvim/lua/plugins/lsp.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/mason.lua" "$HOME/.config/nvim/lua/plugins/mason.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/neo-tree.lua" "$HOME/.config/nvim/lua/plugins/neo-tree.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/telescope.lua" "$HOME/.config/nvim/lua/plugins/telescope.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/treesitter.lua" "$HOME/.config/nvim/lua/plugins/treesitter.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/plugins/ui.lua" "$HOME/.config/nvim/lua/plugins/ui.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/user_example/init.lua" "$HOME/.config/nvim/lua/user_example/init.lua"
handle_file_ln "$HOME/.dotfiles/config/starship.toml" "$HOME/.config/starship.toml"
handle_file_ln "$HOME/.dotfiles/config/tmux/tmux.conf" "$HOME/.config/tmux/tmux.conf"
handle_file_ln "$HOME/.dotfiles/config/wtf/config.yml" "$HOME/.config/wtf/config.yml"
handle_file_ln "$HOME/.dotfiles/ecrc" "$HOME/.ecrc"
handle_file_ln "$HOME/.dotfiles/git_profiles" "$HOME/.git_profiles"
handle_file_ln "$HOME/.dotfiles/huskyrc" "$HOME/.huskyrc"
handle_file_ln "$HOME/.dotfiles/local/bin/antigen.zsh" "$HOME/.local/bin/antigen.zsh"
handle_file_ln "$HOME/.dotfiles/local/bin/dfm" "$HOME/.local/bin/dfm"
handle_file_ln "$HOME/.dotfiles/local/bin/git-dirty" "$HOME/.local/bin/git-dirty"
handle_file_ln "$HOME/.dotfiles/local/bin/x-check-git-attributes" "$HOME/.local/bin/x-check-git-attributes"
handle_file_ln "$HOME/.dotfiles/local/bin/x-dupes.pl" "$HOME/.local/bin/x-dupes.pl"
handle_file_ln "$HOME/.dotfiles/local/bin/x-foreach" "$HOME/.local/bin/x-foreach"
handle_file_ln "$HOME/.dotfiles/local/bin/x-multi-ping.pl" "$HOME/.local/bin/x-multi-ping.pl"
handle_file_ln "$HOME/.dotfiles/local/bin/x-open-ports" "$HOME/.local/bin/x-open-ports"
handle_file_ln "$HOME/.dotfiles/local/bin/x-ssl-expiry-date" "$HOME/.local/bin/x-ssl-expiry-date"
handle_file_ln "$HOME/.dotfiles/local/bin/x-until-error" "$HOME/.local/bin/x-until-error"
handle_file_ln "$HOME/.dotfiles/local/bin/x-until-success" "$HOME/.local/bin/x-until-success"
handle_file_ln "$HOME/.dotfiles/local/bin/x-when-down" "$HOME/.local/bin/x-when-down"
handle_file_ln "$HOME/.dotfiles/local/bin/x-when-up" "$HOME/.local/bin/x-when-up"
handle_file_ln "$HOME/.dotfiles/rcrc" "$HOME/.rcrc"
handle_file_ln "$HOME/.dotfiles/shellcheckrc" "$HOME/.shellcheckrc"
handle_file_ln "$HOME/.dotfiles/ssh/allowed_signers" "$HOME/.ssh/allowed_signers"
handle_file_ln "$HOME/.dotfiles/ssh/config" "$HOME/.ssh/config"
handle_file_ln "$HOME/.dotfiles/vuerc" "$HOME/.vuerc"
handle_file_ln "$HOME/.dotfiles/zshrc" "$HOME/.zshrc"

View File

@@ -1,53 +0,0 @@
#!/usr/bin/env bash
# Install GitHub CLI extensions
source "$HOME/.dotfiles/scripts/shared.sh"
if ! command -v gh &> /dev/null; then
msg_run "gh (GitHub Client) could not be found, please install it first"
exit 1
fi
extensions=(
# GitHub CLI extension for reviewing Dependabot PRs.
einride/gh-dependabot
# A GitHub CLI extension that provides summary pull request metrics.
hectcastro/gh-metrics
# being an extension to view the overall health of an organization's use of actions
rsese/gh-actions-status
# GitHub CLI extension for label management
heaths/gh-label
# An opinionated GitHub Cli extension for creating
# changelogs that adhere to the keep a changelog specification.
chelnak/gh-changelog
# Safely deletes local branches with no upstream and no un-pushed commits
davidraviv/gh-clean-branches
# A beautiful CLI dashboard for GitHub 🚀
dlvhdr/gh-dash
# A github-cli extension script to clone all repositories
# in an organization, optionally filtering by topic.
matt-bartel/gh-clone-org
# GitHub CLI extension to generate montage from GitHub user avatars
andyfeller/gh-montage
# Organisation specific extension for gh cli to retrieve different statistics
VildMedPap/gh-orgstats
# GitHub CLI extension for generating a report on repository dependencies.
andyfeller/gh-dependency-report
# gh cli extension to generate account/organization/enterprise reports
stoe/gh-report
)
msg "Starting to install GitHub CLI extensions..."
for ext in "${extensions[@]}"; do
# Trim spaces
ext=${ext// /}
# Skip comments
if [[ ${ext:0:1} == "#" ]]; then continue; fi
msg_run "Installing $ext"
gh extensions install "$ext"
echo ""
done
msg_ok "Done"

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env zsh
# Install Go packages
source "$HOME/.dotfiles/scripts/shared.sh"
if ! command -v go &> /dev/null; then
msg "go hasn't been installed yet."
exit 0
fi
packages=(
# sysadmin/scripting utilities, distributed as a single binary
github.com/skx/sysbox@latest
)
for pkg in "${packages[@]}"; do
# Trim spaces
pkg=${pkg// /}
# Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
msg_run "Installing go package:" "$pkg"
go install "$pkg"
echo ""
done
msg_ok "Done"

View File

@@ -1,39 +1,39 @@
#!/usr/bin/env zsh
#!/usr/bin/env bash
# Install npm packages globally.
#
# shellcheck source=shared.sh
source "$HOME/.dotfiles/scripts/shared.sh"
if ! command -v npm &> /dev/null; then
msg_err "npm could not be found."
exit 1
else
packages=(
# This is a tool to check if your files consider your .editorconfig rules.
"editorconfig-checker"
# Node module to create a release or a changelog from
# a tag and uses issues or commits to creating the release notes.
"github-release-notes"
"neovim"
"prettier"
"@bchatard/alfred-jetbrains"
"@johnnymorganz/stylua-bin"
"js-debug"
"stylelint-lsp"
"blade-formatter"
"@loopback/cli"
"corepack"
"standardjs"
)
for pkg in "${packages[@]}"; do
# Trim spaces
pkg=${pkg// /}
# Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
msg_run "Installing npm package:" "$pkg"
npm install -g --no-fund --no-progress --no-timing "$pkg"
echo ""
done
fi
packages=(
# This is a tool to check if your files consider your .editorconfig rules.
"editorconfig-checker"
# Node module to create a release or a changelog from
# a tag and uses issues or commits to creating the release notes.
"github-release-notes"
"neovim"
"prettier"
"@bchatard/alfred-jetbrains"
"@johnnymorganz/stylua-bin"
"js-debug"
"stylelint-lsp"
"blade-formatter"
"@loopback/cli"
"corepack"
"standardjs"
)
for pkg in "${packages[@]}"; do
# Trim spaces
pkg=${pkg// /}
# Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
msg_run "Installing npm package:" "$pkg"
npm install -g --no-fund --no-progress --no-timing "$pkg"
echo ""
done

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Settler - my macOS setup automator
# Install XCode CLI Tools with osascript magic.
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
#
@@ -36,26 +36,3 @@ until [ "$(which git)" ]; do
echo -n "."
sleep 1
done
# Install brew
if [ "$(which brew)" ]; then
echo 'Brew already installed'
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
bash "$HOME/.dotfiles/local/bin/dfm" brew install && "Installed Brewfile contents"
bash "$HOME/.dotfiles/local/bin/dfm" dotfiles link && "Linked all dotfiles"
read -r -p "Do you want to set macOS defaults? (y/N) " yn
case $yn in
[yY])
bash "set-defaults.sh"
;;
*)
echo "Skipping..."
;;
esac
echo "Done. Note that some of these changes require a logout/restart to take effect."

View File

@@ -6,6 +6,8 @@
# - https://github.com/freekmurze/dotfiles/blob/main/macos/set-defaults.sh
#
[ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0;
# Ask for the administrator password upfront
sudo -v
@@ -297,3 +299,4 @@ for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
killall "${app}" > /dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart to take effect."

View File

@@ -6,9 +6,9 @@
# -- Colors -- #
CLR_RED="\033[1;31m"
CLR_YELLOW='\033[1;33m'
CLR_YELLOW="\033[1;33m"
CLR_GREEN="\033[1;32m"
CLR_BLUE='\033[1;34m'
CLR_BLUE="\033[1;34m"
CLR_RESET="\033[0m"
# -- Helpers -- #
@@ -111,3 +111,4 @@ function fn_exists()
declare -f -F "$1" > /dev/null
return $?
}

View File

@@ -1,16 +1,11 @@
Host github.com
User git
HostName github.com
IdentityFile ~/.ssh/id_rsa
User git
Host bitbucket.com
Hostname bitbucket.com
IdentityFile ~/.ssh/id_rsa
Host gitlab.com
Hostname gitlab.com
IdentityFile ~/.ssh/id_rsa
Host lakka
User viir
HostName lakka.kapsi.fi
IdentityFile ~/.ssh/id_rsa
Host *
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
# IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"