From 3c043055067fb4f12154076155efbf6cd9926bed Mon Sep 17 00:00:00 2001
From: ddelange <14880945+ddelange@users.noreply.github.com>
Date: Tue, 7 Jul 2020 13:47:27 +0200
Subject: [PATCH] :sparkles: Add mergetool, various fixes
---
.bash_profile | 26 +++++++-------
.secrets.baseline | 4 +--
README.md | 35 +++++++++++++++----
.../Base File.sublime-settings | 2 +-
.../Default (OSX).sublime-keymap | 2 +-
.../Default.sublime-keymap | 2 +-
.../LaTeXTools.sublime-settings | 24 ++++++-------
.../LaTeXing.sublime-settings | 2 +-
.../Package Control.sublime-settings | 2 ++
.../Preferences.sublime-settings | 17 +++++++--
.../SublimeLinter.sublime-settings | 10 +++---
.../SublimeLinter/Monokai (SL).tmTheme | 2 +-
.../SublimeLinter/Zenburnesque (SL).tmTheme | 2 +-
13 files changed, 83 insertions(+), 47 deletions(-)
diff --git a/.bash_profile b/.bash_profile
index 746e2ef..c3740c0 100644
--- a/.bash_profile
+++ b/.bash_profile
@@ -56,15 +56,18 @@ alias sm='smerge'
# bash_history
-shopt -s histverify # https://unix.stackexchange.com/a/4082
# global bash history https://unix.stackexchange.com/a/1292
# Avoid duplicates
-export HISTCONTROL=ignoredups:erasedups
-# When the shell exits, append to the history file instead of overwriting it
-shopt -s histappend
+export HISTCONTROL=ignoredups #:erasedups
# After each command, append to the history file and reread it
# export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
-
+export HISTSIZE=
+export HISTFILESIZE=
+export HISTTIMEFORMAT="[%F %T] "
+export HISTFILE=~/.bash_eternal_history
+# When the shell exits, append to the history file instead of overwriting it
+shopt -s histverify # https://unix.stackexchange.com/a/4082
+shopt -s histappend
# prompt
@@ -79,9 +82,6 @@ PS1="⨊ 𝕯𝓭𝓵:\[\033[36m\]\w\[\033[m\]$ " # ⚛ ⨊ 𝓓𝔇𝒟ℓℒ
# functions
-# https://github.com/ddelange/yt
-source "${HOME}/git/yt/yt.sh"
-
# https://gist.github.com/ddelange/24575a702a10c2cb6348c4c7f342e0eb
kubelogs() {
# View logs as they come in (like in Rancher) using mktemp and less -r +F.
@@ -103,13 +103,13 @@ kubelogs() {
return
fi
local tmpfile=`mktemp`
- local log_tail_lines=${KUBELOGS_MAX:-1000}
- local sleep_amount=$((5 + log_tail_lines / 400))
+ local log_tail_lines=${KUBELOGS_MAX:-10000}
+ local sleep_amount=$((7 + log_tail_lines / 20000))
echo "kubectl logs --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} --since 24h --tail ${log_tail_lines} -f ${podname} > ${tmpfile}"
kubectl logs --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} --since 24h --tail ${log_tail_lines} -f ${podname} > ${tmpfile} &
local k8s_log_pid=$!
echo "Waiting ${sleep_amount}s for logs to download"
- sleep ${sleep_amount} && less -r +F ${tmpfile} && kill ${k8s_log_pid} && echo "kubectl logs pid ${k8s_log_pid} killed"
+ sleep ${sleep_amount} && less -rf +F ${tmpfile} && kill ${k8s_log_pid} && echo "kubectl logs pid ${k8s_log_pid} killed"
}
kubebash() {
@@ -148,9 +148,9 @@ kubebranch() {
echo "Pod \"${pod}\" not found in namespace \"${namespace}\""
return
fi
- kubectl get deployments --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} -o wide | sed -n '1!p' | awk '{print $8}' | uniq | tr "/:" "\t" | column -t | grep ${pod}
+ kubectl get deployments --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} -o wide | sed -n '1!p' | awk '{print $1 "\t" $8}' | uniq | tr ":" "\t" | column -t | grep ${pod}
else
- kubectl get deployments --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} -o wide | sed -n '1!p' | awk '{print $8}' | uniq | tr "/:" "\t" | column -t
+ kubectl get deployments --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} -o wide | sed -n '1!p' | awk '{print $1 "\t" $8}' | uniq | tr ":" "\t" | column -t
fi
}
diff --git a/.secrets.baseline b/.secrets.baseline
index 1408c75..0bf2c58 100644
--- a/.secrets.baseline
+++ b/.secrets.baseline
@@ -3,7 +3,7 @@
"files": null,
"lines": null
},
- "generated_at": "2020-05-10T20:38:58Z",
+ "generated_at": "2020-07-07T11:44:36Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
@@ -62,7 +62,7 @@
{
"hashed_secret": "60b9c35a33c0f5acde612f2984b6917cb35d6d54",
"is_verified": false,
- "line_number": 201,
+ "line_number": 214,
"type": "Secret Keyword"
}
]
diff --git a/README.md b/README.md
index 034cf2e..216860a 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,7 @@ Commandline-tools (including [SDK headers](https://github.com/pyenv/pyenv/wiki#s
```bash
# install homebrew and command-line tools, SDK headers
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
+xcode-select --install
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
# check wether all is good
brew doctor
@@ -78,7 +79,8 @@ brew tap buo/cask-upgrade # `brew cu -a docker` - https://github.com/buo/homebr
brew install \
git git-lfs bash-completion rsync curl openssl readline automake xz zlib \
sshfs htop ncdu direnv pwgen \
- gcc@8 rust ruby node yarn sqlite3
+ gcc@8 rust ruby node@12 sqlite3
+npm install -g yarn
```
@@ -88,7 +90,9 @@ brew install \
brew cask install iterm2
brew tap homebrew/cask-fonts
brew cask install font-inconsolatalgc-nerd-font
-cargo install exa ripgrep # ls, rg
+cargo install ripgrep # rg (search for regex occurrences in directory)
+cargo install zoxide # z (cd with auto-complete)
+cargo install --git https://github.com/ogham/exa.git
# use exa with icons and git status instead of builtin ls
alias ls="exa --all --group-directories-first --icons --level=2" # default level for --tree
alias ll="ls --long --sort=age --git --time=modified --time-style=iso"
@@ -101,6 +105,8 @@ alias ll="ls --long --sort=age --git --time=modified --time-style=iso"
# Docker CE - docker.com/community-edition
brew cask install docker
brew install docker-compose
+# PostgresApp - postgresapp.com
+brew cask install postgres
# Sublime Text - sublimetext.com
brew cask install sublime-text
# Sublime Merge - sublimemerge.com
@@ -172,15 +178,19 @@ mas install 595191960
git clone https://github.com/momo-lab/pyenv-install-latest.git "$(pyenv root)"/plugins/pyenv-install-latest
git clone git://github.com/concordusapps/pyenv-implict.git "$(pyenv root)"/plugins/pyenv-implict
# list all available python versions
- pyenv install -l
+ pyenv install -l | grep '^\s*[0-9]'
pyenv install-latest 2.7
pyenv install-latest 3.7
+ sudo SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/ pyenv install-latest 3.8 # might need to unsource .bash_profile first
pyenv global $(pyenv install-latest --print 3.7) $(pyenv install-latest --print 2.7) # set default versions: prefer py3 over py2
source ~/.bash_profile # global history etc
- pip install --upgrade pip setuptools wheel Cython
+ pip3.7 install --upgrade pip setuptools wheel Cython
+ pip2.7 install --upgrade pip setuptools wheel Cython
+ pip3.8 install --upgrade pip setuptools wheel Cython
# install virtualenv 'vv' based latest pyenv Python version 3.7, inheriting installed packages
pyenv virtualenv $(pyenv install-latest --print 3.7) --system-site-packages vv
pyenv virtualenv $(pyenv install-latest --print 2.7) --system-site-packages vv27
+ pyenv virtualenv $(pyenv install-latest --print 3.8) --system-site-packages vv38
```
- Manage envs
```bash
@@ -220,7 +230,7 @@ Note: first open Chrome for the first time
- iStat Menus preferences: `File/Import Settings...`, select `iStat Menus Settings.ismp`
- Quickly download audio & video with [`yt`](https://github.com/ddelange/yt)
```bash
- git clone https://github.com/ddelange/yt.git ~/git/yt && brew install youtube-dl
+ brew install ddelange/brewformulae/yt
```
@@ -277,6 +287,16 @@ git config --global icdiff.options "--highlight --line-numbers --numlines=3"
git config --global difftool.icdiff.cmd 'icdiff --highlight --line-numbers --numlines=3 $LOCAL $REMOTE'
```
+##### Mergetool
+
+On failed automatic merge, use Sublime Merge GUI for conflict resolution using `git mergetool` or `git mt` (see below).
+```bash
+git config --global mergetool.smerge.cmd 'smerge mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"'
+git config --global mergetool.smerge.trustExitCode true
+git config --global mergetool.keepBackup false
+git config --global merge.tool smerge
+```
+
##### Aliases
@@ -289,13 +309,16 @@ git config --global alias.camend "commit --amend -am"
git config --global alias.amend "commit --amend --no-edit -a"
git config --global alias.br "branch"
git config --global alias.co "checkout"
+git config --global alias.mt "mergetool"
git config --global alias.lg "log --graph --decorate --pretty=oneline --abbrev-commit"
git config --global alias.fp "fetch -p --all" # purge and fetch all remotes
+git config --global alias.defaultbranch '! f() { echo $(git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | xargs); }; f' # https://stackoverflow.com/questions/28666357#comment101797372_50056710
git config --global alias.df '! f() { git icdiff --color=always "$@" | less -eR; }; f' # no FX (keep output in terminal)
git config --global alias.pr '! git push --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)"'
git config --global alias.dm '! git fetch -p && for branch in `git branch -vv | grep '"': gone] ' | awk '"'{print $1}'"'"'`; do git branch -D $branch; done' # 'delete merged' - local branches that have been deleted on remote
-git config --global alias.gg '! f() { git checkout "${1:-master}" && git dm && git pull; }; f'
+git config --global alias.gg '! f() { git checkout "${1:-$(git defaultbranch)}" && git dm && git pull; }; f' # git gg develop -- no arg: defaultbranch. Return to default branch (or specified branch), delete merged, pull branch
git config --global alias.pall '! f() { START=$(git branch | grep "\*" | sed "s/^.//"); for i in $(git branch | sed "s/^.//"); do git checkout $i; git pull || break; done; git checkout $START; }; f' # 'pull all' - pull local branches that have been updated on remote
+git config --global alias.undo '! f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f' # https://megakemp.com/2016/08/25/git-undo/
```
diff --git a/sublime_text_user_settings/Base File.sublime-settings b/sublime_text_user_settings/Base File.sublime-settings
index 4b2afac..fd915d0 100644
--- a/sublime_text_user_settings/Base File.sublime-settings
+++ b/sublime_text_user_settings/Base File.sublime-settings
@@ -1,3 +1,3 @@
[
{ "keys": ["shift+ctrl+a"], "command": "alignment" }
-]
+]
\ No newline at end of file
diff --git a/sublime_text_user_settings/Default (OSX).sublime-keymap b/sublime_text_user_settings/Default (OSX).sublime-keymap
index 0d4f101..32960f8 100644
--- a/sublime_text_user_settings/Default (OSX).sublime-keymap
+++ b/sublime_text_user_settings/Default (OSX).sublime-keymap
@@ -1,2 +1,2 @@
[
-]
+]
\ No newline at end of file
diff --git a/sublime_text_user_settings/Default.sublime-keymap b/sublime_text_user_settings/Default.sublime-keymap
index 0d4f101..32960f8 100644
--- a/sublime_text_user_settings/Default.sublime-keymap
+++ b/sublime_text_user_settings/Default.sublime-keymap
@@ -1,2 +1,2 @@
[
-]
+]
\ No newline at end of file
diff --git a/sublime_text_user_settings/LaTeXTools.sublime-settings b/sublime_text_user_settings/LaTeXTools.sublime-settings
index b1b2357..1b68b2e 100644
--- a/sublime_text_user_settings/LaTeXTools.sublime-settings
+++ b/sublime_text_user_settings/LaTeXTools.sublime-settings
@@ -12,7 +12,7 @@
// Cite/ref autocompletion by default is triggered after e.g. \ref{. If you don't like this,
// set to false. You can also use toggles: C-l,t,a,c and C-l,t,a,r.
"cite_auto_trigger": true,
- "ref_auto_trigger": true,
+ "ref_auto_trigger": true,
// Fill-helper autocompletion triggered for a wide range of references to external
// files. You can also use toggle: C-l,t,a,f
@@ -21,7 +21,7 @@
// Keep focus on Sublime Text after building (true) or switch to PDF viewer (false)
"keep_focus": true,
- // Sync PDF to current editor position after building (true) or not
+ // Sync PDF to current editor position after building (true) or not
"forward_sync": true,
@@ -55,7 +55,7 @@
// and "python" by default is liked to Python 3. If blank, "python" is used
// Note: ST3 uses Python 3 internally, but the evince scripts need Python 2
"python2": "",
- // The name of the ST2 or ST3 executable. On Ubuntu, both subl and sublime-text are
+ // The name of the ST2 or ST3 executable. On Ubuntu, both subl and sublime-text are
// available for ST2; adjust as needed for other platforms, and for ST3
"sublime": "sublime-text",
// How long to wait after evince has launched before sending a sync message
@@ -69,7 +69,7 @@
// ------------------------------------------------------------------
// Build engine settings
// ------------------------------------------------------------------
-
+
// OPTION: "builder"
// Specifies a build engine
// Possible values:
@@ -100,9 +100,9 @@
// If non-empty, specifies a path to a custom builder, relative to the
// Sublime Text Packages directory.
// For instance, "User/builders" (on Windows: "User\builders") is a good
- // choice if you roll your own.
+ // choice if you roll your own.
// (Note: if you choose "User", you may get a Python import error in the
- // console, but things will still work).
+ // console, but things will still work).
// Leave empty ("") for a built-in builder.
"builder_path": "",
@@ -114,12 +114,12 @@
// Builder setting can be general or OS-dependent
"builder_settings" : {
-
+
// General settings:
// See README or third-party documentation
// (built-ins): true shows the log of each command in the output panel
- "display_log" : false,
+ "display_log" : false,
// Platform-specific settings:
"osx" : {
@@ -141,9 +141,9 @@
// ------------------------------------------------------------------
/* This preference sets the format of the quick panel to select citations using wildcards.
- The setting is a list with one or two string using wildcards for author, title, keyword etc.
-
- Default setting: the traditional display, `["{title} ({keyword})","{author}"]`
+ The setting is a list with one or two string using wildcards for author, title, keyword etc.
+
+ Default setting: the traditional display, `["{title} ({keyword})","{author}"]`
Format:
Can quantum-mechanical description of physical reality be considered complete? This is an non-existing subtitle to illustrate (einstein1935quantum)
Albert Einstein and B Podolsky and N Rosen
@@ -173,4 +173,4 @@
// Similarly, the formatting for the autocomplete panel:
"cite_autocomplete_format": "{keyword}: {title}"
-}
+}
\ No newline at end of file
diff --git a/sublime_text_user_settings/LaTeXing.sublime-settings b/sublime_text_user_settings/LaTeXing.sublime-settings
index 3a4ec7f..dac7746 100644
--- a/sublime_text_user_settings/LaTeXing.sublime-settings
+++ b/sublime_text_user_settings/LaTeXing.sublime-settings
@@ -11,4 +11,4 @@
}
],
"output_directory": false
-}
+}
\ No newline at end of file
diff --git a/sublime_text_user_settings/Package Control.sublime-settings b/sublime_text_user_settings/Package Control.sublime-settings
index d6eae02..c3c2f97 100644
--- a/sublime_text_user_settings/Package Control.sublime-settings
+++ b/sublime_text_user_settings/Package Control.sublime-settings
@@ -6,11 +6,13 @@
"installed_packages":
[
"All Autocomplete",
+ "ayu",
"Babel",
"BracketHighlighter",
"Diffy",
"Dockerfile Syntax Highlighting",
"FindKeyConflicts",
+ "Github Color Theme",
"GitLink",
"Jedi - Python autocompletion",
"JsPrettier",
diff --git a/sublime_text_user_settings/Preferences.sublime-settings b/sublime_text_user_settings/Preferences.sublime-settings
index 63981c6..002ff24 100644
--- a/sublime_text_user_settings/Preferences.sublime-settings
+++ b/sublime_text_user_settings/Preferences.sublime-settings
@@ -1,6 +1,4 @@
{
- "index_exclude_patterns": ["*.log", "htmlcov/", "node_modules/", ".mypy_cache/"],
- "folder_exclude_patterns": ["htmlcov", "node_modules", ".mypy_cache"],
"added_words":
[
"accretes",
@@ -52,11 +50,17 @@
],
"auto_indent": true,
"caret_style": "phase",
- "color_scheme": "Packages/Neon Color Scheme/Neon.tmTheme",
+ "color_scheme": "Packages/Github Color Theme/GitHub.tmTheme",
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_indent_guides": true,
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
+ "folder_exclude_patterns":
+ [
+ "htmlcov",
+ "node_modules",
+ ".mypy_cache"
+ ],
"font_options": "subpixel_antialias",
"font_size": 10.0,
"gitlink_revision_type": "commithash",
@@ -72,6 +76,13 @@
],
"indent_to_bracket": false,
"indent_using_spaces": true,
+ "index_exclude_patterns":
+ [
+ "*.log",
+ "htmlcov/",
+ "node_modules/",
+ ".mypy_cache/"
+ ],
"keymaps":
{
"show_pretty_keys": true
diff --git a/sublime_text_user_settings/SublimeLinter.sublime-settings b/sublime_text_user_settings/SublimeLinter.sublime-settings
index 4f31f8f..4755990 100644
--- a/sublime_text_user_settings/SublimeLinter.sublime-settings
+++ b/sublime_text_user_settings/SublimeLinter.sublime-settings
@@ -30,11 +30,11 @@
"disable": false,
"python": "~/.pyenv/versions/vv/bin/python",
"args": [
- "ignore = D10,E203,E501,W503",
- "max-line-length = 88",
- "select = A,B,C4,D,E,F,M,Q,T,W,ABS,BLK",
- // "inline-quotes = \"",
- "docstring-convention = google",
+ "--ignore=D10,E203,E501,W503",
+ "--max-line-length=88",
+ "--select=A,B,C4,D,E,F,M,Q,T,W,ABS,BLK",
+ "--inline-quotes=\"",
+ "--docstring-convention=google",
"--exclude=.git,__pycache__,.direnv,node_modules",
],
"working_dir": "${folder}", // or just put above in a config.cfg with [flake8] in the root level folder in the sidebar
diff --git a/sublime_text_user_settings/SublimeLinter/Monokai (SL).tmTheme b/sublime_text_user_settings/SublimeLinter/Monokai (SL).tmTheme
index d4c2236..90c69b2 100644
--- a/sublime_text_user_settings/SublimeLinter/Monokai (SL).tmTheme
+++ b/sublime_text_user_settings/SublimeLinter/Monokai (SL).tmTheme
@@ -414,4 +414,4 @@
uuid
D8D5E82E-3D5B-46B5-B38E-8C841C21347D
-
+
\ No newline at end of file
diff --git a/sublime_text_user_settings/SublimeLinter/Zenburnesque (SL).tmTheme b/sublime_text_user_settings/SublimeLinter/Zenburnesque (SL).tmTheme
index b78656d..5136213 100644
--- a/sublime_text_user_settings/SublimeLinter/Zenburnesque (SL).tmTheme
+++ b/sublime_text_user_settings/SublimeLinter/Zenburnesque (SL).tmTheme
@@ -370,4 +370,4 @@
uuid
8D4988B9-ADD8-436F-B388-BC1360F8504B
-
+
\ No newline at end of file