~andrewzah/dotfiles

0148053b39289149feaf810a393a2f5e5c16e312 — Andrew Zah 1 year, 7 months ago 210c8cc
udpate
M .gitconfig => .gitconfig +9 -0
@@ 6,6 6,8 @@
[core]
  editor = nvim
  excludesfile = ~/.global_gitignore
	quotepath = false
	commitGraph = true

[alias]
        aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/' | sort


@@ 84,3 86,10 @@
        untracked = red
;[commit]
        ;gpgsign = true
[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
[gc]
	writeCommitGraph = true

M .zshrc => .zshrc +9 -4
@@ 7,11 7,16 @@ source ~/.dotfiles/zsh/secret-exports.zsh
source ~/.dotfiles/zsh/functions.zsh
source ~/.dotfiles/zsh/history.zsh
source ~/.dotfiles/zsh/setopt.zsh
source ~/.dotfiles/zsh/theme.zsh

ZSH_THEME="zah"
source $ZSH/oh-my-zsh.sh
autoload -U colors && colors
#export PS1="%{$fg_bold[magenta]%} λ %{$reset_color%}"

#plugins=(gitfast ruby wd colored-man-pages last-working-dir)
#source ~/.oh-my-zsh/custom/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
setopt INC_APPEND_HISTORY
setopt EXTENDED_HISTORY
export HISTSIZE=10000000
export SAVEHIST=10000000
export HISTFILE=~/Sync/personal/.shell_history
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

M config/nvim/init.vim => config/nvim/init.vim +18 -28
@@ 7,7 7,6 @@ end
call plug#begin('~/.vim/plugged')

""" Language/Syntax
"Plug 'l04m33/vlime', {'rtp': 'vim/'}
Plug 'ElmCast/elm-vim', { 'for': 'elm' }
Plug 'cespare/vim-toml', { 'for': 'toml' }
Plug 'chrisbra/csv.vim', { 'for': 'csv' }


@@ 17,8 16,9 @@ Plug 'fatih/vim-go', { 'for': 'go' }
Plug 'isobit/vim-caddyfile', { 'for': 'caddyfile' }
Plug 'kchmck/vim-coffee-script', { 'for': 'coffee' }
Plug 'leafgarland/typescript-vim', { 'for': 'typescript' }
Plug 'ledger/vim-ledger'
Plug 'lervag/vimtex'
Plug 'leafoftree/vim-svelte-plugin', { 'for': 'svelte'}
"Plug 'ledger/vim-ledger'
"Plug 'lervag/vimtex'
Plug 'maxmellon/vim-jsx-pretty', { 'for': 'javascript' }
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'rhysd/vim-crystal', { 'for': 'crystal' }


@@ 27,22 27,21 @@ Plug 'slim-template/vim-slim', { 'for': 'slim' }
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }

""" Vim Behavior/Functionality
"Plug 'mattn/emmet-vim'
"Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '<plug>(GrepperOperator)'] }
"Plug 'radenling/vim-dispatch-neovim'
"Plug 'tpope/vim-dispatch'
Plug 'chrisbra/NrrwRgn', { 'on': ['<plug>(nrrwrgn#NrrwRgn)'] }
Plug 'bhurlow/vim-parinfer', {'for': 'clojure' }
Plug 'bkad/CamelCaseMotion'
Plug 'chrisbra/NrrwRgn', { 'on': ['<plug>(nrrwrgn#NrrwRgn)'] }
Plug 'godlygeek/tabular'
Plug 'Alok/notational-fzf-vim'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'luochen1990/rainbow'
Plug 'machakann/vim-sandwich'
Plug 'mattn/emmet-vim'
Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '<plug>(GrepperOperator)'] }
Plug 'nathanaelkane/vim-indent-guides', { 'for': ['yaml', 'python', 'haml', 'slim', 'slang'] }
Plug 'radenling/vim-dispatch-neovim'
Plug 'scrooloose/nerdcommenter'
Plug 'soramugi/auto-ctags.vim', { 'for': ['rust', 'ruby'] }
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-fugitive'

"" og theme


@@ 62,7 61,6 @@ set history=1000

" theme / colors
set background=dark
"colorscheme hybrid
colorscheme gruvbox
set termguicolors



@@ 122,7 120,7 @@ set list       " Enable 'list mode', which visually displays certain characters
" Quick timeouts on key combinations.
set timeoutlen=300

set shortmess=atIwmfl
"set shortmess=atIwmfl

