diff --git a/.aliases b/.aliases deleted file mode 100644 index 592287a..0000000 --- a/.aliases +++ /dev/null @@ -1,25 +0,0 @@ -alias ll="ls -lah" -alias grep='grep --color=auto' -alias diff='diff --color=auto' -alias history='history -i' - -alias tx='tmux' - -alias tf='terraform' -alias tg='terragrunt' -alias tm='terramate' - -alias gitb="git branch --show-current" - -alias ghpr='gh pr view -w' -alias ghr='gh repo view -w' - -# Generates string for debian package changelog file -# https://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog -alias debchl="echo ' -- $(git config user.name) <$(git config user.email)> $(date -R)'" - -alias gpgt="echo 'test' | gpg --clearsign" - -if [[ -f ~/.aliases.local ]]; then - source ~/.aliases.local -fi diff --git a/.editorconfig b/.editorconfig new file mode 100755 index 0000000..47f910a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# See more - https://editorconfig.org +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*] +indent_style = space +indent_size = 2 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..7db85ad --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6b0a11a..3a68178 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,18 +1,51 @@ name: checks on: + pull_request: + paths-ignore: + - '**/README.md' push: + branches: + - main paths-ignore: + - '**/README.md' - LICENSE - - README.md - - CONTRIBUTING.md jobs: - shellcheck: + linter: runs-on: ubuntu-latest + strategy: + matrix: + path: + - "setup.sh" + - "deps/brew.sh" + - "shell/.aliases" + - "shell/.functions" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: shellcheck uses: sudo-bot/action-shellcheck@latest with: - cli-args: "setup" + cli-args: "${{ matrix.path }}" + + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Checking that each file in symlinks.cfg actually exists in repo. + - name: Checking symlinks file + run: | + file="symlinks.cfg" + i=0 + while IFS='=' read -r key value; do + i=$((i+1)) + if [[ $key =~ ^# ]]; then + continue + fi + if [[ ! -f $key ]]; then + echo "Can't find file in '$file' on line $i: '$key'" + exit 1 + fi + done < "$file" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..886fc07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.vscode +.idea +.dev +.DS_Store diff --git a/README.md b/README.md index a16e787..1054673 100644 --- a/README.md +++ b/README.md @@ -2,60 +2,20 @@ [![Actions Status](https://github.com/dlampsi/dotfiles/workflows/checks/badge.svg)](https://github.com/dlampsi/dotfiles/actions) -Yet another dotfiles template repo with configuration scripts for personal use. +Yet another dotfiles repo. ## Getting started -All you need to setup configs is a bash. +This repo contains my personal dotfiles for various tools that I use on a daily basis. The setup script will create symlinks to the dotfiles in the home directory and optionally creates a backup of the existing files. -Setup files: -```bash -# Regular setup all dotfiles -./setup - -# Force overwrite existwsing files -./setup -f - -# Setup only zsh -./setup zsh - -# Setup only zsh with force overwrite -./setup -f zsh -``` +## Setup -See all available options: +Clone this repo and run setup script to provision symlinks to the dotfiles: ```bash -./setup -h +./setup.sh ``` -Check setup: +See all available tool options: ```bash -# Check installed alias -alias -# Check installed functions -declare -f +./setup.sh -h ``` - - - -## Content - -### Zsh - -The [.zshrc](.zshrc) and [.zshenv](.zshenv) files will be updated for the configuration for the zsh. - -They will automatically configure the loading of shell functions and aliases (described below). - -### Aliases - -Shell aliases are in the [.aliases](.aliases), which will be copied to the home directory during installation. - -You can keep your local aliases in the `~/.aliases.local` file, they will be included automatically but won't be touched during the setup/update steps. - -### Functions - -Custom functions are in the [functions/](functions/) directory, they will be copied to the `~/.functions/` during the setup. - -### Configs - -The directory contains config files and scripts for various apps, such as tmux or vim. diff --git a/configs/tmux/.tmux/lang.sh b/configs/tmux/.tmux/lang.sh deleted file mode 100644 index 3c70511..0000000 --- a/configs/tmux/.tmux/lang.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# Returning current MacOS language - -lang=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleCurrentKeyboardLayoutInputSourceID | awk -F. '{print $4}' | cut -c1-3) -echo "${lang^^}" diff --git a/configs/tmux/.tmux/plugins/tmux-weather/scripts/helpers.sh b/configs/tmux/.tmux/plugins/tmux-weather/scripts/helpers.sh deleted file mode 100644 index 16c799a..0000000 --- a/configs/tmux/.tmux/plugins/tmux-weather/scripts/helpers.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set_tmux_option() { - local option="$1" - local value="$2" - tmux set-option -gq "$option" "$value" -} - -get_tmux_option() { - local option="$1" - local default_value="$2" - local option_value="$(tmux show-option -gqv "$option")" - if [ -z "$option_value" ]; then - echo "$default_value" - else - echo "$option_value" - fi -} - -# get files age in seconds -get_file_age() { # $1 - cache file - local file_path="${1:-}" - local now=$(date +%s) - # FIX: Using diff flags for MacOs - local file_modification_timestamp=$(stat -f "%m" -t "%Y" "$file_path" 2>/dev/null || echo 0) - if [ $file_modification_timestamp -ne 0 ]; then - echo $((now - file_modification_timestamp)) - else - # return 0 if could not get cache modification time, eg. file does not exist - echo 0 - fi -} diff --git a/deps/brew.sh b/deps/brew.sh new file mode 100755 index 0000000..bc84cec --- /dev/null +++ b/deps/brew.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +brew update +# brew upgrade + +brew install bash +brew install bash-completion2 +brew install telnet +brew install gnupg +brew install git +brew install tmux +brew install jq +brew install wget +brew install pure +brew install neovim + +brew cleanup diff --git a/functions/dockerfilecheck b/functions/dockerfilecheck deleted file mode 100644 index 8e7c028..0000000 --- a/functions/dockerfilecheck +++ /dev/null @@ -1,4 +0,0 @@ - -function dockerfilecheck() { - docker run --rm -w "${PWD}" -v "${PWD}:${PWD}" ghcr.io/hadolint/hadolint:v2.12.0-alpine hadolint "$@" -} diff --git a/functions/dps b/functions/dps deleted file mode 100644 index 6404075..0000000 --- a/functions/dps +++ /dev/null @@ -1,4 +0,0 @@ -# Performs docker ps with a custom format -function dps() { - docker ps --format 'table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.RunningFor}}\t{{.Ports}}\t{{.Image}}' "$@" -} diff --git a/functions/dsrm b/functions/dsrm deleted file mode 100644 index 83e80e5..0000000 --- a/functions/dsrm +++ /dev/null @@ -1,4 +0,0 @@ -# Stops and rms docker container -function dsrm() { - docker stop $1 && docker rm $1 -} diff --git a/functions/gitclb b/functions/gitclb deleted file mode 100644 index 933f5a2..0000000 --- a/functions/gitclb +++ /dev/null @@ -1,5 +0,0 @@ - -# Clears local branches that no longer exist on the remote -function gitclb() { - git fetch -p && for brch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $brch; done -} diff --git a/functions/loadenv b/functions/loadenv deleted file mode 100644 index 2f9c212..0000000 --- a/functions/loadenv +++ /dev/null @@ -1,9 +0,0 @@ -# Loads .env file into session -function loadenv() { - if [ -f .env ]; then - export $(sed '/^ *#/ d' .env) - else - echo 'No .env file found' 1>&2 - return 1 - fi -} diff --git a/functions/shellcheck b/functions/shellcheck deleted file mode 100644 index b2e7e92..0000000 --- a/functions/shellcheck +++ /dev/null @@ -1,4 +0,0 @@ - -function shellcheck() { - docker run --rm -w "${PWD}" -v "${PWD}:${PWD}" koalaman/shellcheck:v0.9.0 "$@" -} diff --git a/git/.gitconfig b/git/.gitconfig new file mode 100644 index 0000000..9828ae6 --- /dev/null +++ b/git/.gitconfig @@ -0,0 +1,26 @@ +[alias] + aliases = config --get-regexp alias + whoami = config user.email + s = status -s + p = pull --recurse-submodules + tags = tag -l + branches = branch --all + remotes = remote --verbose + +[gpg] + program = /opt/homebrew/bin/gpg + +[gpg "ssh"] + +[branch] + # Show most recently changed branches first. + sort = -committerdate + +[commit] + gpgsign = true + +[includeIf "gitdir:~/repos/dlampsi/"] + path = .gitconfig.personal + +[include] + path = .gitconfig.local diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100644 index 0000000..8a5c74f --- /dev/null +++ b/nvim/init.vim @@ -0,0 +1,50 @@ +set number +set shiftwidth=2 +set smartindent +set smarttab +set icon + +" Reload vimrc +nnoremap sv :source $MYVIMRC + +" Copy to clipboard +vnoremap y "+y +nnoremap Y "+yg_ + +" Plugins +call plug#begin() + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.8' } + Plug 'navarasu/onedark.nvim' + + Plug 'nvim-tree/nvim-web-devicons' + Plug 'romgrk/barbar.nvim' + Plug 'nvim-tree/nvim-tree.lua' + + Plug 'github/copilot.vim' + Plug 'preservim/nerdtree' +call plug#end() + +" Theme +let g:onedark_config = { + \ 'style': 'darker', +\} +colorscheme onedark + +" Telescope +nnoremap ff Telescope find_files +nnoremap fg Telescope live_grep +nnoremap fb Telescope buffers +nnoremap fh Telescope help_tags + +" BufferTabs +nnoremap :BufferPrevious +nnoremap :BufferNext + +" NERDTree +nnoremap n :NERDTreeFocus +nnoremap :NERDTree +nnoremap :NERDTreeToggle +nnoremap :NERDTreeFind + diff --git a/setup b/setup deleted file mode 100755 index 0778ff0..0000000 --- a/setup +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -for arg in "$@"; do - case $arg in - -h|--help) - echo "Setup dotfiles an configurations into local environment" - echo " " - echo "$0 [flags] action" - echo " " - echo "flags:" - echo " -h, --help show brief help" - echo " -f, --forche force existing files overwrite" - echo " " - echo "actions:" - echo " disk-image Creating a disk image" - exit 0 - ;; - -f|--force) - force=1 - shift - ;; - *) - action=$1 - shift - ;; - esac -done - -backup_root=$HOME -backup_dir=".dotfiles/backups/$(date '+%Y-%m-%d-%H%M%S')" -backup_path="$backup_root/$backup_dir" - -if [[ -n $force ]]; then - if [[ ! -d "$backup_path" ]]; then - (cd "$backup_root" && mkdir -p "$backup_dir") - echo "Created backup dir: $backup_path" - fi -fi - - -setup_file() { - src=$1 - dest=$2 - - if [[ -n $force || "$3" != "" ]]; then - overwrite=1 - fi - - basedir="$(dirname "${src}")" - basename="$(basename "${src}")" - - if [[ ! -f "$dest" ]]; then - echo "($src) Copying to '$dest'" - cp -n -p "$src" "$dest" - return - fi - - echo "($src) File already exists in '$dest'" - - if [[ -n $overwrite ]]; then - echo "($src) Backup to '$backup_path/$basedir/$basename'" - mkdir -p "$backup_path/$basedir" - cp -p "$dest" "$backup_path/$basedir/$basename" - - cp -p "$src" "$dest" - echo "($src) File '$dest' overwrited" - fi -} - -setup_dir() { - src=$1 - dest=$2 - - if [[ -n $force || "$3" != "" ]]; then - overwrite=1 - fi - - basedir="$(dirname "${src}")" - basename="$(basename "${src}")" - - if [[ ! -d "$dest" ]]; then - echo "($src) Copying to '$dest'" - cp -r "$src/" "$dest/" - return - fi - - echo "($src) Directory already exists in '$dest'" - - if [[ -n $overwrite ]]; then - echo "($src) Backup to '$backup_path/$basename'" - mkdir -p "$backup_path/$src" - cp -r "$dest/" "$backup_path/$basename/" - - cp -r "$src/" "$dest/" - echo "($src) Directory '$dest' overwrited" - fi -} - -setup_aliases() { - setup_file ".aliases" "$HOME/.aliases" -} - -setup_functions() { - setup_dir "functions" "$HOME/.functions" -} - -setup_zsh() { - setup_file "zsh/.zshenv" "$HOME/.zshenv" - setup_file "zsh/.zshrc" "$HOME/.zshrc" -} - -setup_tmux() { - setup_file "configs/tmux/.tmux.conf" "$HOME/.tmux.conf" - setup_file "configs/tmux/.tmux/lang.sh" "$HOME/.tmux/lang.sh" - setup_file "configs/tmux/.tmux/plugins/tmux-weather/scripts/helpers.sh" "$HOME/.tmux/plugins/tmux-weather/scripts/helpers.sh" -} - -setup_vim() { - setup_file "configs/vim/.vimrc" "$HOME/.vimrc" -} - -case $action in - "aliases") - setup_aliases - ;; - "zsh") - setup_zsh - ;; - "functions") - setup_functions - ;; - "tmux") - setup_tmux - ;; - "vim") - setup_vim - ;; - "all"|*) - echo "Running all actions" - setup_aliases - setup_functions - setup_zsh - setup_tmux - setup_vim - ;; -esac diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..57a0a8e --- /dev/null +++ b/setup.sh @@ -0,0 +1,182 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +CURDIR=$(pwd -P) +SYMLINKS_CFG="$CURDIR/symlinks.cfg" + +BACKUP_DIR_BASE="$HOME/.dotfiles/backups" +BACKUP_DIR="$BACKUP_DIR_BASE/$(date '+%Y-%m-%d-%H%M%S')" + +FILES=() + +for arg in "$@"; do + case $arg in + -h|--help) + echo "Setup dotfiles an configurations into local environment" + echo " " + echo "$0 [flags] files..." + echo " " + echo "flags:" + echo " -h, --help Show brief help." + echo " -f, --forche Force existing files overwrite." + echo " -b, --backup Backup existing files before overwrite." + echo " --backup-dir Backup directory. Default: $HOME/.dotfiles/backups" + echo " -t, --timestamps Show timestamps in log output." + echo " -v, --verbose Verbose script output." + echo " " + exit 0 + ;; + -v|--verbose) + VERBOSE=1 + shift + ;; + -f|--force) + FORCE=1 + shift + ;; + -b|--backup) + BACKUP=1 + shift + ;; + --backup-dir) + BACKUP_DIR_BASE=$2 + shift 2 + ;; + -t|--timestamps) + TIMESTAMPS=1 + shift + ;; + *) + FILES+=("$1") + shift + ;; + esac +done + +# ------------------------------------------------------------------------------ +# Functions +# ------------------------------------------------------------------------------ +function log() { + local lvl=$1 + local msg=$2 + local color=$3 + local no_color='\033[0m' + + if [[ -z $TIMESTAMPS ]]; then + echo -e "${color}${lvl}${no_color} $msg" + else + local ts + ts=$(date +"%Y-%m-%d %H:%M:%S") + echo -e "$ts ${color}${lvl}${no_color} $msg" + fi + +} + +function debug() { + local color="\033[1;30m" # gray + if [[ -n "$VERBOSE" ]]; then + log "DEBUG" "$1" "$color" + fi +} + +function info() { + local color='\033[0;32m' # green + log "INFO " "$1" "$color" +} + +function warn() { + local color='\033[0;33m' # yellow + log "WARN " "$1" "$color" +} + +function error() { + local color='\033[0;31m' # red + log "ERROR" "$1" "$color" + exit 1 +} + +function symlink() { + local src=$1 + + if ! grep -q "$src" "$SYMLINKS_CFG"; then + warn "Can't get symlink configuration for '$src'" + return + fi + + cfg_line=$(< "$SYMLINKS_CFG" grep "$src") + if [[ $cfg_line =~ ^# ]]; then + warn "Symlink config line is commented for source: '$src'" + return + fi + slink=$(echo "$cfg_line" | awk -F '=' '{print $2}') + dst=$(eval echo "$slink") + + if [[ -f "$dst" ]] || [[ -d "$dst" ]] || [[ -L "$dst" ]]; then + # Checking if symlink already points to the source file + real_path=$(realpath "$dst") + if [[ "$real_path" == "$CURDIR/$src" ]]; then + debug "[${src}] Symlink already valid" + return + fi + + if [[ -z $FORCE ]]; then + warn "[${src}] File already exists: '$dst'" + return + fi + + if [[ -n $BACKUP ]]; then + info "[${src}] Moving existing file to backup: '$dst'" + dst_basename=$(basename "$dst") + mv "$dst" "$BACKUP_DIR/$dst_basename.bak" + else + info "[${src}] Removing existing file resource" + rm -rf "$dst" + fi + fi + + info "[${src}] Creating symlink: '$dst'" + ln -s "$CURDIR/$src" "$dst" +} + +# ------------------------------------------------------------------------------ +# Main script +# ------------------------------------------------------------------------------ +if [[ ! -f "$SYMLINKS_CFG" ]]; then + error "Symlinks configuration file not found at: '$SYMLINKS_CFG'" +fi + +if [[ ${#FILES[@]} -eq 0 ]]; then + debug "Loading src files from symlinks config" + # shellcheck disable=SC2034 + while IFS='=' read -r key value; do + if [[ $key =~ ^# ]]; then + debug "Skipping commented line: '$key'" + else + FILES+=("$key") + fi + done < "$SYMLINKS_CFG" +fi + +if [[ -n $FORCE && -z $BACKUP ]]; then + echo "" + read -r -p "You're about to overwrite existing files without using the backup flag. Are you sure? (y/n): " answer + if [[ $answer != "y" ]]; then + exit 0 + fi + echo "" +fi + +if [[ -n $FORCE && -n $BACKUP ]]; then + debug "Creating backup directory: $BACKUP_DIR" + mkdir -p "$BACKUP_DIR" +fi + +info "Setting up dotfiles" + +for src in "${FILES[@]}"; do + symlink "$src" +done + +info "All done" diff --git a/shell/.aliases b/shell/.aliases new file mode 100755 index 0000000..2b6c971 --- /dev/null +++ b/shell/.aliases @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +alias reload='exec ${SHELL} -l' +alias ll="ls -lah" +alias grep='grep --color=auto' +alias diff='diff --color=auto' +alias history='history -i' +alias week='date +%V' + +# Signs test string to enable GPG. +alias gpgt="echo 'test' | gpg --clearsign" + +alias shellcheck='docker run --rm -w $PWD -v $PWD:$PWD koalaman/shellcheck:v0.10.0' + +# Show/hide hidden files in Finder +alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" +alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" + +# ------- TMUX +alias tx='tmux' + +# ------- Terraform & co +alias tf='terraform' +alias tg='terragrunt' +alias tm='terramate' + +# ------- Git +alias g="git" +# Shows current branch name +alias gb="git branch --show-current" +# Force push current branch to origin +alias gfp="git push origin \$(git rev-parse --abbrev-ref HEAD) -f" + +# ------- Github CLI +alias ghr="gh repo view -w" +alias ghpr="gh pr view -w" + +# ------- AWS CLI +alias awslocal="aws --endpoint-url=http://localhost:4566" + +# ------- Docker +alias d="docker" +alias dps="docker ps --format 'table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.RunningFor}}\t{{.Ports}}\t{{.Image}}'" +alias dc="docker compose" +alias dcu="docker compose up" +alias dcd="docker compose down" +alias dcr="docker compose run" + + +# ------- Loading local aliases +# shellcheck source=/dev/null +[[ -f ~/.aliases.local ]] && source ~/.aliases.local diff --git a/shell/.functions b/shell/.functions new file mode 100755 index 0000000..513847e --- /dev/null +++ b/shell/.functions @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Clears local branches that no longer exist on the remote +function gcl() { + git fetch -p && for brch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do git branch -D "$brch"; done +} + +# Generates string for debian package changelog file +# https://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog +function debchl() { + echo " -- $(git config user.name) <$(git config user.email)> $(date -R)" +} + +# Returns the current input source language +function lang() { + lang=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleCurrentKeyboardLayoutInputSourceID | awk -F. '{print $4}' | cut -c1-3) + echo "$lang" +} + +# Loading local aliases +# shellcheck source=/dev/null +[[ -f ~/.functions.local ]] && source ~/.functions.local diff --git a/symlinks.cfg b/symlinks.cfg new file mode 100644 index 0000000..28fd6e4 --- /dev/null +++ b/symlinks.cfg @@ -0,0 +1,8 @@ +shell/.functions=$HOME/.functions +shell/.aliases=$HOME/.aliases +git/.gitconfig=$HOME/.gitconfig +tmux/.tmux.conf=$HOME/.tmux.conf +vim/.vimrc=$HOME/.vimrc +nvim/init.vim=$HOME/.config/nvim/init.vim +zsh/.zshenv=$HOME/.zshenv +zsh/.zshrc=$HOME/.zshrc diff --git a/configs/tmux/.tmux.conf b/tmux/.tmux.conf similarity index 74% rename from configs/tmux/.tmux.conf rename to tmux/.tmux.conf index eb09209..5387f70 100644 --- a/configs/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -2,30 +2,25 @@ # Plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin 'tmux-plugins/tmux-resurrect' -set -g @plugin 'tmux-plugins/tmux-logging' -set -g @plugin 'robhurring/tmux-spotify' set -g @plugin 'tmux-plugins/tmux-battery' set -g @plugin 'aaronpowell/tmux-weather' -set -g @plugin 'olimorris/tmux-pomodoro-plus' +set -g @plugin 'robhurring/tmux-spotify' +set -g @plugin 'tmux-plugins/tmux-yank' # ----------------------------------------------------------------------------- # Variables -STATUSBAR_BG=#d7d75f -STATUSBAR_FG=#262626 +STATUSBAR_BG=#1e1e2e +STATUSBAR_FG=#edeef0 # ----------------------------------------------------------------------------- # Base set -g base-index 1 set -g pane-base-index 1 -set -g mouse off +set -g mouse on +set-option -g history-limit 25000 -# ----------------------------------------------------------------------------- -# Pomodoro -set -g @pomodoro_mins 25 -set -g @pomodoro_break_mins 5 -set -g @pomodoro_notifications 'on' -set -g @pomodoro_granularity 'on' +# reload configuration +bind-key -r r source-file ~/.tmux.conf # ----------------------------------------------------------------------------- # Battery - https://github.com/tmux-plugins/tmux-battery @@ -45,13 +40,13 @@ set -g @batt_color_charge_primary_tier8 $STATUSBAR_BG # ----------------------------------------------------------------------------- # Weahter - https://github.com/aaronpowell/tmux-weather -set -g @forecast-format '%c'+'%t'+'%w' +set -g @forecast-format '%c'+'%t' set -g @forecast-cache-path "/tmp/tmux-weather.cache" set -g @forecast-cache-duration 900 # ----------------------------------------------------------------------------- # Statusbar -set-option -g status-position bottom +set-option -g status-position top set-option -g status-style "bg=$STATUSBAR_BG,fg=$STATUSBAR_FG" set -g status-interval 1 set -g status-justify left @@ -59,17 +54,17 @@ set -g status-justify left # ----------------------------------------------------------------------------- # Left statusbar set-option -g status-left-length 100 -set -g status-left '#[bg=#af5f87] #[bold]#S#[nobold] #[bg=default] #(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD) | ' +set -g status-left ' #[bold]#S#[nobold] | ' # ----------------------------------------------------------------------------- # Right statusbar set-option -g status-right-length 100 -set -g status-right '#{pomodoro_status} #{music_status} #{artist} - #{track} | #{forecast} |#{battery_color_charge_bg} #{battery_icon_status} #{battery_percentage} #[default]| #(bash ~/.tmux/lang.sh) | %I:%M %a %d.%h #%U ' +set -g status-right '#{pomodoro_status} #{music_status} #{artist} - #{track} |#{battery_color_charge_bg} #{battery_icon_status} #{battery_percentage} #[default]| %I:%M %a %d.%h #%U ' # ----------------------------------------------------------------------------- # Windows -setw -g window-status-current-style fg=default,bold,bg=default - +setw -g window-status-current-format "#[bg=#af5f87] #I:#W #[bg=default]" +# # Open new splits and windows with the current working directory by default bind '"' split-window -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" @@ -78,3 +73,4 @@ bind c new-window -c "#{pane_current_path}" # ----------------------------------------------------------------------------- # Load pugins run-shell '~/.tmux/plugins/tpm/tpm' + diff --git a/configs/vim/.vimrc b/vim/.vimrc similarity index 100% rename from configs/vim/.vimrc rename to vim/.vimrc diff --git a/zsh/.zshrc b/zsh/.zshrc index 0ba0179..12288ba 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,10 +1,21 @@ -PROMPT=" %{%F{yellow}%}%~ %f%}%# " -#PROMPT="%{%F{cyan}%}%n%{%f%}@%{%F{blue}%}%m%{%f%}:%{%F{yellow}%}%~ %f%}%# " +fpath+=("$(brew --prefix)/share/zsh/site-functions") + +autoload -U promptinit; promptinit +# Pure - https://github.com/sindresorhus/pure +prompt pure +# PROMPT=" %{%F{yellow}%}%~ %f%}%# " + +# History +HISTFILE=~/.zsh_history +HISTSIZE=100000 +SAVEHIST=100000 + +setopt HIST_IGNORE_SPACE # Don't save when prefixed with space +setopt HIST_IGNORE_DUPS # Don't save duplicate lines +setopt SHARE_HISTORY # Share history between sessions # Load functions -for function in ~/.functions/*; do - source $function -done +[[ -f ~/.functions ]] && source ~/.functions # Load aliases [[ -f ~/.aliases ]] && source ~/.aliases