diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b91d798..146e1fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +--- repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 diff --git a/README.md b/README.md index 6922518..d70fcae 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,14 @@ curl -sSL https://get.rvm.io | bash -s stable --auto-dotfiles [GitHub - VundleVim](https://github.com/VundleVim/Vundle.vim) -Launch vim and run `:PluginInstall` +``` +git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim +``` To install from command line: `vim +PluginInstall +qall` +Launch vim and run `:PluginInstall` + ##### Set up .oh-my-zsh [GitHub - Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh) diff --git a/home/.aliases b/home/.aliases index 1d25f51..d9dffe0 100644 --- a/home/.aliases +++ b/home/.aliases @@ -3,35 +3,35 @@ # Detect which `ls` flavor is in use if ls --color > /dev/null 2>&1; then - colorflag='--color=always' # GNU `ls` + colorflag='--color=always' # GNU ls else - colorflag="-G" # OS X `ls` + colorflag="-G" # OS X ls fi # Vim aliases & helpers -alias vi='vim' # Ensure Vi IMproved -alias PluginInstall="vim +PluginInstall +qall" # Quick PluginInstall -alias PluginClean='vim +Pluginclean +qall' # Quick PluginClean +alias vi='vim' # Ensure Vi IMproved +alias PluginInstall="vim +PluginInstall +qall" # Quick PluginInstall +alias PluginClean='vim +Pluginclean +qall' # Quick PluginClean # Canonical hex dump; some systems have this symlinked command -v hd > /dev/null || alias hd="hexdump -C" -# macOS has no `md5sum`, so use `md5` as a fallback +# macOS has no md5sum, so use md5 as a fallback command -v md5sum > /dev/null || alias md5sum="md5" -# macOS has no `sha1sum`, so use `shasum` as a fallback +# macOS has no sha1sum, so use shasum as a fallback command -v sha1sum > /dev/null || alias sha1sum="shasum" # General -alias sudo='sudo ' # Enable aliases to be sudo'ed -alias tree='tree -C' # Pretty color tree -alias path='echo -e ${PATH//:/\\n}' # Pretty path +alias sudo='sudo ' # Enable aliases to be sudo'ed +alias tree='tree -C' # Pretty color tree +alias path='echo -e ${PATH//:/\\n}' # Pretty path # directory listings -alias ls="command ls -hF ${colorflag}" # Always use color output for `ls` -alias l="ls -lF ${colorflag}" # List all files colorized in long format +alias ls="command ls -hF ${colorflag}" # Always use color output for `ls` +alias l="ls -lF ${colorflag}" # List all files colorized in long format alias l.="ls -d .* ${colorflag}" alias ll="ls -aF ${colorflag}" -alias la="ls -laF ${colorflag}" # List all files colorized in long format, including dot files -alias lsd="ls -lF ${colorflag} | grep --color=never '^d'" # List only directories +alias la="ls -laF ${colorflag}" # List all files colorized in long format, including dot files +alias lsd="ls -lF ${colorflag} | grep --color=never '^d'" # List only directories alias dir="ls ${colorflag}--format=vertical" alias vdir="ls ${colorflag} --format=long" @@ -68,19 +68,19 @@ done alias urlencode='python3 -c "import sys, urllib.parse as ul; print(ul.quote_plus(sys.argv[1]));"' # MacOS Helpers -# macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages +# Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages alias update='sudo softwareupdate -i -a && brew update && brew upgrade --all && brew cleanup && brew cask cleanup' -# macOS Delete `.DS_Store` files +# Delete `.DS_Store` files alias cleanupds="find . -type f -name '*.DS_Store' -ls -delete" -# macOS System Logs to improve shell startup speed -# macOS Empty the Trash on all mounted volumes +# Remove system logs and empty the Trash on all mounted volumes alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" -# OSX Show/hide hidden files in Finder +# Show/hide hidden files in Finder +# To-do: Testing, this method might not be a solution with the latest OSX, or macOS updates alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" -# OSX Lock the screen (when going AFK) +# Lock the screen (when going AFK) alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" diff --git a/home/.git-template/hooks/.pre-commit-config.yaml b/home/.git-template/hooks/.pre-commit-config.yaml index 03e5bb9..4fa5e09 100644 --- a/home/.git-template/hooks/.pre-commit-config.yaml +++ b/home/.git-template/hooks/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -# https://pre-commit.com/hooks.html +--- repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 @@ -13,3 +13,5 @@ repos: rev: 3.0.0 hooks: - id: shellcheck + types: [shell] + args: [-e, SC1071, -e, SC2034] diff --git a/home/.tmux.conf b/home/.tmux.conf index 051d83a..2b7561b 100644 --- a/home/.tmux.conf +++ b/home/.tmux.conf @@ -46,6 +46,7 @@ set-option -g display-panes-time 800 # pane indicators display time set-option -g display-time 1000 # status messages display time set-option -g base-index 1 # Start window numbers at 1 set-option -g renumber-windows on # Renumber windows when one is closed +set-option -g focus-events on # focus events # }}} # VISUALS & CLOCK {{{ diff --git a/home/.vimrc b/home/.vimrc index cc1a07f..2b317d9 100644 --- a/home/.vimrc +++ b/home/.vimrc @@ -1,7 +1,7 @@ " Vundle requirements " GitHub: https://github.com/VundleVim/Vundle.vim -set nocompatible " be iMproved, required -filetype off " required +set nocompatible " be iMproved, required +filetype off " required " Set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim @@ -11,14 +11,13 @@ call vundle#begin() Plugin 'VundleVim/Vundle.vim' " GitHub plugins -Plugin 'godlygeek/tabular' Plugin 'airblade/vim-gitgutter' Plugin 'dense-analysis/ale' Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline-themes' " All of your Plugins must be added before the following line -call vundle#end() " required -filetype plugin indent on " required +call vundle#end() " required +filetype plugin indent on " required :so ~/.vimrc.settings diff --git a/home/.vimrc.settings b/home/.vimrc.settings index b067bfa..43b8312 100644 --- a/home/.vimrc.settings +++ b/home/.vimrc.settings @@ -4,6 +4,7 @@ " Vim documentation: help " https://vimdoc.sourceforge.net/htmldoc/ " https://vimdoc.sourceforge.net/htmldoc/fold.html +" [UTF-8 Miscellaneous Symbols](https://www.w3schools.com/charsets/ref_utf_symbols.asp) " }}} " FOLDING {{{ @@ -38,7 +39,7 @@ function! ToggleNumber() endif endfunction -" toggle between paste, and nopaste +" Toggle between paste, and nopaste function! TogglePaste() if(&paste == 1) set nopaste nopaste? @@ -59,6 +60,25 @@ function! Preserve(command) call cursor(l, c) endfunction +" GitStatus(), airblade/vim-gitgutter +function! GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('+%d ~%d -%d', a, m, r) +endfunction + +" LinterStatus(), dense-analysis/ale +function! LinterStatus() abort + let l:counts = ale#statusline#Count(bufnr('')) + let l:all_errors = l:counts.error + l:counts.style_error + let l:all_non_errors = l:counts.total - l:all_errors + + return l:counts.total == 0 ? 'OK' : printf( + \ '%dW %dE', + \ all_non_errors, + \ all_errors + \) +endfunction + " }}} " AUTOGROUPS {{{ @@ -113,66 +133,51 @@ set encoding=utf-8 "}}} " PLUGIN OPTIONS {{{ +" Plugin: airblade/vim-gitgutter options +let g:gitgutter_set_sign_backgrounds = 0 +highlight link GitGutterChangeLine DiffText + " Plugin: dense-analysis/ale options let g:ale_fix_on_save = 0 -let g:ale_open_list = 0 let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─'] -let g:ale_echo_msg_format = '%severity% [%linter%] %s' -let g:ale_change_sign_column_color = 1 -let g:ale_sign_column_always = 1 -"let g:ale_sign_error = '●' -"let g:ale_sign_warning = '.' +let g:ale_echo_msg_format = '[%severity%] [%linter%] %s ' +let g:ale_set_highlights = 0 +let g:ale_change_sign_column_color = 0 +let g:ale_sign_error = '🚩' +let g:ale_sign_warning = '🚧' +let g:ale_pattern_options = {'\.min.js$': {'ale_enabled': 0}} let g:ale_linters = { \ 'javascript': ['prettier', 'eslint'], \ 'ruby': ['rubocop'], - \ 'go': ['golint'], \} let g:ale_linter_aliases = { \ 'Dockerfile': 'dockerfile', - \ 'zsh': 'sh', - \ 'csh': 'sh', - \ 'ps1': 'powershell', \ 'vimwiki': 'markdown', - \ 'xsd': ['xsd', 'xml'], - \ 'xslt': ['xslt', 'xml'], \} let g:ale_linters_ignore = { \ 'typescript': ['tslint'] \} -let g:ale_pattern_options = {'\.min.js$': {'ale_enabled': 0}} -let g:ale_fixers = {'go': ['gofmt'], '*': ['prettier']} +let g:ale_fixers = {'javascript': ['eslint'], '*': ['prettier']} " Plugin: vim-airline/vim-airline options let g:airline_highlighting_cache = 1 +let g:airline#extensions#tabline#buffer_nr_show = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#formatter = 'default' +let g:airline#extensions#ale#enabled = 1 " MOVED TO THEME OPTIONS SECTION " Plugin: vim-airline/vim-airline-theme options "let g:airline_theme='luna' +"set statusline+=%{LinterStatus()} +"set statusline+=%{GitStatus()} "}}} " THEME OPTIONS {{{ " Set colorscheme, overriden by plugins "colorscheme solarized -let g:airline_theme='bubblegum' - -" }}} -" {{{ INDENTATION, SPACES & TABS - -" Indentation -set autoindent -set smartindent - -" Tell VIM to honor two-spaces after a period -set cpo+=J - -" Spaces and tabs -set tabstop=2 -set expandtab -set shiftwidth=2 -set softtabstop=2 +let g:airline_theme='distinguished' " }}} " UI CONFIG {{{ @@ -192,6 +197,9 @@ set cursorline " Number of lines that are checked for set commands set modeline +" Vim 7.4.2201 +set signcolumn=yes + " Highlight column 140 if exists('+colorcolumn') set colorcolumn=80 @@ -212,6 +220,22 @@ set completeopt=longest,menu " Set to allow you to backspace while back past insert mode set backspace=2 +" }}} +" {{{ INDENTATION, SPACES & TABS + +" Indentation +set autoindent +set smartindent + +" Tell VIM to honor two-spaces after a period +set cpo+=J + +" Spaces and tabs +set tabstop=2 +set expandtab +set shiftwidth=2 +set softtabstop=2 + " }}} " SEARCHING {{{ @@ -266,6 +290,10 @@ nmap p :call TogglePaste() :command! W w :command! Q q +" ale, navigate between errors quickly +nmap (ale_previous_wrap) +nmap (ale_next_wrap) + " }}} " SESSIONS, BACKUPS & HISTORY {{{ @@ -273,7 +301,8 @@ nmap p :call TogglePaste() set autoread " Mapping key press wait timeout -set timeout timeoutlen=1000 +set timeout timeoutlen=50 +set ttimeoutlen=50 " Hide buffers after they are abandoned set hidden diff --git a/home/.zshrc b/home/.zshrc index 8ffb0a8..3ddf68b 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -1,47 +1,47 @@ # .zshrc # shellcheck disable=all # https://zsh.sourceforge.io/Guide/zshguide02.html -# User -declare DEFAULT_USER="" -DEFAULT_USER="$(whoami)" # Set default user for the ZSH themes -export DEFAULT_USER -# Completion +## Completion autoload -U compinit compinit +COMPLETION_WAITING_DOTS="%F{blue}…%f" +export COMPLETION_WAITING_DOTS -# History +## History # zstyle -L, zstyle :completion:history-words: zstyle ':completion:*:history-words' menu yes # activate menu zstyle ':completion:*:history-words' remove-all-dups yes # ignore duplicate entries +setopt EXTENDED_HISTORY +hgrep () { fc -Dlim "*$@*" 1 } -# LSCOLORS +## Colors # man ls | grep -A 50 'LSCOLORS' -export CLICOLOR=1 -export COLORTERM=truecolor -export LSCOLORS=Gxfxcxdxbxegedabagacad +CLICOLOR=1 +COLORTERM=truecolor +LSCOLORS=Gxfxcxdxbxegedabagacad zstyle ':completion:*' list-colors "${(s.:.)LSCOLORS}" +export CLICOLOR COLORTERM LSCOLORS -# ZSH w/.oh-my-zsh +## ZSH w/.oh-my-zsh # https://github.com/ohmyzsh/ohmyzsh -export ZSH="${HOME}/.oh-my-zsh" +ZSH="${HOME}/.oh-my-zsh" +ZSH_THEME="agnoster" # Set theme to load. (agnoster, rkj-repos, ys) +zstyle ':omz:update' mode reminder # Set omz update reminder +export ZSH ZSH_THEME +## Plugins # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -export plugins=(git history-substring-search macos brew ssh-agent tmux) - -# Options -export ZSH_THEME="agnoster" # Set theme to load. (agnoster, rkj-repos, ys) -export COMPLETION_WAITING_DOTS=true # display red dots whilst waiting for completion. +plugins=(git history-substring-search macos brew ssh-agent tmux) # Load SSH identities # id_rsa gitlab_priv gitlab_work github_priv github_work zstyle ':omz:plugins:ssh-agent' identities id_rsa # Start oh-my-zsh -zstyle ':omz:update' mode reminder source "${ZSH}/oh-my-zsh.sh" -# Source alias config +# Source other configs source "${HOME}/.aliases" ## Google @@ -50,20 +50,20 @@ if [ -f "${HOME}/google-cloud-sdk/path.zsh.inc" ]; then . "${HOME}/google-cloud- # The next line enables shell command completion for gcloud. if [ -f "${HOME}/google-cloud-sdk/completion.zsh.inc" ]; then . "${HOME}/google-cloud-sdk/completion.zsh.inc"; fi -## JAVA, jenv -# if command -v jenv 1>/dev/null 2>&1; then -# export PATH="/usr/local/opt/openjdk/bin:$PATH" -# export PATH="$HOME/.jenv/bin:$PATH" -# eval "$(jenv init -)" -# fi - -## Python, pyenv +# ## Python, pyenv # if command -v pyenv 1>/dev/null 2>&1; then -# export PYENV_ROOT="$HOME/.pyenv" -# export PATH="$PYENV_ROOT/bin:$PATH" +# export PYENV_ROOT="${HOME}/.pyenv" +# export PATH="${PYENV_ROOT}/bin:${PATH}" # eval "$(pyenv init -)" # fi -## Others -# Setup other services, /usr/local/opt/ -#export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" +# ## JAVA, jenv +# if command -v jenv 1>/dev/null 2>&1; then +# export PATH="/usr/local/opt/openjdk/bin:${PATH}" +# export PATH="${HOME}/.jenv/bin:${PATH}" +# eval "$(jenv init -)" +# fi + +# ## Setup others +# # Setup other services, /usr/local/opt/ +# export PATH="/usr/local/opt/openssl@1.1/bin:${PATH}"