aboutsummaryrefslogtreecommitdiff
path: root/plugin/max-splash.vim
blob: 5282679fc47a67d2a96ca4a1643bf6e7beefc963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"=======================================================================================================================
" MAX_SPLASH:
" Shows recently used files from the current directory in a location list
"=======================================================================================================================

" moved after VimEnter of statusline, so that it does not get overwritten any
" more
if empty(argv())

  " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val}))

  " from the list of recent files: make absolute paths, filter out files not
  " contained in cwd and finally filter out directories and non-files...
  autocmd StdinReadPre * let s:std_in=1
  autocmd VimEnter * if !exists("s:std_in") | call setloclist(0, [], 'r',
        \ {
        \   'title':'Recently used files in directory: '.getcwd(),
        \   'items':map(filter(filter(
        \               map(copy(v:oldfiles),
        \                   {_, p->expand(p)}), 'v:val =~ "'.getcwd().'/"'), 'filereadable(v:val)'),
        \               {_, p->{'filename': fnamemodify(p, ':.')}})
        \ }) | lopen | only | setfiletype qf
endif
..