-
Notifications
You must be signed in to change notification settings - Fork 11
/
ft.vim
71 lines (61 loc) · 2.16 KB
/
ft.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"=============================================================================
" File: autoload/lh/ft.vim {{{1
" Author: Luc Hermitte <EMAIL:hermitte {at} free {dot} fr>
" <URL:http://github.com/LucHermitte/lh-vim-lib>
" License: GPLv3 with exceptions
" <URL:http://github.com/LucHermitte/lh-vim-lib/tree/master/License.md>
" Version: 5.2.1
let s:k_version = 50201
" Created: 28th Jan 2014
" Last Update: 15th Sep 2020
"------------------------------------------------------------------------
" Description:
" library functions related to filetype manipulations
"
"------------------------------------------------------------------------
" }}}1
"=============================================================================
let s:cpo_save=&cpo
set cpo&vim
"------------------------------------------------------------------------
" ## Misc Functions {{{1
" # Version {{{2
function! lh#ft#version()
return s:k_version
endfunction
" # Debug {{{2
let s:verbose = get(s:, 'verbose', 0)
function! lh#ft#verbose(...)
if a:0 > 0 | let s:verbose = a:1 | endif
return s:verbose
endfunction
function! s:Log(...)
call call('lh#log#this', a:000)
endfunction
function! s:Verbose(...)
if s:verbose
call call('s:Log', a:000)
endif
endfunction
function! lh#ft#debug(expr) abort
return eval(a:expr)
endfunction
"------------------------------------------------------------------------
" ## Exported functions {{{1
" Function: lh#ft#is_text(...) {{{3
function! lh#ft#is_text(...)
let ft = a:0 == 0 ? &ft : (a:1)
return ft =~ '^$\|text\|latex\|tex\|html\|docbk\|help\|mail\|man\|xhtml\|markdown\|rst\|gitcommit'
endfunction
" Function: lh#ft#is_script(...) {{{3
function! lh#ft#is_script(...) abort
let ft = a:0 == 0 ? &ft : (a:1)
return ft =~ 'sh$\|perl\|ruby\|python'
endfunction
"------------------------------------------------------------------------
" ## Internal functions {{{1
" }}}1
"------------------------------------------------------------------------
let &cpo=s:cpo_save
"=============================================================================
" vim600: set fdm=marker: