45 Commits

Author SHA1 Message Date
42acaab601 update vim setup script to make undo/swap dirs, and call from pre_bootstrap script 2019-08-03 12:29:13 -07:00
acc317107d add undo/swap dir settings back into .vimrc 2019-08-03 12:28:54 -07:00
fb8954e21e fix solarized dark to use black background 2019-08-02 12:00:21 -07:00
1cd28bbc89 fix aliases that hard-coded /bin/ls 2019-08-02 09:46:28 -07:00
2971ffb3f6 fix invalid tmux config file 2019-08-01 16:04:58 -07:00
389b61e7a1 update brew install script to include tmux 2019-08-01 15:55:13 -07:00
b0eba70875 update readme with notes on steps/order 2019-07-31 17:02:04 -07:00
5cccc29c27 fix ls alias so ls path is not hard-coded 2019-07-31 16:56:46 -07:00
b729d9dfb8 fix permissions for homebrew 2019-07-31 16:56:25 -07:00
2d8e82bd53 install joplin from cask 2019-07-30 14:43:32 -07:00
68b750fbf7 remove iterm cruft from mac settings. not working. 2019-07-30 12:32:26 -07:00
22f51c4838 add software to brew install script 2019-07-30 12:32:07 -07:00
a1cd11646f remove greenfield codes script 2019-07-30 12:31:52 -07:00
3be7090127 add gnu coreutils to path 2019-07-30 11:08:39 -07:00
a97291021b use /tmp for swap files 2019-07-30 11:08:15 -07:00
5a911d6db6 install pyenv in python setup script 2019-07-30 10:59:14 -07:00
486d0b6496 remove --flags from brew install commands (deprecated) 2019-07-30 10:58:26 -07:00
f9e4792e6f fix how set machine name script handles sudo 2019-07-30 10:58:03 -07:00
185744be40 add ssh key generation to pre-bootstrap script 2019-07-30 10:50:31 -07:00
f1acb18add change hard-coded home path to $HOME 2019-07-30 10:39:58 -07:00
93c0da10cc fix shell check 2019-07-30 10:39:05 -07:00
e9845255d8 remove vim swap/undo 2019-07-30 10:32:12 -07:00
211dfb6f01 add some explanatory comments about nnoremap
nnoremap = nnore map
         = n no re map

n > normal mode only
no > don't do
re > recursive
map > mapping
2019-03-07 21:51:44 -08:00
e763143dbe add go bin in home folder to path 2019-03-07 21:51:38 -08:00
3b73777c25 add C-h and C-l to tmux for more vim-like bindings 2019-03-07 21:51:23 -08:00
95f5608272 shift+j/k: 5->7 2019-01-27 10:31:42 -08:00
ea67e3fb2c move faster 2019-01-27 03:11:19 -08:00
89ec0b96f4 Merge branch 'master' of https://git.charlesreid1.com/dotfiles/mac
* 'master' of https://git.charlesreid1.com/dotfiles/mac:
  add vim setup to bootstrap script
2019-01-06 09:39:21 -08:00
8663c388e9 add mcfly to .bashrc 2019-01-06 09:39:00 -08:00
852e2caf54 write history immediately 2019-01-06 09:38:50 -08:00
f4cfd817bb grep alias should be case insensitive 2019-01-06 09:38:32 -08:00
3a19ec3a3b add vim setup to bootstrap script 2018-12-25 17:41:12 -08:00
6ec0b5a7eb update vimrc tab chars 2018-12-25 16:13:39 -08:00
3ab464d78f remove swap files, update vim prep script 2018-12-25 14:56:25 -08:00
df5d2b92e9 add custom solarized color scheme 2018-12-25 14:54:17 -08:00
c7dfafc493 add vim setup script 2018-12-25 13:24:29 -08:00
16d496655f update vimrc (will require more vim prep) 2018-12-25 13:22:36 -08:00
d77689642b fix incorrect function name in .aliases 2018-09-08 16:38:38 -07:00
bc1156a706 update ssh aliases - add bluebear 2018-09-08 16:36:50 -07:00
cc269db172 add git fetch shortcut to gitconfig 2018-08-23 04:59:19 -07:00
af8e2c8b37 fix color scheme, desert is better 2018-08-15 09:37:17 -07:00
83536b79bb update gitconfig url schema, comment out cruft; vimrc comments 2018-08-14 04:13:38 -07:00
dfe43d8043 another one letter alias, s is for screen 2018-08-12 18:57:48 -07:00
01743845de add twiddlecase 2018-08-08 03:54:15 -07:00
0d19b1431d Merge branch 'like-debian' of dotfiles/mac into master 2018-07-23 03:34:57 +00:00
16 changed files with 1546 additions and 233 deletions

