Skip to content

Commit

Permalink
Update g:netrw_list_hide from 'wildignore'
Browse files Browse the repository at this point in the history
(1) s:setup_vinegar() is called two times; second time &wig is empty, use netrw save w:netrw_wigkeep
(2) Fixed index bug in existing code and in its copy of it: from [-strlen(s:dotfiles)-1:-1] to [-strlen(s:dotfiles):-1]

see also tpope#69
  • Loading branch information
kiryph committed Jun 23, 2016
1 parent 6594465 commit 342115e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugin/vinegar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let g:netrw_sort_sequence = '[\/]$,*,\%(' . join(map(split(&suffixes, ','), 'esc
let s:escape = 'substitute(escape(v:val, ".$~"), "*", ".*", "g")'
let g:netrw_list_hide =
\ join(map(split(&wildignore, ','), '"^".' . s:escape . '. "$"'), ',') . ',^\.\.\=/\=$' .
\ (get(g:, 'netrw_list_hide', '')[-strlen(s:dotfiles)-1:-1] ==# s:dotfiles ? ','.s:dotfiles : '')
\ (get(g:, 'netrw_list_hide', '')[-strlen(s:dotfiles):-1] ==# s:dotfiles ? ','.s:dotfiles : '')
if !exists("g:netrw_banner")
let g:netrw_banner = 0
endif
Expand Down Expand Up @@ -75,10 +75,11 @@ function! s:escaped(first, last) abort
endfunction

function! s:setup_vinegar() abort
unsilent echo "Updating g:netrw_list_hide within s:setup_vinegar()"
let g:netrw_list_hide =
\ join(map(split(&wildignore, ','), '"^".' . s:escape . '. "$"'), ',') . ',^\.\.\=/\=$' .
\ (get(g:, 'netrw_list_hide', '')[-strlen(s:dotfiles)-1:-1] ==# s:dotfiles ? ','.s:dotfiles : '')
if exists("w:netrw_wigkeep")
let g:netrw_list_hide =
\ join(map(split(w:netrw_wigkeep, ','), '"^".' . s:escape . '. "$"'), ',') . ',^\.\.\=/\=$' .
\ (get(g:, 'netrw_list_hide', '')[-strlen(s:dotfiles):-1] ==# s:dotfiles ? ','.s:dotfiles : '')
endif
if empty(s:netrw_up)
" save netrw mapping
let s:netrw_up = substitute(maparg('-', 'n'), '\c^:\%(<c-u>\)\=', '', '')
Expand Down

0 comments on commit 342115e

Please sign in to comment.