about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2016-08-26T21·01-0400
committerWilliam Carroll <wpcarro@gmail.com>2016-08-26T21·01-0400
commit7e76ce2e34b0414b9187c3cebf29a967e32e9ae3 (patch)
treee564324a6d7915d4497ceec3b4fe26ed67034f97
parent9b5e7351cfe38471546b37bf15df56397ca085f1 (diff)
Extends tmux support and vim configs
-rw-r--r--configs/.tmux.conf1
-rw-r--r--usbify/.gitignore2
-rwxr-xr-xusbify/update.sh55
-rw-r--r--usbify/vim/.vimrc161
-rwxr-xr-xusbify/vim/vim_point_to_usb.sh52
5 files changed, 270 insertions, 1 deletions
diff --git a/configs/.tmux.conf b/configs/.tmux.conf
index 04b210c12f55..45ef0596ed81 100644
--- a/configs/.tmux.conf
+++ b/configs/.tmux.conf
@@ -1,5 +1,4 @@
 set -g default-terminal "screen-256color"
-set -g mouse on
 
 bind-key -r -T prefix k select-pane -U
 bind-key -r -T prefix j select-pane -D
diff --git a/usbify/.gitignore b/usbify/.gitignore
new file mode 100644
index 000000000000..f31b3e29c9b9
--- /dev/null
+++ b/usbify/.gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+*.swp
diff --git a/usbify/update.sh b/usbify/update.sh
new file mode 100755
index 000000000000..57a5965e9437
--- /dev/null
+++ b/usbify/update.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+
+# This script is used to ensure the USB has the latest code from the repository.
+
+# Update the following values to reflect the locations of each directory on your
+# particular machine.
+path_to_local_repo="$HOME/pc_settings" # path to git repo
+path_to_ext_device="/Volumes/usb_vim" # path to USB device
+
+
+if [ ! -d "$path_to_ext_device" ]; then
+  echo "No external device found at ${path_to_ext_device}." && \
+  echo "Make sure the values input within update.sh are correct." && \
+  echo "path_to_ext_device: $path_to_ext_device" && \
+  echo "Exiting." && return 1
+fi
+
+if [ ! -d "$path_to_local_repo" ]; then
+  echo "No repository found at ${path_to_local_repo}." && \
+  echo "Make sure the values input within update.sh are correct." && \
+  echo "path_to_local_repo: $path_to_local_repo" && \
+  echo "Exiting." && return 1
+fi
+
+
+# Update the local copy of the repo.
+echo -n "Updating pc_settings..." && \
+  pushd "$path_to_local_repo" >/dev/null && \
+  git pull origin master >/dev/null
+
+  if [ ! "$?" -eq 0 ]; then
+    echo "Error: git pull error. Exiting." && \
+    return 1
+  else
+    echo "Done."
+  fi
+
+
+# Copy vim directory to USB device.
+echo -n "Copying files to external device..." && \
+  pushd "$path_to_ext_device" >/dev/null && \
+  rm -rf "${path_to_ext_device}/vim" &>/dev/null && \
+  cp -r "${path_to_local_repo}/usbify/vim" "${path_to_ext_device}/vim" \
+      &>/dev/null && \
+
+  if [ ! "$?" -eq 0 ]; then
+    echo "Error: rm or cp error. Exiting." && \
+    return 1
+  else
+    echo "Done."
+  fi
+
+
+# restore the dirs to its state before running this script
+popd >/dev/null && popd >/dev/null && echo "Complete." && return 0
diff --git a/usbify/vim/.vimrc b/usbify/vim/.vimrc
new file mode 100644
index 000000000000..604e39726b6b
--- /dev/null
+++ b/usbify/vim/.vimrc
@@ -0,0 +1,161 @@
+" -- 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.
+" plugin on GitHub repo
+Plugin 'tpope/vim-fugitive'
+
+" All of your Plugins must be added before the following line
+Plugin 'Raimondi/delimitMate'
+Plugin 'Valloric/YouCompleteMe'
+Plugin 'kien/ctrlp.vim'
+Plugin 'mileszs/ack.vim'
+Plugin 'pangloss/vim-javascript'
+Plugin 'scrooloose/nerdtree'
+Plugin 'scrooloose/syntastic'
+Plugin 'sickill/vim-monokai'
+Plugin 'sjl/clam.vim'
+Plugin 'airblade/vim-gitgutter'
+
+
+call vundle#end()            " required
+filetype plugin indent on    " required
+" To ignore plugin indent changes, instead use:
+"filetype plugin on
+"
+" Brief help
+" :PluginList       - lists configured plugins
+" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
+" :PluginSearch foo - searches for foo; append `!` to refresh local cache
+" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
+"
+" see :h vundle for more details or wiki for FAQ
+" Put your non-Plugin stuff after this line
+" -- END: Vundle config --
+
+
+" backspace settings
+set backspace=2
+set backspace=indent,eol,start
+
+
+" Javascript specific variables
+let g:javascript_plugin_jsdoc = 1
+" set foldmethod=syntax
+
+" GlobalListchars
+set list
+set listchars=eol:¶,trail:~,nbsp:␣
+
+
+" Keeps everything concealed at all times. Even when my cursor is on the word.
+set conceallevel=1
+set concealcursor=nvic
+
+" JavaScript thanks to pangloss/vim-javascript
+let g:javascript_conceal_function = "ƒ"
+match ErrorMsg /ƒ/
+
+
+
+" keyword completion
+inoremap ;; <C-n>
+
+
+" -- Syntastic Settings --
+set statusline+=%#warningmsg#
+set statusline+=%{SyntasticStatuslineFlag()}
+set statusline+=%*
+
+let g:syntastic_always_populate_loc_list = 1
+let g:syntastic_auto_loc_list = 1
+let g:syntastic_check_on_open = 1
+let g:syntastic_check_on_wq = 1
+let g:syntastic_javascript_checkers = ['gjslint']
+
+
+" Basic settings
+syntax on
+set number
+set tabstop=2
+set expandtab
+set shiftwidth=2
+colorscheme monokai
+set t_Co=255
+
+
+" Ensure that <header> is "," character
+let mapleader = ","
+
+
+" Define highlighting groups
+highlight InterestingWord1 ctermbg=Cyan ctermfg=Black
+highlight InterestingWord2 ctermbg=Yellow ctermfg=Black
+highlight InterestingWord3 ctermbg=Magenta ctermfg=Black
+
+
+" h1 highlighting
+nnoremap <silent> <leader>h1 :execute 'match InterestingWord1 /\<<c-r><c-w>\>/'<CR>
+nnoremap <silent> <leader>xh1 :execute 'match none'<CR>
+
+" h2 highlighting
+nnoremap <silent> <leader>h2 :execute '2match InterestingWord2 /\<<c-r><c-w>\>/'<CR>
+nnoremap <silent> <leader>xh2 :execute '2match none'<CR>
+
+" h3 highlighting
+nnoremap <silent> <leader>h3 :execute '3match InterestingWord3 /\<<c-r><c-w>\>/'<CR>
+nnoremap <silent> <leader>xh3 :execute '3match none'<CR>
+
+"clear all highlighted groups
+nnoremap <silent> <leader>xhh :execute 'match none'<CR> :execute '2match none'<CR> :execute '3match none'<CR>
+
+
+" add 80 character wrap line
+highlight OverLength ctermbg=red ctermfg=white guibg=#592929
+match OverLength /\%81v.\+/
+
+
+" map jj to <Esc>
+imap jj <Esc>
+
+" map ctrl + n to :NERDTree
+map <C-n> :NERDTreeToggle<CR>
+
+
+" BOL and EOL
+nnoremap H ^
+nnoremap L $
+
+
+" set -o emacs line-editor defaults
+inoremap <C-a> <Esc>I
+inoremap <C-e> <Esc>A
+
+
+" trim trailing whitespace on save
+autocmd BufWritePre *.{js,py,tpl,html} :%s/\s\+$//e
+
+
+" set default font and size
+set guifont=Operator\ Mono:h16
+
+
+" -- fuzzy-finder --
+set runtimepath^=~/.vim/bundle/ctrlp.vim
+let g:ctrlp_map = '<c-p>'
+let g:ctrlp_cmd = 'CtrlP'
+let g:ctrlp_custom_ignore = {
+  \ 'dir':  'node_modules'
+  \ }
+
diff --git a/usbify/vim/vim_point_to_usb.sh b/usbify/vim/vim_point_to_usb.sh
new file mode 100755
index 000000000000..7ea24fb0b787
--- /dev/null
+++ b/usbify/vim/vim_point_to_usb.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+path_to_ext_device="/Volumes/usb_vim"
+
+
+# ensure there is an external device connected and that the path to it is 
+# accurate.
+if [ ! -d "$path_to_ext_device" ]; then
+  echo "No external device found at: $path_to_ext_device"
+  echo "Ensure that the value set for path_to_ext_device is correct."
+  echo "path_to_ext_device: $path_to_ext_device"
+  echo "Exiting."
+  return 1
+fi
+
+
+
+# This script toggles between local vim and a version that can be stored on an 
+# external device like a USB.
+
+# USB --> local machine
+if [ -L "$HOME/.vim" ] && [ -L "$HOME/.vimrc" ]; then
+  echo "Pointing to USB. Toggling back to local machine..."
+
+  # remove the symlinks
+  rm "$HOME/.vim"
+  rm "$HOME/.vimrc"
+
+  # restore back-ups as active files
+  [ -d "$HOME/.vim.bak" ] && mv "$HOME/.vim.bak" "$HOME/.vim"
+  [ -f "$HOME/.vimrc.bak" ] && mv "$HOME/.vimrc.bak" "$HOME/.vimrc"
+
+  echo ".vim now points to $HOME/.vim"
+  echo ".vimrc now points to $HOME/.vimrc"
+
+# local machine --> USB
+else
+  echo "Pointing to local machine. Toggling to USB..."
+
+  # back-up local machine's files
+  [ -d "$HOME/.vim" ] && mv "$HOME/.vim" "$HOME/.vim.bak"
+  [ -f "$HOME/.vimrc" ] && mv "$HOME/.vimrc" "$HOME/.vimrc.bak"
+
+  # symlink .vim and .vimrc to external device
+  ln -s "${path_to_ext_device}/vim/.vim" "$HOME/.vim"
+  ln -s "${path_to_ext_device}/vim/.vimrc" "$HOME/.vimrc"
+
+  echo ".vim now points to ${path_to_ext_device}/vim/.vim"
+fi
+
+echo "Done."
+