Skip to content

Instantly share code, notes, and snippets.

@oglops
Last active March 27, 2024 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oglops/6baba1a3d577c71e5388bc371c2785c5 to your computer and use it in GitHub Desktop.
Save oglops/6baba1a3d577c71e5388bc371c2785c5 to your computer and use it in GitHub Desktop.
dot files
[user]
name = x
email = x
[push]
default = simple
followTags = true
[diff]
tool = vscode
[merge]
tool = vscode
[mergetool "kdiff3"]
path = /bin/kdiff3
trustExitCode = false
[mergetool]
prompt = false
[difftool "kdiff3"]
path = /bin/kdiff3
trustExitCode = false
[difftool]
prompt = false
[mergetool "vscode"]
cmd = code -n --wait $MERGED
[difftool "vscode"]
cmd = code -n --wait --diff $LOCAL $REMOTE
[core]
excludesfile = /path/to/.gitignore
[core]
excludesfile = ~/.gitignore
editor = vim
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # use n and N to move between diff sections
light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal)
# side-by-side = true
line-numbers = true
[alias]
co = checkout
br = branch
ci = commit
st = status
graph = log --graph --decorate --pretty=oneline --abbrev-commit
pushup = !git push -u origin $(git symbolic-ref --short HEAD)
pushup-mr = pushup -o merge_request.create
fixup = !GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash
release = !svn-deploy deploy -sm '`git show -s --format=%B HEAD`'
meld = !git difftool -t meld --dir-diff &
fixup-head = !git ci -a --fixup HEAD && GIT_SEQUENCE_EDITOR=true git fixup HEAD~2
refetch = "!git fetch origin && git reset --hard $(git merge-base ${1:-main} $(git rev-parse --abbrev-ref HEAD)) && git pull origin $(git rev-parse --abbrev-ref HEAD) #"
# could pass main -X theirs
rebaseit = "!current=$(git rev-parse --abbrev-ref HEAD) && git switch ${1:-main} && git pull && git switch $current && git rebase ${1:-main} ${@:2} #"
insert-empty-commit = "!git_empty_commit(){ randstr=$(openssl rand -hex 6) ; \
tmp_branch=\"tmp_$randstr\" ; \
current_branch=$(git rev-parse --abbrev-ref HEAD) ; \
first_commit=$(git rev-list --topo-order ${1:-main}..$current_branch | tail -n 1) ; \
merge_base=$(git merge-base ${1:-main} $current_branch); \
git co -b $tmp_branch $merge_base; \
git ci --allow-empty -m \"empty commit\" ; \
git cherry-pick $merge_base..$current_branch; \
git co $current_branch; \
git rebase --keep-empty $tmp_branch; \
git br -D $tmp_branch; \
}; git_empty_commit"
delete-all = "!git rebase -X theirs --onto $(git merge-base $(git rev-parse --abbrev-ref HEAD) ${1:-main}) HEAD~ #"
squash-all = "!GIT_SEQUENCE_EDITOR='sed -i \"2,\\$s/^pick/squash/\"' git rebase -i $(git merge-base $(git rev-parse --abbrev-ref HEAD) ${1:-main}) #"
reorder = "!git rebase -i $(git merge-base $(git rev-parse --abbrev-ref HEAD) ${1:-main}) ${@:2} #"
reorder2 = "!f(){ git rebase -i $(git merge-base $(git rev-parse --abbrev-ref HEAD) ${1:-main}) ${@:2}; };f"
diff-mr = "!current=$(git rev-parse --abbrev-ref HEAD) && git diff $(git merge-base ${1:-main} $current)..$current ${@:2} #"
drop = "!git rebase -r --onto "$1"^ "$1" ${@:2} #"
diff-name = "!git diff --name-status ${1-main} ${@:2} #"
diff-dir = "!git difftool --dir-diff --no-symlinks ${1-main} ${@:2} #"
[pager]
branch = false
# diff = false
stash = false
[pull]
rebase = true
[init]
defaultBranch = main
.svn
.directory
tmp
*.pre.py
*.py.orig
*.py.rej
*.pyc
.vscode
.pytest_cache
.gitignore
.vscode
.pytest_cache
*.pyc
tmp
# some of these settings are set by sensible plugin too
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set-option -g default-terminal "screen-256color"
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
# ctrl+shift+k to clear buffer
bind -n C-k clear-history
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# https://github.com/josean-dev/dev-environment-files
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
bind -r h resize-pane -L 5
bind -r m resize-pane -Z
# set -g mouse on
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v"
bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y"
unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode when dragging with mouse
# remove delay for exiting insert mode with ESC in Neovim
set -sg escape-time 10
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind-key w choose-window -F "#{window_name}#{window_flags}"
# https://waylonwalker.com/tmux-choose-tree/
# bind-key j choose-tree -swZ
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'christoomey/vim-tmux-navigator'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
source "$HOME/env/tmux/lib/python3.11/site-packages/powerline/bindings/tmux/powerline.conf"
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
run-shell ~/.tmux/plugins/tmux-sensible/sensible.tmux
# for vim
set -g @resurrect-strategy-vim 'session'
# for neovim
set -g @resurrect-strategy-nvim 'session'
# set -g @resurrect-capture-pane-contents 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# don't rename windows automatically
# set-option -g allow-rename off
alias rsync 'rsync -rlDCv --exclude-from ~/.rsync.exlcudes \!:*'
alias srctmux 'tmux source-file ~/.tmux.conf'
alias killtmux 'tmux kill-session -t 0'
alias cmakegen 'cmake -H. -Bbuild -G "Unix Makefiles" \!*'
alias cmakebuild 'cmake --build build \!*'
alias mmake '(setenv MAYA_LOCATION /path/to/maya2019; make \!*)'
# enable bash equivalent reverse incremental search
bindkey "^R" i-search-back
if ($?tcsh && $?prompt) then
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[2~" overwrite-mode # Ins
bindkey "\e[3~" delete-char # Delete
bindkey "\e[4~" end-of-line # End
bindkey "\e[8~" end-of-line # End rxvt
endif
alias uncheckout 'svn up --set-depth exclude \!*'
alias webserver 'cd ~/screenshots; python -m SimpleHTTPServer &'
setenv PYTHONSTARTUP $HOME/.pythonstartup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment