Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Display buffer modified/readonly status in :CtrlPBuffer #283

wants to merge 2 commits into from

2 participants


This adds a trailing status indicator for modified/readonly buffers:

> /etc/passwd [R]
> path/to/buffer1 [+]
> path/to/buffer2

I love CtrlP, but I really missed this feature from FuzzyFinder. It's useful in a variety of situations. For example, when vim tells me that there are unsaved buffers on exit, sometimes this surprises me and I quickly open the buffer list to see which buffer is not saved. Sometimes, I will execute a bufdo command that will potentially modify many buffers. I'll then go through the buffers one by one to inspect and finalize the changes. The status indicators help me track which buffers are not yet visited by me.


Those indicators interfere with the matching. They also mess up the opening of the buffers because they are added at the source and become a part of the buffer names.

Personally, I'd just use :ls to get a more informative buffer list.


Sorry about that, I should have used it for a while before making the pull request.
How about the new version?


Just one small (negligible) issue. When in regexp mode, the indicators break the highlighting of the matched string:

> doc/ctrlp.txt [+]
r>> txt$

Normally txt should be highlighted.

@kien kien closed this in 1757bad

Thank you! This is good enough for now. I'll try to fix the issue with the highlighting later.

BTW, I've changed the format of the indicators to resemble the output of :ls.


Thank you, too.
I was planning to look at the issue myself, but I was too busy the last few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 20, 2012
  1. @zah
Commits on Sep 21, 2012
  1. @zah

    move the decorators to formatline

    zah authored
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 1 deletion.
  1. +13 −1 autoload/ctrlp.vim
14 autoload/ctrlp.vim
@@ -1302,9 +1302,21 @@ fu! ctrlp#progress(enum, ...)
" *** Paths {{{2
" Line formatting {{{3
+fu! s:BufStat(buf)
+ if getbufvar(a:buf, "&mod")
+ return " [+]"
+ elseif getbufvar(a:buf, "&ro")
+ return " [R]"
+ else
+ retu ""
+ endif
fu! s:formatline(str)
let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str)
- retu '> '.( cond ? s:pathshorten(a:str) : a:str )
+ let res = '> '.( cond ? s:pathshorten(a:str) : a:str )
+ if s:itemtype == 1 | let res .= s:BufStat(a:str) | en
+ retu res
fu! s:pathshorten(str)
Something went wrong with that request. Please try again.