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

Commit334cb16

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

File tree

2 files changed

+330
-161
lines changed

2 files changed

+330
-161
lines changed

‎runtime/lua/vim/filetype.lua‎

Lines changed: 113 additions & 113 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,14 @@ 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()
823-
vim.fn['dist#ft#FTbas']()
822+
bm=function(path,bufnr)
823+
require('vim.filetype.detect').bas(bufnr)
824824
end,
825-
bash=function()
826-
vim.fn['dist#ft#SetFileTypeSH']('bash')
825+
bash=function(path,bufnr)
826+
require('vim.filetype.detect').sh(path,bufnr,'bash')
827827
end,
828828
btm=function(path,bufnr)
829829
returnrequire('vim.filetype.detect').btm(bufnr)
@@ -834,38 +834,38 @@ local extension = {
834834
ch=function(path,bufnr)
835835
returnrequire('vim.filetype.detect').change(bufnr)
836836
end,
837-
com=function()
838-
vim.fn['dist#ft#BindzoneCheck']('dcl')
837+
com=function(path,bufnr)
838+
require('vim.filetype.detect').bindzone(bufnr,'dcl')
839839
end,
840-
cpt=function()
841-
vim.fn['dist#ft#FThtml']()
840+
cpt=function(path,bufnr)
841+
require('vim.filetype.detect').html(bufnr)
842842
end,
843-
csh=function()
844-
vim.fn['dist#ft#CSH']()
843+
csh=function(path,bufnr)
844+
require('vim.filetype.detect').csh(path,bufnr)
845845
end,
846846
d=function(path,bufnr)
847847
returnrequire('vim.filetype.detect').dtrace(bufnr)
848848
end,
849-
db=function()
850-
vim.fn['dist#ft#BindzoneCheck']('')
849+
db=function(path,bufnr)
850+
require('vim.filetype.detect').bindzone(bufnr,'')
851851
end,
852-
dtml=function()
853-
vim.fn['dist#ft#FThtml']()
852+
dtml=function(path,bufnr)
853+
require('vim.filetype.detect').html(bufnr)
854854
end,
855-
e=function()
856-
vim.fn['dist#ft#FTe']()
855+
e=function(path,bufnr)
856+
require('vim.filetype.detect').e(bufnr)
857857
end,
858-
ebuild=function()
859-
vim.fn['dist#ft#SetFileTypeSH']('bash')
858+
ebuild=function(path,bufnr)
859+
require('vim.filetype.detect').sh(path,bufnr,'bash')
860860
end,
861-
eclass=function()
862-
vim.fn['dist#ft#SetFileTypeSH']('bash')
861+
eclass=function(path,bufnr)
862+
require('vim.filetype.detect').sh(path,bufnr,'bash')
863863
end,
864864
ent=function(path,bufnr)
865865
require('vim.filetype.detect').ent(bufnr)
866866
end,
867-
env=function()
868-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
867+
env=function(path,bufnr)
868+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
869869
end,
870870
eu=function(path,bufnr)
871871
require('vim.filetype.detect').euphoria(bufnr)
@@ -886,31 +886,31 @@ local extension = {
886886
require('vim.filetype.detect').frm(bufnr)
887887
end,
888888
fs=function(path,bufnr)
889-
vim.fn['dist#ft#FTfs']()
889+
require('vim.filetype.detect').fs(bufnr)
890890
end,
891891
h=function(path,bufnr)
892892
require('vim.filetype.detect').header(bufnr)
893893
end,
894-
htm=function()
895-
vim.fn['dist#ft#FThtml']()
894+
htm=function(path,bufnr)
895+
require('vim.filetype.detect').html(bufnr)
896896
end,
897-
html=function()
898-
vim.fn['dist#ft#FThtml']()
897+
html=function(path,bufnr)
898+
require('vim.filetype.detect').html(bufnr)
899899
end,
900900
i=function(path,bufnr)
901901
require('vim.filetype.detect').progress_asm(bufnr)
902902
end,
903903
idl=function(path,bufnr)
904904
require('vim.filetype.detect').idl(bufnr)
905905
end,
906-
inc=function()
907-
vim.fn['dist#ft#FTinc']()
906+
inc=function(path,bufnr)
907+
require('vim.filetype.detect').inc(bufnr)
908908
end,
909909
inp=function(path,bufnr)
910910
require('vim.filetype.detect').inp(bufnr)
911911
end,
912-
ksh=function()
913-
vim.fn['dist#ft#SetFileTypeSH']('ksh')
912+
ksh=function(path,bufnr)
913+
require('vim.filetype.detect').sh(path,bufnr,'ksh')
914914
end,
915915
lst=function(path,bufnr)
916916
require('vim.filetype.detect').asm(bufnr)
@@ -941,17 +941,17 @@ local extension = {
941941
return'diff'
942942
end
943943
end,
944-
pl=function()
945-
vim.fn['dist#ft#FTpl']()
944+
pl=function(path,bufnr)
945+
require('vim.filetype.detect').pl(bufnr)
946946
end,
947-
pp=function()
948-
vim.fn['dist#ft#FTpp']()
947+
pp=function(path,bufnr)
948+
require('vim.filetype.detect').pp(bufnr)
949949
end,
950-
pro=function()
951-
vim.fn['dist#ft#ProtoCheck']('idlang')
950+
pro=function(path,bufnr)
951+
require('vim.filetype.detect').proto(bufnr,'idlang')
952952
end,
953-
pt=function()
954-
vim.fn['dist#ft#FThtml']()
953+
pt=function(path,bufnr)
954+
require('vim.filetype.detect').html('idlang')
955955
end,
956956
r=function(path,bufnr)
957957
require('vim.filetype.detect').r(bufnr)
@@ -968,23 +968,23 @@ local extension = {
968968
scd=function(path,bufnr)
969969
require('vim.filetype.detect').scd(bufnr)
970970
end,
971-
sh=function()
972-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
971+
sh=function(path,bufnr)
972+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
973973
end,
974-
shtml=function()
975-
vim.fn['dist#ft#FThtml']()
974+
shtml=function(path,bufnr)
975+
require('vim.filetype.detect').html(bufnr)
976976
end,
977977
sql=function(path,bufnr)
978978
require('vim.filetype.detect').sql(bufnr)
979979
end,
980-
stm=function()
981-
vim.fn['dist#ft#FThtml']()
980+
stm=function(path,bufnr)
981+
require('vim.filetype.detect').html(bufnr)
982982
end,
983-
tcsh=function()
984-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
983+
tcsh=function(path,bufnr)
984+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
985985
end,
986-
tex=function()
987-
vim.fn['dist#ft#FTtex']()
986+
tex=function(path,bufnr)
987+
require('vim.filetype.detect').tex(path,bufnr)
988988
end,
989989
tf=function(path,bufnr)
990990
require('vim.filetype.detect').tf(bufnr)
@@ -1300,63 +1300,63 @@ local filename = {
13001300
['.zcompdump']='zsh',
13011301
['.zshenv']='zsh',
13021302
['.zfbfmarks']='zsh',
1303-
['.alias']=function()
1304-
vim.fn['dist#ft#CSH']()
1303+
['.alias']=function(path,bufnr)
1304+
require('vim.filetype.detect').csh(path,bufnr)
13051305
end,
1306-
['.bashrc']=function()
1307-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1306+
['.bashrc']=function(path,bufnr)
1307+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13081308
end,
1309-
['.cshrc']=function()
1310-
vim.fn['dist#ft#CSH']()
1309+
['.cshrc']=function(path,bufnr)
1310+
require('vim.filetype.detect').csh(path,bufnr)
13111311
end,
1312-
['.env']=function()
1313-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1312+
['.env']=function(path,bufnr)
1313+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
13141314
end,
1315-
['.kshrc']=function()
1316-
vim.fn['dist#ft#SetFileTypeSH']('ksh')
1315+
['.kshrc']=function(path,bufnr)
1316+
require('vim.filetype.detect').sh(path,bufnr,'ksh')
13171317
end,
1318-
['.login']=function()
1319-
vim.fn['dist#ft#CSH']()
1318+
['.login']=function(path,bufnr)
1319+
require('vim.filetype.detect').csh(path,bufnr)
13201320
end,
1321-
['.profile']=function()
1322-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1321+
['.profile']=function(path,bufnr)
1322+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
13231323
end,
1324-
['.tcshrc']=function()
1325-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
1324+
['.tcshrc']=function(path,bufnr)
1325+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
13261326
end,
1327-
['/etc/profile']=function()
1328-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1327+
['/etc/profile']=function(path,bufnr)
1328+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
13291329
end,
1330-
APKBUILD=function()
1331-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1330+
APKBUILD=function(path,bufnr)
1331+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13321332
end,
1333-
PKGBUILD=function()
1334-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1333+
PKGBUILD=function(path,bufnr)
1334+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13351335
end,
1336-
['bash.bashrc']=function()
1337-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1336+
['bash.bashrc']=function(path,bufnr)
1337+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13381338
end,
1339-
bashrc=function()
1340-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1339+
bashrc=function(path,bufnr)
1340+
require('vim.filetype.detect').sh(path,bufnr,'bash')
13411341
end,
13421342
crontab=starsetf('crontab'),
1343-
['csh.cshrc']=function()
1344-
vim.fn['dist#ft#CSH']()
1343+
['csh.cshrc']=function(path,bufnr)
1344+
require('vim.filetype.detect').csh(path,bufnr)
13451345
end,
1346-
['csh.login']=function()
1347-
vim.fn['dist#ft#CSH']()
1346+
['csh.login']=function(path,bufnr)
1347+
require('vim.filetype.detect').csh(path,bufnr)
13481348
end,
1349-
['csh.logout']=function()
1350-
vim.fn['dist#ft#CSH']()
1349+
['csh.logout']=function(path,bufnr)
1350+
require('vim.filetype.detect').csh(path,bufnr)
13511351
end,
1352-
['indent.pro']=function()
1353-
vim.fn['dist#ft#ProtoCheck']('indent')
1352+
['indent.pro']=function(path,bufnr)
1353+
require('vim.filetype.detect').proto(bufnr,'indent')
13541354
end,
1355-
['tcsh.login']=function()
1356-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
1355+
['tcsh.login']=function(path,bufnr)
1356+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
13571357
end,
1358-
['tcsh.tcshrc']=function()
1359-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
1358+
['tcsh.tcshrc']=function(path,bufnr)
1359+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
13601360
end,
13611361
-- END FILENAME
13621362
}
@@ -1528,32 +1528,32 @@ local pattern = {
15281528
['.*/etc/xdg/menus/.*%.menu']='xml',
15291529
['.*Xmodmap']='xmodmap',
15301530
['.*/etc/zprofile']='zsh',
1531-
['%.bash[_-]aliases']=function()
1532-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1531+
['%.bash[_-]aliases']=function(path,bufnr)
1532+
require('vim.filetype.detect').sh(path,bufnr,'bash')
15331533
end,
1534-
['%.bash[_-]logout']=function()
1535-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1534+
['%.bash[_-]logout']=function(path,bufnr)
1535+
require('vim.filetype.detect').sh(path,bufnr,'bash')
15361536
end,
1537-
['%.bash[_-]profile']=function()
1538-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1537+
['%.bash[_-]profile']=function(path,bufnr)
1538+
require('vim.filetype.detect').sh(path,bufnr,'bash')
15391539
end,
1540-
['%.cshrc.*']=function()
1541-
vim.fn['dist#ft#CSH']()
1540+
['%.cshrc.*']=function(path,bufnr)
1541+
require('vim.filetype.detect').csh(path,bufnr)
15421542
end,
15431543
['%.gtkrc.*']=starsetf('gtkrc'),
1544-
['%.kshrc.*']=function()
1545-
vim.fn['dist#ft#SetFileTypeSH']('ksh')
1544+
['%.kshrc.*']=function(path,bufnr)
1545+
require('vim.filetype.detect').sh(path,bufnr,'ksh')
15461546
end,
1547-
['%.login.*']=function()
1548-
vim.fn['dist#ft#CSH']()
1547+
['%.login.*']=function(path,bufnr)
1548+
require('vim.filetype.detect').csh(path,bufnr)
15491549
end,
15501550
['%.neomuttrc.*']=starsetf('neomuttrc'),
1551-
['%.profile.*']=function()
1552-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1551+
['%.profile.*']=function(path,bufnr)
1552+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
15531553
end,
15541554
['%.reminders.*']=starsetf('remind'),
1555-
['%.tcshrc.*']=function()
1556-
vim.fn['dist#ft#SetFileTypeShell']('tcsh')
1555+
['%.tcshrc.*']=function(path,bufnr)
1556+
require('vim.filetype.detect').shell(path,bufnr,'tcsh')
15571557
end,
15581558
['%.zcompdump.*']=starsetf('zsh'),
15591559
['%.zlog.*']=starsetf('zsh'),
@@ -1592,8 +1592,8 @@ local pattern = {
15921592
['.*/etc/logcheck/.*%.d.*/.*']=starsetf('logcheck'),
15931593
['.*/etc/modprobe%..*']=starsetf('modconf'),
15941594
['.*/etc/pam%.d/.*']=starsetf('pamconf'),
1595-
['.*/etc/profile']=function()
1596-
vim.fn['dist#ft#SetFileTypeSH'](vim.fn.getline(1))
1595+
['.*/etc/profile']=function(path,bufnr)
1596+
require('vim.filetype.detect').sh(path,bufnr,vim.fn.getline(1))
15971597
end,
15981598
['.*/etc/proftpd/.*%.conf.*']=starsetf('apachestyle'),
15991599
['.*/etc/proftpd/conf%..*/.*']=starsetf('apachestyle'),
@@ -1621,8 +1621,8 @@ local pattern = {
16211621
['access%.conf.*']=starsetf('apache'),
16221622
['apache%.conf.*']=starsetf('apache'),
16231623
['apache2%.conf.*']=starsetf('apache'),
1624-
['bash%-fc[-%.]']=function()
1625-
vim.fn['dist#ft#SetFileTypeSH']('bash')
1624+
['bash%-fc[-%.]']=function(path,bufnr)
1625+
require('vim.filetype.detect').sh(path,bufnr,'bash')
16261626
end,
16271627
['cabal%.project%..*']=starsetf('cabalproject'),
16281628
['crontab%..*']=starsetf('crontab'),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp