Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit 96506691d974744c6c46e0a2617f02e1b4746525 @jasoncodes committed Oct 23, 2012
Showing with 56 additions and 0 deletions.
  1. +18 −0 README.markdown
  2. +37 −0 autoload/ctrlp/modified.vim
  3. +1 −0 plugin/ctrlp-modified.vim
@@ -0,0 +1,18 @@
+# ctrlp-modified.vim
+
+Easily open locally modified files in your git-versioned projects.
+
+## Installation
+
+Add `ctrlp-modified` after `ctrlp` in your [Vundle](https://github.com/gmarik/vundle) config:
+
+``` vim
+Bundle 'kien/ctrlp.vim'
+Bundle 'jasoncodes/ctrlp-modified.vim'
+```
+
+Then set yourself up a mapping:
+
+``` vim
+map <Leader>m :CtrlPModified<CR>
+```
@@ -0,0 +1,37 @@
+if exists('g:loaded_ctrlp_modified') && g:loaded_ctrlp_modified
+ finish
+endif
+let g:loaded_ctrlp_modified = 1
+
+let s:modified_var = {
+\ 'init': 'ctrlp#modified#init()',
+\ 'exit': 'ctrlp#modified#exit()',
+\ 'accept': 'ctrlp#modified#accept',
+\ 'lname': 'modified',
+\ 'sname': 'modified',
+\ 'type': 'path',
+\ 'sort': 0,
+\}
+
+if exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
+ let g:ctrlp_ext_vars = add(g:ctrlp_ext_vars, s:modified_var)
+else
+ let g:ctrlp_ext_vars = [s:modified_var]
+endif
+
+function! ctrlp#modified#init()
+ return split(system("git ls-files --modified --others --exclude-standard"), "\n")
+endfunc
+
+function! ctrlp#modified#accept(mode, str)
+ call ctrlp#exit()
+ execute "e ".a:str
+endfunction
+
+function! ctrlp#modified#exit()
+endfunction
+
+let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
+function! ctrlp#modified#id()
+ return s:id
+endfunction
@@ -0,0 +1 @@
+command! CtrlPModified cal ctrlp#init(ctrlp#modified#id())

0 comments on commit 9650669

Please sign in to comment.