Просмотр исходного кода

Merge branch 'master' of code.parsleygardens.net:cinaeco/dotfiles

Conflicts:
	vim/vimrc
Weiyi Lou 13 лет назад
Родитель
Сommit
3bb02f5af7

+ 0 - 4
screen/screenrc

@@ -63,10 +63,6 @@ vbell                 on              # default: ???
 # Message to be displayed when the visual bell is triggered.
 vbell_msg             " *beep* "
 
-# Disable nethack error messsages. This gets triggered by the prescence of a
-# .nethackrc or the $NETHACKOPTIONS environmental variable
-nethack off
-
 # Get rid of screen 0
 # http://www.linuxquestions.org/questions/linux-software-2/gnu-screen-start-window-numbering-at-1-keep-window-number-0-from-ever-being-used-772580/
 bind c screen 1

+ 0 - 72
vim/plugin/html_autoclosetag.vim

@@ -1,72 +0,0 @@
-" File:         HTML AutoCloseTag.vim
-" Author:       Michael Sanders (msanders42 [at] gmail [dot] com)
-" Last Updated: April 7 2009
-" Version:      0.3
-" Description:  Automatically closes HTML tag once you finish typing it with >
-
-if exists('b:mapped_auto_closetag') || &cp | finish | endif
-let g:mapped_auto_closetag = 1
-
-ino <buffer> <silent> < <><left>
-ino <buffer> <silent> > <c-r>=<SID>CloseTag()<cr>
-ino <buffer> <expr> <cr> <SID>Return()
-
-if exists('s:did_auto_closetag') | finish | endif
-let g:did_auto_closetag = 1
-
-" Gets the current HTML tag by the cursor.
-fun s:GetCurrentTag()
-	return matchstr(matchstr(getline('.'),
-						\ '<\zs\(\w\|=\| \|''\|"\)*>\%'.col('.').'c'), '^\a*')
-endf
-
-" Cleanly return after autocompleting an html/xml tag.
-fun s:Return()
-	let tag = s:GetCurrentTag()
-	return tag != '' && match(getline('.'), '</'.tag.'>') > -1 ?
-				\ "\<cr>\<cr>\<up>" : "\<cr>"
-endf
-
-fun s:InComment()
-	return stridx(synIDattr(synID(line('.'), col('.')-1, 0), 'name'), 'omment') != -1
-endf
-
-" Counts occurance of needle in page, when not in a comment.
-fun s:CountInPage(needle)
-	let pos = [line('.'), col('.')]
-	call cursor(1, 1)
-	let counter = search(a:needle, 'Wc')
-	while search(a:needle, 'W')
-		if !s:InComment() | let counter += 1 | endif
-	endw
-	call cursor(pos)
-	return counter
-endf
-
-" Returns whether a closing tag has already been inserted.
-fun s:ClosingTag(tag)
-	return s:CountInPage('\c<'.a:tag.'.\{-}>') <= s:CountInPage('\c</'.a:tag.'>')
-endf
-
-" Automatically inserts closing tag after starting tag is typed
-fun s:CloseTag()
-	let line = getline('.')
-	let col = col('.')
-	if line[col-1] != '>' | return '>' | endif
-	let col += 1
-	call cursor(0, col)
-	" Don't autocomplete next to a word or another tag or if inside comment
-	if line[col] !~ '\w\|<\|>' && !s:InComment()
-		let tag = s:GetCurrentTag()
-		" Insert closing tag if tag is not self-closing and has not already
-		" been closed
-		if tag != '' && tag !~ '\vimg|input|link|meta|br|hr|area|base|param|dd|dt'
-					\ && !s:ClosingTag(tag)
-			let line = substitute(line, '\%'.col.'c', '</'.escape(tag, '/').'>', '')
-			call setline('.', line)
-			call cursor(0, col)
-		endif
-	endif
-	return ''
-endf
-" vim:noet:sw=4:ts=4:ft=vim

+ 4 - 0
vim/snippets/php.snippets

@@ -5,3 +5,7 @@ snippet vardump
 	var_dump($${1:check_variable}); exit;
 snippet logger
 	Logger::debug('${1:description} ' . print_r($${2:variable}, true));
