diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..ae9975b --- /dev/null +++ b/.bashrc @@ -0,0 +1,166 @@ +# ~/.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 + color_off="\[\033[0m\]" # Text Reset + + # Regular Colors + black="\[\033[0;30m\]" + red="\[\033[0;31m\]" + green="\[\033[0;32m\]" + yellow="\[\033[0;33m\]" + blue="\[\033[0;34m\]" + purple="\[\033[0;35m\]" + cyan="\[\033[0;36m\]" + white="\[\033[0;37m\]" +# bold_white='\[\033[0;1m\]' # paths +# info_blue='\[\033[1;34m\]' # default formatting +# info_red='\[\033[1;31m\]' # root formatting +# prompt_green='\[\033[;32m\]' # chrome + + path_color=$blue + chrome_color=$purple + context_color=$cyan + prompt_symbol=@ # πŸš€πŸ’² + prompt='\$' + if [ "$EUID" -eq 0 ]; then # Change prompt colors for root user + context_color=$red + prompt_symbol=πŸ’€ + fi + PROMPT_COMMAND='if [[ $? != 0 && $? != 130 ]];then echo "⚠️";fi' + PS1="$chrome_colorβ”Œβ”€β”€[${context_color}\A${chrome_color}]─"'${debian_chroot:+('${path_color}'$debian_chroot'${chrome_color}')─}${VIRTUAL_ENV:+('${path_color}'$(realpath $VIRTUAL_ENV --relative-to $PWD --relative-base /home)'${chrome_color}')─}'"[${context_color}\u${chrome_color}${prompt_symbol}${context_color}\h${chrome_color}]─(${path_color}\w${chrome_color})\n${chrome_color}β””${context_color}${prompt}${color_off} " + PS2="$chrome_colorβ””>$color_off " + + export VIRTUAL_ENV_DISABLE_PROMPT=1 + +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' + + alias ip='ip --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 -alFh' +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 + +# Customizations + +# Kubernetes +export EDITOR=nano +alias k9=k9s +which kubectl 1> /dev/null && source <(kubectl completion bash) +which helm 1> /dev/null && source <(helm completion bash) +[ -d "${KREW_ROOT:-$HOME/.krew}/bin" ] && export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" + +# Helpful Aliases +alias rsync="rsync -e 'ssh -o RemoteCommand=none'" +alias sudosu="sudo bash --rcfile ~/.bashrc" + +if [ -n "${SUDO_USER}" ]; then + alias nano="nano --rcfile \"/home/${SUDO_USER}/.nanorc\"" +fi diff --git a/.nanorc b/.nanorc new file mode 100644 index 0000000..184d425 --- /dev/null +++ b/.nanorc @@ -0,0 +1,6 @@ +set mouse +#set linenumbers +set smarthome +#set minibar +set keycolor cyan,gray +set titlecolor cyan,gray diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..e26e9bc --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,53 @@ +#set -g terminal-overrides 'xterm*:smcup@:rmcup@' +set -g @plugin 'tmux-plugins/tpm' + +# Mouse Scrolling +set -g mouse on +#set -g @plugin 'nhdaly/tmux-better-mouse-mode' +#set -g @scroll-without-changing-pane "on" +#set -g @emulate-scroll-for-no-mouse-alternate-buffer "on" + +#unbind -T copy-mode MouseDragEnd1Pane +#bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection primary -filter | xclip -selection clipboard" + +# Mouse Copy +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @yank_action 'copy-pipe-no-clear' +#bind -T copy-mode C-C send -X copy-pipe-no-clear "xsel -i --clipboard" +#bind -T copy-mode-vi C-C send -X copy-pipe-no-clear "xsel -i --clipboard" +#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip" +#set -g @yank_with_mouse off +#set -g @yank_line 'C-C' + +# Split +bind S-down split-window -v +bind S-right split-window -h + +# Navigation +bind -n C-Left select-pane -L +bind -n C-Right select-pane -R +bind -n C-Up select-pane -U +bind -n C-Down select-pane -D + +bind -n C-S-Left previous-window +bind -n C-S-Right next-window + +# Config +bind R source-file ~/.tmux.conf \; display "Config reloaded!" + +# Colors +set -g default-terminal "screen-256color" +set -g pane-border-style fg='#008b8b' +set -g pane-active-border-style fg='#34E2E2' + +set -g message-style bg='#222222',fg='#34E2E2' +set -g status-style bg='#222222',fg='#AD7FA8' + +# Status +set -g status-left '#{?client_prefix,#[fg=#008b8b]β–ˆ, }' +set -g status-interval 1 +set-window-option -g window-status-style fg='#008b8b',bg=default +set-window-option -g window-status-current-style fg='#222222',bg='#ad7fa8' + +# Load Plugins +run '~/.tmux/plugins/tpm/tpm' diff --git a/.tmux/plugins/tmux-yank b/.tmux/plugins/tmux-yank new file mode 160000 index 0000000..acfd36e --- /dev/null +++ b/.tmux/plugins/tmux-yank @@ -0,0 +1 @@ +Subproject commit acfd36e4fcba99f8310a7dfb432111c242fe7392 diff --git a/.tmux/plugins/tpm b/.tmux/plugins/tpm new file mode 160000 index 0000000..99469c4 --- /dev/null +++ b/.tmux/plugins/tpm @@ -0,0 +1 @@ +Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946 diff --git a/README.md b/README.md index a737510..cf8ee9f 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,18 @@ # Dotfiles +Dotfiles for `bash`, `nano`, `tmux`, etc. Includes a `setup` script that will backup any existing dotfiles and link +those found in this repository. - - -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: - -``` -cd existing_repo -git remote add origin https://git.mcknight.tech/d_mcknight/dotfiles.git -git branch -M main -git push -uf origin main +## Setup +Setup dotfiles: +```shell +cd ~/ +git clone https://git.mcknight.tech/d_mcknight/dotfiles .dotfiles +bash .dotfiles/setup ``` -## Integrate with your tools - -- [ ] [Set up project integrations](https://git.mcknight.tech/d_mcknight/dotfiles/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README - -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. +## Updates +To update dotfiles: +```shell +cd ~/.dotfiles +git pull +``` \ No newline at end of file diff --git a/setup b/setup new file mode 100644 index 0000000..46d7505 --- /dev/null +++ b/setup @@ -0,0 +1,13 @@ +#!/bin/sh + +# Backup any existing dotfiles +[ -f ~/.bashrc ] && mv ~/.bashrc ~/.bashrc.bak +[ -f ~/.nanorc ] && mv ~/.nanorc ~/.nanorc.bak +[ -f ~/.tmux.conf ] && mv ~/.tmux.conf ~/.tmux.conf.bak +[ -d ~/.tmux ] && mv ~/.tmux ~/.tmux.bak + +# Link dotfiles +[ -e ~/.tmux.conf ] || ln -s ~/.dotfiles/.tmux.conf ~/.tmux.conf +[ -e ~/.bashrc ] || ln -s ~/.dotfiles/.bashrc ~/.bashrc +[ -e ~/.nanorc ] || ln -s ~/.dotfiles/.nanorc ~/.nanorc +[ -e ~/.tmux ] || ln -s ~/.dotfiles/.tmux ~/.tmux