Merge pull request #556 from acarlson1029/readonly-glyph

Allow user-defined read-only indicator.
This commit is contained in:
Martin Grenfell 2016-04-26 08:58:18 +01:00
commit 7954eac006
4 changed files with 6 additions and 4 deletions

View File

@ -61,7 +61,7 @@ function! s:Path.cacheDisplayString() abort
endif endif
if self.isReadOnly if self.isReadOnly
let self.cachedDisplayString .= ' [RO]' let self.cachedDisplayString .= ' ['.g:NERDTreeGlyphReadOnly.']'
endif endif
endfunction endfunction

View File

@ -375,7 +375,7 @@ function! s:UI._stripMarkup(line, removeLeadingSpaces)
let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","") let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","")
"strip off any read only flag "strip off any read only flag
let line = substitute (line, ' \[RO\]', "","") exec 'let line = substitute (line, " \['.g:NERDTreeGlyphReadOnly.'\]", "","")'
"strip off any bookmark flags "strip off any bookmark flags
let line = substitute (line, ' {[^}]*}', "","") let line = substitute (line, ' {[^}]*}', "","")

View File

@ -84,6 +84,8 @@ else
endif endif
endif endif
call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
if !exists('g:NERDTreeStatusline') if !exists('g:NERDTreeStatusline')
"the exists() crap here is a hack to stop vim spazzing out when "the exists() crap here is a hack to stop vim spazzing out when

View File

@ -1,6 +1,6 @@
let s:tree_up_dir_line = '.. (up a dir)' let s:tree_up_dir_line = '.. (up a dir)'
syn match NERDTreeIgnore #\~# syn match NERDTreeIgnore #\~#
syn match NERDTreeIgnore #\[RO\]# exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#'
"highlighting for the .. (up dir) line at the top of the tree "highlighting for the .. (up dir) line at the top of the tree
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#" execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
@ -31,7 +31,7 @@ syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmar
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile' exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
"highlighting for readonly files "highlighting for readonly files
syn match NERDTreeRO # *\zs.*\ze \[RO\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile
syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir