🦈🏠🐜 Initial Commit 🐜🦈🏠

This commit is contained in:
Jason 2022-07-06 07:07:00 -04:00
commit 4ec9719a1c
No known key found for this signature in database
GPG Key ID: 4F765975C1F0EE5F
13 changed files with 795 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
# gitignore created on 07/05/22 at 22:56
# Disable reminder in prompt
ignoredirmessage
# Disable reminder in prompt
ignoredirmessage
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Desktop.ini
# Other
.installed
# ignore commit message
.gitcommit
# ignore commit message
.gitcommit

65
Dockerfile Normal file
View File

@ -0,0 +1,65 @@
FROM alpine:edge as build
RUN apk --no-cache add --update \
vim \
bash \
curl \
ca-certificates \
git \
tmux \
util-linux \
pciutils \
usbutils \
coreutils \
binutils \
findutils \
grep \
iproute2 && \
ln -sf /bin/bash /bin/sh && \
mkdir -p /root/.vim/autoload /root/.vim/bundle /root/.cache/resurrect
COPY ./config/resurrect/ /root/.cache/resurrect/
COPY ./config/tmux.conf /config/.tmux.conf
COPY ./config/bashrc /config/.bashrc
COPY ./config/vimrc /config/.vimrc
COPY ./bin/. /usr/local/bin/
RUN /usr/local/bin/tmux-plugins \
curl -q -LSsf -o ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim && \
vim -u "/config/.vimrc" -c ":BundleInstall" +qall </dev/null &>/dev/null && \
vim -u "/config/.vimrc" -c ":PluginInstall" +qall </dev/null &>/dev/null && \
vim -u "/config/.vimrc" -c ":PluginClean" +qall </dev/null &>/dev/null
FROM scratch
ARG BUILD_DATE="$(date +'%Y-%m-%d %H:%M')"
LABEL \
org.label-schema.name="vim" \
org.label-schema.description="vim text editor" \
org.label-schema.url="https://github.com/casjaysdev/vim" \
org.label-schema.vcs-url="https://github.com/casjaysdev/vim" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.version=$BUILD_DATE \
org.label-schema.vcs-ref=$BUILD_DATE \
org.label-schema.license="MIT" \
org.label-schema.vcs-type="Git" \
org.label-schema.schema-version="latest" \
org.label-schema.vendor="CasjaysDev" \
maintainer="CasjaysDev <docker-admin@casjaysdev.com>"
ENV VIM_INDENT="2" \
VIMRC="/root/.vimrc" \
SHELL="/bin/bash" \
TERM="xterm-256color" \
HOSTNAME="casjaysdev-vim" \
TZ="${TZ:-America/New_York}"
WORKDIR /root
VOLUME ["/root","/config"]
COPY --from=build /. /
HEALTHCHECK CMD [ "/usr/local/bin/entrypoint-vim.sh", "healthcheck" ]
ENTRYPOINT [ "/usr/local/bin/entrypoint-vim.sh" ]
CMD [ "/usr/bin/tmux" ]

13
LICENSE.md Normal file
View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2022 Jason Hempstead <git-admin@casjaysdev.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1. You just DO WHAT THE FUCK YOU WANT TO.

43
README.md Normal file
View File

