Last active
May 3, 2022 15:17
-
-
Save JoeKarlsson/c6bfce645c33bd51333ab1de68f01e06 to your computer and use it in GitHub Desktop.
Joe's Dot Files - https://dotfiles.github.io/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Joe Karlsson | |
email = [email protected] | |
github = joekarlsson1 | |
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
ui = auto | |
[color "branch"] | |
current = red reverse | |
local = blue | |
remote = green | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold | |
new = green bold | |
[color "status"] | |
added = yellow | |
changed = green | |
untracked = cyan | |
[help] | |
autocorrect = 1 | |
[push] | |
default = matching | |
[branch] | |
autosetupmerge = true | |
[advice] | |
statusHints = false | |
[core] | |
autocrlf = false | |
safecrlf = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # | |
############ | |
# it's better to unpack these files and commit the raw source | |
# git has its own built in compression methods | |
*.7z | |
*.dmg | |
*.gz | |
*.iso | |
*.jar | |
*.rar | |
*.tar | |
*.zip | |
# Logs and databases # | |
###################### | |
*.log | |
*.sql | |
*.sqlite | |
# OS generated files # | |
###################### | |
.DS_Store | |
.DS_Store? | |
._* | |
.Spotlight-V100 | |
.Trashes | |
ehthumbs.db | |
Thumbs.db | |
# Sass Cache # | |
############## | |
*.sassc | |
.sass-cache | |
# WebStorm # | |
############ | |
.idea | |
# VIM # | |
####### | |
tags |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var extend = function () { | |
load('/Users/jtlabreck/.mongorc.mongohacker.js'); | |
} | |
| |
var mkrand = function(min, max) { | |
if(!max || max < min) { | |
max = min; | |
min = 0; | |
} | |
| |
return Math.floor((Math.random() * (max - min + 1)) + min); | |
}; | |
| |
var mkstring = function(len, seed) { | |
if(!seed || seed === '') { | |
seed = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | |
} | |
| |
var mkstrlen = 0, mkstrs = '', mkstrseedlen = seed.length; | |
for(mkstrlen = 0; mkstrlen < len; mkstrlen++) { | |
mkstrs += seed[mkrand(0, mkstrseedlen - 1)]; | |
} | |
| |
return mkstrs; | |
}; | |
| |
var getKeys = function(collName) { | |
var keys = {}; | |
db.getCollection(collName).find().forEach(function(value) { | |
Object.keys(value).forEach(function (keyName) { | |
if(keys[keyName]) { | |
keys[keyName] += 1; | |
return; | |
} | |
keys[keyName] = 1; | |
}); | |
}); | |
| |
return keys; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//registry.npmjs.org/:_authToken=de6d07f5-37ee-478a-9d42-5c4532a2475d | |
progress=false | |
init.author.name=Joe | |
[email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################## | |
# => BASIC SETTINGS | |
############################## | |
# Fix pbpaste in tmux sessions | |
# set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# Unbind default prefix and set it to Ctrl+a cause easier | |
unbind C-b | |
set -g prefix C-a | |
bind C-a send-prefix | |
# tmux display things in 256 colors | |
set -g default-terminal "xterm-256color" | |
set -ga terminal-overrides ",xterm-256color:Tc" | |
# set -g status-utf8 on | |
set -g history-limit 20000 | |
# Automatically renumber tmux windows | |
set -g renumber-windows on | |
# For nested tmux sessions | |
bind-key a send-prefix | |
# Activity Monitoring | |
setw -g monitor-activity off | |
set -g visual-activity off | |
# Rather than constraining window size to the maximum size of any client | |
# connected to the *session*, constrain window size to the maximum size of any | |
# client connected to *that window*. Much more reasonable. | |
setw -g aggressive-resize on | |
# make delay shorter | |
set -sg escape-time 0 | |
# tile all windows | |
unbind = | |
bind = select-layout tiled | |
# make window/pane index start with 1 | |
set -g base-index 1 | |
setw -g pane-base-index 1 | |
# Don't rename my windows | |
set-option -g allow-rename off | |
############################## | |
# => KEY BINDINGS | |
############################## | |
# reload config file | |
bind r source-file ~/.tmux.conf \; display "Config Reloaded!" | |
# load dev config | |
bind C-d source-file ~/.tmux/dev.conf \; display "Dev config loaded!" | |
# quickly open a new window | |
bind N new-window | |
# split window and fix path for tmux 1.9 | |
bind | split-window -h -c "#{pane_current_path}" | |
bind - split-window -v -c "#{pane_current_path}" | |
# synchronize all panes in a window | |
bind y setw synchronize-panes | |
# pane movement shortcuts | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
bind -r C-h select-window -t :- | |
bind -r C-l select-window -t :+ | |
# Resize pane shortcuts | |
bind -r H resize-pane -L 2 | |
bind -r J resize-pane -D 2 | |
bind -r K resize-pane -U 2 | |
bind -r L resize-pane -R 2 | |
# enable mouse support for switching panes/windows | |
# NOTE: This breaks selecting/copying text on OSX | |
# To select text as expected, hold Option to disable it (iTerm2) | |
set -g mouse on | |
# setw -g mode-mouse on | |
# set -g mouse-select-pane on | |
# set -g mouse-resize-pane on | |
# set -g mouse-select-window on | |
# maximizing and restoring windows | |
unbind Up | |
bind Up new-window -d -n fullscreen \; swap-pane -s fullscreen.1 \; select-window -t fullscreen | |
unbind Down | |
bind Down last-window \; swap-pane -s fullscreen.1 \; kill-window -t fullscreen | |
# set vi mode for copy mode | |
setw -g mode-keys vi | |
# more settings to make copy-mode more vim-like | |
unbind [ | |
bind Escape copy-mode | |
unbind p | |
bind p paste-buffer | |
# Setup 'v' to begin selection as in Vim | |
bind-key -t vi-copy v begin-selection | |
bind-key -t vi-copy y copy-pipe "pbcopy" | |
# Smart pane switching with awareness of vim splits | |
# vim-tmux-navigator | |
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"' | |
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" | |
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" | |
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" | |
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" | |
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Allow vim to break compatibility with vi | |
set nocompatible | |
" Map Leader to space | |
let mapleader = "\<Space>" | |
let g:mapleader = "\<Space>" | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => LOAD PLUGINS | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
source ~/.vim/plugins.vim | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => BASIC SETTINGS | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Show current line number | |
set number | |
" Show relative line numbers | |
set relativenumber | |
" Highlight cursor current line | |
set cursorline | |
" Set how many lines of history VIM has to remember | |
set history=700 | |
" Enable filetype plugins | |
filetype plugin on | |
filetype indent on | |
" Set to auto read when a file is changed from the outside | |
set autoread | |
" Fast editing of vimrc | |
map <leader>e :e! ~/.vimrc<cr> | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => COLORS AND FONTS | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Enable syntax highlighting | |
syntax enable | |
set background=dark | |
" Theme, Colorscheme, & Font | |
if has("gui_running") | |
colorscheme Tomorrow-Night | |
set guifont=Monaco:h14 | |
set linespace=2 | |
set noantialias | |
else | |
try | |
colorscheme OceanicNext | |
catch | |
endtry | |
endif | |
function! ReverseBackground() | |
if &background=="light" | |
set background=dark | |
colorscheme OceanicNext | |
else | |
set background=light | |
colorscheme solarized | |
execute 'AirlineTheme solarized' | |
endif | |
endfunction | |
command! Invbg call ReverseBackground() | |
" Set extra options when running in GUI mode | |
if has("gui_running") | |
set guioptions-=T | |
set guioptions-=e | |
set t_Co=256 | |
set guitablabel=%M\ %t | |
endif | |
" Set utf8 as standard encoding and en_US as the standard language | |
set encoding=utf8 | |
" Use Unix as the standard file type | |
set ffs=unix,dos,mac | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => USER INTERFACE | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Set 7 lines to the cursor - when moving vertically using j/k | |
set so=7 | |
" Turn on the WiLd menu | |
set wildmenu | |
set wildmode=full | |
" Ignore compiled files | |
set wildignore=*.o,*~,*.pyc | |
if has("win16") || has("win32") | |
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store | |
else | |
set wildignore+=.git\*,.hg\*,.svn\* | |
endif | |
"Always show current position | |
set ruler | |
" Height of the command bar | |
set cmdheight=2 | |
" A buffer becomes hidden when it is abandoned | |
set hid | |
" Configure backspace so it acts as it should act | |
set backspace=eol,start,indent | |
set whichwrap+=<,>,h,l | |
" In many terminal emulators the mouse works just fine, thus enable it. | |
if has('mouse') | |
set mouse=a | |
endif | |
" Ignore case when searching | |
set ignorecase | |
" When searching try to be smart about cases | |
set smartcase | |
" Highlight search results | |
set hlsearch | |
" Makes search act like search in modern browsers | |
set incsearch | |
" Don't redraw while executing macros (good performance config) | |
set lazyredraw | |
" For regular expressions turn magic on | |
set magic | |
" Show matching brackets when text indicator is over them | |
set showmatch | |
" How many tenths of a second to blink when matching brackets | |
set mat=2 | |
" No annoying sound on errors | |
set noerrorbells | |
set novisualbell | |
set t_vb= | |
set tm=500 | |
" Set up code folding | |
set foldmethod=indent | |
set foldnestmax=20 | |
" set foldlevelstart=20 | |
set nofoldenable | |
" Disable scrollbars (real hackers don't use scrollbars for navigation!) | |
set guioptions-=r | |
set guioptions-=R | |
set guioptions-=l | |
set guioptions-=L | |
" Set highlight cursor line | |
hi CursorLine cterm=none ctermbg=8 ctermfg=none | |
" Style verticle split seporator | |
hi VertSplit cterm=none ctermbg=none ctermfg=23 | |
" Change selected text bg color | |
hi Visual cterm=none ctermbg=11 ctermfg=none | |
" Set folded highlight color | |
hi Folded ctermbg=10 ctermfg=10 | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => FILES, BACKUPS, AND UNDO | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Turn backup off | |
set nobackup | |
set nowb | |
set noswapfile | |
" Turn on presistent undo | |
" means that you can undo even when you close a buffer/Vim | |
try | |
set undodir=~/.vim/temp_dirs/undodir | |
set undofile | |
catch | |
endtry | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => TEXT, TAB, AND INDENT RELATED | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Use spaces instead of tabs | |
set expandtab | |
" Be smart when using tabs | |
set smarttab | |
" Number of spaces to use for indent and unindent | |
set shiftwidth=2 | |
" Visible width of tabs | |
set tabstop=2 | |
" Linebreak on 500 characters | |
set lbr | |
set tw=500 | |
autocmd BufRead,BufNewFile *.md setlocal textwidth=80 | |
set ai "Auto indent | |
set si "Smart indent | |
set wrap "Wrap lines | |
" Strip trailing spaces on save | |
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() | |
" Automatically recognize filetypes by extension | |
autocmd BufRead,BufNewFile .{babel,eslint,stylelint}rc set filetype=json | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => VISUAL MODE RELATED | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Visual mode pressing * or # searches for the current selection | |
" Super useful! From an idea by Michael Naumann | |
vnoremap <silent> * :call VisualSelection('f', '')<CR> | |
vnoremap <silent> # :call VisualSelection('b', '')<CR> | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => MOVING AROUND | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Treat long lines as break lines (useful when moving around in them). | |
" Store relative line number jumps in the jumplist. | |
noremap <expr> j v:count > 1 ? 'm`' . v:count . 'j' : 'gj' | |
noremap <expr> k v:count > 1 ? 'm`' . v:count . 'k' : 'gk' | |
" Use gj gk to go quicker | |
noremap gj 5gj | |
noremap gk 5gk | |
" Disable highlight when <leader><cr> is pressed | |
map <silent> <leader><cr> :noh<cr> | |
" Smart way to move between windows | |
nnoremap <C-j> <C-W>j | |
nnoremap <C-k> <C-W>k | |
nnoremap <C-h> <C-W>h | |
nnoremap <C-l> <C-W>l | |
if has('nvim') | |
" Hack to get <C-h> working in neovim | |
nnoremap <BS> <C-W>h | |
" Exit terminal input mode | |
" tnoremap <Esc> <C-\><C-n> | |
" Easy navigation from terminal | |
tnoremap <C-h> <C-\><C-n><C-w>h | |
tnoremap <C-j> <C-\><C-n><C-w>j | |
tnoremap <C-k> <C-\><C-n><C-w>k | |
tnoremap <C-l> <C-\><C-n><C-w>l | |
endif | |
" Map Alt-[h,j,k,l] for resizing a window split | |
nnoremap <silent> <M-h> :vertical resize -2<CR> | |
nnoremap <silent> <M-j> :resize -2<CR> | |
nnoremap <silent> <M-k> :resize +2<CR> | |
nnoremap <silent> <M-l> :vertical resize +2<CR> | |
" Close the current buffer | |
" map <leader>bd :Bclose<cr> | |
" Close all the buffers | |
" map <leader>ba :1,1000 bd!<cr> | |
" Specify the behavior when switching between buffers | |
try | |
set switchbuf=useopen,usetab,newtab | |
set stal=2 | |
catch | |
endtry | |
" Return to last edit position when opening files (You want this!) | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
" Remember info about open buffers on close | |
set viminfo^=% | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => STATUS LINE | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Always show the status line | |
set laststatus=2 | |
" Format the status line | |
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l | |
" Hide tabline | |
set showtabline=1 | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => SPELLING CHECK | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
hi SpellBad cterm=underline,bold ctermfg=red gui=underline,bold guifg=red | |
" Toggle and untoggle spell checking | |
map <leader>sc :setlocal spell!<cr> | |
" Shortcuts using <leader> | |
map <leader>sn ]s | |
map <leader>sp [s | |
map <leader>sa zg | |
map <leader>s? z= | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => MAPPINGS | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Exit insert mode with `jk` | |
inoremap jk <ESC> | |
" Fast saving | |
nmap <leader>w :w!<cr> | |
" Copy/Paste to clipboard | |
vmap <leader>y "+y | |
vmap <leader>d "+d | |
map <leader>p "+p | |
map <leader>P "+P | |
" Indent/Unindent | |
noremap > >> | |
noremap < << | |
vnoremap > >gv | |
vnoremap < <gv | |
" To the leftmost non-blank character of the current line | |
map 0 g^ | |
" To the rightmost character of the current line | |
map $ g$ | |
" Trim WhiteSpace | |
nnoremap <Leader>tws :%s/\s\+$//e<CR> | |
if has("mac") || has("macunix") | |
nmap <D-j> <M-j> | |
nmap <D-k> <M-k> | |
vmap <D-j> <M-j> | |
vmap <D-k> <M-k> | |
endif | |
" Toggle paste mode on and off | |
map <leader>pp :setlocal paste!<cr> | |
" Set Syntax | |
map <leader>sy :set syntax= | |
" Quick quit | |
map <leader>qq :q<cr> | |
" Quick file reload | |
map <leader>r :e<cr> | |
" Quick Open Notes | |
" Directory to notes folder | |
let g:notes_folder = '~/Desktop/Notes/' | |
" Project specific notes | |
let g:notes = g:notes_folder . 'Projects/' . fnamemodify(getcwd(), ':t') . '.md' | |
let g:note_size = 15 | |
" Open current project notes | |
map <silent> <leader>n :execute ':topleft split ' . g:notes<cr>:execute ':resize' . g:note_size<cr> | |
" Open daily notes | |
let g:daily_notes = g:notes_folder . 'Daily/daily-notes.org' | |
map <silent> <leader>nn :execute ':topleft split ' . g:daily_notes<cr>:execute ':resize' . g:note_size<cr> | |
" Toggle quotes for json file | |
map <leader>" :call ConcealJsonToggle()<cr> | |
let g:toggle_json_conceal=0 | |
" List contents of most used registers | |
nnoremap <silent> "" :registers "0123456789abcdefghijklmnopqrstuvwxyz*+.<CR> | |
" Paste in visual mode without updating default register | |
vnoremap p "_c<Esc>p | |
" Quick macro invocation with q register | |
nnoremap Q @q | |
" Switch between the last two files | |
nnoremap <leader><leader> <C-^> | |
" Math macro, do math on current line | |
nnoremap <leader>= 0v$hyA = <C-r>=<C-r>"<CR><Esc> | |
" Quickly select text you just pasted | |
nnoremap gV `[v`] | |
" Quickly edit your macros | |
" Usage <leader>m or "q<leader>m | |
nnoremap <leader>m :<c-u><c-r>='let @'. v:register .' = '. string(getreg(v:register))<cr><c-f><left> | |
" Use very magic | |
" Everything is special unless escaped | |
" nnoremap / /\v | |
" vnoremap / /\v | |
" Saner behavior of n and N | |
nnoremap <expr> n 'Nn'[v:searchforward] | |
nnoremap <expr> N 'nN'[v:searchforward] | |
" Search current word without moving cursor | |
nnoremap <silent> K :let stay_star_view = winsaveview()<cr>*:call winrestview(stay_star_view)<cr> | |
" Easily jump between brackets | |
map <S-Tab> % | |
nnoremap <expr> <UP> len(getline(line('.')-1)) > 0 ? '{+' : '{-' | |
nnoremap <expr> <DOWN> len(getline(line('.')+1)) > 0 ? '}-' : '}+' | |
" Read selected text | |
" TODO: escape single quote (') characters | |
xnoremap <silent> <leader>s y:call jobstart('say -v Samantha -r 300 <C-r>"')<CR> | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => HELPER FUNCTIONS | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
function! VisualSelection(direction, extra_filter) range | |
let l:saved_reg = @" | |
execute "normal! vgvy" | |
let l:pattern = escape(@", '\\/.*$^~[]') | |
let l:pattern = substitute(l:pattern, "\n$", "", "") | |
if a:direction == 'b' | |
execute "normal ?" . l:pattern . "^M" | |
elseif a:direction == 'f' | |
execute "normal /" . l:pattern . "^M" | |
endif | |
let @/ = l:pattern | |
let @" = l:saved_reg | |
endfunction | |
" Returns true if paste mode is enabled | |
function! HasPaste() | |
if &paste | |
return 'PASTE MODE ' | |
endif | |
return '' | |
endfunction | |
" Don't close window, when deleting a buffer | |
command! Bclose call <SID>BufcloseCloseIt() | |
function! <SID>BufcloseCloseIt() | |
let l:currentBufNum = bufnr("%") | |
let l:alternateBufNum = bufnr("#") | |
if buflisted(l:alternateBufNum) | |
buffer # | |
else | |
bnext | |
endif | |
if bufnr("%") == l:currentBufNum | |
new | |
endif | |
if buflisted(l:currentBufNum) | |
execute("bdelete! ".l:currentBufNum) | |
endif | |
endfunction | |
" Toggle quotes for json file | |
function! ConcealJsonToggle() | |
if g:toggle_json_conceal | |
set conceallevel=2 | |
let g:toggle_json_conceal=0 | |
else | |
set conceallevel=0 | |
let g:toggle_json_conceal=1 | |
endif | |
endfunction | |
" Strip trailing spaces | |
function! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
" NERDTrees File highlighting | |
function! NERDTreeHighlightFile(extension, fg, bg, guifg) | |
exec 'autocmd FileType nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guifg='. a:guifg | |
exec 'autocmd FileType nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' | |
endfunction | |
call NERDTreeHighlightFile('html', 202, 'none', '#FC4709') | |
call NERDTreeHighlightFile('hbs', 202, 'none', '#FC4709') | |
call NERDTreeHighlightFile('jade', 149, 'none', '#A0D24D') | |
call NERDTreeHighlightFile('json', 223, 'none', '#FECEA0') | |
call NERDTreeHighlightFile('scss', 44, 'none', '#1AD0CE') | |
call NERDTreeHighlightFile('css', 44, 'none', '#1AD0CE') | |
call NERDTreeHighlightFile('js', 226, 'none', '#FFFF0D') | |
call NERDTreeHighlightFile('rb', 197, 'none', '#E53378') | |
call NERDTreeHighlightFile('md', 208, 'none', '#FD720A') | |
call NERDTreeHighlightFile('php', 140, 'none', '#9E6FCD') | |
call NERDTreeHighlightFile('svg', 178, 'none', '#CDA109') | |
call NERDTreeHighlightFile('gif', 36, 'none', '#15A274') | |
call NERDTreeHighlightFile('jpg', 36, 'none', '#15A274') | |
call NERDTreeHighlightFile('png', 36, 'none', '#15A274') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. | |
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
fi | |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH=~/.oh-my-zsh | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
# ZSH_THEME="agnoster" | |
ZSH_THEME="powerlevel10k/powerlevel10k" | |
# DEFAULT_USER="[email protected]" | |
DEFAULT_USER=whoami | |
COMPLETION_WAITING_DOTS="true" | |
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor) | |
ZSH_HIGHLIGHT_PATTERNS=('rm -rf *' 'fg=white,bold,bg=red') | |
unsetopt nomatch | |
setopt APPEND_HISTORY | |
setopt INTERACTIVE_COMMENTS | |
plugins=( | |
git | |
git-extras | |
git-flow | |
github | |
heroku | |
iterm2 | |
lol | |
macos | |
sublime | |
vagrant | |
z | |
web-search | |
) | |
source $ZSH/oh-my-zsh.sh | |
export EDITOR="vim"; | |
export GREP_OPTIONS="--color=auto"; | |
# ██ ██ | |
# ░██░░ | |
# ██████ ░██ ██ ██████ ██████ █████ ██████ | |
# ░░░░░░██ ░██░██ ░░░░░░██ ██░░░░ ██░░░██ ██░░░░ | |
# ███████ ░██░██ ███████ ░░█████ ░███████░░█████ | |
# ██░░░░██ ░██░██ ██░░░░██ ░░░░░██░██░░░░ ░░░░░██ | |
# ░░████████ ███░██░░████████ ██████ ░░██████ ██████ | |
# ░░░░░░░░ ░░░ ░░ ░░░░░░░░ ░░░░░░ ░░░░░░ ░░░░░░ | |
# | |
alias zshconfig="$EDITOR ~/.zshrc" | |
alias ohmyzsh="$EDITOR ~/.oh-my-zsh" | |
alias ssource='source ~/.zshrc' | |
alias sz='source ~/.zshrc' | |
alias dev="cd ~/Documents/dev" | |
alias s2="cd ~/Documents/dev/s2" | |
alias docs="cd ~/Documents" | |
alias dl="cd ~/Downloads" | |
alias dt="cd ~/Desktop" | |
alias cp='cp -iv' # Preferred 'cp' implementation | |
alias mv='mv -iv' # Preferred 'mv' implementation | |
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation | |
alias ll='ls -FGlAhp' # Preferred 'ls' implementation | |
alias less='less -FSRXc' # Preferred 'less' implementation | |
cd() { builtin cd "$@"; ll; } # Always list directory contents upon 'cd' | |
alias cd..='cd ../' # Go back 1 directory level (for fast typers) | |
alias ..='cd ../' # Go back 1 directory level | |
alias ...='cd ../../' # Go back 2 directory levels | |
alias .3='cd ../../../' # Go back 3 directory levels | |
alias .4='cd ../../../../' # Go back 4 directory levels | |
alias .5='cd ../../../../../' # Go back 5 directory levels | |
alias .6='cd ../../../../../../' # Go back 6 directory levels | |
alias edit='subl' # edit: Opens any file in sublime editor | |
alias f='open -a Finder ./' # f: Opens current directory in MacOS Finder | |
alias ~="cd ~" # ~: Go Home | |
alias c='clear' # c: Clear terminal display | |
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths | |
alias show_options='shopt' # Show_options: display bash options settings | |
alias fix_stty='stty sane' # fix_stty: Restore terminal settings when screwed up | |
alias cic='set completion-ignore-case On' # cic: Make tab-completion case-insensitive | |
mcd () { mkdir -p "$1" && cd "$1"; } # mcd: Makes new Dir and jumps inside | |
trash () { command mv "$@" ~/.Trash ; } # trash: Moves a file to the MacOS trash | |
alias DT='tee ~/Desktop/terminalOut.txt' # DT: Pipe content to file on MacOS Desktop | |
alias lss="ls -Gal" | |
alias lp="ls -p" | |
alias h="history" | |
alias "cd.."="cd .." | |
alias hosts="sudo $EDITOR /etc/hosts" | |
alias c="cd" | |
alias g="git" | |
alias gs="git status" | |
alias gcm="git commit -m" | |
alias e="$EDITOR ." | |
alias ql="qlmanage -p" | |
alias yolo="git commit -am '`curl -s http://whatthecommit.com/index.txt`'" | |
alias yoloo="git commit -am '`curl -s http://whatthecommit.com/index.txt`' && git push origin master --force" | |
alias unhidelibrary="chflags nohidden ~/Library" | |
alias showdotfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" | |
alias hidedotfiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" | |
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" | |
alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" | |
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | printf '=> Public key copied to pasteboard.\n'"; | |
alias vup="vagrant up && vagrant provision && vagrant ssh" | |
alias vp="vagrant provision" | |
alias vs='sites && vagrant ssh' | |
alias vag="vagrant" | |
alias caff="caffeinate -dis" | |
alias lc="lolcat" | |
alias speedtest="speedtest-cli" | |
alias killnode="kill -9 $(ps aux | grep '\snode\s' | awk '{print $2}')" | |
# http://xkcd.com/530/ | |
alias stfu="osascript -e 'set volume output muted true'" | |
alias pumpitup="osascript -e 'set volume 10'" | |
alias bell='echo "\a"' | |
alias v=vim | |
alias vi=vim | |
alias mvi=mvim | |
alias currentdate='date "+%Y.%m.%d"' | |
alias fs='fortune -as | cowsay -f small | lolcat' | |
alias ip="curl ipinfo.io/ip" | |
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" | |
alias stest="wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip" | |
alias ack=ag | |
alias server="python -m SimpleHTTPServer" # start virutal server in the present directory | |
alias ll1="tree --dirsfirst -ChFL 1" | |
alias ll2="tree --dirsfirst -ChFL 2" | |
alias ll3="tree --dirsfirst -ChFL 3" | |
alias ll4="tree --dirsfirst -ChFupDaL 1" | |
alias ll5="tree --dirsfirst -ChFupDaL 2" | |
alias ll6="tree --dirsfirst -ChFupDaL 3" | |
alias gist="gist -ec $1" | |
alias exot=exit | |
alias 3d="figlet -f 3d $1" | |
alias pc='phpcs --standard="WordPress" $@' | |
alias pcf='phpcbf --standard="WordPress" $@' | |
alias pcfall='find . | grep .php | xargs phpcbf --standard="WordPress"' | |
alias dand=dandelion | |
alias gifs_deploy="sh generate_json && git add . && git commit -m 'Gifs' && git push origin master && dandelion deploy" | |
alias tailf="less +F $0" | |
alias sha256="shasum -a 256 "$1" " | |
# ----------------------------- | |
# NPM | |
# ----------------------------- | |
(( $+commands[npm] )) && { | |
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion" | |
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then | |
npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null | |
[[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE | |
fi | |
[[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE | |
unset __NPM_COMPLETION_FILE | |
} | |
alias npmg="npm i -g " # Install dependencies globally | |
alias npmS="npm i -S " # Install and save to dependencies in your package.json | |
alias npmD="npm i -D " # Install and save to dev-dependencies in your package.json | |
alias npmE='PATH="$(npm bin)":"$PATH"' # Execute command from node_modules folder based on current directory | |
alias npmO="npm outdated" # Check which npm modules are outdated | |
alias npmV="npm -v" # Check package versions | |
alias npmL="npm list" # Check package versions | |
alias npmst="npm start" # Run npm start | |
alias npmt="npm test" # Run npm test | |
alias npmrm="rm -rf node_modules && npm install" # Run npm test | |
# ----------------------------- | |
# NODE | |
# ----------------------------- | |
# Open the node api for your current version to the optional section. | |
function node-docs { | |
local section=${1:-all} | |
open_command "https://nodejs.org/docs/$(node --version)/api/$section.html" | |
} | |
# ----------------------------- | |
# ATOM | |
# ----------------------------- | |
local _atom_paths > /dev/null 2>&1 | |
_atom_paths=( | |
"$HOME/Applications/Atom.app" | |
"/Applications/Atom.app" | |
) | |
for _atom_path in $_atom_paths; do | |
if [[ -a $_atom_path ]]; then | |
alias at="open -a '$_atom_path'" | |
break | |
fi | |
done | |
alias atom='at .' | |
# ----------------------------- | |
# MAKE TERMINAL BETTER | |
# ----------------------------- | |
alias sz='source ~/.zshrc' | |
alias cp='cp -iv' # Preferred 'cp' implementation | |
alias mv='mv -iv' # Preferred 'mv' implementation | |
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation | |
alias ll='ls -FGlAhp' # Preferred 'ls' implementation | |
alias less='less -FSRXc' # Preferred 'less' implementation | |
cd() { builtin cd "$@"; ll; } # Always list directory contents upon 'cd' | |
alias cd..='cd ../' # Go back 1 directory level (for fast typers) | |
alias ..='cd ../' # Go back 1 directory level | |
alias ...='cd ../../' # Go back 2 directory levels | |
alias .3='cd ../../../' # Go back 3 directory levels | |
alias .4='cd ../../../../' # Go back 4 directory levels | |
alias .5='cd ../../../../../' # Go back 5 directory levels | |
alias .6='cd ../../../../../../' # Go back 6 directory levels | |
alias edit='atom' # edit: Opens any file in sublime editor | |
alias f='open -a Finder ./' # f: Opens current directory in MacOS Finder | |
alias ~="cd ~" # ~: Go Home | |
alias c='clear' # c: Clear terminal display | |
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths | |
alias show_options='shopt' # Show_options: display bash options settings | |
alias fix_stty='stty sane' # fix_stty: Restore terminal settings when screwed up | |
alias cic='set completion-ignore-case On' # cic: Make tab-completion case-insensitive | |
mcd () { mkdir -p "$1" && cd "$1"; } # mcd: Makes new Dir and jumps inside | |
trash () { command mv "$@" ~/.Trash ; } # trash: Moves a file to the MacOS trash | |
alias DT='tee ~/Desktop/terminalOut.txt' # DT: Pipe content to file on MacOS Desktop | |
# ------------------------------- | |
# FILE AND FOLDER MANAGEMENT | |
# ------------------------------- | |
zipf () { zip -r "$1".zip "$1" ; } # zipf: To create a ZIP archive of a folder | |
alias numFiles='echo $(ls -1 | wc -l)' # numFiles: Count of non-hidden files in current dir | |
alias make1mb='mkfile 1m ./1MB.dat' # make1mb: Creates a file of 1mb size (all zeros) | |
alias make5mb='mkfile 5m ./5MB.dat' # make5mb: Creates a file of 5mb size (all zeros) | |
alias make10mb='mkfile 10m ./10MB.dat' # make10mb: Creates a file of 10mb size (all zeros) | |
# cdf: 'Cd's to frontmost window of MacOS Finder | |
# ------------------------------------------------------ | |
cdf () { | |
currFolderPath=$( /usr/bin/osascript <<EOT | |
tell application "Finder" | |
try | |
set currFolder to (folder of the front window as alias) | |
on error | |
set currFolder to (path to desktop folder as alias) | |
end try | |
POSIX path of currFolder | |
end tell | |
EOT | |
) | |
echo "cd to \"$currFolderPath\"" | |
cd "$currFolderPath" | |
} | |
# | |
# ██ ██ | |
# ██████ ░██ ░██ | |
# ░██░░░██ ██████ ██████░██ ██████ | |
# ░██ ░██ ░░░░░░██ ░░░██░ ░██████ ██░░░░ | |
# ░██████ ███████ ░██ ░██░░░██░░█████ | |
# ░██░░░ ██░░░░██ ░██ ░██ ░██ ░░░░░██ | |
# ░██ ░░████████ ░░██ ░██ ░██ ██████ | |
# ░░ ░░░░░░░░ ░░ ░░ ░░ ░░░░░░ | |
# | |
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" | |
ulimit -n 2000 | |
export NODE_TLS_REJECT_UNAUTHORIZED=0 | |
# added by travis gem | |
[ -f /Users/a6002304/.travis/travis.sh ] && source /Users/a6002304/.travis/travis.sh | |
PATH=${PATH}:/usr/local/bin | |
PATH=${PATH}:/usr/bin | |
PATH=${PATH}:/bin | |
PATH=${PATH}:/usr/sbin | |
PATH=${PATH}:/sbin | |
PATH=${PATH}:/usr/local/git/bin | |
PATH=${PATH}:/opt/sm/bin | |
PATH=${PATH}:/opt/sm/pkg/active/bin | |
PATH=${PATH}:/opt/sm/pkg/active/sbin | |
PATH=${PATH}:/usr/local/heroku/bin | |
export PATH="$PATH:/usr/local/bin/" | |
export PATH="/usr/local/git/bin:/sw/bin/:/usr/local/bin:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:$PATH" | |
export PATH="$PATH:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/php/bin:/usr/local/php5/bin" | |
export PATH=${PATH} | |
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin | |
export PATH=$HOME/.binctl:$PATH | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file has been auto-generated by i3-config-wizard(1). | |
# It will not be overwritten, so edit it as you like. | |
# | |
# Should you change your keyboard layout some time, delete | |
# this file and re-run i3-config-wizard(1). | |
# | |
# i3 config file (v4) | |
# | |
# Please see http://i3wm.org/docs/userguide.html for a complete reference! | |
set $mod Mod1 | |
# Font for window titles. Will also be used by the bar unless a different font | |
# is used in the bar {} block below. | |
font pango:monospace 8 | |
# This font is widely installed, provides lots of unicode glyphs, right-to-left | |
# text rendering and scalability on retina/hidpi displays (thanks to pango). | |
#font pango:DejaVu Sans Mono 8 | |
# Before i3 v4.8, we used to recommend this one as the default: | |
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 | |
# The font above is very space-efficient, that is, it looks good, sharp and | |
# clear in small sizes. However, its unicode glyph coverage is limited, the old | |
# X core fonts rendering does not support right-to-left and this being a bitmap | |
# font, it doesn’t scale on retina/hidpi displays. | |
# Use Mouse+$mod to drag floating windows to their wanted position | |
floating_modifier $mod | |
# start a terminal | |
bindsym $mod+Return exec i3-sensible-terminal | |
# kill focused window | |
bindsym $mod+Shift+q kill | |
# start dmenu (a program launcher) | |
bindsym $mod+d exec dmenu_run | |
# There also is the (new) i3-dmenu-desktop which only displays applications | |
# shipping a .desktop file. It is a wrapper around dmenu, so you need that | |
# installed. | |
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop | |
# change focus | |
bindsym $mod+j focus left | |
bindsym $mod+k focus down | |
bindsym $mod+l focus up | |
bindsym $mod+semicolon focus right | |
# alternatively, you can use the cursor keys: | |
bindsym $mod+Left focus left | |
bindsym $mod+Down focus down | |
bindsym $mod+Up focus up | |
bindsym $mod+Right focus right | |
# move focused window | |
bindsym $mod+Shift+j move left | |
bindsym $mod+Shift+k move down | |
bindsym $mod+Shift+l move up | |
bindsym $mod+Shift+semicolon move right | |
# alternatively, you can use the cursor keys: | |
bindsym $mod+Shift+Left move left | |
bindsym $mod+Shift+Down move down | |
bindsym $mod+Shift+Up move up | |
bindsym $mod+Shift+Right move right | |
# split in horizontal orientation | |
bindsym $mod+h split h | |
# split in vertical orientation | |
bindsym $mod+v split v | |
# enter fullscreen mode for the focused container | |
bindsym $mod+f fullscreen toggle | |
# change container layout (stacked, tabbed, toggle split) | |
bindsym $mod+s layout stacking | |
bindsym $mod+w layout tabbed | |
bindsym $mod+e layout toggle split | |
# toggle tiling / floating | |
bindsym $mod+Shift+space floating toggle | |
# change focus between tiling / floating windows | |
bindsym $mod+space focus mode_toggle | |
# focus the parent container | |
bindsym $mod+a focus parent | |
# focus the child container | |
#bindsym $mod+d focus child | |
# switch to workspace | |
bindsym $mod+1 workspace 1 | |
bindsym $mod+2 workspace 2 | |
bindsym $mod+3 workspace 3 | |
bindsym $mod+4 workspace 4 | |
bindsym $mod+5 workspace 5 | |
bindsym $mod+6 workspace 6 | |
bindsym $mod+7 workspace 7 | |
bindsym $mod+8 workspace 8 | |
bindsym $mod+9 workspace 9 | |
bindsym $mod+0 workspace 10 | |
# move focused container to workspace | |
bindsym $mod+Shift+1 move container to workspace 1 | |
bindsym $mod+Shift+2 move container to workspace 2 | |
bindsym $mod+Shift+3 move container to workspace 3 | |
bindsym $mod+Shift+4 move container to workspace 4 | |
bindsym $mod+Shift+5 move container to workspace 5 | |
bindsym $mod+Shift+6 move container to workspace 6 | |
bindsym $mod+Shift+7 move container to workspace 7 | |
bindsym $mod+Shift+8 move container to workspace 8 | |
bindsym $mod+Shift+9 move container to workspace 9 | |
bindsym $mod+Shift+0 move container to workspace 10 | |
# reload the configuration file | |
bindsym $mod+Shift+c reload | |
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) | |
bindsym $mod+Shift+r restart | |
# exit i3 (logs you out of your X session) | |
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" | |
# resize window (you can also use the mouse for that) | |
mode "resize" { | |
# These bindings trigger as soon as you enter the resize mode | |
# Pressing left will shrink the window’s width. | |
# Pressing right will grow the window’s width. | |
# Pressing up will shrink the window’s height. | |
# Pressing down will grow the window’s height. | |
bindsym j resize shrink width 10 px or 10 ppt | |
bindsym k resize grow height 10 px or 10 ppt | |
bindsym l resize shrink height 10 px or 10 ppt | |
bindsym semicolon resize grow width 10 px or 10 ppt | |
# same bindings, but for the arrow keys | |
bindsym Left resize shrink width 10 px or 10 ppt | |
bindsym Down resize grow height 10 px or 10 ppt | |
bindsym Up resize shrink height 10 px or 10 ppt | |
bindsym Right resize grow width 10 px or 10 ppt | |
# back to normal: Enter or Escape | |
bindsym Return mode "default" | |
bindsym Escape mode "default" | |
} | |
bindsym $mod+r mode "resize" | |
# Start i3bar to display a workspace bar (plus the system information i3status | |
# finds out, if available) | |
bar { | |
status_command i3status | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Reasonably sets OS X defaults. My sources: | |
# - https://github.com/skwp/dotfiles/blob/master/bin/osx | |
# - https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# ~/dotfiles/osx/set-defaults.sh — http://mths.be/osx | |
# | |
# Close any open System Preferences panes, to prevent them from overriding | |
# settings we’re about to change | |
osascript -e 'tell application "System Preferences" to quit' | |
# Set computer name | |
COMPUTERNAME="Joe Karlsson's MP" | |
HOSTNAME='mp' | |
LOCALHOSTNAME='mp' | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
############################################################################### | |
# General UI/UX # | |
############################################################################### | |
# Set computer name (as done via System Preferences → Sharing) | |
#sudo scutil --set ComputerName $COMPUTERNAME | |
#sudo scutil --set HostName $HOSTNAME | |
#sudo scutil --set LocalHostName $LOCALHOSTNAME | |
#sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $LOCALHOSTNAME | |
# Disable the sound effects on boot | |
# sudo nvram SystemAudioVolume=" " | |
# Set highlight color to green | |
defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" | |
# Set sidebar icon size to medium | |
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 | |
# Reveal IP address, hostname, OS version, etc. when clicking the clock | |
# in the login window | |
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName | |
############################################################################### | |
# Apple software: Safari, Updater, iTunes, etc. # | |
############################################################################### | |
# Hide Safari's bookmark bar. | |
defaults write com.apple.Safari ShowFavoritesBar -bool false | |
# Set up Safari for development. | |
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true | |
defaults write com.apple.Safari IncludeDevelopMenu -bool true | |
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true | |
defaults write com.apple.Safari "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true | |
defaults write -g WebKitDeveloperExtras -bool true | |
# Privacy: don’t send search queries to Apple | |
defaults write com.apple.Safari UniversalSearchEnabled -bool false | |
defaults write com.apple.Safari SuppressSearchSuggestions -bool true | |
# Prevent Safari from opening ‘safe’ files automatically after downloading | |
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false | |
# Set Safari’s home page to `about:blank` for faster loading | |
defaults write com.apple.Safari HomePage -string "about:blank" | |
# Use AirDrop over every interface. | |
defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1 | |
# Check for software updates daily, not just once per week. | |
defaults write com.assple.SoftwareUpdate ScheduleFrequency -int 1 | |
# Disable the “Are you sure you want to open this application?” dialog | |
defaults write com.apple.LaunchServices LSQuarantine -bool false | |
# Disable Swipe controls for Google Chrome | |
defaults write com.google.Chrome.plist AppleEnableSwipeNavigateWithScrolls -bool FALSE | |
# Disable inline attachments in Mail.app (just show the icons) | |
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true | |
# Only use UTF-8 in Terminal.app | |
defaults write com.apple.terminal StringEncodings -array 4 | |
# Disable some menu bar icons: Time Machine, Volume and User | |
for domain in ~/Library/Preferences/ByHost/com.apple.stytemuiserver.*; do | |
"/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ | |
"/System/Library/CoreServices/Menu Extras/Volume.menu" \ | |
"/System/Library/CoreServices/Menu Extras/User.menu" | |
done | |
############################################################################### | |
# Activity Monitor # | |
############################################################################### | |
# Show the main window when launching Activity Monitor | |
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true | |
# Visualize CPU usage in the Activity Monitor Dock icon | |
defaults write com.apple.ActivityMonitor IconType -int 5 | |
# Show all processes in Activity Monitor | |
defaults write com.apple.ActivityMonitor ShowCategory -int 0 | |
# Sort Activity Monitor results by CPU usage | |
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" | |
defaults write com.apple.ActivityMonitor SortDirection -int 0 | |
############################################################################### | |
# Interfaces: trackpad, mouse, keyboard, bluetooth, etc. | |
############################################################################### | |
# Map bottom right corner of Apple trackpad to right-click. | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true | |
defaults -currentHost write -g com.apple.trackpad.trackpadCornerClickBehavior -int 1 | |
defaults -currentHost write com.apple.trackpad.enableSecondaryClick -bool true | |
# Disable press-and-hold for keys in favor of key repeat. | |
# defaults write -g ApplePressAndHoldEnabled -bool false | |
# Set language and text formats. (USD and Imperial Units) | |
defaults write -g AppleLanguages -array "en" "nl" | |
defaults write -g AppleLocale -string "en_US@currency=USD" | |
defaults write -g AppleMeasurementUnits -string "Inches" | |
defaults write -g AppleMetricUnits -bool false | |
# Set a blazingly fast keyboard repeat rate | |
# defaults write NSGlobalDomain KeyRepeat -int 1 | |
# defaults write NSGlobalDomain InitialKeyRepeat -int 10 | |
# Increase sound quality for Bluetooth headphones/headsets | |
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 | |
############################################################################### | |
# Screen | |
############################################################################### | |
# Hot corners | |
# Possible values: | |
# 0: no-op | |
# 2: Mission Control | |
# 3: Show application windows | |
# 4: Desktop | |
# 5: Start screen saver | |
# 6: Disable screen saver | |
# 7: Dashboard | |
# 10: Put display to sleep | |
# 11: Launchpad | |
# 12: Notification Center | |
# defaults write com.apple.dock wvous-bl-corner -int 5 | |
# defaults write com.apple.dock wvous-bl-modifier -int 0 | |
# Require password immediately after sleep or screen saver. | |
# defaults write com.apple.screensaver askForPassword -int 1 | |
# defaults write com.apple.screensaver askForPasswordDelay -int 0 | |
# Enable sub-pixel rendering on non-Apple LCDs. | |
defaults write NSGlobalDomain AppleFontSmoothing -int 2 | |
# Disable and kill Dashboard | |
# Can be reverted with: | |
# defaults write com.apple.dashboard mcx-disabled -boolean NO; killall Doc | |
defaults write com.apple.dashboard mcx-disabled -boolean YES; killall Dock | |
# Disable icons on the Desktop | |
# This will "hide" all the files on the Desktop, but one can still access | |
# the files through Finder. Makes things look pretty. | |
# defaults write com.apple.finder CreateDesktop -bool false && killall Finder | |
# Save screenshots to the desktop | |
defaults write com.apple.screencapture location -string "${HOME}/Desktop" | |
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) | |
defaults write com.apple.screencapture type -string "png" | |
# Disable shadow in screenshots | |
defaults write com.apple.screencapture disable-shadow -bool true | |
############################################################################### | |
# Finder | |
############################################################################### | |
# Show the ~/Library folder. | |
chflags nohidden ~/Library | |
# Set the Finder prefs for showing a few different volumes on the Desktop. | |
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true | |
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true | |
# Always open everything in Finder's column view. This is important. | |
defaults write com.apple.Finder FXPreferredViewStyle Nlsv | |
# Show hidden files and file extensions by default | |
defaults write com.apple.finder AppleShowAllFiles -bool true | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
# Disable the warning when changing file extensions | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# Allow text-selection in Quick Look | |
defaults write com.apple.finder QLEnableTextSelection -bool true | |
# Disable the warning before emptying the Trash | |
defaults write com.apple.finder WarnOnEmptyTrash -bool false | |
# Enable auto-correct | |
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool true | |
# Disable the “Are you sure you want to open this application?” dialog | |
defaults write com.apple.LaunchServices LSQuarantine -bool false | |
# Expand print panel by default | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true | |
# Expand save panel by default | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true | |
# Disable Resume system-wide | |
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false | |
# Disable the crash reporter | |
defaults write com.apple.CrashReporter DialogType -string "none" | |
# Show icons for hard drives, servers, and removable media on the desktop | |
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true | |
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true | |
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true | |
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true | |
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons | |
defaults write com.apple.finder QuitMenuItem -bool true | |
# Finder: show hidden files by default | |
defaults write com.apple.finder AppleShowAllFiles -bool true | |
# Finder: show all filename extensions | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
# Finder: show status bar | |
defaults write com.apple.finder ShowStatusBar -bool true | |
# Finder: show path bar | |
defaults write com.apple.finder ShowPathbar -bool true | |
# When performing a search, search the current folder by default | |
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" | |
# Disable the warning when changing a file extension | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# Avoid creating .DS_Store files on network or USB volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true | |
# Disable the warning before emptying the Trash | |
defaults write com.apple.finder WarnOnEmptyTrash -bool false | |
############################################################################### | |
# SSD | |
############################################################################### | |
# Disable the sudden motion sensor as it’s not useful for SSDs | |
sudo pmset -a sms 0 | |
############################################################################### | |
# Dock | |
############################################################################### | |
# Show indicator lights for open applications in the Dock | |
defaults write com.apple.dock show-process-indicators -bool true | |
# Automatically hide and show the Dock | |
# defaults write com.apple.dock autohide -bool true | |
############################################################################### | |
# Address Book, Dashboard, iCal, TextEdit, and Disk Utility # | |
############################################################################### | |
# Enable the debug menu in Address Book | |
defaults write com.apple.addressbook ABShowDebugMenu -bool true | |
# Enable Dashboard dev mode (allows keeping widgets on the desktop) | |
defaults write com.apple.dashboard devmode -bool true | |
# Enable the debug menu in iCal (pre-10.8) | |
defaults write com.apple.iCal IncludeDebugMenu -bool true | |
# Use plain text mode for new TextEdit documents | |
defaults write com.apple.TextEdit RichText -int 0 | |
# Open and save files as UTF-8 in TextEdit | |
defaults write com.apple.TextEdit PlainTextEncoding -int 4 | |
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 | |
# Enable the debug menu in Disk Utility | |
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true | |
defaults write com.apple.DiskUtility advanced-image-options -bool true | |
# Auto-play videos when opened with QuickTime Player | |
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true | |
############################################################################### | |
# Mac App Store # | |
############################################################################### | |
# Enable the WebKit Developer Tools in the Mac App Store | |
defaults write com.apple.appstore WebKitDeveloperExtras -bool true | |
# Enable Debug Menu in the Mac App Store | |
defaults write com.apple.appstore ShowDebugMenu -bool true | |
# Enable the automatic update check | |
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true | |
# Check for software updates daily, not just once per week | |
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 | |
# Download newly available updates in background | |
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 | |
# Install System data files & security updates | |
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 | |
# Automatically download apps purchased on other Macs | |
defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 | |
# Turn on app auto-update | |
defaults write com.apple.commerce AutoUpdate -bool true | |
# Allow the App Store to reboot machine on macOS updates | |
defaults write com.apple.commerce AutoUpdateRestartRequired -bool true | |
############################################################################### | |
# Transmission.app # | |
############################################################################### | |
# Use `~/Documents/Torrents` to store incomplete downloads | |
defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true | |
defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Movies/Torrents" | |
# Use `~/Downloads` to store completed downloads | |
# defaults write org.m0k.transmission DownloadLocationConstant -bool true | |
# Don’t prompt for confirmation before downloading | |
defaults write org.m0k.transmission DownloadAsk -bool false | |
defaults write org.m0k.transmission MagnetOpenAsk -bool false | |
# Don’t prompt for confirmation before removing non-downloading active transfers | |
defaults write org.m0k.transmission CheckRemoveDownloading -bool true | |
# Trash original torrent files | |
defaults write org.m0k.transmission DeleteOriginalTorrent -bool true | |
# Hide the donate message | |
defaults write org.m0k.transmission WarningDonate -bool false | |
# Hide the legal disclaimer | |
defaults write org.m0k.transmission WarningLegal -bool false | |
# IP block list. | |
# Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ | |
defaults write org.m0k.transmission BlocklistNew -bool true | |
defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" | |
defaults write org.m0k.transmission BlocklistAutoUpdate -bool true | |
# Randomize port on launch | |
defaults write org.m0k.transmission RandomPort -bool true | |
############################################################################### | |
# Photos # | |
############################################################################### | |
# Prevent Photos from opening automatically when devices are plugged in | |
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true | |
############################################################################### | |
# Do some clean up work. | |
############################################################################### | |
for app in "Activity Monitor" \ | |
"Address Book" \ | |
"Calendar" \ | |
"cfprefsd" \ | |
"Contacts" \ | |
"Dock" \ | |
"Finder" \ | |
"Google Chrome Canary" \ | |
"Google Chrome" \ | |
"Mail" \ | |
"Messages" \ | |
"Opera" \ | |
"Photos" \ | |
"Safari" \ | |
"Transmission" \ | |
"iCal"; do | |
killall "${app}" &> /dev/null | |
done | |
# Wait a bit before moving on... | |
sleep 1 | |
# ...and then. | |
echo "Success! Defaults are set." | |
echo "Some changes will not take effect until you reboot your machine." | |
# See if the user wants to reboot. | |
function reboot() { | |
read -p "Do you want to reboot your computer now? (y/N)" choice | |
case "$choice" in | |
y | Yes | yes ) echo "Yes"; exit;; # If y | yes, reboot | |
n | N | No | no) echo "No"; exit;; # If n | no, exit | |
* ) echo "Invalid answer. Enter \"y/yes\" or \"N/no\"" && return;; | |
esac | |
} | |
# Call on the function | |
if [[ "Yes" == $(reboot) ]] | |
then | |
echo "Rebooting." | |
sudo reboot | |
exit 0 | |
else | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment