mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	vim-patch:9.1.0972: filetype: TI linker map files are not recognized
Problem:  filetype: TI linker map files are not recognized
Solution: detect TI linker map files as lnkmap filetype
          (Wu, Zhenyu)
References:
https://downloads.ti.com/docs/esd/SPRUI03A/Content/SPRUI03A_HTML/linker_description.html
closes: vim/vim#16324
5113831d16
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Christian Clason
					
				
			
			
				
	
			
			
			
						parent
						
							493b6899ee
						
					
				
				
					commit
					0e880b5612
				
			
							
								
								
									
										16
									
								
								runtime/ftplugin/lnkmap.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								runtime/ftplugin/lnkmap.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
" Vim filetype plugin file
 | 
			
		||||
" Language:	TI Linker map
 | 
			
		||||
" Document:	https://downloads.ti.com/docs/esd/SPRUI03A/Content/SPRUI03A_HTML/linker_description.html
 | 
			
		||||
" Maintainer:	Wu, Zhenyu <wuzhenyu@ustc.edu>
 | 
			
		||||
" Last Change:	2024 Dec 25
 | 
			
		||||
 | 
			
		||||
if exists("b:did_ftplugin")
 | 
			
		||||
  finish
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
" Don't load another plugin for this buffer
 | 
			
		||||
let b:did_ftplugin = 1
 | 
			
		||||
 | 
			
		||||
let b:undo_ftplugin = "setl iskeyword<"
 | 
			
		||||
 | 
			
		||||
setl iskeyword+=.
 | 
			
		||||
@@ -736,7 +736,7 @@ local extension = {
 | 
			
		||||
  mk = detect.make,
 | 
			
		||||
  mak = detect.make,
 | 
			
		||||
  page = 'mallard',
 | 
			
		||||
  map = 'map',
 | 
			
		||||
  map = detect_line1('^%*+$', 'lnkmap', 'map'),
 | 
			
		||||
  mws = 'maple',
 | 
			
		||||
  mpl = 'maple',
 | 
			
		||||
  mv = 'maple',
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								runtime/syntax/lnkmap.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								runtime/syntax/lnkmap.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
" Vim syntax file
 | 
			
		||||
" Language:	TI Linker map
 | 
			
		||||
" Document:	https://downloads.ti.com/docs/esd/SPRUI03A/Content/SPRUI03A_HTML/linker_description.html
 | 
			
		||||
" Maintainer:	Wu, Zhenyu <wuzhenyu@ustc.edu>
 | 
			
		||||
" Last Change:	2024 Dec 25
 | 
			
		||||
 | 
			
		||||
if exists("b:current_syntax")
 | 
			
		||||
  finish
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
syn match lnkmapTime			">> .*$"
 | 
			
		||||
syn region lnkmapHeadline		start="^\*\+$" end="^\*\+$"
 | 
			
		||||
syn match lnkmapHeadline		"^[A-Z][-A-Z0-9 ']*\ze\%(:\|$\)"
 | 
			
		||||
syn match lnkmapSectionDelim		"^=\+$"
 | 
			
		||||
syn match lnkmapTableDelim		"\%(^\|\s\)\zs---*\ze\%($\|\s\)"
 | 
			
		||||
syn match lnkmapNumber			"\%(^\|\s\)\zs[0-9a-f]\+\ze\%($\|\s\)"
 | 
			
		||||
syn match lnkmapSections      		'\<\.\k\+\>'
 | 
			
		||||
syn match lnkmapFile			'[^ =]\+\%(\.\S\+\)\+\>'
 | 
			
		||||
syn match lnkmapLibFile			'[^ =]\+\.lib\>'
 | 
			
		||||
syn match lnkmapAttrib			'\<[RWIX]\+\>'
 | 
			
		||||
syn match lnkmapAttrib			'\s\zs--HOLE--\ze\%\(\s\|$\)'
 | 
			
		||||
syn keyword lnkmapAttrib		UNINITIALIZED
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
hi def link lnkmapTime			Comment
 | 
			
		||||
hi def link lnkmapHeadline		Title
 | 
			
		||||
hi def link lnkmapSectionDelim		PreProc
 | 
			
		||||
hi def link lnkmapTableDelim		PreProc
 | 
			
		||||
hi def link lnkmapNumber		Number
 | 
			
		||||
hi def link lnkmapSections		Macro
 | 
			
		||||
hi def link lnkmapFile			String
 | 
			
		||||
hi def link lnkmapLibFile		Special
 | 
			
		||||
hi def link lnkmapAttrib		Type
 | 
			
		||||
 | 
			
		||||
let b:current_syntax = "lnkmap"
 | 
			
		||||
@@ -459,7 +459,6 @@ func s:GetFilenameChecks() abort
 | 
			
		||||
    \ 'mallard': ['file.page'],
 | 
			
		||||
    "\ 'man': ['file.man'],
 | 
			
		||||
    \ 'manconf': ['/etc/man.conf', 'man.config', 'any/etc/man.conf'],
 | 
			
		||||
    \ 'map': ['file.map'],
 | 
			
		||||
    \ 'maple': ['file.mv', 'file.mpl', 'file.mws'],
 | 
			
		||||
    \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'],
 | 
			
		||||
    \ 'masm': ['file.masm'],
 | 
			
		||||
@@ -2765,6 +2764,24 @@ func Test_make_file()
 | 
			
		||||
  filetype off
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
func Test_map_file()
 | 
			
		||||
  filetype on
 | 
			
		||||
 | 
			
		||||
  " TI linker map file
 | 
			
		||||
  call writefile(['******************************************************************************', '               TMS320C6x Linker Unix v7.4.24                   ', '******************************************************************************'], 'Xfile.map', 'D')
 | 
			
		||||
  split Xfile.map
 | 
			
		||||
  call assert_equal('lnkmap', &filetype)
 | 
			
		||||
  bwipe!
 | 
			
		||||
 | 
			
		||||
  " TI linker map file
 | 
			
		||||
  call writefile(['MAP', 'NAME "local-demo"', 'END'], 'Xfile.map', 'D')
 | 
			
		||||
  split Xfile.map
 | 
			
		||||
  call assert_equal('map', &filetype)
 | 
			
		||||
  bwipe!
 | 
			
		||||
 | 
			
		||||
  filetype off
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
func Test_org_file()
 | 
			
		||||
  filetype on
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user