@ -0,0 +1,43 @@
# vim Readme 👋
Vim is a highly configurable text editor
## Run container
dockermgr install vim
### via command line
```shell
docker run -d \
--restart always \
--name vim \
--hostname vim \
-e TZ=${TIMEZONE:-America/New_York} \
-v $PWD/vim/data:/root \
-v $PWD/vim/config:/etc/vim \
casjaysdev/vim:latest
```
### via docker-compose
```yaml
version: "2"
services:
vim:
image: casjaysdev/vim
container_name: vim
environment:
- TZ=America/New_York
- HOSTNAME=vim
volumes:
- $HOME/.local/share/docker/storage/vim/data:/root
- $HOME/.local/share/docker/storage/vim/config:/etc/vim
restart:
- always
```
## Authors
🤖 Casjay: [Github](https://github.com/casjay) [Docker](https://hub.docker.com/casjay) 🤖
⛵ CasjaysDev: [Github](https://github.com/casjaysdev) [Docker](https://hub.docker.com/casjaysdev) ⛵

83
bin/entrypoint-vim.sh Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202202021753-git
# @Author : Jason Hempstead
# @Contact : jason@casjaysdev.com
# @License : WTFPL
# @ReadME : entrypoint-vim.sh --help
# @Copyright : Copyright: (c) 2022 Jason Hempstead, Casjays Developments
# @Created : Wednesday, Feb 02, 2022 17:53 EST
# @File : entrypoint-vim.sh
# @Description :
# @TODO :
# @Other :
# @Resource :
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename "$0")"
VERSION="202202021753-git"
USER="${SUDO_USER:-${USER}}"
HOME="${USER_HOME:-${HOME}}"
SRC_DIR="${BASH_SOURCE%/*}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set bash options
if [[ "$1" == "--debug" ]]; then shift 1 && set -xo pipefail && export SCRIPT_OPTS="--debug" && export _DEBUG="on"; fi
trap 'exitCode=${exitCode:-$?};[ -n "$ENTRYPOINT_SH_TEMP_FILE" ] && [ -f "$ENTRYPOINT_SH_TEMP_FILE" ] && rm -Rf "$ENTRYPOINT_SH_TEMP_FILE" &>/dev/null' EXIT
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__exec_bash() { [ -n "$1" ] && exec /bin/bash -l -c "${@:-bash}" || exec /bin/bash -l; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CONFIG_DIR="$(ls -A /config/ 2>/dev/null | grep '^' || false)"
SHELL="${SHELL:-/bin/bash}"
VIMRC="${VIMRC:-$HOME/.vimrc}"
VIM_INDENT="${VIM_INDENT:-2}"
TERM="${TERM:-xterm-256color}"
HOSTNAME="${HOSTNAME:-casjaysdev-vim}"
TZ="${TZ:-America/New_York}"
export TZ HOSTNAME
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ -n "${TZ}" ] && echo "${TZ}" >/etc/timezone
[ -n "${HOSTNAME}" ] && echo "${HOSTNAME}" >/etc/hostname
[ -n "${HOSTNAME}" ] && echo "127.0.0.1 $HOSTNAME localhost" >/etc/hosts
[ -f "/usr/share/zoneinfo/${TZ}" ] && ln -sf "/usr/share/zoneinfo/${TZ}" "/etc/localtime"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -n "$CONFIG_DIR" ]; then
for config in $CONFIG_DIR; do
if [ -d "/config/$config" ]; then
cp -Rf "/config/$config/." "/root/$config/"
elif [ -f "/config/$config" ]; then
cp -Rf "/config/$config" "/root/$config"
fi
done
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[[ -f "/config/vimrc" ]] || { [[ -f "/root/.vimrc" ]] && cp -Rf "/root/.vimrc" "/config/vimrc"; }
[[ -f "/config/tmux.conf" ]] || { [[ -f "/root/.tmux.conf" ]] && cp -Rf "/root/.tmux.conf" "/config/tmux.conf"; }
[[ -d "/config/resurrect" ]] || { [[ -d "/root/.cache/resurrect" ]] && mkdir -p "/config/resurrect" && cp -Rf "/root/.cache/resurrect/." "/config/resurrect/"; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [[ -f "$VIMRC" ]]; then
sed -i 's|set ts=4|set ts='$VIM_INDENT'|g' "$VIMRC"
sed -i 's|set shiftwidth=4|set shiftwidth='$VIM_INDENT'|g' "$VIMRC"
else
echo "Could not find .vimrc at $VIMRC"
exit 1
fi
case "$1" in
healthcheck)
if [[ -f "$VIMRC" ]] && builtin type -P vim &>/dev/null; then
exit 0
else
exit 1
fi
;;
bash | shell | sh)
shift 1
__exec_bash "$@"
;;
tmux)
shift 1
exec tmux "$@"
;;
*)
__exec_bash "$@"
;;
esac

