Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial commit.

  • Loading branch information...
commit 96506691d974744c6c46e0a2617f02e1b4746525 0 parents
Jason Weathered authored October 23, 2012
18  README.markdown
Source Rendered
... ...
@@ -0,0 +1,18 @@
  1
+# ctrlp-modified.vim
  2
+
  3
+Easily open locally modified files in your git-versioned projects.
  4
+
  5
+## Installation
  6
+
  7
+Add `ctrlp-modified` after `ctrlp` in your [Vundle](https://github.com/gmarik/vundle) config:
  8
+
  9
+``` vim
  10
+Bundle 'kien/ctrlp.vim'
  11
+Bundle 'jasoncodes/ctrlp-modified.vim'
  12
+```
  13
+
  14
+Then set yourself up a mapping:
  15
+
  16
+``` vim
  17
+map <Leader>m :CtrlPModified<CR>
  18
+```
37  autoload/ctrlp/modified.vim
... ...
@@ -0,0 +1,37 @@
  1
+if exists('g:loaded_ctrlp_modified') && g:loaded_ctrlp_modified
  2
+  finish
  3
+endif
  4
+let g:loaded_ctrlp_modified = 1
  5
+
  6
+let s:modified_var = {
  7
+\  'init':   'ctrlp#modified#init()',
  8
+\  'exit':   'ctrlp#modified#exit()',
  9
+\  'accept': 'ctrlp#modified#accept',
  10
+\  'lname':  'modified',
  11
+\  'sname':  'modified',
  12
+\  'type':   'path',
  13
+\  'sort':   0,
  14
+\}
  15
+
  16
+if exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
  17
+  let g:ctrlp_ext_vars = add(g:ctrlp_ext_vars, s:modified_var)
  18
+else
  19
+  let g:ctrlp_ext_vars = [s:modified_var]
  20
+endif
  21
+
  22
+function! ctrlp#modified#init()
  23
+  return split(system("git ls-files --modified --others --exclude-standard"), "\n")
  24
+endfunc
  25
+
  26
+function! ctrlp#modified#accept(mode, str)
  27
+  call ctrlp#exit()
  28
+  execute "e ".a:str
  29
+endfunction
  30
+
  31
+function! ctrlp#modified#exit()
  32
+endfunction
  33
+
  34
+let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
  35
+function! ctrlp#modified#id()
  36
+  return s:id
  37
+endfunction
1  plugin/ctrlp-modified.vim
... ...
@@ -0,0 +1 @@
  1
+command! CtrlPModified cal ctrlp#init(ctrlp#modified#id())

0 notes on commit 9650669

Please sign in to comment.
Something went wrong with that request. Please try again.