Skip to content

Instantly share code, notes, and snippets.

@byBretema
Last active June 20, 2019 16:08
Show Gist options
  • Save byBretema/d58171e38bc4d46e7327dd3b4c912c73 to your computer and use it in GitHub Desktop.
Save byBretema/d58171e38bc4d46e7327dd3b4c912c73 to your computer and use it in GitHub Desktop.
macOS .dotfiles
[user]
name = cambalamas
email = [email protected]
[github]
user = cambalamas
[core]
editor = code
autocrlf = input
[color]
ui = true
[push]
default = simple
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[alias]
st = status -sb
lg = log --graph --oneline --decorate
pup = !git pull && git submodule init && git submodule update && git submodule status
[credential]
helper = manager
# https://github.com/jonas/tig/blob/master/contrib/chocolate.theme.tigrc
color diff-stat 95 default
color date 172 default
color "Merge: " cyan default
color graph-commit red default
color id 167 default
color "author " 95 default
color "Commit: " 90 default
color cursor white 101 bold
color palette-0 93 default
color palette-1 95 default
color palette-2 124 default
color palette-7 90 default bold
color delimiter 90 default
color main-tracked 99 default bold
# Prefix
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Basic
set -g mouse on
set -g set-clipboard on
unbind -n WheelUpPane
unbind -n WheelDownPane
setw -g clock-mode-style 24
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
bind C-r source-file ~/.tmux.conf \; display-message "Config reloaded..."
bind-key -T copy-mode MouseDragEnd1Pane send -X copy-pipe-and-cancel "pbcopy"
# Times.
set -sg escape-time 0
set -g display-time 200
set -g status-interval 30
bind T command-prompt "rename-window '%%'"
# Panes
bind -n C-q kill-pane
bind -n C-Space resize-pane -Z
bind -n C-p select-pane -t :.+
bind -n C-h split-window -v -c "#{pane_current_path}"
bind -n C-v split-window -h -c "#{pane_current_path}"
setw -g pane-base-index 1
# Windows
bind -n C-o next-window
bind -n C-n new-window -c "#{pane_current_path}"
bind -n C-w kill-window
bind -n C-t split-window "exec top"
set -g base-index 1
setw -g automatic-rename on
set -g allow-rename on
set -g window-status-format "#[fg=black,bold,#{?window_zoomed_flag,bg=brightyellow,bg=brightwhite}] #I #{?#{!=:#W,#(basename $SHELL)},#W ,}"
set -g window-status-current-format "#[fg=black,bold,#{?window_zoomed_flag,bg=brightyellow,bg=brightgreen}] #I #{?#{!=:#W,#(basename $SHELL)},#W ,}"
# Status bar
set -g status-position top
set -g status-justify left
# set -g status-left-length 0
set -g status-left " "
set -g status-right-length 550
set -g status-right "#[bold] TMUX 🧐 %H:%M ⏰ #P/#{window_panes} 📍 "
# set -g status-bg black
set -g status-fg brightwhite
set -g status-bg default
# ----------------------------------------------------------#
# @cambalamas zsh's configuration file #
# ----------------------------------------------------------#
# ----------------------------------------------------------#
# History size and place
SAVEHIST=1024 # big history
HISTSIZE=1024 # big history
HISTFILE=~/.zsh_history # where to store zsh history
# Basic cool modules
autoload -U colors && colors # colors
autoload -U zsh-mime-setup && zsh-mime-setup # run all as executable.
autoload -U select-word-style && select-word-style bash # ctrl+w del words.
# ----------------------------------------------------------#
# Disabled
unsetopt hup # no hup signal at shell exit.
unsetopt beep # no bell on error.
unsetopt bg_nice # no lower prio for background jobs.
unsetopt clobber # must use >| to truncate existing files.
unsetopt list_beep # no bell on ambiguous completion.
unsetopt hist_beep # no bell on error in history.
unsetopt ignore_eof # do not exit on end-of-file.
unsetopt rm_star_silent # confirmation for `rm *' or `rm path/*'.
unsetopt hist_ignore_space # ignore space prefixed commands.
# Stuff
setopt auto_cd # if command is a path, cd into it.
setopt correct # try to correct spelling of commands.
setopt glob_dots # include dotfiles in globbing.
setopt cdablevars # if cd a var whose value is a valid directory.
setopt chase_links # resolve symlinks.
setopt extended_glob # activate complex pattern globbing.
setopt auto_name_dirs # use exported name of dirs.
setopt auto_remove_slash # self explicit.
setopt interactive_comments # allow comments please.
# Pushd
setopt auto_pushd # make cd push old dir in dir stack.
setopt pushd_silent # no dir stack after pushd or popd.
setopt pushd_to_home # `pushd` = `pushd $HOME`.
setopt pushd_ignore_dups # no duplicates in dir stack.
# History
setopt bang_hist # !keyword.
setopt hist_verify # show before executing history commands.
setopt share_history # share hist between sessions.
setopt append_history # append.
setopt extended_history # timestamps on history.
setopt hist_reduce_blanks # trim blanks.
setopt inc_append_history # add commands as they are typed.
setopt hist_ignore_all_dups # no duplicate.
# Completion
setopt correct # spelling correction for commands.
setopt hash_list_all # hash everything before completion.
setopt always_to_end # go to word-end if cursor its in the middle.
setopt list_ambiguous # complete until it gets ambiguous.
setopt completealiases # complete alisases.
setopt complete_in_word # allow completion from within a word/phrase.
# More completion
autoload -U compinit -d && compinit
zstyle ':completion:*' menu select=2 # menu if items > 2
zstyle ':completion::complete:*' use-cache on # use cache
zstyle ':completion:*' cache-path ~/.zsh/cache # cache path
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # colorz !
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # ignore case
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
# ----------------------------------------------------------#
# Uses the zsh precmd function hook to
# set the tab title to the current working
# directory before each prompt
function precmd () {
window_title="\\033]0;${PWD##*/}\\007"
echo -ne "$window_title"
}
# A safe 'rm' alternative
function rr { mv $* ~/.Trash/ }
# Create a folder and enter
function md { mkdir -p $1 && cd $1 }
# Copy a file to dropbox folder
function db { cp -vi $* ~/Dropbox/temp }
# Quick push
function qgp { git add -A; git commit -m "$*"; git push }
# Quick info and check of your net status
function net {
public=$(curl -s icanhazip.com)
echo "$fg[blue]Public$fg[white]: $fg[yellow]$public"
private=$(ifconfig en0 | grep 'inet ' | awk '{print $2}')
echo "$fg[blue]Private$fg[white]: $fg[yellow]$private"
avg8888=$(ping -qc 5 8.8.8.8 | sed -n 5p | awk -F"/" '{print $5" ms"}')
echo "$fg[blue]8.8.8.8 $fg[white]=> $fg[yellow]$avg8888"
avgDotES=$(ping -qc 5 google.es | sed -n 5p | awk -F"/" '{print $5" ms"}')
echo "$fg[blue]Google.es $fg[white]=> $fg[yellow]$avgDotES"
}
# Restart touchbar mbpro2019
function restartTouchbar {
pkill "Touch Bar agent"
killall "ControlStrip"
}
# ----------------------------------------------------------#
alias d='docker'
alias h='history'
alias bk='cd $OLDPWD'
alias l='colorls --group-directories-first --almost-all'
alias ll='colorls --group-directories-first --almost-all --long'
alias lll='tree -LC 2'
alias e='$EDITOR'
alias py='python'
alias py3='python3'
alias tks='tmux kill-server'
alias getweb='wget -m -k -K -E -e robots=off'
alias ez='$EDITOR ~/.zshrc'
alias uz='source ~/.zshrc'
alias tn='tmux new -s $(date +"%d%m%y_%H%M%S")'
alias t='tmux attach -t default || tmux new -s default'
alias tks='tmux kill-server'
alias et='$EDITOR ~/.tmux.conf'
# ----------------------------------------------------------#
PATH="$PATH:\
/usr/local/opt/[email protected]/bin:\
"
export EDITOR="code"
export DevPath=~/Dev
export TERM=xterm-256color
# Less colors, for colorized man pages :)
export LESS_TERMCAP_mb=$(printf '\e[01;36m') # blink = cyan.
export LESS_TERMCAP_so=$(printf '\e[01;31m') # standout = green.
export LESS_TERMCAP_us=$(printf '\e[04;33m') # underline = yellow.
export LESS_TERMCAP_md=$(printf '\e[01;35m') # double-bright = bold+magenta.
export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode.
export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline mode.
export LESS_TERMCAP_me=$(printf '\e[0m') # turn off all appearances.
# ----------------------------------------------------------#
# 3rd party tools
export ZSHPATH="/usr/local/share/zsh/"
source $ZSHPATH"z.sh"
source $(dirname $(gem which colorls))/tab_complete.sh
source $ZSHPATH"zsh-autosuggestions/zsh-autosuggestions.zsh"
source $ZSHPATH"zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
SPACESHIP_CHAR_SUFFIX=" "
autoload -U promptinit; promptinit
prompt spaceship
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "cmd+g",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "cmd+d",
"command": "-editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "cmd+d",
"command": "editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "shift+cmd+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "cmd+e",
"command": "workbench.action.gotoSymbol"
},
{
"key": "shift+cmd+o",
"command": "-workbench.action.gotoSymbol"
},
{
"key": "shift+cmd+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "cmd+[Semicolon]",
"command": "workbench.action.terminal.toggleTerminal"
},
{
"key": "ctrl+`",
"command": "-workbench.action.terminal.toggleTerminal"
},
{
"key": "cmd+r",
"command": "workbench.action.openRecent"
},
{
"key": "ctrl+r",
"command": "-workbench.action.openRecent"
}
]
{
//----------------------------------------------//
// //
// VS-CODE SETTINGS //
// ~ BY <[email protected]> //
// //
//----------------------------------------------//
//
// ............................................ //
"files.trimFinalNewlines": false,
"files.insertFinalNewline": true,
"files.autoSave": "onFocusChange",
"files.trimTrailingWhitespace": true,
"files.hotExit": "onExitAndWindowClose",
// ............................................ //
"editor.fontSize": 14,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.fontLigatures": true,
"editor.cursorBlinking": "phase",
"editor.renderFinalNewline": true,
"editor.renderLineHighlight": "all",
"editor.renderWhitespace": "boundary",
"editor.acceptSuggestionOnEnter": "smart",
"editor.fontFamily": "'iA Writer Mono V', Menlo, Monaco, 'Courier New', monospace",
// "editor.fontFamily": "'Fira Code', Menlo, Monaco, 'Courier New', monospace",
// ............................................ //
"window.restoreFullscreen": true,
"window.restoreWindows": "all",
"window.openFoldersInNewWindow": "on",
"window.newWindowDimensions": "fullscreen",
// ............................................ //
"workbench.colorCustomizations": {
"[Default Dark+]": {
"panel.border": "#D76",
"panel.background": "#333",
"statusBar.background": "#555"
},
"[Shades Of Blue]": {
"panel.border": "#D76",
"panel.background": "#1A1A33",
// "editor.background": "#121225"
},
"[Slack Theme Aubergine Dark]": {
"panel.border": "#569489",
"panel.background": "#382838",
"editor.background": "#323",
"tab.activeBackground": "#323"
}
},
"workbench.settings.editor": "json",
"workbench.quickOpen.closeOnFocusLost": true,
"workbench.statusBar.feedback.visible": false,
"workbench.list.keyboardNavigation": "filter",
"workbench.editor.highlightModifiedTabs": true,
"workbench.commandPalette.preserveInput": true,
"workbench.editor.enablePreviewFromQuickOpen": false,
// ............................................ //
"terminal.integrated.shell.osx": "/usr/local/bin/zsh",
"terminal.integrated.fontSize": 14,
"terminal.integrated.cursorBlinking": true,
"terminal.integrated.fontFamily": "FuraCode Nerd Font Mono",
// ............................................ //
"C_Cpp.updateChannel": "Insiders",
"C_Cpp.clang_format_style": "file",
"go.useLanguageServer": true,
"workbench.colorTheme": "Andromeda Italic Bordered",
"workbench.iconTheme": "vscode-icons",
"liveServer.settings.donotShowInfoMsg": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment