mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-31 15:42:41 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af32dd6bf3 | ||
|
|
e519d98a68 | ||
| cde571de69 | |||
| b563ba5cd0 | |||
| f357d23559 | |||
|
|
b183fcbdb2 | ||
| 17ce1c6ee6 | |||
| 66de4b3323 | |||
| b55c1a17ba |
81
README.md
81
README.md
@@ -1,8 +1,9 @@
|
|||||||
# .dotfiles
|
# .dotfiles
|
||||||
|
|
||||||
Welcome to [ivuorinen](https://github.com/ivuorinen)'s .dotfiles repository. It's a hodgepodge of scripts
|
Welcome to [ivuorinen](https://github.com/ivuorinen)'s .dotfiles repository.
|
||||||
and configurations, tests and mistakes I'm not aware of yet. As I find more interesting tools, configs and
|
It's a hodgepodge of scripts and configurations, tests and mistakes I'm not
|
||||||
other stuff, this repository will live accordingly.
|
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,
|
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.
|
fork or download the repo as a zip and go from there with your own configs.
|
||||||
@@ -16,27 +17,28 @@ fork or download the repo as a zip and go from there with your own configs.
|
|||||||
3. ???
|
3. ???
|
||||||
4. Profit
|
4. Profit
|
||||||
|
|
||||||
Note: there's a bit chicken/egg situation, because settler assumes you don't have git,
|
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™.
|
and you need git to clone the repo. This will change soon™.
|
||||||
|
|
||||||
## Interesting files and locations
|
## Interesting files and locations
|
||||||
|
|
||||||
### Special folders
|
### Interesting folders
|
||||||
|
|
||||||
| Path | Description |
|
| Path | Description |
|
||||||
|--------------------|-------------------------------------------------------------------------------------|
|
| ------------------ | --------------------------------------------------- |
|
||||||
| `.github` | GitHub Repository configuration files. Not part of the dotfiles per se. |
|
| `.github` | GitHub Repository configuration files. |
|
||||||
| `host-{hostname}/` | Host specific dotfiles. Configurations that should apply to that host only. |
|
| `host-{hostname}/` | Configurations that should apply to that host only. |
|
||||||
| `local/bin` | Helper scripts that I've collected or wrote to make life easier. |
|
| `local/bin` | Helper scripts that I've collected or wrote. |
|
||||||
| `scripts` | Setup scripts. Some can be run many times, some are meant only for the first round. |
|
| `scripts` | Setup scripts. |
|
||||||
|
|
||||||
### dotfile folders
|
### dotfile folders
|
||||||
|
|
||||||
| Repo | Destination | Description |
|
| Repo | Destination | Description |
|
||||||
|-----------|-------------|------------------------------------------------------------------|
|
| --------- | ----------- | ------------------------------------------- |
|
||||||
| `config/` | `.config/` | Configurations for applications. |
|
| `config/` | `.config/` | Configurations for applications. |
|
||||||
| `local/` | `.local/` | XDG Base folder, contains `bin`, `share` and `state` for example |
|
| `local/` | `.local/` | XDG Base folder: `bin`, `share` and `state` |
|
||||||
| `ssh/` | `.ssh/` | SSH Configurations. |
|
| `ssh/` | `.ssh/` | SSH Configurations. |
|
||||||
|
|
||||||
### dfm - the dotfiles manager
|
### dfm - the dotfiles manager
|
||||||
|
|
||||||
@@ -44,7 +46,8 @@ and you need git to clone the repo. This will change soon™.
|
|||||||
|
|
||||||
### `scripts/install-dotfiles.sh` - dotfiles linker
|
### `scripts/install-dotfiles.sh` - dotfiles linker
|
||||||
|
|
||||||
The `scripts/install-dotfiles.sh` is a `rcm` generated shell script that does all the necessary linking.
|
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`
|
To refresh the file, you can run `dfm dotfiles update`
|
||||||
|
|
||||||
@@ -55,7 +58,7 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
|
|||||||
### XDG Variables
|
### XDG Variables
|
||||||
|
|
||||||
| Var | Default |
|
| Var | Default |
|
||||||
|--------------------|----------------------|
|
| ------------------ | -------------------- |
|
||||||
| Executables | `$HOME/.local/bin` |
|
| Executables | `$HOME/.local/bin` |
|
||||||
| `$XDG_DATA_HOME` | `$HOME/.local/share` |
|
| `$XDG_DATA_HOME` | `$HOME/.local/share` |
|
||||||
| `$XDG_STATE_HOME` | `$HOME/.local/state` |
|
| `$XDG_STATE_HOME` | `$HOME/.local/state` |
|
||||||
@@ -67,17 +70,24 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
|
|||||||
- `$XDG_CONFIG_HOME` defines the base directory relative to which user-specific configuration
|
- `$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,
|
files should be stored. If `$XDG_CONFIG_HOME` is either not set or empty,
|
||||||
a default equal to `$HOME/.config` should be used.
|
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.
|
- `$XDG_STATE_HOME` defines the base directory relative
|
||||||
If `$XDG_STATE_HOME` is either not set or empty, a default equal to `$HOME/.local/state` should be used.
|
to which user-specific state files should be stored.
|
||||||
- The `$XDG_STATE_HOME` contains state data that should persist between (application) restarts,
|
If `$XDG_STATE_HOME` is either not set or empty, a default
|
||||||
but that is not important or portable enough to the user that it should be stored in `$XDG_DATA_HOME`.
|
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:
|
It may contain:
|
||||||
- actions history (logs, history, recently used files, …)
|
- 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, …)
|
- current state of the application that can be reused
|
||||||
- User-specific executable files may be stored in `$HOME/.local/bin`. Distributions should ensure this
|
on a restart (view, layout, open files, undo history, …)
|
||||||
directory shows up in the UNIX `$PATH` environment variable, at an appropriate place.
|
- User-specific executable files may be stored in `$HOME/.local/bin`.
|
||||||
- `$XDG_DATA_DIRS` defines the preference-ordered set of base directories to search for data files in addition
|
Distributions should ensure this directory shows up in the UNIX `$PATH`
|
||||||
to the `$XDG_DATA_HOME` base directory. The directories in `$XDG_DATA_DIRS` should be seperated with a colon ':'.
|
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
|
[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
|
|
||||||
@@ -85,12 +95,9 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
|
|||||||
|
|
||||||
### Interesting dotfiles repos
|
### Interesting dotfiles repos
|
||||||
|
|
||||||
- https://dotfiles.github.io/inspiration/
|
- [https://dotfiles.github.io/inspiration/](dotfiles.github.io/inspiration)
|
||||||
- https://github.com/frdmn/dotfiles - Ansible-based dotfile setup for macOS
|
- [https://github.com/frdmn/dotfiles](github.com/frdmn/dotfiles) - Ansible-based
|
||||||
- https://github.com/mvdan/dotfiles - Here be dragons
|
dotfile setup for macOS
|
||||||
- https://github.com/vsouza/dotfiles - 🏡 My dotfiles
|
- [https://github.com/mvdan/dotfiles](mvdan/dotfiles) - Here be dragons
|
||||||
- https://github.com/freekmurze/dotfiles - My personal dotfiles
|
- [https://github.com/vsouza/dotfiles](vsouza/dotfiles) - 🏡 My dotfiles
|
||||||
|
- [https://github.com/freekmurze/dotfiles](freekmurze/dotfiles) - My personal dotfiles
|
||||||
### Interesting dotfiles tools
|
|
||||||
|
|
||||||
- https://github.com/zero-sh/zero.sh - Radically simple personal bootstrapping tool for macOS.
|
|
||||||
|
|||||||
Submodule config/astronvim/lua/user updated: 521d7dbfa4...890023c86c
Submodule config/nvim updated: e9855e4842...e283d6749f
@@ -13,8 +13,8 @@ disabled = true
|
|||||||
|
|
||||||
[git_branch]
|
[git_branch]
|
||||||
symbol = '🌱 '
|
symbol = '🌱 '
|
||||||
truncation_length = 4
|
truncation_length = 20
|
||||||
truncation_symbol = ''
|
truncation_symbol = '…'
|
||||||
ignore_branches = ['master', 'main']
|
ignore_branches = ['master', 'main']
|
||||||
|
|
||||||
[git_status]
|
[git_status]
|
||||||
|
|||||||
@@ -1,33 +1,72 @@
|
|||||||
PATH=$HOME/.local/bin:$HOME/bin:$HOME/.gem/bin:$HOME/.rvm/bin:/usr/local/bin:/usr/sbin:/usr/bin:$PATH
|
# 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
|
export LC_ALL=fi_FI.utf8
|
||||||
|
|
||||||
source $HOME/.local/bin/antigen
|
# 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"
|
||||||
|
|
||||||
antigen use oh-my-zsh
|
# Try to load antigen, if present
|
||||||
|
[[ -f "$XDG_BIN_HOME/antigen.zsh" ]] && source "$XDG_BIN_HOME/antigen.zsh"
|
||||||
|
|
||||||
antigen bundle git
|
# If antigen was loaded
|
||||||
antigen bundle php
|
if command -v antigen &> /dev/null; then
|
||||||
# antigen bundle rvm
|
antigen use oh-my-zsh
|
||||||
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
|
hash git 2>/dev/null && antigen bundle git
|
||||||
|
hash php 2>/dev/null && antigen bundle php
|
||||||
|
|
||||||
antigen apply
|
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 t='tail -f'
|
||||||
alias logrotate='/usr/sbin/logrotate -s $HOME/logs/state'
|
alias logrotate='/usr/sbin/logrotate -s $HOME/logs/state'
|
||||||
alias dn='du -chd1'
|
alias dn='du -chd1'
|
||||||
alias nano='nano -wS -$'
|
alias nano='nano -wS -$'
|
||||||
alias cat=bat
|
|
||||||
alias gpg=gpg2
|
alias gpg=gpg2
|
||||||
|
|
||||||
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
|
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*
|
[[ -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"
|
. "$HOME/.acme.sh/acme.sh.env"
|
||||||
|
|||||||
@@ -26,16 +26,15 @@ function section_reset
|
|||||||
;;
|
;;
|
||||||
nvim)
|
nvim)
|
||||||
rm -rf ~/.local/share/nvim ~/.local/state/nvim ~/.cache/nvim ~/.config/astronvim ~/.config/nvim
|
rm -rf ~/.local/share/nvim ~/.local/state/nvim ~/.cache/nvim ~/.config/astronvim ~/.config/nvim
|
||||||
msg_done "Deleted old nvim files"
|
msg_ok "Deleted old nvim files"
|
||||||
ln -s ~/.dotfiles/config/astronvim ~/.config/astronvim
|
ln -s ~/.dotfiles/config/astronvim ~/.config/astronvim
|
||||||
ln -s ~/.dotfiles/config/nvim ~/.config/nvim
|
ln -s ~/.dotfiles/config/nvim ~/.config/nvim
|
||||||
msg_done "Linked nvim and astronvim"
|
msg_ok "Linked nvim and astronvim"
|
||||||
$0 install brew
|
$0 install brew
|
||||||
$0 install ext_go
|
$0 install ext_go
|
||||||
$0 install ext_npm
|
$0 install ext_npm
|
||||||
msg_done "Installed brew, and packages for go and npm"
|
msg_ok "Installed brew, and packages for go and npm"
|
||||||
nvim --headless -c 'autocmd User PackerComplete quitall'
|
msg_done "...and we are done!"
|
||||||
msg_done "Installed nvim packages and we are now ready"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
menu_section "$USAGE_PREFIX" "all | nvim"
|
menu_section "$USAGE_PREFIX" "all | nvim"
|
||||||
|
|||||||
178
local/bin/iterm2_shell_integration.zsh
Executable file
178
local/bin/iterm2_shell_integration.zsh
Executable 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
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Install GitHub CLI extensions
|
# Install GitHub CLI extensions
|
||||||
|
|
||||||
|
# shellcheck source="shared.sh"
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||||
|
|
||||||
if ! command -v gh &> /dev/null; then
|
if ! command -v gh &> /dev/null; then
|
||||||
|
|||||||
79
zshrc
79
zshrc
@@ -1,21 +1,28 @@
|
|||||||
# 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"
|
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
autoload -U colors zsh/terminfo
|
autoload -U colors zsh/terminfo
|
||||||
colors
|
colors
|
||||||
|
|
||||||
export HOMEBREW="/opt/homebrew"
|
# Defaults
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
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
|
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
export XDG_DATA_HOME="$HOME/.local/share"
|
export XDG_DATA_HOME="$HOME/.local/share"
|
||||||
export XDG_CONFIG_HOME="$HOME/.config"
|
export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
export XDG_STATE_HOME="$HOME/.local/state"
|
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
|
if [ command -v brew &> /dev/null ]; then
|
||||||
BREW_BIN=$(brew --prefix)/bin
|
BREW_BIN=$(brew --prefix)/bin
|
||||||
BREW_SBIN=$(brew --prefix)/sbin
|
BREW_SBIN=$(brew --prefix)/sbin
|
||||||
@@ -40,22 +47,38 @@ if command -v nvim &> /dev/null; then
|
|||||||
export EDITOR="nvim"
|
export EDITOR="nvim"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LOCAL_BIN="$HOME/.local/bin"
|
# z, https://github.com/rupa/z
|
||||||
COMPOSER_DIR="$HOME/.composer/vendor/bin"
|
export _Z_DATA="$XDG_STATE_HOME/z"
|
||||||
export PATH="$LOCAL_BIN:$COMPOSER_DIR:$PATH"
|
|
||||||
|
|
||||||
export NVM_DIR="$HOME/.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
|
||||||
|
|
||||||
|
# nvm, the node version manager
|
||||||
|
export NVM_DIR="$XDG_STATE_HOME/nvm"
|
||||||
export NVM_LAZY_LOAD=true
|
export NVM_LAZY_LOAD=true
|
||||||
export NVM_COMPLETION=true
|
export NVM_COMPLETION=true
|
||||||
export NVM_AUTO_USE=true
|
export NVM_AUTO_USE=true
|
||||||
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
|
[ -s "$HOMEBREW_PKG/nvm/nvm.sh" ] && \. "$HOMEBREW_PKG/nvm/nvm.sh"
|
||||||
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
|
[ -s "$HOMEBREW_PKG/nvm/etc/bash_completion.d/nvm" ] && \. "$HOMEBREW_PKG/nvm/etc/bash_completion.d/nvm"
|
||||||
|
|
||||||
|
# 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.
|
# Run x-load-configs in your terminal to reload the files.
|
||||||
function x-load-configs()
|
function x-load-configs()
|
||||||
{
|
{
|
||||||
# Load the shell dotfiles, and then some:
|
# 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" ] && [ -f "$file" ] && source "$file"
|
||||||
[ -r "$file-secret" ] && [ -f "$file-secret" ] && source "$file-secret"
|
[ -r "$file-secret" ] && [ -f "$file-secret" ] && source "$file-secret"
|
||||||
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
|
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
|
||||||
@@ -67,15 +90,19 @@ x-load-configs
|
|||||||
# Import ssh keys in keychain
|
# Import ssh keys in keychain
|
||||||
ssh-add -A 2>/dev/null;
|
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
|
# 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
|
# antigen is present
|
||||||
if command -v antigen &> /dev/null; then
|
if command -v antigen &> /dev/null; then
|
||||||
antigen use oh-my-zsh
|
antigen use oh-my-zsh
|
||||||
|
|
||||||
# antigen theme oskarkrawczyk/honukai-iterm-zsh honukai
|
|
||||||
|
|
||||||
antigen bundle ssh-agent
|
antigen bundle ssh-agent
|
||||||
antigen bundle colored-man-pages
|
antigen bundle colored-man-pages
|
||||||
antigen bundle jreese/zsh-titles
|
antigen bundle jreese/zsh-titles
|
||||||
@@ -84,16 +111,14 @@ if command -v antigen &> /dev/null; then
|
|||||||
antigen bundle MichaelAquilina/zsh-you-should-use
|
antigen bundle MichaelAquilina/zsh-you-should-use
|
||||||
antigen bundle unixorn/autoupdate-antigen.zshplugin
|
antigen bundle unixorn/autoupdate-antigen.zshplugin
|
||||||
antigen bundle Sparragus/zsh-auto-nvm-use
|
antigen bundle Sparragus/zsh-auto-nvm-use
|
||||||
# antigen bundle git-auto-fetch
|
|
||||||
|
|
||||||
hash php 2>/dev/null && antigen bundle php
|
hash php 2>/dev/null && antigen bundle php
|
||||||
hash nvm 2>/dev/null && antigen bundle nvm
|
hash nvm 2>/dev/null && antigen bundle nvm
|
||||||
hash docker 2>/dev/null && antigen bundle docker
|
hash docker 2>/dev/null && antigen bundle docker
|
||||||
# hash ruby 2>/dev/null && antigen bundle ruby
|
# 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 jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin
|
||||||
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
|
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
|
||||||
# antigen bundle voronkovich/phpcs.plugin.zsh
|
|
||||||
|
|
||||||
# Platform dependant bundles
|
# Platform dependant bundles
|
||||||
if [[ $(uname) == 'Linux' ]]; then
|
if [[ $(uname) == 'Linux' ]]; then
|
||||||
@@ -113,9 +138,18 @@ fi
|
|||||||
|
|
||||||
# op (1Password cli) is present
|
# op (1Password cli) is present
|
||||||
if hash op 2>/dev/null; then
|
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
|
eval "$(op completion zsh)"; compdef _op op
|
||||||
fi
|
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
|
# gcloud is present
|
||||||
#if hash gcloud 2>/dev/null; then
|
#if hash gcloud 2>/dev/null; then
|
||||||
# GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
|
# GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
|
||||||
@@ -123,7 +157,8 @@ fi
|
|||||||
# [[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
|
# [[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
eval "$(starship init zsh)"
|
# 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"
|
||||||
|
|
||||||
# Fig post block. Keep at the bottom of this file.
|
eval "$(starship init zsh)"
|
||||||
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user