7f2c706a6945

Moar.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 30 Oct 2011 15:15:40 -0400
parents 61488a7c8ab9
children 30835aec3aee
branches/tags (none)
files .gitconfig vim/.vimrc vim/ftplugin/clojure/clojurefolding.vim vim/plugin/grep-operator.vim

Changes

--- a/.gitconfig	Tue Oct 25 20:54:53 2011 -0400
+++ b/.gitconfig	Sun Oct 30 15:15:40 2011 -0400
@@ -1,6 +1,6 @@
 [user]
-    name = Steve Losh
-    email = steve@stevelosh.com
+	name = Steve Losh
+	email = steve@stevelosh.com
 
 [core]
     pager = cat
--- a/vim/.vimrc	Tue Oct 25 20:54:53 2011 -0400
+++ b/vim/.vimrc	Sun Oct 30 15:15:40 2011 -0400
@@ -698,6 +698,10 @@
 " Substitute
 nnoremap <leader>s :%s//<left>
 
+" Emacs bindings in command line mode
+cnoremap <c-a> <home>
+cnoremap <c-e> <end>
+
 " Diffoff
 nnoremap <leader>D :diffoff!<cr>
 
@@ -883,6 +887,13 @@
 let g:ctrlp_working_path_mode = 0
 let g:ctrlp_match_window_reversed = 1
 let g:ctrlp_split_window = 0
+let g:ctrlp_prompt_mappings = {
+\ 'PrtSelectMove("j")':   ['<c-j>', '<down>', '<s-tab>'],
+\ 'PrtSelectMove("k")':   ['<c-k>', '<up>', '<tab>'],
+\ 'PrtHistory(-1)':       ['<c-n>'],
+\ 'PrtHistory(1)':        ['<c-p>'],
+\ 'ToggleFocus()':        ['<c-tab>'],
+\ }
 
 " }}}
 " Easymotion {{{
@@ -1133,18 +1144,13 @@
 " Note: If the text covered by a motion contains a newline it won't work.  Ack
 " searches line-by-line.
 
-nnoremap <silent> \a :<C-U>set opfunc=<SID>AckMotion<CR>g@
+nnoremap <silent> \a :set opfunc=<SID>AckMotion<CR>g@
 xnoremap <silent> \a :<C-U>call <SID>AckMotion(visualmode())<CR>
 
 function! s:CopyMotionForType(type)
     if a:type ==# 'v'
-        " From visual mode
         silent execute "normal! `<" . a:type . "`>y"
-    elseif a:type ==# 'line'
-        " Linewise motion
-        silent execute "normal! '[V']y"
-    else
-        " Charwise motion
+    elseif a:type ==# 'char'
         silent execute "normal! `[v`]y"
     endif
 endfunction
@@ -1154,8 +1160,7 @@
 
     call s:CopyMotionForType(a:type)
 
-    let pattern = escape(@@, "'")
-    execute "normal! :Ack! --literal '" . pattern . "'\<cr>"
+    execute "normal! :Ack! --literal " . shellescape(@@) . "\<cr>"
 
     let @@ = reg_save
 endfunction
--- a/vim/ftplugin/clojure/clojurefolding.vim	Tue Oct 25 20:54:53 2011 -0400
+++ b/vim/ftplugin/clojure/clojurefolding.vim	Sun Oct 30 15:15:40 2011 -0400
@@ -9,6 +9,8 @@
 function GetClojureFold()
       if getline(v:lnum) =~ '^\s*(defn.*\s'
             return ">1"
+      elseif getline(v:lnum) =~ '^\s*(def .*\s'
+            return ">1"
       elseif getline(v:lnum) =~ '^\s*(defmacro.*\s'
             return ">1"
       elseif getline(v:lnum) =~ '^\s*(ns.*\s'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/plugin/grep-operator.vim	Sun Oct 30 15:15:40 2011 -0400
@@ -0,0 +1,19 @@
+nnoremap <leader>g :set operatorfunc=<SID>GrepOperator<cr>g@
+vnoremap <leader>g :<C-U>call <SID>GrepOperator(visualmode())<cr>
+
+function! s:GrepOperator(type)
+    let saved_unnamed_register = @@
+
+    if a:type ==# 'v'
+        normal! `<v`>y
+    elseif a:type ==# 'char'
+        normal! `[v`]y
+    else
+        return
+    endif
+
+    silent execute "grep! -R " . shellescape(@@) . " ."
+    copen
+
+    let @@ = saved_unnamed_register
+endfunction