about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README.md17
-rw-r--r--aliases.sh3
-rw-r--r--configs/#.vimrc#479
-rw-r--r--configs/.emacs7
-rw-r--r--elixir-tooling.md19
5 files changed, 518 insertions, 7 deletions
diff --git a/README.md b/README.md
index 09cf89f1cb4a..a247e7e7d7be 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,9 @@
-# My Mac Configuration
+# My P(ersonal) C(omputer) Settings
+
 I'm documenting this primarily for personal use. This reposity contains shell configs, vim configs, emacs configs, a list of commonly used applications, and other items.
 
+Ironically, I prefer to use a Mac as my personal computer, so hopefully the name, `pc_settings` isn't misleading.
+
 The overall goal of this repository is to reduce the time it takes to adopt a new computer and equip it with the necessary tooling to do meaningful work.
 
 
@@ -68,16 +71,18 @@ To support ligatures make sure Hasklig is installed (link at the bottom). Ensure
 
 
 ### Commonly used applications
+* Emacs OS X - text editor
+* sublime text - text editor
+* webstorm - web IDE
+* pycharm - python IDE
 * dash - provides quick access to offline documentation (use with Alfred)
 * Alfred - replaces macOS Spotlight and integrates with external Apps like Dash
+* iterm - substitute for Terminal application
 * homebrew - necessary for procuring shell applications
-* karabiner - `key-repeat: 50ms delay-until-repeat: 300ms` increase your Mac's key repeat settings beyond the default range
 * spectacle - resize and move your windows with keyboard shortcuts
 * iterm - substitute for Terminal application
+* Fish Shell - a more modern alternative to Bash or Zsh
 * oh my zsh - a full suite of z-shell extensions
-* sublime text - text editor
-* webstorm - web IDE
-* pycharm - python IDE
 * docker - for running containers and virtual environments
 * mou - markdown editor
 * f.lux - modulates the blue amount from the screen throughout the day
