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.
This commit is contained in:
Sanchayan Maity 2021-05-14 19:34:26 +05:30
parent 58fe622b66
commit 04b2a511e1
4 changed files with 24 additions and 3 deletions

View file

@ -0,0 +1,22 @@
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']) |

View file

@ -0,0 +1 @@
au BufRead,BufNewFile *.nix set filetype=nix

View file

@ -134,7 +134,6 @@ local init = function ()
use 'vim-pandoc/vim-pandoc-syntax'
-- Dhall & nix
use 'vmchale/dhall-vim'
use 'LnL7/vim-nix'
-- LISP
use {
'Olical/conjure',
@ -148,7 +147,6 @@ local init = function ()
}
use 'wlangstroth/vim-racket'
-- Other syntax highlighting support
use 'georgewitteman/vim-fish'
use 'inkarkat/SyntaxAttr.vim'
-- For statusline
use {

View file

@ -1,5 +1,5 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = { "bash", "c", "clojure", "cpp", "fennel", "java", "javascript", "jsdoc", "json", "lua", "python", "rust", "toml" },
ensure_installed = { "bash", "c", "clojure", "cpp", "fennel", "fish", "java", "javascript", "jsdoc", "json", "lua", "nix", "python", "rust", "toml" },
highlight = {
enable = true,
},