From 70f090c6f5fcc54745f341f6106311babddcfe0c Mon Sep 17 00:00:00 2001
From: Christian Ringger <ringger@phys.ethz.ch>
Date: Thu, 13 Feb 2020 14:31:16 +0100
Subject: [PATCH] Add globi profile

---
 profile/globi/.gitconfig          | 111 ++++++++++++++++++++++++++++++
 profile/globi/.gitignore_global   |  11 +++
 profile/globi/.vimrc              | 111 ++++++++++++++++++++++++++++++
 profile/globi/envrcd.d/00-config  |   7 ++
 profile/globi/envrcd.d/10-envvars |  26 +++++++
 profile/globi/envrcd.d/20-aliases |  10 +++
 6 files changed, 276 insertions(+)
 create mode 100644 profile/globi/.gitconfig
 create mode 100644 profile/globi/.gitignore_global
 create mode 100644 profile/globi/.vimrc
 create mode 100644 profile/globi/envrcd.d/00-config
 create mode 100644 profile/globi/envrcd.d/10-envvars
 create mode 100644 profile/globi/envrcd.d/20-aliases

diff --git a/profile/globi/.gitconfig b/profile/globi/.gitconfig
new file mode 100644
index 0000000..a85fabd
--- /dev/null
+++ b/profile/globi/.gitconfig
@@ -0,0 +1,111 @@
+[core]
+    editor = vim
+    excludesfile = ~/.gitignore_global
+    pager = diff-so-fancy | less --tabs=4 -RFX
+    #pager = delta --dark --plus-color="#004200" --minus-color="#420000" --theme="DarkNeon" --highlight-removed
+    #pager = delta --dark --plus-color="#004d1e" --minus-color="#5e000a" --theme="DarkNeon" --highlight-removed
+
+[user]
+    name = Christian Ringger
+    email = ringger@phys.ethz.ch
+    signingkey = 99EEA27988963CFE
+
+[gitlab]
+    #url = "https://gitlab.phys.ethz.ch"
+    #token = ""
+
+[color]
+    ui = auto
+
+[color "diff"]
+    meta = white dim            # metainformation
+    frag = cyan                 # line number in hunk header
+    func = white                # function name in hunk header
+    plain = white               # context text
+    new = green                 # added lines
+    old = red                   # removed lines
+    commit = yellow             # commit headers
+    whitespace = red reverse    # whitespace errors
+
+[color "diff-highlight"]
+    oldNormal = red
+    oldHighlight = red 52
+    newNormal = green
+    newHighlight = green 22
+
+[color "status"]
+    added = green
+    changed = red
+    untracked = yellow
+
+[color "grep"]
+    filename = yellow
+
+[diff]
+    tool = vimdiff
+    compactionHeuristic = true
+    colorMoved = default
+
+[difftool]
+    prompt = true
+
+[diff-so-fancy]
+    # Disable green marker at the beginning of new empty lines
+    markEmptyLines = false
+
+[diff "ansible-vault"]
+    textconv = ansible-vault view
+    cachetextconv = false
+
+[merge]
+    tool = vimdiff
+
+[interactive]
+    singlekey = true
+
+[push]
+    default = simple
+
+[pull]
+    # Only pull if fast-forward is possible. Use `git pull --rebase` or `git pull --no-ff` otherwise.
+    ff = only
+    # Use `git pull --rebase` by default, otherwise use `git fetch; git merge`
+    #rebase = true
+
+[rebase]
+    # Automatically stash and pop your uncommitted changes
+    #autoStash = true
+
+[alias]
+    co = checkout
+    st = status
+    # diff and show based on words instead of lines
+    diffw = diff --color-words
+    showw = show --color-words
+    d = diff
+    dc = diff --cached
+    ds = diff --staged
+    wd = diff --color-words
+    wdc = diff --cached --color-words
+    wdiff = diff --color-words
+    ci = commit -v
+    cm = commit -m
+    aa = add -A
+    undo = reset --hard
+    ls = ls-files
+    k = !gitk --all
+    pra = pull --rebase --autostash
+    su = submodule update --recursive --remote
+    ranking = "!git shortlog | egrep -v '^ |^$' | sed -e 's/^\\(.*\\) (\\(.*\\)):/\\2 \\1/' | sort -rn"
+    addremove = "!git add . && git ls-files --deleted | xargs --no-run-if-empty git rm"
+    # prettier log (limited to 10 commits)
+    logg = !git --no-pager log --pretty=tformat:'%Creset (%ar) - %Cred %an: %Cgreen %s %Creset' --graph -n 10
+    # prettier log (limited to 10 commits, showing hash)
+    loggh = !git --no-pager log --pretty=tformat:'%C(yellow) %H %Creset (%ar) - %Cred %an: %Cgreen %s %Creset' --graph -n 10
+    # prettier log (showing all commits)
+    logga = log --pretty=format:'%Creset (%ar) - %Cred %an: %Cgreen %s' --graph
+    # prettier log (showing all commits, showing hash)
+    loggha = log --pretty=format:'%C(yellow) %H %Creset (%ar) - %Cred %an: %Cgreen %s' --graph
+    loggah = log --pretty=format:'%C(yellow) %H %Creset (%ar) - %Cred %an: %Cgreen %s' --graph
+    adog = log --all --decorate --oneline --graph
+    adogv = !"git adog --format=format:'%C(yellow)%h%C(reset)%C(auto)%d%C(reset) %C(normal)%s%C(reset) %C(dim green)%an%C(reset) %C(dim white)(%ar)%C(reset)'"
diff --git a/profile/globi/.gitignore_global b/profile/globi/.gitignore_global
new file mode 100644
index 0000000..5e6c2a0
--- /dev/null
+++ b/profile/globi/.gitignore_global
@@ -0,0 +1,11 @@
+.DS_Store
+.*.sw?
+*~
+vendor/bundle/*
+.ruby-version
+.vagrant
+.ropeproject
+.ipynb_checkpoints/
+__pycache__
+.cache
+tags
diff --git a/profile/globi/.vimrc b/profile/globi/.vimrc
new file mode 100644
index 0000000..1e23217
--- /dev/null
+++ b/profile/globi/.vimrc
@@ -0,0 +1,111 @@
+" --- general settings ---{{{
+" load debian settings from $VIMRUNTIME/debian.vim
+runtime! debian.vim
+
+" insert custom path to &runtimepath
+let &runtimepath=$ENVRCD_VIM_PATH.','.&runtimepath
+
+syntax on               "enable syntax highlighting
+set nocompatible        "use vim defaults instead of 100% vi compatibility
+set encoding=utf8       "default file encoding
+set ttyfast             "fast terminal
+set mouse=              "disable mouse mode
+filetype plugin on      "enable filetype plugins
+filetype indent on      "automatic indentation according to filetype
+"set autoindent          "preserve indentation on new line
+set backspace=eol,start,indent  "allow backspace at end of line etc
+set showmatch           "show matching parenthesis
+"set linebreak           "break line at end of a word
+"set textwidth=0         "don't break text after a certain length
+set tabstop=4           "show existing tab with 4 spaces width
+set shiftwidth=4        "when indenting with '>', use 4 spaces width
+set softtabstop=4       "use 4 spaces per tab when editing
+set expandtab           "when pressing tab, insert 4 spaces
+set smarttab            "use sw at beginning of line, ts otherwise
+set incsearch           "incremental search
+set wrapscan            "continue search from top when reaching the end
+set ignorecase          "search is not case-sensitive
+set smartcase           "search case-sensitive for uppercase patterns
+set hlsearch            "search pattern highlighting
+set magic               "enable extended regexes
+set spellsuggest=7      "show 7 suggestions when spellchecking
+set nopaste             "fix middlemouse button paste (seems default setting)
+set history=999         "increase history (default = 20)
+set undolevels=999      "more undo (default=100)
+set nobackup            "toggle keeping ~ backups of files when saving
+set swapfile            "use swp file while a file is open
+set modeline            "scan first/last lines of file for vim commands
+set modelines=5         "number of lines checked for modelines
+set display=lastline    "show beginning of broken line at bottom of window instead of displaying @
+"set clipboard=unnamed   "make all operations such as yy, dd, p work with the clipboard
+set wildmenu            "show matches for command-line completion
+set wildmode=longest:full,full  "define how tab completion proceeds on partial match
+set wildignore+=*.o,*.pdf       "Let tab completion ignore certain file types
+set fillchars=fold:-
+
+" temporary workaround for jessie's old vim version
+if v:version >704 || v:version==704 && has('patch710')
+  set listchars=eol:¬,tab:>-,trail:~,space:·  "define replacement for invisible characters (set invlist)
+endif
+
+" Disable auto-comment after breaking lines with formatoptions
+au FileType * setl fo-=c fo-=r fo-=o
+"}}}
+
+" --- functions ---{{{
+" --- map key to toggle opt ---
+function MapToggle(key, opt)
+  let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>"
+  exec 'nnoremap '.a:key.' '.cmd
+  exec 'inoremap '.a:key." \<C-O>".cmd
+endfunction
+command -nargs=+ MapToggle call MapToggle(<f-args>)
+
+" --- toggle mouse=i on/off ---
+function ToggleMouse()
+  if (&mouse == 'i') || (&mouse == 'a')
+    set mouse=
+  else
+    set mouse=i
+  endif
+endfunc
+
+" --- Clean trailing spaces ---
+function! CleanSpaces()
+    %s/\s\+$//e
+endfunction
+"}}}
+
+" --- keyboard mappings ---{{{
+" --- F key toggles ---
+" toggle paste mode (normal/insert)
+MapToggle <F2> paste
+set pastetoggle=<F2>
+" toggle mouse mode (normal/insert)
+nnoremap <F3> :call ToggleMouse()<CR>
+inoremap <F3> <C-O>:call ToggleMouse()<CR>
+" toggle list mode (normal/insert)
+MapToggle <F4> list
+
+" --- normal mappings ---
+" toggle paste mode
+MapToggle <Leader>p paste
+" set mouse modes
+nnoremap <Leader>m :set mouse=<CR>
+nnoremap <Leader>mi :set mouse=i<CR>
+nnoremap <Leader>ma :set mouse=a<CR>
+" toggle list of invisible characters
+MapToggle <Leader>w list
+" remap space to fold/unfold
+map <space> za
+" remap \s to toggle spellchecking
+map <Leader>s :set invspell<CR>
+" remap \n to toggle display of line numbers
+map <Leader>n :set invnu<CR>
+" remap \h to stop hlsearch until next search
+map <Leader>h :noh<CR>
+"}}}
+
+" --- vim modeline ---{{{
+" vim: set foldmethod=marker:
+"}}}
diff --git a/profile/globi/envrcd.d/00-config b/profile/globi/envrcd.d/00-config
new file mode 100644
index 0000000..c8f5f62
--- /dev/null
+++ b/profile/globi/envrcd.d/00-config
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# load the defaults
+source_profile_if_exists "rda"
+
+# set the path to this profile
+export ENVRCD_PROFILE_PATH="${ENVRCD_PATH}/profile/globi"
diff --git a/profile/globi/envrcd.d/10-envvars b/profile/globi/envrcd.d/10-envvars
new file mode 100644
index 0000000..7ca3ca4
--- /dev/null
+++ b/profile/globi/envrcd.d/10-envvars
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# --- path ---
+export PATH=~/bin:${ENVRCD_PROFILE_PATH}/bin:${PATH}
+
+# --- git ---
+if [ "${ENVRCD_USER}" == "globi" ]; then
+    export GIT_AUTHOR_NAME='Christian Ringger'
+    export GIT_AUTHOR_EMAIL='ringger@phys.ethz.ch'
+    export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}"
+    export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}"
+fi
+
+# --- debian packaging ---
+if [ "${ENVRCD_USER}" == "globi" ]; then
+    export DEBEMAIL="ringger@phys.ethz.ch"
+    export DEBFULLNAME="Christian Ringger"
+fi
+
+
+# --- ansible ---
+#if [ "${ENVRCD_USER}" == "globi" ] && [ "${USER}" == "chringge" ]; then
+#    #export ANSIBLE_CONFIG="~/.ansible.cfg"
+#    export ANSIBLE_STRATEGY_PLUGINS="~/.ansible/mitogen/ansible_mitogen/plugins/strategy"
+#    export ANSIBLE_STRATEGY="mitogen_linear"
+#fi
diff --git a/profile/globi/envrcd.d/20-aliases b/profile/globi/envrcd.d/20-aliases
new file mode 100644
index 0000000..b90b1d4
--- /dev/null
+++ b/profile/globi/envrcd.d/20-aliases
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+
+alias kc='eval $(keychain --nogui --eval --agents ssh,gpg --quick id_rsa 99EEA27988963CFE)'
+alias kcs='eval $(keychain --nogui --eval --agents ssh --quick id_rsa)'
+
+unalias git
+if [ "${ENVRCD_USER}" != "globi" ] || [ "${HOSTNAME}" != "portus" ] || [ "${USER}" != "chringge" ]; then
+    alias git="HOME=${ENVRCD_PROFILE_PATH} git"
+fi
\ No newline at end of file
-- 
GitLab