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

Add and remove various vim plugins, move ssh auth socket to fixed place

Moving the socket ensures that the socket location in tmux shell environments
does not get stale, and so lose our ssh agent forwarding.
weiyi 11 лет назад
Родитель
Сommit
2430f88415
4 измененных файлов с 59 добавлено и 24 удалено
  1. 15 0
      vim/settings/incsearch.vim
  2. 7 10
      vim/vimrc
  3. 26 14
      vim/vimrc.bundles
  4. 11 0
      zsh/omz-custom/ssh-add.zsh

+ 15 - 0
vim/settings/incsearch.vim

@@ -0,0 +1,15 @@
+" incsearch.vim: Improved incremental searching
+
+" Basic Usage
+map /  <Plug>(incsearch-forward)
+map ?  <Plug>(incsearch-backward)
+map g/ <Plug>(incsearch-stay)
+
+" Autoremove search highlighting
+let g:incsearch#auto_nohlsearch = 1
+map n  <Plug>(incsearch-nohl-n)
+map N  <Plug>(incsearch-nohl-N)
+map *  <Plug>(incsearch-nohl-*)
+map #  <Plug>(incsearch-nohl-#)
+map g* <Plug>(incsearch-nohl-g*)
+map g# <Plug>(incsearch-nohl-g#)

+ 7 - 10
vim/vimrc

@@ -1,6 +1,12 @@
 " Do not try to be compatible with vi
 " Do not try to be compatible with vi
 set nocompatible
 set nocompatible
 
 
+" Formatting for JSON files
+au FileType json setlocal equalprg=python\ -m\ json.tool
+
+" Remap vim's 'increment next number' to <C-b> since <C-a> is used by tmux.
+nnoremap <C-b> <C-a>
+
 if has("autocmd")
 if has("autocmd")
   " Clear existing autocmd
   " Clear existing autocmd
   autocmd!
   autocmd!
@@ -38,6 +44,7 @@ set shiftwidth=2    " amount to indent with > and <
 set smarttab        " backspace tabs where appropriate even if spaces
 set smarttab        " backspace tabs where appropriate even if spaces
 set textwidth=80    " try to keep text within 80 characters
 set textwidth=80    " try to keep text within 80 characters
 set colorcolumn=+1  " mark out the limits of the textwidth
 set colorcolumn=+1  " mark out the limits of the textwidth
+set hidden
 
 
 set mouse=a
 set mouse=a
 set nojoinspaces                " Prevents inserting two spaces after punctuation on a join (J)
 set nojoinspaces                " Prevents inserting two spaces after punctuation on a join (J)
@@ -94,16 +101,6 @@ nnoremap <silent> <leader>l :set list!<CR>
 " Toggle scrollbind for moving multiple splits in sync together
 " Toggle scrollbind for moving multiple splits in sync together
 nnoremap <silent> <leader>s :set scrollbind! scrollbind?<CR>
 nnoremap <silent> <leader>s :set scrollbind! scrollbind?<CR>
 
 
-" Backspace to clear current search (and stop highlighting)
-nnoremap <silent> <backspace> :call ClearSearch()<CR>
-
-function! ClearSearch()
-  if (@/ != "")
-    let @/=""
-    redraw
-  endif
-endfunction
-
 " Allow using the repeat operator with a visual selection (!)
 " Allow using the repeat operator with a visual selection (!)
 " http://stackoverflow.com/a/8064607/127816
 " http://stackoverflow.com/a/8064607/127816
 vnoremap . :normal .<CR>
 vnoremap . :normal .<CR>

+ 26 - 14
vim/vimrc.bundles

@@ -19,15 +19,15 @@ call vundle#rc()
 " Vundle managing itself!
 " Vundle managing itself!
 Bundle 'gmarik/vundle'
 Bundle 'gmarik/vundle'
 
 
-if executable('ack-grep')
-  let g:ackprg="ack-grep -H --nocolor --nogroup --column"
-  Bundle 'mileszs/ack.vim'
-elseif executable('ack')
-  Bundle 'mileszs/ack.vim'
-elseif executable('ag')
-  Bundle 'mileszs/ack.vim'
-  let g:ackprg = 'ag --nogroup --nocolor --column --smart-case'
-endif
+"if executable('ack-grep')
+  "let g:ackprg="ack-grep -H --nocolor --nogroup --column"
+  "Bundle 'mileszs/ack.vim'
+"elseif executable('ack')
+  "Bundle 'mileszs/ack.vim'
+"elseif executable('ag')
+  "Bundle 'mileszs/ack.vim'
+  "let g:ackprg = 'ag --nogroup --nocolor --column --smart-case'
+"endif
 
 
 Bundle 'kien/ctrlp.vim'
 Bundle 'kien/ctrlp.vim'
 Bundle 'tacahiroy/ctrlp-funky'
 Bundle 'tacahiroy/ctrlp-funky'
