aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload/filetype.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-01-03 17:27:37 +1300
committerTom Ryder <tom@sanctum.geek.nz>2020-01-03 17:27:37 +1300
commitd389cbec9bddfcb4418df43fa7dca7a837be1c3d (patch)
tree1476b0eeb6dacae5b491db726cb4f103e72aac22 /vim/autoload/filetype.vim
parentFix case sensitivity of an operator for vim-vint (diff)
downloaddotfiles-d389cbec9bddfcb4418df43fa7dca7a837be1c3d.tar.gz
dotfiles-d389cbec9bddfcb4418df43fa7dca7a837be1c3d.zip
Rename filetype repeat commands
Diffstat (limited to 'vim/autoload/filetype.vim')
-rw-r--r--vim/autoload/filetype.vim66
1 files changed, 0 insertions, 66 deletions
diff --git a/vim/autoload/filetype.vim b/vim/autoload/filetype.vim
deleted file mode 100644
index 6a66d62e..00000000
--- a/vim/autoload/filetype.vim
+++ /dev/null
@@ -1,66 +0,0 @@
-" Helper function to run the 'filetypedetect' group on a file with its
-" extension stripped off
-function! filetype#StripRepeat() abort
-
- " Check we have the fnameescape() function
- if !exists('*fnameescape')
- return
- endif
-
- " Expand the match result
- let fn = expand('<afile>')
-
- " Strip leading and trailing #hashes#
- if fn =~# '^#\+.*#\+$'
- let fn = substitute(fn, '^#\+\(.\+\)#\+$', '\1', '')
-
- " Strip trailing tilde~
- elseif fn =~# '\~$'
- let fn = substitute(fn, '\~$', '', '')
-
- " Strip generic .extension
- else
- let fn = expand('<afile>:r')
- endif
-
- " Re-run the group if there's anything left
- if strlen(fn)
- execute 'doautocmd filetypedetect BufRead ' . fnameescape(fn)
- endif
-
-endfunction
-
-" Helper function to run the 'filetypedetect' group on a file in a temporary
-" sudoedit(8) directory, modifying it with an attempt to reverse the temporary
-" filename change
-function! filetype#SudoRepeat() abort
-
- " Check we have the fnameescape() function
- if !exists('*fnameescape')
- return
- endif
-
- " Expand the match result
- let fn = expand('<afile>')
-
- " myfileXXQGS16A.conf: strip eight chars before final period
- if fn =~# '/[^/]\+\w\{8}\.[^./]\+$'
- let fr = expand('<afile>:r')
- let fe = expand('<afile>:e')
- let fn = strpart(fr, -8, strlen(fr)) . '.' . fe
-
- " myfile.XXQGS16A: strip extension
- elseif fn =~# '/[^/]\+\.\w\{8}$'
- let fn = expand('<afile>:r')
-
- " Unrecognised pattern; return, don't repeat
- else
- return
- endif
-
- " Re-run the group if there's anything left
- if strlen(fn)
- execute 'doautocmd filetypedetect BufRead ' . fnameescape(fn)
- endif
-
-endfunction