View File

@@ -54,6 +54,7 @@ alias mv='mv -i'
# ls aliases # ls aliases
# -------------------- # --------------------
# Detect which `ls` flavor is in use # Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls` if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color" colorflag="--color"
export LS_COLORS='no=00:fi=00:di=01;31:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' export LS_COLORS='no=00:fi=00:di=01;31:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
@@ -66,26 +67,26 @@ fi
alias ls="/bin/ls -1 ${colorflag} ${groupflag}" alias ls="ls -1 ${colorflag} ${groupflag}"
alias sl='ls' alias sl='ls'
# List all files colorized in long format # List all files colorized in long format
alias l="/bin/ls -lhAF ${colorflag}" alias l="ls -lhAF ${colorflag}"
alias ll="l" alias ll="l"
# List all files colorized in long format, including dot files # List all files colorized in long format, including dot files
alias la="l -a" alias la="l -a"
# List only directories # List only directories
alias lsd="/bin/ls -lF ${colorflag} | grep --color=never '^d'" alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"
alias lr='ls -r' # reverse alias lr='ls -r' # reverse
alias llr='ll -r' # reverse alias llr='ll -r' # reverse
alias lt='/bin/ls -lhAFt -G' # time alias lt='ls -lhAFt -G' # time
alias lt='ls -t' # time alias lt='ls -t' # time
alias llt='ll -t' # time alias llt='ll -t' # time
@@ -178,7 +179,7 @@ function krash() {
chmod +x ~/ssh.file # execute file chmod +x ~/ssh.file # execute file
~/ssh.file > /dev/null ~/ssh.file > /dev/null
rm -f ~/ssh.file rm -f ~/ssh.file
export IP="45.56.87.232" export IP="krash"
ssh -Y charles@${IP} # the actual ssh call ssh -Y charles@${IP} # the actual ssh call
} }
@@ -192,6 +193,15 @@ function wisko() {
ssh -Y melo@${IP} # the actual ssh call ssh -Y melo@${IP} # the actual ssh call
} }
alias bluebear="bluebear"
function bluebear() {
ssh-agent > ~/ssh.file # env vars in ssh.file
chmod +x ~/ssh.file # execute file
~/ssh.file > /dev/null
rm -f ~/ssh.file
export IP="bluebear"
ssh -Y charles@${IP} # the actual ssh call
}
@@ -278,10 +288,11 @@ alias d="cd ~/Desktop"
alias g="git" alias g="git"
alias h="history" alias h="history"
alias s="screen"
# Always enable colored `grep` output # Always enable colored `grep` output
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage. # Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage.
alias grep='grep --color=auto' alias grep='grep -i --color=auto'
alias fgrep='fgrep --color=auto' alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto' alias egrep='egrep --color=auto'

View File

@@ -13,12 +13,14 @@ GIT_EDITOR="vim"
# Set $PATH here # Set $PATH here
PATH="/usr/local/bin:$PATH" PATH="/usr/local/bin:$PATH"
PATH="/usr/local/sbin:${PATH}" # homebrew admin tools PATH="/usr/local/sbin:${PATH}" # homebrew admin tools
PATH="${HOME}/go/bin:${PATH}"
PATH="$(brew --prefix coreutils)/libexec/gnubin:${PATH}"
if [[ "$HOSTNAME" == "maya" ]]; then if [[ "$HOSTNAME" == "maya" ]]; then
# Setting PATH for homebrew # Setting PATH for homebrew
PATH="/Users/charles/.local/bin:$PATH" PATH="$HOME/.local/bin:$PATH"
PATH="/Users/charles/Library/Python/3.6/bin:$PATH" PATH="$HOME/Library/Python/3.6/bin:$PATH"
### # some weird new homebrew thing?? ### # some weird new homebrew thing??
### # this is where python -> python3 lives now ### # this is where python -> python3 lives now
@@ -39,7 +41,7 @@ fi
# pyenv installer # pyenv installer
# https://github.com/pyenv/pyenv-installer # https://github.com/pyenv/pyenv-installer
export PATH="/Users/charles/.pyenv/bin:$PATH" export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)" eval "$(pyenv init -)"
#eval "$(pyenv virtualenv-init -)" #eval "$(pyenv virtualenv-init -)"
@@ -57,11 +59,15 @@ HISTIGNORE="ls:cls:clc:clear:pwd:l:ll:[ ]*"
HISTSIZE=1000000 HISTSIZE=1000000
HISTTIMEFORMAT=': %Y-%m-%d_%H:%M:%S; ' HISTTIMEFORMAT=': %Y-%m-%d_%H:%M:%S; '
# Append to the Bash history file, rather than overwriting it
shopt -s histappend;
# Save Bash history # Save Bash history
shopt -s cmdhist; shopt -s cmdhist;
# Append to the Bash history file, rather than overwriting it
shopt -s histappend;
# Write history to .bash_history immediately.
# -a writes current/new lines to history file
# -n reloads only new commands
# https://askubuntu.com/a/673283
PROMPT_COMMAND='history -a;history -n'