+snippet logmem
+	Logger::debug('Memory Usage: ${1:description} ' . memory_get_usage() / (1024 * 1024) . ' MiB');
+snippet logtime
+	Logger::debug('Time Index: ${1:description} ' . xdebug_time_index() . 's');

+ 15 - 23
vim/vimrc

@@ -1,4 +1,4 @@
-set nocompatible "Don't have to try to be compatible with old vi
+set nocompatible    " Don't have to try to be compatible with old vi
 set encoding=utf-8
 
 """"""""
@@ -9,10 +9,9 @@ call pathogen#helptags()
 
 
 """"""""
-"" Environment
+"" Environment - What kind of machine are we on?
 """""""""""""""""""""""""""""""""""""""""""""""""""
 
-" Determine what kind of machine we're on e.g. Linux, Darwin, Win(?)
 if has("unix")
   " remove the newline character from the uname command
   let s:uname = substitute(system("uname"), "\n", "", "")
@@ -23,9 +22,10 @@ endif
 "" General Behaviours
 """""""""""""""""""""""""""""""""""""""""""""""""""
 
-set splitbelow "New splits appear below current window instead of above
-set splitright "New splits appear right of current window
-set ttyfast "Smooth movement
+set splitbelow    " New splits appear below current window instead of above
+set splitright    " New splits appear right of current window
+set ttyfast       " Smooth movement
+set ttymouse=xterm2
 
 " Persistent undo
 if has("persistent_undo")
@@ -33,8 +33,6 @@ if has("persistent_undo")
     set undodir=~/.vimundo
 endif
 
-set ttymouse=xterm2
-
 if has("autocmd")
     " Enable filetype specific features
     filetype plugin indent on
@@ -68,9 +66,9 @@ endif
 """"""""
 "" Start Up
 """""""""""""""""""""""""""""""""""""""""""""""""""
+
 function! StartUp()
-    " Stuff in here will be called by autocmd below
-    " example, start NERDTree if vim called with no arguments
+    " start NERDTree if vim called with no arguments
     if 0 == argc()
         NERDTree
     end
@@ -86,10 +84,10 @@ set tabstop=2       " actual tab press distance
 set shiftround      " indent to nearest tabstops
 set shiftwidth=2    " amount to indent with > and <
 set smarttab        " backspace tabs where appropriate even if spaces
-set softtabstop=2   " let backspace delete indent
+set softtabstop=2   " let backspace delete by indents
 set wrap lbr        " wrap long lines of text
 set backspace=eol,start,indent "backspace over everything
-set textwidth=80
+set textwidth=80    " try to keep text within 80 characters
 set colorcolumn=+1  " mark out the limits of the textwidth
 set listchars=trail:_,tab:>.,eol:$
 
@@ -147,13 +145,13 @@ set magic       " enables wildcard searching
 "" Key Remaps
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""
 
-let mapleader = "," "Leader key lets you make more kinds of shortcuts!
+let mapleader = ","    " easier to use than \
 
 " More convenient escape
 imap ii <Esc>
 imap II <Esc>
 
-" Yank to end of line, like D
+" Yank to end of line, like D deletes to end of line
 nmap Y y$
 
 " Clear trailing white space
@@ -230,7 +228,7 @@ nnoremap <silent> <expr> $ ScreenMovement("$")
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 """"""""" NERDTree
-let g:NERDTreeQuitOnOpen = 1
+let g:NERDTreeQuitOnOpen = 1 " close sidebar after we go to selection
 if s:uname == "Darwin"
   let g:NERDTreeDirArrows=0 " Problems showing NERDTree arrows in OS X
 endif
@@ -247,22 +245,16 @@ let g:gundo_preview_bottom = 1
 let g:did_surrounding = 1  " Disable msander's surrounding (surround fork)
 
 
