Browse Source

Add some mac compatibility to install script

Andrew Swistak 11 năm trước cách đây
mục cha
commit
9bfc7d2121

+ 0 - 0
bashrc → arch/bashrc


+ 0 - 0
conky/conkyrc → arch/conky/conkyrc


+ 0 - 0
conky/conkyrings.lua → arch/conky/conkyrings.lua


+ 0 - 0
fehbg → arch/fehbg


+ 0 - 0
gtkrc-2.0 → arch/gtkrc-2.0


+ 0 - 0
openbox/autostart → arch/openbox/autostart


+ 0 - 0
openbox/environment → arch/openbox/environment


+ 0 - 0
openbox/menu.xml → arch/openbox/menu.xml


+ 0 - 0
openbox/rc.xml → arch/openbox/rc.xml


+ 0 - 0
scripts/auto-hibernate.sh → arch/scripts/auto-hibernate.sh


+ 0 - 0
scripts/find_max_ext_monitor_res.rb → arch/scripts/find_max_ext_monitor_res.rb


+ 6 - 4
scripts/install_dotfiles.sh → arch/scripts/install_dotfiles.sh

@@ -1,7 +1,8 @@
 #!/bin/bash
 
+# BASH_SOURCE means the directory location of this bash script
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
-exclude=("scripts" "README.md")
+exclude=("scripts")
 configs=("conky" "openbox" "tint2")
 
 elemIn() {
@@ -38,10 +39,11 @@ for i in $(ls "$DIR"); do
   fi
 done
 
+ln -fsn $DIR/../vim "$HOME"/.vim
+ln -fsn $DIR/../vim/pathogen/autoload "$DIR"/../vim/
+mkdir -p "$DIR"/../vim/tmp/{backup,swap,undo}
 git submodule update --init --recursive
 git submodule foreach --recursive git pull origin master
-ln -fsn "$DIR"/vim/pathogen/autoload "$DIR"/vim/
-mkdir -p "$DIR"/vim/tmp/{backup,swap,undo}
 
 #Very specific to Arch
 read -p "Install boost and airline glyphs [y/N] " -n 1 -r
@@ -54,7 +56,7 @@ read -p "Auto compile YouCompleteMe? [y/N] " -n 1 -r
 if [[ $REPLY =~ ^[Yy]$ ]]; then
   echo ""
   echo "Compiling YouCompleteMe"
-  cd "$DIR"/vim/bundle/YouCompleteMe
+  cd "$DIR"/../vim/bundle/YouCompleteMe
   ./install.sh
 fi
 echo ""

+ 0 - 0
scripts/toggle_dual_monitor.sh → arch/scripts/toggle_dual_monitor.sh


+ 0 - 0
scripts/toggle_mirror_display.sh → arch/scripts/toggle_mirror_display.sh


+ 1 - 1
scripts/update_vim_plugins.sh → arch/scripts/update_vim_plugins.sh

@@ -8,7 +8,7 @@ git submodule foreach --recursive git pull origin master
 read -p "Auto compile YouCompleteMe? [y/N] " -n 1 -r
 if [[ $REPLY =~ ^[Yy]$ ]]; then
   echo ""
-  cd "$DIR"/vim/bundle/YouCompleteMe
+  cd "$DIR"/../vim/bundle/YouCompleteMe
   ./install.sh
 fi
 echo ""

+ 0 - 0
scripts/volume-change.sh → arch/scripts/volume-change.sh


+ 0 - 0
tint2/default.tint2rc → arch/tint2/default.tint2rc


+ 0 - 0
tint2/snap.jpg → arch/tint2/snap.jpg


+ 0 - 0
tint2/tint2confrc → arch/tint2/tint2confrc


+ 0 - 0
tint2/tint2rc → arch/tint2/tint2rc


+ 0 - 0
tint2/tint2rc.bak → arch/tint2/tint2rc.bak


+ 0 - 0
vimrc → arch/vimrc


+ 0 - 0
xbindkeysrc → arch/xbindkeysrc


+ 0 - 0
zshrc → arch/zshrc


+ 123 - 0
osx/bashrc

@@ -0,0 +1,123 @@
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+
+# If not running interactively, don't do anything
+case $- in
+    *i*) ;;
+      *) return;;
+esac
+
+# don't put duplicate lines or lines starting with space in the history.
+# See bash(1) for more options
+HISTCONTROL=ignoreboth
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=1000
+HISTFILESIZE=2000
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# If set, the pattern "**" used in a pathname expansion context will
+# match all files and zero or more directories and subdirectories.
+#shopt -s globstar
+
+# make less more friendly for non-text input files, see lesspipe(1)
+[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
+    debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# set a fancy prompt (non-color, unless we know we "want" color)
+case "$TERM" in
+    xterm-color) color_prompt=yes;;
+esac
+
+# uncomment for a colored prompt, if the terminal has the capability; turned
+# off by default to not distract the user: the focus in a terminal window
+# should be on the output of commands, not on the prompt
+#force_color_prompt=yes
+
+if [ -n "$force_color_prompt" ]; then
+    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
+	# We have color support; assume it's compliant with Ecma-48
+	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
+	# a case would tend to support setf rather than setaf.)
+	color_prompt=yes
+    else
+	color_prompt=
+    fi
+fi
+
+if [ "$color_prompt" = yes ]; then
+    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+else
+    PS1='[\u@\h \W]\$ '
+fi
+unset color_prompt force_color_prompt
+
+# If this is an xterm set the title to user@host:dir
+case "$TERM" in
+xterm*|rxvt*)
+    #PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\]$PS1"
+    PS1='[\u@\h \W]\$ '
+    ;;
+*)
+    ;;
+esac
+
+# enable color support of ls and also add handy aliases
+if [ -x /usr/bin/dircolors ]; then
+    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+    alias ls='ls --color=auto'
+    #alias dir='dir --color=auto'
+    #alias vdir='vdir --color=auto'
+
+    alias grep='grep --color=auto'
+    alias fgrep='fgrep --color=auto'
+    alias egrep='egrep --color=auto'
+fi
+
+# some more ls aliases
+alias ll='ls -alF'
+alias la='ls -A'
+alias l='ls -CF'
+alias ls='ls -G'
+
+# Add an "alert" alias for long running commands.  Use like so:
+#   sleep 10; alert
+alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
+
+# Alias definitions.
+# You may want to put all your additions into a separate file like
+# ~/.bash_aliases, instead of adding them here directly.
+# See /usr/share/doc/bash-doc/examples in the bash-doc package.
+
+if [ -f ~/.bash_aliases ]; then
+    . ~/.bash_aliases
+fi
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+if ! shopt -oq posix; then
+  if [ -f /usr/share/bash-completion/bash_completion ]; then
+    . /usr/share/bash-completion/bash_completion
+  elif [ -f /etc/bash_completion ]; then
+    . /etc/bash_completion
+  fi
+fi
+
+export EDITOR="mvim"
+alias vim="mvim"
+
+export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
+
+alias xbox_controller='sudo xboxdrv --config ~/Documents/xboxdrv_profiles/wiredxbox_minecraft.conf --detach-kernel-driver'

+ 59 - 0
osx/scripts/install_dotfiles.sh

@@ -0,0 +1,59 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
+exclude=("scripts")
+
+elemIn() {
+  for e in "${@:2}"; do
+    [[ "$e" = "$1" ]] && return 1
+  done
+  return 0
+}
+
+link() {
+  if [ -e "$1/$3$2" ]; then
+    read -p "$1/$3$2 exists! Delete? [y/N] " -n 1 -r
+    if [[ $REPLY =~ ^[Yy]$ ]]; then
+      # It might be a very, very bad idea to rm -rf.
+      rm -rf "$1/$3$2"
+      ln -sn "$DIR/$2" "$1/$3$2"
+    fi
+    echo ""
+  else
+    ln -sn "$DIR/$2" "$1/$3$2"
+  fi
+}
+
+for i in $(ls "$DIR"); do
+  elemIn "$i" "${exclude[@]}"
+  if [[  $? == 1 ]]; then continue; fi
+  echo "Linking $i to $HOME/.$i"
+  link "$HOME" "$i" "."
+done
+
+ln -fsn $DIR/../vim "$HOME"/.vim
+ln -fsn $DIR/../vim/pathogen/autoload "$DIR"/../vim/
+mkdir -p "$DIR"/../vim/tmp/{backup,swap,undo}
+git submodule update --init --recursive
+git submodule foreach --recursive git pull origin master
+
+read -p "Auto compile YouCompleteMe? [y/N] " -n 1 -r
+if [[ $REPLY =~ ^[Yy]$ ]]; then
+  echo ""
+  echo "Compiling YouCompleteMe"
+  cd "$DIR"/../vim/bundle/YouCompleteMe
+  ./install.sh
+fi
+echo ""
+
+read -p "Auto compile exuberant-ctags? [y/N] " -n 1 -r
+if [[ $REPLY =~ ^[Yy]$ ]]; then
+  echo ""
+  git clone git://github.com/jakedouglas/exuberant-ctags.git "$DIR"/exuberant-ctags
+  cd "$DIR"/exuberant-ctags
+  ./configure
+  make
+  sudo make install
+  rm -rf "$DIR"/exuberant-ctags
+fi
+echo ""