@@ -108,6 +113,6 @@ To support ligatures make sure Hasklig is installed (link at the bottom). Ensure
 * Install [Hasklig](https://github.com/i-tu/Hasklig) for ligature support in Elm, Elixir, etc
 * Install [FiraCode](https://github.com/tonsky/FiraCode/wiki) for ligature support
 * Install [Operator Mono](http://www.typography.com/blog/introducing-operator) for expressive Italics
-* Install powerline fonts 
+* Install powerline fonts
 * add Adobe Source Code Pro font for shell and text editors
 * increase trackpad / mouse speed to maximum levels
diff --git a/aliases.sh b/aliases.sh
index 36149a41a9ae..ed4613271313 100644
--- a/aliases.sh
+++ b/aliases.sh
@@ -26,3 +26,6 @@ alias wdirs='dirs | tr " " "\n" | sort -r'
 # Pretty-print git history
 alias glp="git log --graph --pretty=format:'%Cred%h%Creset -%Cblue %an %Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
 
+# Convenient alias for git status
+alias gst="git status"
+
diff --git a/configs/#.vimrc# b/configs/#.vimrc#
new file mode 100644
index 000000000000..84fc89065f62
--- /dev/null
+++ b/configs/#.vimrc#
@@ -0,0 +1,479 @@
+" -- BEGIN: Vundle config --
+set nocompatible              " be iMproved, required
+filetype off                  " required
+
+" set the runtime path to include Vundle and initialize
+set rtp+=~/.vim/bundle/Vundle.vim
+call vundle#begin()
+" alternatively, pass a path where Vundle should install plugins
+"call vundle#begin('~/some/path/here')
+
+" let Vundle manage Vundle, required
+Plugin 'VundleVim/Vundle.vim'
+
+" The following are examples of different formats supported.
+" Keep Plugin commands between vundle#begin/end.
+
+" Displays git information in airline.
+Plugin 'tpope/vim-fugitive'
+
+" Displays git-tracked C*UD ops within gutter.
+Plugin 'airblade/vim-gitgutter'
+
+" Fuzzy-finder
+Plugin 'kien/ctrlp.vim'
+
+" Grep file contents
+Plugin 'mileszs/ack.vim'
+
+" JS support
+Plugin 'pangloss/vim-javascript'
+
+" Visual dir-tree navigation
+Plugin 'scrooloose/nerdtree'
+
+" Syntax Highlighting Support
+Plugin 'lambdatoast/elm.vim'
+
+       this is a test
+       so is this
+       
+
+" Elixir Plugins
+Plugin 'elixir-lang/vim-elixir'
+Plugin 'slashmili/alchemist.vim'
+Plugin 'powerman/vim-plugin-AnsiEsc'
+
+" TypeScript Plugins
+Plugin 'rschmukler/typescript-vim'
+
+" Themes
+Plugin 'sickill/vim-monokai'
+Plugin 'altercation/vim-colors-solarized'
+Plugin 'mhartington/oceanic-next'
+
+" Executes shell commands and pipes output into new Vim buffer.
+Plugin 'sjl/clam.vim'
+
+" Multiple cursors for simultaneous edits.
+" NOTE: use <C-n> to run miltiple cursors not <C-d>
+Plugin 'terryma/vim-multiple-cursors'
+
+" Visualize buffers
+Plugin 'vim-airline/vim-airline'
+Plugin 'vim-airline/vim-airline-themes'
+
+" Visually align assignments
+Plugin 'godlygeek/tabular'
+
+" Visually Highlight and comment code.
+Plugin 'tpope/vim-commentary'
+
+" Macros for quotes, parens, etc.
+Plugin 'tpope/vim-surround'
+
+" Allows Plugins to be repeated with `.` character
+Plugin 'tpope/vim-repeat'
+
+" Seamlessly navigate Vim and Tmux with similar bindings.
+Plugin 'christoomey/vim-tmux-navigator'
+
+" Async `:make` for code linting etc.
+Plugin 'neomake/neomake'
+
+" Color pack
+Plugin 'flazz/vim-colorschemes'
+
+" Dash integration (macOS only)
+Plugin 'rizzatti/dash.vim'
+
+" Better buffer mgt than CtrlP
+Plugin 'yegappan/mru'
+
+Plugin 'zanglg/nova.vim'
+
+call vundle#end()            " required
+filetype plugin indent on    " required
+" Put your non-Plugin stuff after this line
+" -- END: Vundle config --
+
+
+" Basic settings
+set number
+set wrap!
+set tabstop=2
+set expandtab
+set shiftwidth=2
+set background=dark
+
+syntax enable
+colorscheme nova
+
+set termguicolors
+
+set history=1000
+set undolevels=1000
+
+set t_Co=255
+
+" Support italics
+highlight Comment cterm=italic
+
+" Changes <leader> to <space> character.
+let mapleader = " "
+
+
+" Auto resize window splits
+autocmd VimResized * wincmd =
+
+
+" Neomake Settings
+autocmd! BufWritePost * Neomake
+
+" Elixir linting
+let g:neomake_elixir_credo_maker = {
+      \ 'exe': 'mix',
+      \ 'args': ['credo', 'list', '%:p', '--format=oneline'],
+      \ 'errorformat':
+      \   '%W[F] %. %f:%l:%c %m,' .
+      \   '%W[F] %. %f:%l %m,' .
+      \   '%W[R] %. %f:%l:%c %m,' .
+      \   '%W[R] %. %f:%l %m,' .
+      \   '%I[C] %. %f:%l:%c %m,' .
+      \   '%I[C] %. %f:%l %m,' .
+      \   '%-Z%.%#'
+      \ }
+
+
+" Alchemist settings
+let g:alchemist#elixir_erlang_src = '/usr/local/share/src'
+
+
+" Airline Settings
+" Enables the list of buffers.
+let g:airline#extensions#tabline#enabled = 1
+
+" Buffer numbers alongside files
+let g:airline#extensions#tabline#buffer_nr_show = 1
+
+" Shows the filename only.
+let g:airline#extensions#tabline#fnamemod = ':t'
+
+" Allow glyphs in airline
+let g:airline_powerline_fonts = 1
+
+" Change Airline theme
+let g:airline_theme = 'hybrid'
+
+
+" Jump to buffers.
+nmap <F1> :1b<CR>
+nmap <F2> :2b<CR>
+nmap <F3> :3b<CR>
+nmap <F4> :4b<CR>
+nmap <F5> :5b<CR>
+nmap <F6> :6b<CR>
+nmap <F7> :7b<CR>
+nmap <F8> :8b<CR>
+nmap <F9> :9b<CR>
+
+
+" It's the twenty-first century...no swaps.
+set noswapfile
+
+
+" Allow visual tab completion in command mode
+set wildmenu
+
+
+" Show Vim commands as they're being input.
+set showcmd
+
+
+" Code folding
+set foldmethod=indent
+set foldnestmax=10
+set nofoldenable
+set foldlevel=4
+
+
+" Use relative line numbers
+set relativenumber
+
+
+" emulate ci" and ci' behavior
+nnoremap ci( f(%ci(
+nnoremap ci[ f[%ci[
+
+
+" extend functionality of <C-e> & <C-y> scrolling
+nnoremap <C-e> <C-e>j
+vnoremap <C-e> <C-e>j
+nnoremap <C-y> <C-y>k
+vnoremap <C-y> <C-y>k
+
+
+" Opens all folds within the buffer
+nnoremap ZZ zR
+
+" Closes all folds within the buffer
+nnoremap zz zM
+
+" Opens all folds beneath the cursor
+" NOTE: j is the character to go down
+nnoremap zJ zO
+
+" Opens single fold beneath the cursor
+" NOTE: j is the character to go down
+nnoremap zj zo
+
+" Opens single fold beneath the cursor
+" NOTE: k is the character to go down
+nnoremap zK zC
+
+" Opens single fold beneath the cursor
+" NOTE: k is the character to go down
+nnoremap zk zc
+
+
+" Lookup Dash word under cursor in Dash
+nnoremap <leader>j :Dash<CR>
+
+
+" Save shortcut
+nnoremap <C-s> :w<CR>
+
+
+" Switch to MRU'd buffer
+nnoremap <leader><leader> <C-^>
+
+
+" Alternative MRU to CtrlP MRU
+nnoremap <leader>b :MRU<CR>
+
+
+" Supports mouse interaction.
+set mouse=a
+
+
+" Highlights matches during a search.
+set hlsearch
+
+" Clear highlight
+noremap <leader>/ :nohlsearch<CR>
+
+
+" backspace settings
+set backspace=2
+set backspace=indent,eol,start
+
+
+" Javascript specific variables
+let g:javascript_plugin_jsdoc = 1
+
+" GlobalListchars
+set list
+set listchars=tab:··,trail:·,nbsp:·
+
+
+" Keeps everything concealed at all times. Even when cursor is on the word.
+set conceallevel=1
+set concealcursor=nvic
+
+
+" map jk to <Esc>
+inoremap jk <Esc>
+
+
+" Conventional Emacs line-editor defaults
+" NOTE: <C-a> interferes w/ current tmux prefix
+inoremap <C-a> <Esc>I
+inoremap <C-e> <Esc>A
+
+
+" Manage Vertical and Horizontal splits
+nnoremap sl <Esc>:vs<CR><C-w>l
+nnoremap sh <Esc>:vs<CR>
+nnoremap sj <Esc>:sp<CR><C-w>j
+nnoremap sk <Esc>:sp<CR>
+
+
+" Delete (i.e. "close") the currently opened buffer
+" TODO: unless it's a split window, which should be :q
+nnoremap <leader>q :bdelete<CR>
+
+
+" Set CtrlP runtime path
+set runtimepath^=~/.vim/bundle/ctrlp.vim
+
+
+" Buffer creation and management
+" Buffer movement
+nnoremap <Tab> :1bnext<CR>
+nnoremap <S-Tab> :1bprevious<CR>
+
+
+" make Y do what is intuitive given: 
+"   D: deletes until EOL
+"   C: changes until EOL
+"   Y: (should) yank until EOL
+nnoremap Y y$
+
+
+" scrolling and maintaing mouse position
+" nnoremap <C-j> j<C-e>
+" nnoremap <C-k> k<C-y>
+
+
+" Shorter binding for window rotations
+nnoremap <C-r> <C-w><C-r>
+
+
+" remap redo key that is eclipsed by `rotate` currently
+nnoremap U :redo<CR>
+
+
+" Define highlighting groups
+" NOTE: The ANSII aliases for colors will change when iTerm2 settings are
+" changed.
+highlight InterestingWord1 ctermbg=Magenta ctermfg=Black
+highlight InterestingWord2 ctermbg=Blue ctermfg=Black
+
+" h1 highlighting
+nnoremap <silent> <leader>1 :execute '2match InterestingWord1 /\<<c-r><c-w>\>/'<CR>
+nnoremap <silent> <leader>x1 :execute '2match none'<CR>
+vnoremap <silent> <leader>1 :execute '2match InterestingWord1 /\<<c-r><c-w>\>/'<CR>
+
+" h2 highlighting
+nnoremap <silent> <leader>2 :execute '3match InterestingWord2 /\<<c-r><c-w>\>/'<CR>
+nnoremap <silent> <leader>x2 :execute '3match none'<CR>
+
+"clear all highlighted groups
+nnoremap <silent> <leader>xx :execute '2match none'<CR> :execute '3match none'<CR> hh
+
+
+" pasteboard copy & paste
+nnoremap <C-c> V"+y
+vnoremap <C-c> "+y
+
+inoremap <C-v> <Esc>"+pa
+" nnoremap <C-v> o<Esc>"+p
+vnoremap <C-v> "+p
+
+
+" Manage 80 char line limits
+highlight OverLength1 ctermbg=Magenta ctermfg=Black
+highlight OverLength2 ctermbg=LightMagenta ctermfg=Black
+highlight OverLength3 ctermbg=White ctermfg=Black
+" match OverLength3 /\%81v.\+/
+match OverLength2 /\%91v.\+/
+" match OverLength3 /\%101v.\+/
+
+
+" Toggle word-wrapping
+nnoremap <leader>w :set wrap!<CR>
+
+
+" Resize split to 10,20,...,100 chars
+" Uncomment the next lines for support at those sizes.
+" These bindings interfere with the highlight groups, however.
+" Increases the width of a vertical split.
+" nnoremap <leader>1 :vertical resize 10<CR>
+" nnoremap <leader>2 :vertical resize 20<CR>
+nnoremap <leader>3 :vertical resize 30<CR>
+nnoremap <leader>4 :vertical resize 40<CR>
+nnoremap <leader>5 :vertical resize 50<CR>
+nnoremap <leader>6 :vertical resize 60<CR>
+nnoremap <leader>7 :vertical resize 70<CR>
+nnoremap <leader>8 :vertical resize 80<CR>
+nnoremap <leader>9 :vertical resize 90<CR>
+nnoremap <leader>0 :vertical resize 100<CR>
+
+
+" Increases the height of a horizontal split.
+nnoremap <leader>v1 :resize 5<CR>
+nnoremap <leader>v2 :resize 10<CR>
+nnoremap <leader>v3 :resize 15<CR>
+nnoremap <leader>v4 :resize 20<CR>
+nnoremap <leader>v5 :resize 25<CR>
+nnoremap <leader>v6 :resize 30<CR>
+nnoremap <leader>v7 :resize 35<CR>
+nnoremap <leader>v8 :resize 40<CR>
+nnoremap <leader>v9 :resize 45<CR>
+nnoremap <leader>v0 :resize 50<CR>
+
+
+" NERDTree settings
+" Show hidden files by default. (Toggle with capital 'i')
+let NERDTreeShowHidden = 1
+
+" View Directory tree with ctrl + n
+nnoremap <leader>n :NERDTreeToggle<CR>
+
+" View open buffer location in tree.
+nnoremap <leader>f :NERDTreeFind<CR>
+
+
+" BOL and EOL
+nnoremap H ^
+vnoremap H ^
+nnoremap L $
+vnoremap L $
+
+
+" Search for visually selected text
+vnoremap // y/<C-r>"<CR>N
+
+
+" trim trailing whitespace on save
+autocmd BufWritePre *.{js,py,tpl,less,html,ex,exs,txt} :%s/\s\+$//e
+
+
+" Use .gitignore file to populate Ctrl-P
+let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
+
+
+" Ignores dirs and files
+let g:ctrlp_custom_ignore = {
+  \ 'dir':  'node_modules',
+  \ 'file': '\v\.(exe|dll|png|jpg|jpeg)$'
+\}
+
+
+" WIP: Run elixir tests on that line
+" TODO: only register binding in *.exs? file extensions
+nnoremap <leader>t :call ExTestToggle()<CR>
+
+
+" Jumps from an Elixir module file to an Elixir test file.
+fun! ExTestToggle()
+  if expand('%:e') == "ex"
+
+    let test_file_name = expand('%:t:r') . "_test.exs"
+    let test_file_dir = substitute(expand('%:p:h'), "/lib/", "/test/", "")
+    let full_test_path = join([test_file_dir, test_file_name], "/")
+
+    e `=full_test_path`
+
+  elseif match(expand('%:t'), "_test.exs") != -1
+
+    let test_file_name = expand('%:t:r')
+    let offset_amt = strlen(test_file_name) - strlen("_test")
+    let module_file_name = strpart(test_file_name, 0, offset_amt) . ".ex"
+    let module_file_dir = substitute(expand('%:p:h'), "/test/", "/lib/", "")
+    let full_module_path = join([module_file_dir, module_file_name], "/")
+
+    e `=full_module_path`
+
+  endif
+endfun
+
+
+" Creates intermediate directories and file to match current buffer's filepath
+fun! CreateNonExistingDirsAndFile()
+  ! echo "Creating directory..." && mkdir -p %:p:h && echo "Created directory." && echo "Creating file..." && touch %:t:p && echo "Created file."
+
+  " Write the buffer to the recently created file.
+  w
+endfun
+
diff --git a/configs/.emacs b/configs/.emacs
index dd72ff9df20e..71b43f730c80 100644
--- a/configs/.emacs
+++ b/configs/.emacs
@@ -1,4 +1,4 @@
-;; William Carroll's Emacs configuration
+; William Carroll's Emacs configuration
 
 
 ;; From `https://github.com/melpa/melpa`
@@ -104,6 +104,11 @@
 (global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen)
 
 
+;; Dired Settings
+(require 'dired)
+(define-key dired-mode-map (kbd "c") 'find-file)
+
+
 ;; Helm Settings
 (require 'helm)
 (require 'helm-config)
diff --git a/elixir-tooling.md b/elixir-tooling.md
new file mode 100644
index 000000000000..9410fa1fe3af
--- /dev/null
+++ b/elixir-tooling.md
@@ -0,0 +1,19 @@
+# Elixir Tooling
+
+Disclaimer: This file is intended to document learnings about tooling text editors to work with Elixir.
+
+## Emacs
+
+### Useful plugins
+
+* `Elixir-mode`: font-locking, indentation, etc.
+* `Alchemist`: IEx, mix, autocompletion via `company`, etc.
+* `Flycheck`: works with linters, `Dogma` and `Credo`
+
+When running an umbrella app, to allow `Alchemist` to properly jump to function definitions run...
+
+```bash
+$ ln -sf ../../_build _build
+```
+
+...where `../../_build` is the path to the umbrella root directory.