12
bin/renew_env.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eu
pane_fmt="#{pane_id} #{pane_in_mode} #{pane_input_off} #{pane_dead} #{pane_current_command}"
tmux list-panes -s -F "$pane_fmt" | awk '
$2 == 0 && $3 == 0 && $4 == 0 && $5 ~ /(bash|zsh|ksh|fish)/ { print $1 }
' | while read -r pane_id; do
# renew environment variables according to update-environment tmux option
# also clear screen
tmux send-keys -t "$pane_id" 'Enter' 'eval "$(tmux show-env -s)"' 'Enter' 'C-l'
done

42
bin/tmux-plugins Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename "$0")"
VERSION="202108242343-git"
USER="${SUDO_USER:-${USER}}"
HOME="${USER_HOME:-${HOME}}"
SRC_DIR="${BASH_SOURCE%/*}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set bash options
[[ "$1" == "--debug" ]] && shift 1 && set -euo pipefail
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202108242343-git
# @Author : Jason Hempstead
# @Contact : jason@casjaysdev.com
# @License : WTFPL
# @ReadME : install_plugins.sh
# @Copyright : Copyright: (c) 2021 Jason Hempstead, CasjaysDev
# @Created : Tuesday, Aug 24, 2021 23:43 EDT
# @File : install_plugins.sh
# @Description : Install tmux plugins
# @TODO :
# @Other :
# @Resource :
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TMUX_HOME="$HOME/.config/tmux"
TMUX_SHARE_DIR="$HOME/.local/share/tmux"
TMUX_PLUGIN_MANAGER_PATH="$TMUX_SHARE_DIR/tpm"
export TMUX_HOME TMUX_PLUGIN_MANAGER_PATH TMUX_SHARE_DIR
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[[ -d "$TMUX_PLUGIN_MANAGER_PATH/.git" ]] && git -C "$TMUX_PLUGIN_MANAGER_PATH" pull ||
git clone https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ -x "$TMUX_PLUGIN_MANAGER_PATH/bin/install_plugins" ] &&
$TMUX_PLUGIN_MANAGER_PATH/bin/install_plugins
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mkdir -p "$TMUX_SHARE_DIR/resurrect"
[[ -f "$TMUX_HOME/resurrect" ]] && ln -sf "$TMUX_HOME/resurrect" "$TMUX_SHARE_DIR/resurrect/last"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#[[ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]] && [[ -f "$TMUX_SHARE_DIR/resurrect/last" ]] && echo "Install completed"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
exit ${exitCode:-0}

85
bin/weather Executable file
View File

@ -0,0 +1,85 @@
#!/usr/bin/env sh
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202207060010-git
# @Author : Jason Hempstead
# @Contact : jason@casjaysdev.com
# @License : LICENSE.md
# @ReadME : weather --help
# @Copyright : Copyright: (c) 2022 Jason Hempstead, Casjays Developments
# @Created : Wednesday, Jul 06, 2022 00:10 EDT
# @File : weather
# @Description : get weather - used by tmux
# @TODO :
# @Other :
# @Resource :
# @sudo/root : no
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PROG="$(basename "$0" 2>/dev/null)"
USER="${SUDO_USER:-${USER}}"
HOME="${USER_HOME:-${HOME}}"
SRC_DIR="$(dirname "$PROG")"
VERSION="202207060012-git"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set bash options
if [ "$1" = "--debug" ]; then shift 1 && set -xo && export SCRIPT_OPTS="--debug" && export _DEBUG="on"; fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Check for needed applications
#type -P sh &>/dev/null || exit 1 # exit if not found
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set variables
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set functions
__version() { echo "$VERSION"; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set additional variables
exitCode=""
GEN_SCRIPT_ARRAY_DIR="$HOME/.config/weather"
WEATHER_CONFIG_DIR="$HOME/.config/weather"
WEATHER_CONFIG_FILE="settings.conf"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# bring in user config
[ -f "$WEATHER_CONFIG_DIR/$WEATHER_CONFIG_FILE" ] && . "$WEATHER_CONFIG_DIR/$WEATHER_CONFIG_FILE"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Argument/Option settings
SETARGS="$*"
SHORTOPTS="v,h"
LONGOPTS="options,config,version,help"
ARRAY=""
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setup application options
setopts=$(getopt -o "$SHORTOPTS" --long "$LONGOPTS" -n "$APPNAME" -- "$@" 2>/dev/null)
eval set -- "${setopts}" 2>/dev/null
while :; do
case $1 in
--version)
shift 1
__version
;;
--help)
shift 1
printf 'Display current weather in your terminal'
;;
--config)
shift 1
__gen_config
;;
--)
shift 1
break
;;
esac
done
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Main application
curl -q -LSsf "http://wttr.in/?format=3" | awk '{print $1,$(NF-1),$NF}' | sed 's|, |: |g' || echo N/A
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# End application
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# lets exit with code
exit ${exitCode:-$?}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# end

