From a3fd73813f6ea55cf217ad42f2bf72ee76fba5bf Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 8 Apr 2015 11:19:35 -0400 Subject: [PATCH] Added sudo for zsh, added ;; for insert mode --- shells/zshrc | 1 + vim/vimrc | 4 +++- zsh/sudo.zsh | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 zsh/sudo.zsh diff --git a/shells/zshrc b/shells/zshrc index 1ad4f43..559ac77 100644 --- a/shells/zshrc +++ b/shells/zshrc @@ -269,6 +269,7 @@ source /home/stonewareslord/git/sync/zsh/theme-and-appearance.zsh source /home/stonewareslord/git/sync/zsh/completion.zsh source /home/stonewareslord/git/sync/zsh/key-bindings.zsh source /home/stonewareslord/git/sync/zsh/spectrum.zsh +source /home/stonewareslord/git/sync/zsh/sudo.zsh #source /home/stonewareslord/git/sync/zsh/misc.zsh #source /home/stonewareslord/git/sync/zsh/history.zsh diff --git a/vim/vimrc b/vim/vimrc index b8d6bfb..33d2f11 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -106,7 +106,7 @@ inoremap {} {}O inoremap {% {% %} inoremap [] [] inoremap ;; m`A;``a -"inoremap ;; A;o +inoremap ;; A;o "nnoremap ;; m"A;`" "nnoremap ;; A;o inoremap @@ -331,6 +331,8 @@ Plug 'vim-scripts/DirDiff.vim' "Directory diff | https://github.com/vim-scripts/DirDiff.vim Plug 'vim-scripts/DoxygenToolkit.vim' "Doxygen | https://github.com/vim-scripts/DoxygenToolkit.vim +Plug 'vim-scripts/SyntaxRange' + "Range of syntaxes | https://github.com/vim-scripts/SyntaxRange "DO NOT DELETE LINE ABOVE OR \bun WILL BREAK call plug#end() filetype plugin indent on diff --git a/zsh/sudo.zsh b/zsh/sudo.zsh new file mode 100644 index 0000000..e3ba399 --- /dev/null +++ b/zsh/sudo.zsh @@ -0,0 +1,21 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# sudo will be inserted before the command +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming +# +# ------------------------------------------------------------------------------ + +sudo-command-line() { + [[ -z $BUFFER ]] && zle up-history + [[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER" +} +zle -N sudo-command-line +# Defined shortcut keys: [Esc] [Esc] +bindkey "\e\e" sudo-command-line