aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/alternate_filetypes.vim
blob: 6e765feb1fbf618ebc8068fa50652170f3b20d52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
function! s:AlternateFileType() abort
  let filetypes = get(b:, 'alternate_filetypes', [&filetype])
  if &filetype !=# filetypes[0]
    let &filetype = filetypes[0]
  endif
  set filetype?
endfunction
command -bar AlternateFileType
      \ call s:AlternateFileType()
nnoremap <Plug>(AlternateFileType)
      \ :<C-U>AlternateFileType<CR>
nmap <Leader># <Plug>(AlternateFileType)
nmap <Leader>3 <Leader>#