+ 26 - 0
osx/scripts/update_vim_plugins.sh

@@ -0,0 +1,26 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
+
+git submodule update --init --recursive
+git submodule foreach --recursive git pull origin master
+
+read -p "Auto compile YouCompleteMe? [y/N] " -n 1 -r
+if [[ $REPLY =~ ^[Yy]$ ]]; then
+  echo ""
+  cd "$DIR"/../vim/bundle/YouCompleteMe
+  ./install.sh
+fi
+echo ""
+
+read -p "Auto install exuberant-ctags? [y/N] " -n 1 -r
+if [[ $REPLY =~ ^[Yy]$ ]]; then
+    echo ""
+    git clone git://github.com/jakedouglas/exuberant-ctags.git ~/exuberant-ctags
+    cd ~/exuberant-ctags
+    ./configure
+    make
+    sudo make install
+    rm -rf ~/exuberant-ctags
+fi
+echo ""

+ 243 - 0
osx/vimrc

@@ -0,0 +1,243 @@
+" Use pathogen to load other plugins
+execute pathogen#infect()
+Helptags
+filetype plugin indent on
+
+"""""""""""""""""""""""""""""""""""""""""
+" Some Basics
+" Note : vim-sensible does some of these
+" settings already
+"""""""""""""""""""""""""""""""""""""""""
+set encoding=utf-8
+
+" Search settings
+set incsearch
+set ignorecase
+set smartcase
+set hlsearch
+
+" Indentation and tab functionality
+set tabstop=2
+set shiftwidth=2
+set softtabstop=2
+set expandtab
+set autoindent
+set smarttab
+set smartindent
+
+" Code Folding
+set nofoldenable
+set foldmethod=indent
+set foldnestmax=10
+set viewoptions=cursor,folds,slash,unix
+" let g:skipview_files = ['*\.vim']
+
+" Line numbers
+set number
+
+" Line Wrapping
+set nowrap
+
+" Automatically update externally updated files
+set autoread
+
+" Command expiration
+set timeout
+set ttimeoutlen=15
+
+" New window split settings
+set splitright
+
+" Remember buffer info on close
+set viminfo^=%
+
+" Set font for (m|g)vim
+set guifont=Meslo\ LG\ S\ for\ Powerline:h11
+
+"""""""""""""""""""""""""""""""""""""""""
+" Keybinds
+"""""""""""""""""""""""""""""""""""""""""
+
+let mapleader="\<space>"
+
+" Wrapped lines treated like normal ones
+nnoremap j gj
+nnoremap k gk
+
+" Set CTRL+S to save becuase I smack that every 10 seconds on whatever application I use
+" browse is only available in gvim
+command -nargs=0 -bar Update if &modified
+          \|  if empty(bufname('%'))
+          \|    browse confirm write
+          \|  else
+          \|    confirm write
+          \|  endif
+          \|endif
+nnoremap <silent> <C-s> :Update<CR>
+inoremap <C-s> <C-o>:Update<CR>
+vnoremap <C-s> <C-o>:Update<CR>
+
+" CTRL+w to close the current buffer
+nnoremap <silent> <C-w> :call CloseWindow()<CR>
+
+" Buffer magic
+nnoremap <leader>l :ls<CR>:b<space>
+
+" Switch indentation settings
+nnoremap <leader>y :set expandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>
+nnoremap <leader>Y :set expandtab tabstop=8 shiftwidth=8 softtabstop=4<CR>
+nnoremap <leader>m :set expandtab tabstop=2 shiftwidth=2 softtabstop=2<CR>
+nnoremap <leader>M :set noexpandtab tabstop=8 softtabstop=4 shiftwidth=4<CR>
+
+" To wrap or not to wrap
+nnoremap <leader>w :setlocal wrap!<CR>:setlocal wrap?<CR>
+
+" Window Switching and Resizing
+nnoremap <silent> <C-k> :wincmd k<CR>
+nnoremap <silent> <C-J> :wincmd j<CR>
+nnoremap <silent> <C-h> :wincmd h<CR>
+nnoremap <silent> <C-l> :wincmd l<CR>
+nnoremap <silent>   +   :wincmd +<CR>
+nnoremap <silent>   _   :wincmd -<CR>
+nnoremap <silent> ) :wincmd ><CR>
+nnoremap <silent> ( :wincmd <<CR>
+nnoremap <silent> <leader>r :wincmd r<CR>
+nnoremap <silent> <leader>R :wincmd R<CR>
+
+" ALt+d to duplicate a line, vmode version is best for SHIFT+V, not the others
+nnoremap <D-d> yyp
+vnoremap <D-d> y<C-o>p
+inoremap <D-d> <C-o>:yank<CR><C-o>:put<CR>
+
+" Open new files in new buffer or new windows
+nnoremap <C-o> :e<space>
+nnoremap <C-p> :sp<space>
+nnoremap <D-p> :vs<space>
+
+" Move lines of text via Alt+[jk] (Like sublime!)
+nnoremap <D-j> :m+1<CR>==
+nnoremap <D-k> :m-2<CR>==
+vnoremap <D-j> :m '>+1<CR>gv=gv
+vnoremap <D-k> :m '<-2<CR>gv=gv
+
+" Clear searches so there aren't underlined words.
+nnoremap <silent> <C-i> :nohlsearch<CR>
+
+" Set specific directories for swap, undo, and backups.
+set backupdir=~/.vim/tmp/backup//
+set directory=~/.vim/tmp/swap//
+set undodir=~/.vim/tmp/undo//
+set undofile
+
+"""""""""""""""""""""""""""""""""""""""""
+" Ctrl-P Settings
+"""""""""""""""""""""""""""""""""""""""""
+
+" Keybinding and functionality
+let g:ctrlp_map = "<leader>o"
+let g:ctrlp_cmd = 'CtrlPLastMode'
+let g:ctrlp_extensions = ['line']
+
+" Move Ctrl-P to top of the screen
+let g:ctrlp_match_window_bottom = 0
+let g:ctrlp_match_window_reversed = 0
+
+" Ignore some filetypes
+let g:ctrlp_custom_ignore = '\v\~$|\.(o|swp|pyc|wav|mp3|ogg|blend)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|__init__\.py'
+let g:ctrlp_switch_buffer = 'E'
+"let g:ctrlp_by_filename = 1
+let g:ctrlp_clear_cache_on_exit = 0
+
+" Uncomment to show hidden directories.
+"let g:ctrlp_show_hidden = 1
+
+"""""""""""""""""""""""""""""""""""""""""
+" Airline (Powerline replacement)
+"""""""""""""""""""""""""""""""""""""""""
+let g:airline_theme = 'powerlineish'
+let g:airline_powerline_fonts = 1
+
+"""""""""""""""""""""""""""""""""""""""""
+" NerdTree
+"""""""""""""""""""""""""""""""""""""""""
+
+" Directory tree toggle
+nnoremap <leader>e :NERDTreeToggle<CR>
+
+"""""""""""""""""""""""""""""""""""""""""
+" NerdCommenter
+"""""""""""""""""""""""""""""""""""""""""
+
+map <leader>cc <plug>NERDCommenterToggle
+
+" For some reason, CommentToggle doesn't work unless this is
+" remapped, so remapping it to something I won't ever use.
+map <leader><D-/><space> <plug>NERDCommenterComment
+
+""""""""""""""""""""""""""""""""""""""""
+" UltiSnips
+""""""""""""""""""""""""""""""""""""""""
+
+let g:UltiSnipsExpandTrigger = "<D-c>"
+let g:UltiSnipsJumpForwardTrigger = "<D-w>"
+let g:UltiSnipsJumpBackwardTrigger = "<D-s>"
+
+"""""""""""""""""""""""""""""""""""""""""
+" Easytags
+"""""""""""""""""""""""""""""""""""""""""
+
+let g:easytags_updatetime_min = 2000
+
+"""""""""""""""""""""""""""""""""""""""""
+" Tex Settings
+"""""""""""""""""""""""""""""""""""""""""
+
+let g:tex_flavor = "latex"
+let g:LatexBox_latexmk_options = "-pvc -pdfps"
+autocmd FileType tex setlocal spell spelllang=en_us
+
+"""""""""""""""""""""""""""""""""""""""""
+" Colors and Themes
+"""""""""""""""""""""""""""""""""""""""""
+
+syntax enable
+"Set 256 color mode (not always needed).
+if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "xfce4-terminal"
+  set t_Co=256
+endif
+
+" Use a nice color scheme
+colors Monokai
+
+""""""""""""""""""""""""""""""""""""""""
+" Useful Stuff
+""""""""""""""""""""""""""""""""""""""""
+
+" Delete trailing whitespaces on saving.
+func! DeleteTrailingWS()
+  exe "normal mz"
+  %s/\s\+$//ge
+  exe "normal `z"
+endfunc
+autocmd BufWrite * :call DeleteTrailingWS()
+
+" Allow the use of ALT as a function key.
+let c='a'
+while c <= 'z'
+  exec "set <A-".c.">=\e".c
+  exec "imap \e".c." <A-".c.">"
+  let c = nr2char(1+char2nr(c))
+endw
+
+" Close current window or vim if no unsaved windows are open.
+fun! CloseWindow()
+  if &modified
+    echo "Save first or manual exit."
+  else
+    if len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
+      q
+    else
+      :bd
+    endif
+  endif
+endfunction

+ 40 - 0
osx/zshrc

@@ -0,0 +1,40 @@
+# Lines configured by zsh-newuser-install
+HISTFILE=~/.histfile
+HISTSIZE=1000
+SAVEHIST=1000
+setopt incappendhistory nomatch
+unsetopt beep
+bindkey -v
+# End of lines configured by zsh-newuser-install
+# The following lines were added by compinstall
+zstyle :compinstall filename '/Users/drew/.zshrc'
+
+autoload -Uz compinit
+compinit
+# End of lines added by compinstall
+
+export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
+
+autoload -U colors && colors
+# Have to reset color to cyan after the bold tags for some reason.
+PROMPT="%{$fg[cyan]%}[%n@%M %B%1~%b%{$fg[cyan]%}]%# %{$reset_color%}"
+
+alias ll='ls -alF'
+alias la='ls -A'
+alias l='ls -CF'
+alias ls='ls -G'
+
+# Allow ctrl+S in vim to save files, ie pass
+# the command to vim when vim is open.
+
+export EDITOR="mvim"
+alias vim="mvim"
+
+alias xbox_controller='sudo xboxdrv --config ~/Documents/xboxdrv_profiles/wiredxbox_minecraft.conf --detach-kernel-driver'
+
+# Set Home, End, Del, PgUp, PgDown keys to actually do something.
+bindkey '^[OH' beginning-of-line
+bindkey '^[OF' end-of-line
+bindkey '^[[3~' delete-char
+bindkey '^[[5~' beginning-of-buffer-or-history
+bindkey '^[[6~' end-of-buffer-or-history