dotfiles/nvim/.config/nvim/ftdetect/fish.vim
Sanchayan Maity 04b2a511e1 nvim: treesitter: Add fish and nix
Drop the syntax highlighting plugins for fish and nix and switch to
treesitter. The ftdetect is taken from the respective plugins.

We might need to add the indent specific scripts for fish and nix
later since we are not enabling indent with treesitter.
2021-05-14 19:36:43 +05:30

23 lines
836 B
VimL

autocmd BufRead,BufNewFile *.fish setfiletype fish
" Detect fish scripts by the shebang line.
autocmd BufRead *
\ if getline(1) =~# '\v^#!%(\f*/|/usr/bin/env\s*<)fish>' |
\ setlocal filetype=fish |
\ endif
" Move cursor to first empty line when using funced.
autocmd BufRead fish_funced_*_*.fish call search('^$')
" Fish histories are YAML documents.
autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml
" Universal variable storages should not be hand edited.
autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly
" Mimic `funced` when manually creating functions.
autocmd BufNewFile ~/.config/fish/functions/*.fish
\ call append(0, ['function '.expand('%:t:r'),
\'',
\'end']) |