" Backup, Swap, and Undo
set directory^=~/.nvim/tmp,/tmp


@@ 159,6 157,8 @@ let g:clojure_conceal_extras = 1
" Rainbow brackets/parens
let g:rainbow_active = 1

let g:netrw_silent = 1

" vim markdown disable idiotic defaults
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_emphasis_multiline = 0


@@ 208,8 208,8 @@ if get(g:, 'elite_mode')
endif

" auto-ctags options
let g:auto_ctags = 1
let g:auto_ctags_directory_list = ['.git']
"let g:auto_ctags = 1
"let g:auto_ctags_directory_list = ['.git']

let g:wildfire_objects = {
  \ "*" : ["i'", 'i"', "i)", "i]", "i}"],


@@ 229,11 229,6 @@ let g:ale_linters = {
  \ 'go': ['go fmt'],
\ }

let g:grepper = {}
let g:grepper.tools = ['rg', 'git', 'grep']

let test#strategy = "dispatch"

"""
""" Key remapping
"""


@@ 308,11 303,6 @@ nnoremap <leader>sl :call LoadSession()<cr>
" Highlight syntax for word under cursor
nnoremap <leader>pr :HLT!<cr>

" Grepper
nnoremap <Leader>* :Grepper -cword -noprompt<CR>
nnoremap gs <Plug>(GrepperOperator)
xnoremap gs <Plug>(GrepperOperator)

""" Syntaxes """

" Autoset slang syntax highlighting


@@ 331,14 321,14 @@ autocmd! FocusGained,BufEnter * checktime
" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
if has('persistent_undo') && isdirectory(expand('~').'/.vim/backups')
  silent !mkdir ~/.vim/backups > /dev/null 2>&1
  set undodir=~/.vim/backups
if has('persistent_undo') && isdirectory(expand('~').'/.nvim/backups')
  silent !mkdir ~/.nvim/backups > /dev/null 2>&1
  set undodir=~/.nvim/backups
  set undofile
endif

set ssop-=options       " do not store options (vimrc) in a session
"" Make and load method to save session per dir
" Make and load method to save session per dir
function! MakeSession()
    let b:sessiondir = $HOME . "/.vim/sessions" . getcwd()
    if (filewritable(b:sessiondir) != 2)


@@ 362,7 352,7 @@ endfunction
" Auto-commands 
augroup autosourcing
    if(argc() == 0)
        "au VimEnter * nested :call LoadSession() " Uncomment to automatically load session
        au VimEnter * nested :call LoadSession() " Uncomment to automatically load session
        au VimLeave * :call MakeSession()
    endif
augroup END

M ssh_config => ssh_config +4 -0
@@ 3,3 3,7 @@ Host *

Host cyber.ossys.com
 IdentityFile ~/.ssh/cyber

Host git.andrewzah.com
  Port 2929 
  IdentityFile ~/.ssh/id_rsa

M zsh/aliases.zsh => zsh/aliases.zsh +9 -1
@@ 1,4 1,8 @@
alias ll="ls -al"
alias l="exa"
alias ls="exa"
alias ll="exa -l"

alias gpom="git push origin master"

alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"



@@ 13,3 17,7 @@ alias ctags="`brew --prefix`/bin/ctags -f ./.git/tags"
# directories
alias cdw="cd ~/Website"
alias cdp="cd ~/Programming"
alias cda="cd ~/Work/afml"

# common
alias g="go build"

M zsh/functions.zsh => zsh/functions.zsh +0 -11
@@ 42,20 42,9 @@ function t() {
	fi;
}

function run_msql() {
  docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=DereApittyI99I' \
    -p 1433:1433 --name sql1 \
    -d mcr.microsoft.com/mssql/server:2017-latest
}

# SOURCES
# https://github.com/mathiasbynens/dotfiles/blob/master/.functions


# transfer.sh alias
transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi 
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; cat $tmpfile | pbcopy; rm -f $tmpfile; } 

# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is

M zsh/path-exports.zsh => zsh/path-exports.zsh +13 -3
@@ 28,12 28,22 @@ export UPDATE_ZSH_DAYS=1
# Rust: Cargo
export PATH=$HOME/.cargo/bin:$PATH

# ruby

# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
#export PATH="$HOME/.rbenv/bin:$PATH"

# openssl compatibility issues
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
# RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.3.8

# go
export GOPATH="$HOME/.go"

# python
export PATH=/usr/local/share/python:$PATH
#export PATH=/usr/local/share/python:$PATH

# anaconda
export PATH=/usr/local/anaconda3/bin:$PATH

A zsh/theme.zsh => zsh/theme.zsh +63 -0
@@ 0,0 1,63 @@
function preexec() {
  timer=${timer:-$SECONDS}
}

function precmd() {
  if [ $timer ]; then
    timer_show=$(($SECONDS - $timer))
    set_prompt
    unset timer
  fi
}

get_time() {
  if [[ -n "${timer_show}" ]]; then
    echo -e "${timer_show}"
  fi
}

convertsecs() {
  local T=$1
  local D=$((T/60/60/24))
  local H=$((T/60/60%24))
  local M=$((T/60%60))
  local S=$((T%60))
  [[ $D > 0 ]] && printf '%dd ' $D
  [[ $H > 0 ]] && printf '%dh ' $H
  [[ $M > 0 ]] && printf '%dm ' $M
  [[ $D > 0 || $H > 0 || $M > 0 ]] && printf ''
  printf '%ds\n' $S
}

# -- info commands

function dir_status() {
  echo "%{$fg_bold[cyan]%}%2~%{$reset_color%}"
}

function exit_code_status() {
  if [[ "$?" != "0" ]]; then
    echo -e "%{$fg_bold[red]%}"
  else
    echo -e "%{$fg_bold[green]%}"
  fi
}

function parse_git_branch() {
  echo -e "$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/')"
}

function set_prompt() {
  PROMPT=' $(exit_code_status)λ ($(convertsecs $(get_time))) $(dir_status) $(exit_code_status)\$ %{$reset_color%}'

  RPROMPT='%{$fg[green]%}$(parse_git_branch)%{$reset_color%}'
}


function zle-line-init zle-keymap-select {
  set_prompt
  zle reset-prompt
}

zle -N zle-line-init
zle -N zle-keymap-select

M zsh/zah.zsh-theme => zsh/zah.zsh-theme +0 -67
@@ 45,41 45,7 @@
    command -v $1 > /dev/null 2>&1
  }

  _convertsecs() {
    local T=$1
    local D=$((T/60/60/24))
    local H=$((T/60/60%24))
    local M=$((T/60%60))
    local S=$((T%60))
    [[ $D > 0 ]] && printf '%dd ' $D
    [[ $H > 0 ]] && printf '%dh ' $H
    [[ $M > 0 ]] && printf '%dm ' $M
    [[ $D > 0 || $H > 0 || $M > 0 ]] && printf ''
    printf '%ds\n' $S
  }

# ZSH Hooks
# =========

# TIME
# track elapsed time
  function preexec() {
    timer=${timer:-$SECONDS}
  }

  function precmd() {
    if [ $timer ]; then
      timer_show=$(($SECONDS - $timer))
      set_prompt
      unset timer
    fi
  }

  get_time() {
    if [[ -n "${timer_show}" ]]; then
      echo -e "${timer_show}"
    fi
  }

# Prompt Functions
# ================


@@ 90,40 56,7 @@
  function user_host_status () { echo "%{$fg[magenta]%}%n%{$fg[cyan]%}@%{$fg[yellow]%}%m%{$fg_bold[red]%}:%{$reset_color%}" }

  # Set color of lambda based on exit code
  function exit_code_status() {
    if [[ "$?" != "0" ]]; then
      echo -e "%{$fg_bold[red]%}"
    else
      echo -e "%{$fg_bold[green]%}"
    fi
  }

  function dir_status() {
    echo "%{$fg_bold[cyan]%}%2~%{$reset_color%}"
  }

  # Wrap up in set_prompt so it can be 
  # refreshed by time functions, etc
  function set_prompt() {
    case ${KEYMAP} in
      (vicmd)       VI_MODE="$(normal-mode)" ;;
      (main|viins)  VI_MODE="$(insert-mode)" ;;
      (*)           VI_MODE="$(insert-mode)" ;;
    esac

    PROMPT=' $(exit_code_status)λ ($(_convertsecs $(get_time))) $(dir_status) $(exit_code_status)\$ %{$reset_color%}'

    if [[ -n $(git_prompt_info) ]]; then
      RPROMPT='%{$fg[green]%}{$(git_prompt_info)}%{$reset_color%}$(git_prompt_status)%{$reset_color%}'
    else
      RPROMPT=''
    fi
  }

  function zle-line-init zle-keymap-select {
    set_prompt
    zle reset-prompt
  }

  zle -N zle-line-init
  zle -N zle-keymap-select