Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8f478fc

Browse files
committed
refactor(runtime): convert the remaining dist#ft functions to lua
1 parentd7dd600 commit8f478fc

File tree

2 files changed

+323
-154
lines changed

2 files changed

+323
-154
lines changed

‎runtime/lua/vim/filetype.lua‎

Lines changed: 110 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,8 @@ local extension = {
786786
zut='zimbutempl',
787787
zsh='zsh',
788788
vala='vala',
789-
E=function()
790-
vim.fn['dist#ft#FTe']()
789+
E=function(path,bufnr)
790+
require('vim.filetype.detect').e(bufnr)
791791
end,
792792
EU=function(path,bufnr)
793793
returnrequire('vim.filetype.detect').euphoria(bufnr)
@@ -804,8 +804,8 @@ local extension = {
804804
EXW=function(path,bufnr)
805805
returnrequire('vim.filetype.detect').euphoria(bufnr)
806806
end,
807-
PL=function()
808-
vim.fn['dist#ft#FTpl']()
807+
PL=function(path,bufnr)
808+
require('vim.filetype.detect').pl(bufnr)
809809
end,
810810
R=function(path,bufnr)
811811
require('vim.filetype.detect').r(bufnr)
@@ -816,14 +816,15 @@ local extension = {
816816
bas=function(path,bufnr)
817817
require('vim.filetype.detect').bas(bufnr)
818818
end,
819-
bi=function()
820-
vim.fn['dist#ft#FTbas']()
819+
bi=function(path,bufnr)
820+
require('vim.filetype.detect').bas(bufnr)
821821
end,
822-
bm=function()
822+
bm=function(path,bufnr)
823823
vim.fn['dist#ft#FTbas']()
824+
require('vim.filetype.detect').bas(bufnr)
824825
end,
825-
bash=function()
826-
vim.fn['dist#ft#SetFileTypeSH']('bash')
826+
bash=function(path,bufnr)
827+
require('vim.filetype.detect').sh(path,bufnr,'bash')
827828
end,
828829
btm=function(path,bufnr)
829830
returnrequire('vim.filetype.detect').btm(bufnr)
@@ -834,38 +835,38 @@ local extension = {
834835
ch=function(path,bufnr)
835836
returnrequire('vim.filetype.detect').change(bufnr)
836837
end,
837-
com=function()
838-
vim.fn['dist#ft#BindzoneCheck']('dcl')
838+
com=function(path,bufnr)
839+
require('vim.filetype.detect').bindzone(bufnr,'dcl')
839840
end,
840-
cpt=function()
841-
vim.fn['dist#ft#FThtml']()
841+
cpt=function(path,bufnr)
842+
require('vim.filetype.detect').html(bufnr)
842843
end,
843-
csh=function()
844-
vim.fn['dist#ft#CSH']()
844+
csh=function(path,bufnr)
845+
require('vim.filetype.detect').csh(path,bufnr)
845846
end,
846847
d=function(path,bufnr)
847848
returnrequire('vim.filetype.detect').dtrace(bufnr)
848849
end,
849-
db=function()
850-
vim.fn['dist#ft#BindzoneCheck']('')
850+
db=function(path,bufnr)
851+
require('vim.filetype.detect').bindzone(bufnr,'')
851852
end,
852-
dtml=function()
853-
vim.fn['dist#ft#FThtml']()
853+
dtml=function(path,bufnr)
854+
require('vim.filetype.detect').html(bufnr)
854855
end,
855-
e=function()
856-
vim.fn['dist#ft#FTe']()
856+
e=function(path,bufnr)
857+
require('vim.filetype.detect').e(bufnr)
857858
end,
858-
ebuild=function()
859-
vim.fn['dist#ft#SetFileTypeSH']('bash')
859+
ebuild=function(path,bufnr)
860+
require('vim.filetype.detect').sh(path,bufnr,'bash')
860861
end,
861-
eclass=function()
862-
vim.fn['dist#ft#SetFileTypeSH']('bash')
862+
eclass=function(path,bufnr)
863+
require('vim.filetype.detect').sh(path,bufnr,'bash')
863864
end,
864865
ent=function(path,bufnr)
865866
require('vim.filetype.detect').ent(bufnr)
866867
end,
867-
env=function()
868-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
868+
env=function(path,bufnr)
869+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
869870
end,
870871
eu=function(path,bufnr)
871872
require('vim.filetype.detect').euphoria(bufnr)
@@ -886,31 +887,31 @@ local extension = {
886887
require('vim.filetype.detect').frm(bufnr)
887888
end,
888889
fs=function(path,bufnr)
889-
vim.fn['dist#ft#FTfs']()
890+
require('vim.filetype.detect').fs(bufnr)
890891
end,
891892
h=function(path,bufnr)
892893
require('vim.filetype.detect').header(bufnr)
893894
end,
894-
htm=function()
895-
vim.fn['dist#ft#FThtml']()
895+
htm=function(path,bufnr)
896+
require('vim.filetype.detect').html(bufnr)
896897
end,
897-
html=function()
898-
vim.fn['dist#ft#FThtml']()
898+
html=function(path,bufnr)
899+
require('vim.filetype.detect').html(bufnr)
899900
end,
900901
i=function(path,bufnr)
901902
require('vim.filetype.detect').progress_asm(bufnr)
902903
end,
903904
idl=function(path,bufnr)
904905
require('vim.filetype.detect').idl(bufnr)
905906
end,
906-
inc=function()
907-
vim.fn['dist#ft#FTinc']()
907+
inc=function(path,bufnr)
908+
require('vim.filetype.detect').inc(bufnr)
908909
end,
909910
inp=function(path,bufnr)
910911
require('vim.filetype.detect').inp(bufnr)
911912
end,
912-
ksh=function()
913-
vim.fn['dist#ft#SetFileTypeSH']('ksh')
913+
ksh=function(path,bufnr)
914+
require('vim.filetype.detect').sh(path,bufnr,'ksh')
914915
end,
915916
lst=function(path,bufnr)
916917
require('vim.filetype.detect').asm(bufnr)
@@ -941,17 +942,17 @@ local extension = {
941942
return'diff'
942943
end
943944
end,
944-
pl=function()
945-
vim.fn['dist#ft#FTpl']()
945+
pl=function(path,bufnr)
946+
require('vim.filetype.detect').pl(bufnr)
946947
end,
947-
pp=function()
948-
vim.fn['dist#ft#FTpp']()
948+
pp=function(path,bufnr)
949+
require('vim.filetype.detect').pp(bufnr)
949950
end,
950-
pro=function()
951-
vim.fn['dist#ft#ProtoCheck']('idlang')
951+
pro=function(path,bufnr)
952+
require('vim.filetype.detect').proto(bufnr,'idlang')
952953
end,
953-
pt=function()
954-
vim.fn['dist#ft#FThtml']()
954+
pt=function(path,bufnr)
955+
require('vim.filetype.detect').html('idlang')
955956
end,
956957
r=function(path,bufnr)
957958
require('vim.filetype.detect').r(bufnr)
@@ -968,22 +969,22 @@ local extension = {
968969
scd=function(path,bufnr)
969970
require('vim.filetype.detect').scd(bufnr)
970971
end,
971-
sh=function()
972-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
972+
sh=function(path,bufnr)
973+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
973974
end,
974-
shtml=function()
975-
vim.fn['dist#ft#FThtml']()
975+
shtml=function(path,bufnr)
976+
require('vim.filetype.detect').html(bufnr)
976977
end,
977978
sql=function(path,bufnr)
978979
require('vim.filetype.detect').sql(bufnr)
979980
end,
980-
stm=function()
981-
vim.fn['dist#ft#FThtml']()
981+
stm=function(path,bufnr)
982+
require('vim.filetype.detect').html(bufnr)
982983
end,
983-
tcsh=function()
984-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
984+
tcsh=function(path,bufnr)
985+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
985986
end,
986-
tex=function()
987+
tex=function(path,bufnr)
987988
vim.fn['dist#ft#FTtex']()
988989
end,
989990
tf=function(path,bufnr)
@@ -1300,63 +1301,63 @@ local filename = {
13001301
['.zcompdump']='zsh',
13011302
['.zshenv']='zsh',
13021303
['.zfbfmarks']='zsh',
1303-
['.alias']=function()
1304-
vim.fn['dist#ft#CSH']()
1304+
['.alias']=function(path,bufnr)
1305+
require('vim.filetype.detect').csh(path,bufnr)
13051306
end,
1306-
['.bashrc']=function()
1307-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1307+
['.bashrc']=function(path,bufnr)
1308+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13081309
end,
1309-
['.cshrc']=function()
1310-
vim.fn['dist#ft#CSH']()
1310+
['.cshrc']=function(path,bufnr)
1311+
require('vim.filetype.detect').csh(path,bufnr)
13111312
end,
1312-
['.env']=function()
1313-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1313+
['.env']=function(path,bufnr)
1314+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
13141315
end,
1315-
['.kshrc']=function()
1316-
vim.fn['dist#ft#SetFileTypeSH']('ksh')
1316+
['.kshrc']=function(path,bufnr)
1317+
require('vim.filetype.detect').sh(path,bufnr,'ksh')
13171318
end,
1318-
['.login']=function()
1319-
vim.fn['dist#ft#CSH']()
1319+
['.login']=function(path,bufnr)
1320+
require('vim.filetype.detect').csh(path,bufnr)
13201321
end,
1321-
['.profile']=function()
1322-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1322+
['.profile']=function(path,bufnr)
1323+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
13231324
end,
1324-
['.tcshrc']=function()
1325-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
1325+
['.tcshrc']=function(path,bufnr)
1326+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
13261327
end,
1327-
['/etc/profile']=function()
1328-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1328+
['/etc/profile']=function(path,bufnr)
1329+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
13291330
end,
1330-
APKBUILD=function()
1331-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1331+
APKBUILD=function(path,bufnr)
1332+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13321333
end,
1333-
PKGBUILD=function()
1334-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1334+
PKGBUILD=function(path,bufnr)
1335+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13351336
end,
1336-
['bash.bashrc']=function()
1337-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1337+
['bash.bashrc']=function(path,bufnr)
1338+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13381339
end,
1339-
bashrc=function()
1340-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1340+
bashrc=function(path,bufnr)
1341+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13411342
end,
13421343
crontab=starsetf('crontab'),
1343-
['csh.cshrc']=function()
1344-
vim.fn['dist#ft#CSH']()
1344+
['csh.cshrc']=function(path,bufnr)
1345+
require('vim.filetype.detect').csh(path,bufnr)
13451346
end,
1346-
['csh.login']=function()
1347-
vim.fn['dist#ft#CSH']()
1347+
['csh.login']=function(path,bufnr)
1348+
require('vim.filetype.detect').csh(path,bufnr)
13481349
end,
1349-
['csh.logout']=function()
1350-
vim.fn['dist#ft#CSH']()
1350+
['csh.logout']=function(path,bufnr)
1351+
require('vim.filetype.detect').csh(path,bufnr)
13511352
end,
1352-
['indent.pro']=function()
1353-
vim.fn['dist#ft#ProtoCheck']('indent')
1353+
['indent.pro']=function(path,bufnr)
1354+
require('vim.filetype.detect').proto(bufnr,'indent')
13541355
end,
1355-
['tcsh.login']=function()
1356-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
1356+
['tcsh.login']=function(path,bufnr)
1357+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
13571358
end,
1358-
['tcsh.tcshrc']=function()
1359-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
1359+
['tcsh.tcshrc']=function(path,bufnr)
1360+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
13601361
end,
13611362
-- END FILENAME
13621363
}
@@ -1528,32 +1529,32 @@ local pattern = {
15281529
['.*/etc/xdg/menus/.*%.menu']='xml',
15291530
['.*Xmodmap']='xmodmap',
15301531
['.*/etc/zprofile']='zsh',
1531-
['%.bash[_-]aliases']=function()
1532-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1532+
['%.bash[_-]aliases']=function(path,bufnr)
1533+
require('vim.filetype.detect').sh(path,bufnr,'bash')
15331534
end,
1534-
['%.bash[_-]logout']=function()
1535-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1535+
['%.bash[_-]logout']=function(path,bufnr)
1536+
require('vim.filetype.detect').sh(path,bufnr,'bash')
15361537
end,
1537-
['%.bash[_-]profile']=function()
1538-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1538+
['%.bash[_-]profile']=function(path,bufnr)
1539+
require('vim.filetype.detect').sh(path,bufnr,'bash')
15391540
end,
1540-
['%.cshrc.*']=function()
1541-
vim.fn['dist#ft#CSH']()
1541+
['%.cshrc.*']=function(path,bufnr)
1542+
require('vim.filetype.detect').csh(path,bufnr)
15421543
end,
15431544
['%.gtkrc.*']=starsetf('gtkrc'),
1544-
['%.kshrc.*']=function()
1545-
vim.fn['dist#ft#SetFileTypeSH']('ksh')
1545+
['%.kshrc.*']=function(path,bufnr)
1546+
require('vim.filetype.detect').sh(path,bufnr,'ksh')
15461547
end,
1547-
['%.login.*']=function()
1548-
vim.fn['dist#ft#CSH']()
1548+
['%.login.*']=function(path,bufnr)
1549+
require('vim.filetype.detect').csh(path,bufnr)
15491550
end,
15501551
['%.neomuttrc.*']=starsetf('neomuttrc'),
1551-
['%.profile.*']=function()
1552-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1552+
['%.profile.*']=function(path,bufnr)
1553+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
15531554
end,
15541555
['%.reminders.*']=starsetf('remind'),
1555-
['%.tcshrc.*']=function()
1556-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
1556+
['%.tcshrc.*']=function(path,bufnr)
1557+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
15571558
end,
15581559
['%.zcompdump.*']=starsetf('zsh'),
15591560
['%.zlog.*']=starsetf('zsh'),
@@ -1593,7 +1594,7 @@ local pattern = {
15931594
['.*/etc/modprobe%..*']=starsetf('modconf'),
15941595
['.*/etc/pam%.d/.*']=starsetf('pamconf'),
15951596
['.*/etc/profile']=function()
1596-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1597+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
15971598
end,
15981599
['.*/etc/proftpd/.*%.conf.*']=starsetf('apachestyle'),
15991600
['.*/etc/proftpd/conf%..*/.*']=starsetf('apachestyle'),
@@ -1622,7 +1623,7 @@ local pattern = {
16221623
['apache%.conf.*']=starsetf('apache'),
16231624
['apache2%.conf.*']=starsetf('apache'),
16241625
['bash%-fc[-%.]']=function()
1625-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1626+
require('vim.filetype.detect').sh(path,bufnr,'bash')
16261627
end,
16271628
['cabal%.project%..*']=starsetf('cabalproject'),
16281629
['crontab%..*']=starsetf('crontab'),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp