summaryrefslogtreecommitdiff
path: root/.config/nvim/plugins/aerial.vim
blob: 9a6db49dc1eb620688d68e29d5993e3b1365f08b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
lua <<EOF
require('aerial').setup({
  filter_kind = false,
})

require('telescope').load_extension('aerial')
EOF

nnoremap <leader>a <cmd>AerialToggle!<CR>
nnoremap <leader>fa <cmd>Telescope aerial<CR>

" add aerial to tab switch filetypes
call add(g:NERDTreeStatusLineTabSwitchFiletypes, 'aerial')

" close Aerial and NERDTree if they are the only remaining windows
function AerialNERDTreeClose()
  if winnr('$') != 2
    return
  endif

  let window_filetypes = UtilityWinfiletypes()

  if index(window_filetypes, 'aerial') != -1 && index(window_filetypes, 'nerdtree') != -1
    " one quit suffices, since aerial and nerdtree close themselves
    quit
  endif
endfunction
autocmd BufEnter * call AerialNERDTreeClose()