@@ -37,21 +37,32 @@ Bundle 'kshenoy/vim-signature'
 
 
 Bundle 'nathanaelkane/vim-indent-guides'
 Bundle 'nathanaelkane/vim-indent-guides'
 Bundle 'altercation/vim-colors-solarized'
 Bundle 'altercation/vim-colors-solarized'
-Bundle 'cinaeco/EasyGrep'
+"Bundle 'cinaeco/EasyGrep'
 
 
 Bundle 'tpope/vim-surround'
 Bundle 'tpope/vim-surround'
-Bundle 'spf13/vim-autoclose'
+"Bundle 'spf13/vim-autoclose'
+Bundle 'Raimondi/delimitMate'
 Bundle 'terryma/vim-multiple-cursors'
 Bundle 'terryma/vim-multiple-cursors'
 Bundle 'matchit.zip'
 Bundle 'matchit.zip'
-Bundle 'sjl/gundo.vim'
+"Bundle 'sjl/gundo.vim'
 Bundle 'tpope/vim-abolish.git'
 Bundle 'tpope/vim-abolish.git'
+Bundle 'tpope/vim-unimpaired.git'
 Bundle 'scrooloose/syntastic'
 Bundle 'scrooloose/syntastic'
-Bundle 'mattn/webapi-vim'
+"Bundle 'mattn/webapi-vim'
 Bundle 'tpope/vim-fugitive'
 Bundle 'tpope/vim-fugitive'
-Bundle 'mattn/gist-vim'
+"Bundle 'mattn/gist-vim'
 Bundle 'scrooloose/nerdcommenter'
 Bundle 'scrooloose/nerdcommenter'
 Bundle 'godlygeek/tabular'
 Bundle 'godlygeek/tabular'
 Bundle 'tristen/vim-sparkup'
 Bundle 'tristen/vim-sparkup'
+Bundle 'haya14busa/incsearch.vim'
+Bundle 'katono/rogue.vim'
+
+" Text Objects {{{
+Bundle 'kana/vim-textobj-user'
+Bundle 'kana/vim-textobj-entire'
+Bundle 'bkad/CamelCaseMotion'
+Bundle 'vim-scripts/argtextobj.vim'
+" }}}
 
 
 " File Browser {{{
 " File Browser {{{
 Bundle 'scrooloose/nerdtree'
 Bundle 'scrooloose/nerdtree'
@@ -87,6 +98,7 @@ Bundle 'quentindecock/vim-cucumber-align-pipes'
 Bundle 'kchmck/vim-coffee-script'
 Bundle 'kchmck/vim-coffee-script'
 Bundle 'mintplant/vim-literate-coffeescript'
 Bundle 'mintplant/vim-literate-coffeescript'
 Bundle 'groenewege/vim-less'
 Bundle 'groenewege/vim-less'
+Bundle 'elzr/vim-json'
 " }}}
 " }}}
 
 
 " }}}
 " }}}

+ 11 - 0
zsh/omz-custom/ssh-add.zsh

@@ -6,3 +6,14 @@
 if [[ `ssh-add -L | grep "^ssh-" | wc -l` -eq 0 ]]; then
 if [[ `ssh-add -L | grep "^ssh-" | wc -l` -eq 0 ]]; then
   ssh-add 2> /dev/null
   ssh-add 2> /dev/null
 fi
 fi
+
+# Put ssh authentication socket in predicatable place for ssh-agent forwarding.
+#
+# This allows us to overcome stale sockets in tmux.
+SOCK="/tmp/ssh-agent-$USER-tmux"
+if test $SSH_AUTH_SOCK && [ $SSH_AUTH_SOCK != $SOCK ]
+then
+    rm -f /tmp/ssh-agent-$USER-screen
+    ln -sf $SSH_AUTH_SOCK $SOCK
+    export SSH_AUTH_SOCK=$SOCK
+fi