summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/safe-paste/safe-paste.plugin.zsh54
-rwxr-xr-xplugins/sublime/sublime.plugin.zsh2
-rw-r--r--themes/gianu.zsh-theme11
3 files changed, 66 insertions, 1 deletions
diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh
new file mode 100644
index 000000000..0aa97965f
--- /dev/null
+++ b/plugins/safe-paste/safe-paste.plugin.zsh
@@ -0,0 +1,54 @@
+# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html
+#
+# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed
+# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html
+
+# create a new keymap to use while pasting
+bindkey -N paste
+# make everything in this keymap call our custom widget
+bindkey -R -M paste "^@"-"\M-^?" paste-insert
+# these are the codes sent around the pasted text in bracketed
+# paste mode.
+# do the first one with both -M viins and -M vicmd in vi mode
+bindkey '^[[200~' _start_paste
+bindkey -M paste '^[[201~' _end_paste
+# insert newlines rather than carriage returns when pasting newlines
+bindkey -M paste -s '^M' '^J'
+
+zle -N _start_paste
+zle -N _end_paste
+zle -N zle-line-init _zle_line_init
+zle -N zle-line-finish _zle_line_finish
+zle -N paste-insert _paste_insert
+
+# switch the active keymap to paste mode
+function _start_paste() {
+ bindkey -A paste main
+}
+
+# go back to our normal keymap, and insert all the pasted text in the
+# command line. this has the nice effect of making the whole paste be
+# a single undo/redo event.
+function _end_paste() {
+#use bindkey -v here with vi mode probably. maybe you want to track
+#if you were in ins or cmd mode and restore the right one.
+ bindkey -e
+ LBUFFER+=$_paste_content
+ unset _paste_content
+}
+
+function _paste_insert() {
+ _paste_content+=$KEYS
+}
+
+function _zle_line_init() {
+ # Tell terminal to send escape codes around pastes.
+ [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004h'
+}
+
+function _zle_line_finish() {
+ # Tell it to stop when we leave zle, so pasting in other programs
+ # doesn't get the ^[[200~ codes around the pasted text.
+ [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004l'
+}
+
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index bfbc45a07..7a5ada337 100755
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -1,6 +1,6 @@
# Sublime Text 2 Aliases
-local _sublime_darwin_paths
+local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
diff --git a/themes/gianu.zsh-theme b/themes/gianu.zsh-theme
new file mode 100644
index 000000000..c7fe40665
--- /dev/null
+++ b/themes/gianu.zsh-theme
@@ -0,0 +1,11 @@
+# Oh-my-Zsh prompt created by gianu
+#
+# github.com/gianu
+# sgianazza@gmail.com
+
+PROMPT='[%{$fg_bold[white]%}%n%{$reset_color%}@%{$fg_bold[red]%}%m%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)%{$reset_color%}]$ '
+
+ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg_bold[green]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX=")"
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}"