-""""""""" HTML Autoclose Tag
-" We are instead trying out sparkup
-let g:mapped_auto_closetag = 1  " Disable html autoclose plugin
-let g:did_auto_closetag = 1  " Disable html autoclose plugin
-
-
 """"""""" Powerline
 let g:Powerline_symbols = 'compatible' " alternatives: fancy, unicode
 
 
 """"""""" Tagbar
-let g:tagbar_autoclose = 1
+let g:tagbar_autoclose = 1 " close sidebar after we go to selection
 
 
 """"""""
-"" Functions, the Givers of Power (in order of use)
+"" Functions
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 function! FoldText()

+ 1 - 0
zsh/oh-my-zsh-custom/ack.zsh

@@ -0,0 +1 @@
+alias ackl='ack -a --ignore-dir=webroot'

+ 11 - 0
zsh/oh-my-zsh-custom/git.zsh

@@ -1,13 +1,24 @@
 ## preferred git shortcuts not in the git plugin
+#
 alias ga.='git add .'
 alias gs='git status'
 alias gd='git diff'
 alias gds='git diff --staged'
+
+alias gcob='git checkout -b'
+alias gf='git fetch'
+
+alias gbd='git branch -d'
+alias gbD='git branch -D'
+
 alias gl='git log --graph --date=relative --pretty="format:%C(yellow)%h %Cblue[%cn] %Creset%s... %cd"'
 alias gls='git log --graph --stat'
 alias glp='git log -p'
+
 alias gr='git rebase'
+
 alias gtrack='git branch --set-upstream $(current_branch) origin/$(current_branch)'
+
 # useful git plugin built-in ones include:
 #   ga, gc, gco, gb, gba, gm, grhh, ggpull, ggpush
 # ggpull translates into `git pull origin <current branch>`, same for ggpush

+ 1 - 43
zsh/oh-my-zsh-custom/ssh-agent.zsh

@@ -1,47 +1,5 @@
-# Keep ssh-agent persisting, even when in screen
-# Have not solved the issue of being unable to connect to ssh-agent in ubuntu
-# Have not had time to investigate oh-my-zsh's own ssh-agent plugin
-
 #############
 # SSH AGENT #
 #############
 
-# Don't do for OSX, as it has it's own handling of ssh-agent
-if [ `uname` != Darwin ]; then
-
-  # Check to see if SSH Agent is already running
-  agent_pid="$(ps -ef | grep "ssh-agent" | grep -v "grep" | awk '{print($2)}')"
-
-  # If the agent is not running (pid is zero length string)
-  if [[ -z "$agent_pid" ]]; then
-    # Start up SSH Agent
-
-    # this seems to be the proper method as opposed to `exec ssh-agent bash`
-    eval "$(ssh-agent)"
-
-    # if you have a passphrase on your key file you may or may
-    # not want to add it when logging in, so comment this out
-    # if asking for the passphrase annoys you
-    #ssh-add
-
-  # If the agent is running (pid is non zero)
-  else
-    # Connect to the currently running ssh-agent
-
-    # this doesn't work because for some reason the ppid is 1 both when
-    # starting from ~/.profile and when executing as `ssh-agent bash`
-    #agent_ppid="$(ps -ef | grep "ssh-agent" | grep -v "grep" | awk '{print($3)}')"
-    agent_ppid="$(($agent_pid - 1))"
-
-    # and the actual auth socket file name is simply numerically one less than
-    # the actual process id, regardless of what `ps -ef` reports as the ppid
-    agent_sock="$(find /tmp -path "*ssh*" -type s -iname "agent.$agent_ppid")"
-
-    echo "Agent pid $agent_pid"
-    export SSH_AGENT_PID="$agent_pid"
-
-    echo "Agent sock $agent_sock"
-    export SSH_AUTH_SOCK="$agent_sock"
-  fi
-fi
-
+zstyle :omz:plugins:ssh-agent agent-forwarding on

+ 1 - 1
zsh/zshrc

@@ -30,7 +30,7 @@ DISABLE_AUTO_TITLE="true"
 # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
 # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
 # Example format: plugins=(rails git textmate ruby lighthouse)
-plugins=(git vi-mode)
+plugins=(git vi-mode ssh-agent)
 
 source $ZSH/oh-my-zsh.sh