From 9cca807999f3929ed8bc0d7981b0defab35c307e Mon Sep 17 00:00:00 2001 From: Runar Bjarnason Date: Thu, 25 Oct 2018 09:28:30 -0400 Subject: [PATCH 1/2] Added autogroup that gets cleared on sourcing --- ftdetect/fish.vim | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/ftdetect/fish.vim b/ftdetect/fish.vim index cbb7d0d..c286111 100644 --- a/ftdetect/fish.vim +++ b/ftdetect/fish.vim @@ -1,23 +1,28 @@ -autocmd BufRead,BufNewFile *.fish setfiletype fish +augroup vimfish -" Detect fish scripts by the shebang line. -autocmd BufRead * - \ if getline(1) =~# '\v^#!%(\f*/|/usr/bin/env\s*<)fish>' | - \ setlocal filetype=fish | - \ endif + autocmd! -" Move cursor to first empty line when using funced. -autocmd BufRead fish_funced_*_*.fish call search('^$') + autocmd BufRead,BufNewFile *.fish setfiletype fish -" Fish histories are YAML documents. -autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml + " Detect fish scripts by the shebang line. + autocmd BufRead * + \ if getline(1) =~# '\v^#!%(\f*/|/usr/bin/env\s*<)fish>' | + \ setlocal filetype=fish | + \ endif -" Universal variable storages should not be hand edited. -autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly + " Move cursor to first empty line when using funced. + autocmd BufRead fish_funced_*_*.fish call search('^$') -" Mimic `funced` when manually creating functions. -autocmd BufNewFile ~/.config/fish/functions/*.fish - \ call append(0, ['function '.expand('%:t:r'), - \'', - \'end']) | - \ 2 + " 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']) | + \ 2 +augroup END From 71d11dd5ca87dbe262b21921cb1592cadd2b222b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Mon, 10 Dec 2018 19:47:58 +0000 Subject: [PATCH 2/2] Update fish.vim --- ftdetect/fish.vim | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/ftdetect/fish.vim b/ftdetect/fish.vim index c286111..32b034a 100644 --- a/ftdetect/fish.vim +++ b/ftdetect/fish.vim @@ -1,28 +1,25 @@ -augroup vimfish +autocmd! - autocmd! +autocmd BufRead,BufNewFile *.fish setfiletype fish - 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 - " 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('^$') - " 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 - " 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 - " 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']) | - \ 2 -augroup END +" Mimic `funced` when manually creating functions. +autocmd BufNewFile ~/.config/fish/functions/*.fish + \ call append(0, ['function '.expand('%:t:r'), + \'', + \'end']) | + \ 2