View File

@@ -1 +1,7 @@
[ -n "$PS1" ] && source ~/.bash_profile; [ -n "$PS1" ] && source ~/.bash_profile;
# mcfly is a pretty cool command completion program
# Control + R on the command line, then start typing stuff
if [[ -f "$(brew --prefix)/opt/mcfly/mcfly.bash" ]]; then
source "$(brew --prefix)/opt/mcfly/mcfly.bash"
fi

View File

@@ -1,3 +1,10 @@
######################
## see bottom for url shorthands,
## but worth mentioning here:
#
## replace any git@github stuff with gh:
## replace any ssh://git@g.... with cmr:
[user] [user]
email = charlesreid1@gmail.com email = charlesreid1@gmail.com
name = Charles Reid name = Charles Reid
@@ -30,17 +37,21 @@
b = branch -v b = branch -v
bv = branch -v bv = branch -v
ba = branch -a ba = branch -a
bb = branch -v -a
r = remote -v r = remote -v
rv = remote -v rv = remote -v
ra = remote -v
f = fetch --all
cdiff = diff --cached cdiff = diff --cached
# Show the diff between the latest commit and the current state # Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state ### # `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" ### di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Pull in remote changes for the current repository and all its submodules # Pull in remote changes for the current repository and all its submodules
p = !"git pull; git submodule foreach git pull origin master" p = !"git pull; git submodule foreach git pull origin master"
@@ -51,7 +62,8 @@
# Commit all changes # Commit all changes
ca = !git add -A && git commit -av ca = !git add -A && git commit -av
# Switch to a branch, creating it if necessary # Switch to a branch, creating it
# from the current branch if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Show verbose output about tags, branches or remotes # Show verbose output about tags, branches or remotes
@@ -65,6 +77,11 @@
# Amend the currently staged files to the latest commit # Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD amend = commit --amend --reuse-message=HEAD
# Oops
fix = commit --amend --reuse-message=HEAD --edit
# Credit an author on the latest commit # Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
@@ -74,17 +91,17 @@
# Remove the old tag with this name and tag the latest commit with it. # Remove the old tag with this name and tag the latest commit with it.
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r" retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r"
# Find branches containing commit ### # Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f" ### fb = "!f() { git branch -a --contains $1; }; f"
# Find tags containing commit ### # Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f" ### ft = "!f() { git describe --always --contains $1; }; f"
# Find commits by source code ### # Find commits by source code
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f" ### fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
# Find commits by commit message ### # Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" ### fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
# List contributors with number of commits # List contributors with number of commits
contributors = shortlog --summary --numbered contributors = shortlog --summary --numbered
@@ -96,6 +113,8 @@
[core] [core]
editor = vim
# Use custom `.gitignore` and `.gitattributes` # Use custom `.gitignore` and `.gitattributes`
excludesfile = ~/.gitignore excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes attributesfile = ~/.gitattributes
@@ -168,6 +187,12 @@
# URL shorthands # URL shorthands
[url "ssh://git@git.charlesreid1.com:222/"]
insteadOf = "cmr:"
[url "git@github.com:"] [url "git@github.com:"]
insteadOf = "gh:" insteadOf = "gh:"

View File

@@ -33,6 +33,8 @@ bind-key h select-pane -L
bind-key j select-pane -D bind-key j select-pane -D
bind-key k select-pane -U bind-key k select-pane -U
bind-key l select-pane -R bind-key l select-pane -R
bind-key C-h select-pane -L
bind-key C-l select-pane -R
# smart pane switching with awareness of vim splits # smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L" bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L"
@@ -64,18 +66,10 @@ set-window-option -g display-panes-time 1500
set-option -g status-interval 1 set-option -g status-interval 1
set-option -g status-left '' set-option -g status-left ''
set-option -g status-right '%l:%M%p' set-option -g status-right '%l:%M%p'
set-window-option -g window-status-current-fg magenta
set-option -g status-fg default set-option -g status-fg default
# Status Bar solarized-dark (default) # Status Bar solarized-dark (default)
set-option -g status-bg black set-option -g status-bg black
set-option -g pane-active-border-fg black
set-option -g pane-border-fg black
# Status Bar solarized-light
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g status-bg white"
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-active-border-fg white"
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-border-fg white"
# Set window notifications # Set window notifications
setw -g monitor-activity on setw -g monitor-activity on