67
bin/yank.sh Executable file
View File

@ -0,0 +1,67 @@
#!/usr/bin/env bash
set -eu
cmd_exists() {
type "$1" &>/dev/null || return 1
}
# get data either form stdin or from file
buf=$(cat "$@")
copy_backend_remote_tunnel_port=$(tmux show-option -gvq "@copy_backend_remote_tunnel_port")
copy_use_osc52_fallback=$(tmux show-option -gvq "@copy_use_osc52_fallback")
# Resolve copy backend: pbcopy (OSX), reattach-to-user-namespace (OSX), xclip/xsel (Linux)
copy_backend=""
if cmd_exists pbcopy; then
copy_backend="pbcopy"
elif cmd_exists reattach-to-user-namespace; then
copy_backend="reattach-to-user-namespace pbcopy"
elif [ -n "${DISPLAY-}" ] && cmd_exists xsel; then
copy_backend="xsel -i --clipboard"
elif [ -n "${DISPLAY-}" ] && cmd_exists xclip; then
copy_backend="xclip -i -f -selection primary | xclip -i -selection clipboard"
elif [ -n "${copy_backend_remote_tunnel_port-}" ] &&
(netstat -f inet -nl 2>/dev/null || netstat -4 -nl 2>/dev/null) |
grep -q "[.:]$copy_backend_remote_tunnel_port"; then
copy_backend="nc localhost $copy_backend_remote_tunnel_port"
fi
# if copy backend is resolved, copy and exit
if [ -n "$copy_backend" ]; then
printf "%s" "$buf" | eval "$copy_backend"
exit
fi
# If no copy backends were eligible, decide to fallback to OSC 52 escape sequences
# Note, most terminals do not handle OSC
if [ "$copy_use_osc52_fallback" == "off" ]; then
exit
fi
# Copy via OSC 52 ANSI escape sequence to controlling terminal
buflen=$(printf %s "$buf" | wc -c)
# https://sunaku.github.io/tmux-yank-osc52.html
# The maximum length of an OSC 52 escape sequence is 100_000 bytes, of which
# 7 bytes are occupied by a "\033]52;c;" header, 1 byte by a "\a" footer, and
# 99_992 bytes by the base64-encoded result of 74_994 bytes of copyable text
maxlen=74994
# warn if exceeds maxlen
if [ "$buflen" -gt "$maxlen" ]; then
printf "input is %d bytes too long" "$((buflen - maxlen))" >&2
fi
# build up OSC 52 ANSI escape sequence
esc="\033]52;c;$(printf %s "$buf" | head -c $maxlen | base64 | tr -d '\r\n')\a"
esc="\033Ptmux;\033$esc\033\\"
# resolve target terminal to send escape sequence
# if we are on remote machine, send directly to SSH_TTY to transport escape sequence
# to terminal on local machine, so data lands in clipboard on our local machine
pane_active_tty=$(tmux list-panes -F "#{pane_active} #{pane_tty}" | awk '$1=="1" { print $2 }')
target_tty="${SSH_TTY:-$pane_active_tty}"
printf '%s' "$esc" >"$target_tty"