1171
.vim/colors/solarized.vim Normal file

File diff suppressed because it is too large Load Diff

320
.vimrc
View File

@@ -4,49 +4,77 @@
set nocompatible " iMproved set nocompatible " iMproved
filetype off " required filetype off " required
filetype plugin indent on filetype plugin indent on
setlocal spell spelllang=en_us "setlocal spell spelllang=en_us
set nofoldenable " disable folding set nofoldenable " disable folding
" ----------------------------------
" Extremely Important Fix
" ----------------------------------
" Turn off Esc+O key sequences (eliminates one-second delay when pressing O): " Turn off Esc+O key sequences (eliminates one-second delay when pressing O):
" https://superuser.com/questions/161178/why-does-vim-delay-for-a-second-whenever-i-use-the-o-command-open-a-new-line#161216 " https://superuser.com/questions/161178/why-does-vim-delay-for-a-second-whenever-i-use-the-o-command-open-a-new-line#161216
" if this is re-enabled i may stab someone. " if this is re-enabled i may stab someone.
set noesckeys set noesckeys
set ttimeoutlen=5 set ttimeoutlen=5
" you have to do this a second time " now you have to do this a second time
" (after the above lines)
set nocompatible set nocompatible
" ------------------------
" Lazy stuffs
" -----------------------
" https://spf13.com/post/perfect-vimrc-vim-config-file/
"
" make ; work like : to save us from Shift
" nnoremap --> extra n means normal mode only,
" nore means no recursive
nnoremap ; :
"
"""" Remove trailing whitespaces and \^M chars
"""autocmd FileType c,cpp,java,php,js,python,twig,xml,yml autocmd
"""BufWritePre <buffer> :call
"""setline(1,map(getline(1,"$"),'substitute(v:val,"\\\\s\\\\+$","","")'))
" ----------------------------------------
" fix latex highlighting in markdown
" ----------------------------------------
function! MathAndLiquid()
"" Define certain regions
" Block math. Look for "$$[anything]$$"
syn region math start=/\$\$/ end=/\$\$/
" inline math. Look for "$[not $][anything]$"
syn match math_block '\$[^$].\{-}\$'
" Fenced code blocks, used in GitHub Flavored Markdown (GFM) " -----------------------------------
syn region highlight_block start='```' end='```' " TwiddleCase function
" -----------------------------------
"" Actually highlight those regions. " TwiddleCase cycles a visual selection through
hi link math Statement " lower case/UPPER CASE/Capital Case
hi link math_block Function "
hi link highlight_block Function " Originallly mapped to ~
" Switched to Control+P
" b/c it was not doing anything useful
function! TwiddleCase(str)
if a:str ==# toupper(a:str)
let result = tolower(a:str)
elseif a:str ==# tolower(a:str)
let result = substitute(a:str,'\(\<\w\+\>\)', '\u\1', 'g')
else
let result = toupper(a:str)
endif
return result
endfunction endfunction
"" Map twiddle to ~
" Call everytime we open a Markdown file "vnoremap ~ y:call setreg('', TwiddleCase(@"), getregtype(''))<CR>gv""Pgv
autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathAndLiquid() " Map twiddle to C-p
vnoremap <C-p> y:call setreg('', TwiddleCase(@"), getregtype(''))<CR>gv""Pgv
" ----------------------------------------
" insert new line without leaving normal mode
" by typing, literally, backslash o or O
" \o \O
" (this still sucks.)
" https://vi.stackexchange.com/a/3877
" ----------------------------------------
nnoremap <Leader>o o<Esc>
nnoremap <Leader>O O<Esc>
@@ -78,21 +106,12 @@ if has("autocmd")
\ exe "normal g`\"" | \ exe "normal g`\"" |
\ endif \ endif
endif " has("autocmd") endif " has("autocmd")
" in Python, don't move comment hashtag to first column.
" smartindent unnecessary for python anyway.
" http://stackoverflow.com/questions/2063175/vim-insert-mode-comments-go-to-start-of-line
au! FileType python setl nosmartindent
" allow visual mode to go to blank space at end of lines " allow visual mode to go to blank space at end of lines
set virtualedit=block set virtualedit=block
" put horz./vert. splits in the right place " put horz./vert. splits in the right place
set splitbelow set splitbelow
set splitright set splitright
" ------------------------
" End Vim Annoyances
" -----------------------
" ------------------------ " ------------------------
@@ -101,6 +120,7 @@ set splitright
" this turns on syntax highlighting " this turns on syntax highlighting
syntax on syntax on
"set synmaxcol=200 " don't syntax highlight past this many chars
set ic set ic
" this highlights search items " this highlights search items
set hls set hls
@@ -120,34 +140,81 @@ set backspace=indent,eol,start
" murder that cursed blinking cursor " murder that cursed blinking cursor
let &guicursor = &guicursor . ",a:blinkon0" let &guicursor = &guicursor . ",a:blinkon0"
" ------------------------
" End For Sanity " --------------------------
" ----------------------- " Pathogen
" --------------------------
"
" to install vim pathogen plugin:
" mkdir -p ~/.vim/autoload ~/.vim/bundle && \
" curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
"
" now you need to "infect" yourself
" (questionable word choices...)
execute pathogen#infect()
" --------------------------
" Go settings
" --------------------------
"
" https://github.com/paulswanson/congo/blob/master/congo.sh
"
filetype indent plugin on
"set number
"set mouse=a
"
" to install vim-go plugin:
" git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go
"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_fmt_command = "goimports"
" ------------------------ " ------------------------
" Filetype Settings " Filetype Settings
" ----------------------- " -----------------------
" python
" ------------------------
" don't move comment hashtag to the first column.
" smartindent is unnecessary for python anyway.
" http://stackoverflow.com/questions/2063175/vim-insert-mode-comments-go-to-start-of-line
au! FileType python setl nosmartindent
" golang
" see https://github.com/paulswanson/congo/blob/master/congo.sh
" ------------------------
au BufRead,BufNewFile *.go set noexpandtab
" Makefiles " Makefiles
" ------------------------
au BufRead,BufNewFile Makefile*,*.make,*.mk set noexpandtab au BufRead,BufNewFile Makefile*,*.make,*.mk set noexpandtab
" C++ " C++
" ------------------------
au BufRead,BufNewFile *.cpp,*.cxx,*.cc,*.c,*.h,*.hpp,*.hxx,*.hh set tabstop=4 shiftwidth=4 softtabstop=4 nowrap au BufRead,BufNewFile *.cpp,*.cxx,*.cc,*.c,*.h,*.hpp,*.hxx,*.hh set tabstop=4 shiftwidth=4 softtabstop=4 nowrap
" Snakemake files: Snakefile, .rule, .snake, .settings, .smk " Snakemake files: Snakefile, .rule, .snake, .settings, .smk
au BufNewFile,BufRead Snakefile set syntax=snakemake " ------------------------
au BufNewFile,BufRead *rule set syntax=snakemake au BufNewFile,BufRead set syntax=snakemake
au BufNewFile,BufRead *.snake set syntax=snakemake au BufNewFile,BufRead Snakefile*,*.rule,*.snake,*.smk set syntax=snakemake
au BufNewFile,BufRead *.settings set syntax=snakemake
au BufNewFile,BufRead *.smk set syntax=snakemake
" Yaml " Yaml
" ------------------------
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" don't autoindent yaml files
filetype plugin indent on
au filetype yaml call DisableIndentY()
function! DisableIndentY()
set autoindent&
set cindent&
set smartindent&
set indentexpr&
endfunction
@@ -165,18 +232,17 @@ set nowrap
set tabstop=4 shiftwidth=4 expandtab set tabstop=4 shiftwidth=4 expandtab
set nosmartindent " die die die set nosmartindent " die die die
" color scheme stuff " set the text width at
"colorscheme desert
"colorscheme solarized
"
"
" 80 or 88, whatever " 80 or 88, whatever
set textwidth=80 "set textwidth=80
" " IMPORTANT -
" if you're curious about the reasoning behind B950, " above directive will auto-wrap
" Bugbear's documentation explains it. The tl;dr is " your text as you type it, and may
" "it's like highway speed limits, we won't bother " end up driving you mad.
" you if you overdo it by a few km/h".
" > Bugbear's documentation explains 88 vs 80:
" > "it's like highway speed limits, we won't bother
" > you if you overdo it by a few km/h".
" "
" Turn character 80/88 red " Turn character 80/88 red
" (for visibility conforming to " (for visibility conforming to
@@ -186,16 +252,6 @@ hi Bang ctermfg=red guifg=red
"match Bang /\%>87v.*\%<89v/ "match Bang /\%>87v.*\%<89v/
match Bang /\%>79v.*\%<81v/ match Bang /\%>79v.*\%<81v/
" ------------------------
" End Lines & Tabs
" ------------------------
" --------------------------- " ---------------------------
@@ -211,14 +267,6 @@ abbreviate slef self
abbreviate paramters parameters abbreviate paramters parameters
abbreviate exmaple example abbreviate exmaple example
" ------------------------
" End Lines & Tabs
" -----------------------
" ------------------------ " ------------------------
@@ -234,11 +282,6 @@ endif
" Running command :CD will change to current file's directory " Running command :CD will change to current file's directory
com! CD cd %:p:h com! CD cd %:p:h
" ------------------------
" End Tab Wild Mode
" -----------------------
" ------------------------ " ------------------------
@@ -266,15 +309,6 @@ if has("user_commands")
command! -bang Qa qa<bang> command! -bang Qa qa<bang>
endif endif
" ------------------------
" End Fat Fingers
" -----------------------
" ------------------------ " ------------------------
@@ -291,11 +325,25 @@ function! DisableIndent()
set indentexpr& set indentexpr&
endfunction endfunction
" ------------------------ " fix latex highlighting in markdown
" End Markdown function! MathAndLiquid()
" ----------------------- "" Define certain regions
" Block math. Look for "$$[anything]$$"
syn region math start=/\$\$/ end=/\$\$/
" inline math. Look for "$[not $][anything]$"
syn match math_block '\$[^$].\{-}\$'
" Fenced code blocks, used in GitHub Flavored Markdown (GFM)
syn region highlight_block start='```' end='```'
"" Actually highlight those regions.
hi link math Statement
hi link math_block Function
hi link highlight_block Function
endfunction
" Call everytime we open a Markdown file
autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathAndLiquid()
@@ -309,13 +357,6 @@ if has("persistent_undo")
set undofile set undofile
endif endif
" ------------------------
" End Reddit
" -----------------------
" ------------------------ " ------------------------
@@ -354,14 +395,6 @@ endif
" Don't copy the contents of an overwritten selection. " Don't copy the contents of an overwritten selection.
vnoremap p "_dP vnoremap p "_dP
" -----------------------------
" End Github Maximum Awesome
" -----------------------------
"
" ==================== " ====================
@@ -369,11 +402,6 @@ vnoremap p "_dP
" ==================== " ====================
" " (woah.) " " (woah.)
" Use the Solarized Dark theme
set background=dark
colorscheme solarized
let g:solarized_termtrans=1
" Enhance command-line completion " Enhance command-line completion
set wildmenu set wildmenu
" Allow backspace in insert mode " Allow backspace in insert mode
@@ -386,8 +414,7 @@ set ttyfast
"""""""""""""""""""""""" """"""""""""""""""""""""
" Dont add empty newlines at the end of files " Dont add empty newlines at the end of files
set noeol set noeol
" Centralize backups, swapfiles and undo history " Set swap file dir
set backupdir=~/.vim/backups
set directory=~/.vim/swap set directory=~/.vim/swap
if exists("&undodir") if exists("&undodir")
set undodir=~/.vim/undo set undodir=~/.vim/undo
@@ -402,8 +429,8 @@ set modelines=4
"""set secure """set secure
" Enable line numbers " Enable line numbers
set number set number
" Enable syntax highlighting """""""""""""" Enable syntax highlighting
syntax on """""""""""""syntax on
" Highlight current line " Highlight current line
set cursorline set cursorline
" Highlight searches " Highlight searches
@@ -459,5 +486,68 @@ if has("autocmd")
endif endif
" Mark special characters " Mark special characters
"set listchars=nbsp:☠,tab:▸␣ "set listchars=nbsp:☠,tab:▸␣
set listchars=tab:▸␣ "set listchars=tab:▸␣
"set list "set list
" ----------------------------
" colorrrzzzzz
" ----------------------------
set background=dark
set t_Co=256
function! BgToggle()
if &background == "light"
execute ":set background=dark"
else
execute ":set background=light"
endif
endfunction
nnoremap <F5> :call BgToggle()<cr>
" to install vim-colors-solarized plugin:
" git clone git://github.com/altercation/vim-colors-solarized.git ~/.vim/bundle/vim-colors-solarized
"
let g:solarized_termcolors=256
"" If the following line is commented out,
"" F5/background toggle will change from
"" dark to light. If the line is enabled,
"" the background color will remain the same
"" dark default terminal backgorund color.
"let g:solarized_termtrans = 1
"
let g:solarized_degrade = 0
let g:solarized_bold = 1
let g:solarized_underline = 1
let g:solarized_italic = 1
let g:solarized_contrast = "normal"
let g:solarized_visibility= "normal"
" install solarized by getting the
" solarized color scheme in vim format
" (solarized.vim) from here:
"
" https://raw.githubusercontent.com/altercation/vim-colors-solarized/master/colors/solarized.vim
"
" put it in ~/.vim/colors/solarized.vim
colorscheme solarized
" ------------------------
" Move Faster
" ------------------------
"
" default shift + j (combines lines)
" moves to shift + L
nnoremap <S-L> :join<CR>
" shift + j and shift + k
" move up and down n lines
map <S-j> 7j
map <S-k> 7k
" these have to go at the end

View File

@@ -2,3 +2,8 @@
Repository containing dotfiles appropriate for use on Mac laptops. Repository containing dotfiles appropriate for use on Mac laptops.
Step 1: Run pre bootstrap script
Step 2: Run vim setup script (TODO: add pathogen installation)
Step 3: Run bootstrap script

View File

@@ -15,6 +15,7 @@ function doIt() {
--exclude "python_install.sh" \ --exclude "python_install.sh" \
--exclude "python_setup.sh" \ --exclude "python_setup.sh" \
--exclude "set_machine_name.sh" \ --exclude "set_machine_name.sh" \
--exclude "vim_setup.sh" \
--exclude "README.md" \ --exclude "README.md" \
--exclude "LICENSE" \ --exclude "LICENSE" \
-avh --no-perms . ~; -avh --no-perms . ~;

View File

@@ -2,6 +2,9 @@
# #
# Homebrew setup/install # Homebrew setup/install
sudo chown -R $(whoami) /usr/local/var/homebrew
sudo chmod -R g+rwx /usr/local
brew update brew update
# Install command-line tools using Homebrew. # Install command-line tools using Homebrew.
@@ -23,7 +26,7 @@ brew install moreutils
brew install findutils brew install findutils
# Install GNU `sed`, overwriting the built-in `sed`. # Install GNU `sed`, overwriting the built-in `sed`.
brew install gnu-sed --with-default-names brew install gnu-sed
# Install Bash 4. # Install Bash 4.
# Note: dont forget to add `/usr/local/bin/bash` to `/etc/shells` before # Note: dont forget to add `/usr/local/bin/bash` to `/etc/shells` before
@@ -37,18 +40,27 @@ if ! fgrep -q '/usr/local/bin/bash' /etc/shells; then
chsh -s /usr/local/bin/bash; chsh -s /usr/local/bin/bash;
fi; fi;
# Install `wget` with IRI support. # Install wget
brew install wget --with-iri brew install wget
# Install GnuPG to enable PGP-signing commits. # Install GnuPG to enable PGP-signing commits.
brew install gnupg brew install gnupg
# Install joplin for note-taking
brew cask install joplin
# Install aws cli
brew install awscli
# Install more recent versions of some macOS tools. # Install more recent versions of some macOS tools.
brew install vim --with-override-system-vi brew install vim
brew install grep brew install grep
brew install openssh brew install openssh
brew install screen brew install screen
brew install homebrew/php/php56 --with-gmp brew install tmux
# Install openjdk
brew cask install adoptopenjdk
# Install font tools. # Install font tools.
brew tap bramstein/webfonttools brew tap bramstein/webfonttools
@@ -87,7 +99,7 @@ brew install sqlmap
# Install other useful binaries. # Install other useful binaries.
brew install ack brew install ack
brew install git brew install git
brew install imagemagick --with-webp brew install imagemagick
brew install speedtest_cli brew install speedtest_cli
brew install tree brew install tree

View File

@@ -1,20 +0,0 @@
#!/bin/bash
#
# Prepare a codes directory,
# or, whatever you want to call it
NAME="codes"
DIR="${HOME}/${NAME}"
# Make it
mkdir -p ${DIR}
cd ${DIR}
git clone --recursive https://charlesreid1.com:3000/charlesreid1/bot-master.git bots
git clone --recursive https://charlesreid1.com:3000/charlesreid1/charlesreid1-master.git charlesreid1
git clone --recursive https://charlesreid1.com:3000/cs/cs-master.git cs
git clone --recursive https://charlesreid1.com:3000/dotfiles/dotfiles-master.git dotfiles
git clone --recursive https://charlesreid1.com:3000/kali/kali-master.git kali
git clone --recursive https://charlesreid1.com:3000/charlesreid1/pelican-master.git pelican
git clone --recursive https://charlesreid1.com:3000/rpi/pi-master.git rpi

View File

@@ -599,53 +599,6 @@ defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
# Only use UTF-8 in Terminal.app # Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4 defaults write com.apple.terminal StringEncodings -array 4
# Use a modified version of the Solarized Dark theme by default in Terminal.app
osascript <<EOD
tell application "Terminal"
local allOpenedWindows
local initialOpenedWindows
local windowID
set themeName to "Solarized Dark xterm-256color"
(* Store the IDs of all the open terminal windows. *)
set initialOpenedWindows to id of every window
(* Open the custom theme so that it gets added to the list
of available terminal themes (note: this will open two
additional terminal windows). *)
do shell script "open '$HOME/init/" & themeName & ".terminal'"
(* Wait a little bit to ensure that the custom theme is added. *)
delay 1
(* Set the custom theme as the default terminal theme. *)
set default settings to settings set themeName
(* Get the IDs of all the currently opened terminal windows. *)
set allOpenedWindows to id of every window
repeat with windowID in allOpenedWindows
(* Close the additional windows that were opened in order
to add the custom theme to the list of terminal themes. *)
if initialOpenedWindows does not contain windowID then
close (every window whose id is windowID)
(* Change the theme for the initial opened terminal windows
to remove the need to close them in order for the custom
theme to be applied. *)
else
set current settings of tabs of (every window whose id is windowID) to settings set themeName
end if
end repeat
end tell
EOD
# Enable “focus follows mouse” for Terminal.app and all X11 apps # Enable “focus follows mouse” for Terminal.app and all X11 apps
# i.e. hover over a window and start typing in it without clicking first # i.e. hover over a window and start typing in it without clicking first
#defaults write com.apple.terminal FocusFollowsMouse -bool true #defaults write com.apple.terminal FocusFollowsMouse -bool true
@@ -658,9 +611,6 @@ defaults write com.apple.terminal SecureKeyboardEntry -bool true
# Disable the annoying line marks # Disable the annoying line marks
defaults write com.apple.Terminal ShowLineMarks -int 0 defaults write com.apple.Terminal ShowLineMarks -int 0
# Install the Solarized Dark theme for iTerm
open "${HOME}/init/Solarized Dark.itermcolors"
# Dont display the annoying prompt when quitting iTerm # Dont display the annoying prompt when quitting iTerm
defaults write com.googlecode.iterm2 PromptOnQuit -bool false defaults write com.googlecode.iterm2 PromptOnQuit -bool false

View File

@@ -1,11 +1,41 @@
#!/bin/sh #!/bin/sh
# Actually make the swap directory vim is going to use echo "About to generate SSH keys"
mkdir -p ~/.vim/swap sleep 2
mkdir -p ~/.vim/undo if [ -f "$HOME/.ssh/id_rsa" ]; then
echo "Keys already exist"
else
yes | ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N ''
chmod 700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 600 $HOME/.ssh/authorized_keys
echo "Done generating keys"
fi
# Change shell to homebrew bash echo "About to set up vim."
BASH="/usr/local/bin/bash" sleep 2
echo "About to set shell to ${BASH}" ./vim_setup.sh
echo "About to change Mac settings"
sleep 2
./mac_settings.sh
echo "About to install and set up python"
sleep 2
./python_install.sh
./python_setup.sh
echo "About to run brew installation script"
sleep 2
./brew_install.sh
echo "About to set shell to bash"
if [ -f "/usr/local/bin/bash" ]; then
BASH="/usr/local/bin/bash"
else
BASH="/bin/bash"
fi
echo "Found ${BASH}"
sleep 2
chsh -s ${BASH} chsh -s ${BASH}

View File

@@ -2,3 +2,5 @@
brew install python2 python3 brew install python2 python3
curl https://pyenv.run | bash

View File

@@ -6,16 +6,25 @@
# #
# It will prompt you for the hostname you want to set. # It will prompt you for the hostname you want to set.
if [ "$(id -u)" != "0" ]; then
echo ""
echo ""
echo "This script should be run as root!"
echo ""
echo ""
exit 1;
fi
# darwin # darwin
echo "The current hostname is ${HOSTNAME}" echo "The current hostname is ${HOSTNAME}"
echo "Type the new hostname you want for your machine, then press [ENTER]:" echo "Type the new hostname you want for your machine, then press [ENTER]:"
read newhostname read newhostname
sudo scutil --set ComputerName "${newhostname}" scutil --set ComputerName "${newhostname}"
sudo scutil --set HostName "${newhostname}" scutil --set HostName "${newhostname}"
sudo scutil --set LocalHostName "${newhostname}" scutil --set LocalHostName "${newhostname}"
sudo echo "127.0.0.1 ${newhostname}" >> /etc/hosts echo "127.0.0.1 ${newhostname}" >> /etc/hosts
echo "The new hostname is ${newhostname}" echo "The new hostname is ${newhostname}"
echo "Try logging out and back in." echo "Try logging out and back in."

21
vim_setup.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
echo "Making vim undo and swap dirs"
mkdir -p ~/.vim/swap \
~/.vim/undo
echo "Installing solarized color scheme ..."
mkdir -p ~/.vim/colors \
&& cp .vim/colors/* ~/.vim/colors/.
echo "Installing vim-pathogen ..."
mkdir -p \
~/.vim/autoload \
~/.vim/bundle \
&& curl -LSso \
~/.vim/autoload/pathogen.vim \
https://tpo.pe/pathogen.vim
echo "Installing vim-go ..."
git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go || echo "Existing vim-go folder already found, skipping this step ..."