50
config/bashrc Normal file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202207052258-git
# @Author : Jason Hempstead
# @Contact : jason@casjaysdev.com
# @License : LICENSE.md
# @ReadME : bashrc --help
# @Copyright : Copyright: (c) 2022 Jason Hempstead, Casjays Developments
# @Created : Tuesday, Jul 05, 2022 22:58 EDT
# @File : bashrc
# @Description :
# @TODO :
# @Other :
# @Resource :
# @sudo/root : no
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
export HISTCONTROL='ignoreboth'
export HISTFILE="$HOME/.bash_history"
export HISTSIZE=1000
export HISTTIMEFORMAT='[%F (%X)]: '
export TIMEFORMAT='%3R'
export LS_COLORS='fi=37:di=1;97:ln=90:mh=90:ex=3;2;37:no=1;97:mi=90:ow=91'
export GREP_COLOR='1;91'
export SUDO_EDITOR='/usr/bin/vim'
export TERM='xterm-256color'
# Pretty-print man(1) pages.
export LESS_TERMCAP_mb=$'\e[1;91m'
export LESS_TERMCAP_md=$'\e[1;91m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_so=$'\e[1;93m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;92m'
# aliases
alias :q='exit'
alias q='exit'
alias t='tmux '
alias v='vim '
alias sv='sudo vim '
# completions
UsrBashComp='/usr/share/bash-completion/bash_completion'
[[ -f $UsrBashComp && -r $UsrBashComp ]] && . "$UsrBashComp"
BCFuncs="$HOME/.bash_functions"
[[ -f $BCFuncs && -r $BCFuncs ]] && . "$BCFuncs"
unset BCAliases BCFuncs UsrBashComp

20
config/resurrect Normal file
View File

@ -0,0 +1,20 @@
pane 0 1 1 :* 1 :~ 1 bash :
pane 0 2 0 :- 1 :~ 1 bash :
pane 0 3 0 : 1 :~ 1 bash :
pane 0 4 0 : 1 :~ 1 bash :
pane 0 5 0 : 1 :~ 1 bash :
pane 0 6 0 : 1 :~ 1 bash :
pane 0 7 0 : 1 :~ 1 bash :
pane 0 8 0 : 1 :~ 1 bash :
pane 0 9 0 : 1 :~ 0 bash :
pane 0 9 0 : 2 :~ 1 bash :
window 0 1 :main 1 :* ac3e,170x40,0,0,1 off
window 0 2 :dev 0 :- ac3f,170x40,0,0,2 off
window 0 3 :dev 0 : ac40,170x40,0,0,3 off
window 0 4 :test 0 : ac41,170x40,0,0,4 off
window 0 5 :www 0 : ac42,170x40,0,0,5 off
window 0 6 :ssh 0 : ac43,170x40,0,0,6 off
window 0 7 :ssh 0 : ac44,170x40,0,0,7 off
window 0 8 :media 0 : ac45,170x40,0,0,8 off
window 0 9 :other 0 : 070d,170x40,0,0[170x20,0,0,9,170x19,0,21,10] off
state 0

240
config/tmux.conf Normal file
View File

@ -0,0 +1,240 @@
# Override LC and LANG
set-environment -g LANG 'en_US.UTF-8'
set-environment -g LC_ALL 'en_US.UTF-8'
set-environment -g LC_CTYPE 'en_US.UTF-8'
# plugins
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.local/share/tmux/plugins'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'jabirali/tmux-tilish'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'christoomey/tmux-navigator'
set -g @plugin 'kristijanhusak/tmux-simple-git-status'
set -g @plugin 'chriszarate/tmux-tasks'
# Set the prefix to Ctrl+a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# nested tmux, obey me
bind-key a send-prefix
# set default shell
set -g default-command bash
# set theme
color_orange="colour166" # 208, 166
color_purple="colour134" # 135, 134
color_green="colour076" # 070
color_blue="colour39"
color_yellow="colour220"
color_red="colour160"
color_black="colour232"
color_white="white" # 015
# Change values, but not remove/rename variables itself
color_dark="$color_black"
color_light="$color_white"
color_session_text="$color_blue"
color_status_text="colour245"
color_main="$color_orange"
color_secondary="$color_purple"
color_level_ok="$color_green"
color_level_warn="$color_yellow"
color_level_stress="$color_red"
color_window_off_indicator="colour088"
color_window_off_status_bg="colour238"
color_window_off_status_current_bg="colour254"
set-option -g mode-style "fg=default,bg=$color_main"
set-option -g message-style "fg=$color_main,bg=$color_dark"
# All kind of nice options
set-option -g default-terminal "screen-256color"
set-option -g history-limit 100000
set-option -g repeat-time 500
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
set-option -ga terminal-overrides ',xterm*:smcup@:rmcup@'
set-option -g base-index 1
set-option -g update-environment -r
# titles
set-option -g set-titles on
set-option -g set-titles-string "#T"
# Window options
set-option -g allow-rename on
set-option -g base-index 1
set-window-option -g pane-base-index 1
set-window-option -g renumber-windows on
set-window-option -g monitor-activity on
set-window-option -g xterm-keys on
set-window-option -g automatic-rename on
set-window-option -g aggressive-resize off
set-window-option -g pane-base-index 1
# Remap keys to my settings
unbind-key d ; bind-key d detach-client
unbind-key Tab ; bind-key Tab choose-window
unbind-key t ; bind-key t new-window
unbind-key ` ; bind-key ` last-window
unbind-key n ; bind-key n next-window
unbind-key p ; bind-key p previous-window
#unbind-key , ; bind-key , rename-window
# Window selection
unbind-key 1 ; bind-key 1 select-window -t 1
unbind-key 2 ; bind-key 2 select-window -t 2
unbind-key 3 ; bind-key 3 select-window -t 3
unbind-key 4 ; bind-key 4 select-window -t 4
unbind-key 5 ; bind-key 5 select-window -t 5
unbind-key 6 ; bind-key 6 select-window -t 6
unbind-key 7 ; bind-key 7 select-window -t 7
unbind-key 8 ; bind-key 8 select-window -t 8
unbind-key 9 ; bind-key 9 select-window -t 9
# Window splitting
unbind-key \ ; bind-key \ split-window -c "#{pane_current_path}" -h
unbind-key / ; bind-key / split-window -c "#{pane_current_path}" -v
# Pane selection and resizing
unbind-key left ; bind-key left select-pane -L
unbind-key up ; bind-key up select-pane -U
unbind-key down ; bind-key down select-pane -D
unbind-key right ; bind-key right select-pane -R
unbind-key C-h ; bind-key C-h select-pane -L
unbind-key C-k ; bind-key C-k select-pane -U
unbind-key C-j ; bind-key C-j select-pane -D
unbind-key C-l ; bind-key C-l select-pane -R
unbind-key j ; bind-key -r j resize-pane -D 5
unbind-key k ; bind-key -r k resize-pane -U 5
unbind-key h ; bind-key -r h resize-pane -L 5
unbind-key l ; bind-key -r l resize-pane -R 5
unbind-key C-left ; bind-key -r C-left resize-pane -L 1
unbind-key C-right ; bind-key -r C-right resize-pane -R 1
unbind-key C-up ; bind-key -r C-up resize-pane -U 1
unbind-key C-down ; bind-key -r C-down resize-pane -D 1
unbind-key @ ; bind-key @ confirm-before kill-window
unbind-key ? ; bind-key ? list-keys
# Set that stupid Esc-Wait off, so VI works again
set-option -sg escape-time 0
# set mode either vi or emacs
set-window-option -g mode-keys emacs
# Source setup file
bind-key r source-file ~/.tmux.conf \; display-message 'source ~/.tmux.conf'
bind-key C-r source-file ~/.tmux.conf \; display-message 'source ~/.tmux.conf'
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# system clipboard
#bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
#bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# copy/paste
set-option -g @copy_use_osc52_fallback on
# mouse support
set-window-option -g mouse on
unbind-key m ; bind-key m run "mouse-toggle"
# Select layout
bind-key w command-prompt -p "tiled/even-horizontal/even-vertical/main-horizontal/main-vertical?" "select-layout '%%'"
# Zoom tmux pane with '+' key
bind + resize-pane -Z
# Message display time (ms)
set-option -g display-time 2000
# Notification
set-window-option -g monitor-activity on
set-option -g visual-activity on
set-option -g bell-action any
set-option -g visual-bell on
# Plugin properties
set -g @tilish-navigate 'on'
set -g @sidebar-tree 't'
set -g @sidebar-tree-focus 'T'
set -g @sidebar-tree-command 'tree -C'
set -g @sidebar-tree-position 'right'
## tmux prefix highlight
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_prefix_prompt 'PRE'
set -g @prefix_highlight_copy_prompt 'COPY'
set -g @prefix_highlight_sync_prompt 'SYNC'
set -g @prefix_highlight_empty_prompt 'TMUX'
# tmux continuum
set -g @continuum-restore 'on'
set -g @continuum-save-interval '5'
# tmux resurrect
set -g @resurrect-dir '~/.cache/resurrect'
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
set -g @resurrect-hook-post-save-all 'eval $(xdotool getwindowgeometry --shell $WINDOWID); echo 0,$X,$Y,$WIDTH,$HEIGHT > ~/.cache/resurrect/geometry'
set -g @resurrect-hook-pre-restore-all 'wmctrl -i -r $WINDOWID -e $(cat ~/.cache/resurrect/geometry)'
# Task manager
set -g @tasks_manager 'taskwarrior'
set -g @tasks_format_begin '#[fg=orange,bg=#f8f8f2]'
set -g @tasks_format_end '#[fg=white,bg=#44475a]'
set -g @tasks_icon_urgent '🔥'
set -g @tasks_icon_outstanding '+'
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
# general status bar settings
set-option -g status on
set-option -g status-interval 2
set-option -g status-position "bottom"
set-option -g status-justify "centre"
set-option -g status-left-length 120
set-option -g status-right-length 120
set -g status-style "fg=$color_status_text,bg=$color_dark"
set -g window-status-separator ''
set -g status-left ' #{prefix_highlight} | Sess:#S | #(whoami)@#H | #{tasks_status} |#{simple_git_status}'
set -g status-right '#(echo -n "$(weather)" | Continuum: #{continuum_status} | %a %m/%d %H:%M '
set -g window-status-format ' #I:#W '
set -g window-status-current-format ' #W '
setw -g window-status-activity-style "fg=$color_main"
setw -g window-status-current-style "fg=$color_light,bold,bg=$color_main"
# import user config
if '[ -f ~/.tmux.local ]' 'source ~/.tmux.local'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
if "test ! -d ~/.local/share/tmux/tpm/.git" "run '/usr/local/bin/tmux-plugins'"
if "test -f ~/.local/share/tmux/tpm/tpm" "run '~/usr/local/bin/tmux-plugins'"

50
config/vimrc Normal file
View File

@ -0,0 +1,50 @@
" enable syntax highlighting
syntax enable
" show line numbers
set number
" set tabs to have 4 spaces
set ts=4
" indent when moving to the next line while writing code
set autoindent
" expand tabs into spaces
set expandtab
" when using the >> or << commands, shift lines by 4 spaces
set shiftwidth=4
" show a visual line under the cursor's current line
set cursorline
" show the matching part of the pair for [] {} and ()
set showmatch
" enable higligting search results
set hlsearch
" enable incremental search
set incsearch
"
set colorcolumn=120
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -q -LSsf -o ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'editorconfig/editorconfig-vim'
Plug 'vim-airline/vim-airline'
" fuzzy finder
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
call plug#end()
let g:airline_powerline_fonts = 0
colorscheme elflord