mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:7517a8c: runtime(lf): improve syntax script, add filetype plugin
- Greatly improve detection and highlighting of command/shell regions,
input-device key labels, escape sequences (@joelim-work)
- Add ftplugin for formatoptions, toggling comment areas
(@andis-sprinkis)
- Add a few missing lf option keywords, rm. old non-working code, misc.
formatting (@andis-sprinkis)
closes: vim/vim#17078
7517a8cadf
Co-authored-by: Andis Spriņķis <andis@sprinkis.com>
This commit is contained in:

committed by
Christian Clason

parent
c73a827564
commit
ff2cbe8fac
22
runtime/ftplugin/lf.vim
Normal file
22
runtime/ftplugin/lf.vim
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: lf file manager configuration file (lfrc)
|
||||||
|
" Maintainer: Andis Sprinkis <andis@sprinkis.com>
|
||||||
|
" URL: https://github.com/andis-sprinkis/lf-vim
|
||||||
|
" Last Change: 6 Apr 2025
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin") | finish | endif
|
||||||
|
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
let s:cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setlocal comments< commentstring< formatoptions<"
|
||||||
|
|
||||||
|
setlocal comments=:#
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
|
setlocal formatoptions-=t formatoptions+=rol
|
||||||
|
|
||||||
|
let &cpo = s:cpo
|
||||||
|
unlet s:cpo
|
@@ -3,15 +3,13 @@
|
|||||||
" Maintainer: Andis Sprinkis <andis@sprinkis.com>
|
" Maintainer: Andis Sprinkis <andis@sprinkis.com>
|
||||||
" Former Maintainer: Cameron Wright
|
" Former Maintainer: Cameron Wright
|
||||||
" URL: https://github.com/andis-sprinkis/lf-vim
|
" URL: https://github.com/andis-sprinkis/lf-vim
|
||||||
" Last Change: 28 March 2025
|
" Last Change: 5 Apr 2025
|
||||||
" 29 Mar 2025 by Vim Project (save and restore 'cpo' setting)
|
|
||||||
"
|
"
|
||||||
" The shell syntax highlighting is configurable. See $VIMRUNTIME/doc/syntax.txt
|
" The shell syntax highlighting is configurable. See $VIMRUNTIME/doc/syntax.txt
|
||||||
" lf version: 34
|
" lf version: 34
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax") | finish | endif
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let s:cpo = &cpo
|
let s:cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
@@ -23,11 +21,7 @@ syn match lfComment '#.*$'
|
|||||||
|
|
||||||
"{{{ String Matching
|
"{{{ String Matching
|
||||||
syn match lfString "'.*'"
|
syn match lfString "'.*'"
|
||||||
syn match lfString '".*"' contains=lfVar,lfSpecial
|
syn match lfString '".*"' contains=lfSpecial
|
||||||
"}}}
|
|
||||||
|
|
||||||
"{{{ Match lf Variables
|
|
||||||
syn match lfVar '\$f\|\$fx\|\$fs\|\$id'
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"{{{ Keywords
|
"{{{ Keywords
|
||||||
@@ -45,6 +39,7 @@ syn keyword lfOptions
|
|||||||
\ cleaner
|
\ cleaner
|
||||||
\ clear
|
\ clear
|
||||||
\ clearmaps
|
\ clearmaps
|
||||||
|
\ cmaps
|
||||||
\ cmd-capitalize-word
|
\ cmd-capitalize-word
|
||||||
\ cmd-complete
|
\ cmd-complete
|
||||||
\ cmd-delete
|
\ cmd-delete
|
||||||
@@ -73,6 +68,7 @@ syn keyword lfOptions
|
|||||||
\ cmd-word
|
\ cmd-word
|
||||||
\ cmd-word-back
|
\ cmd-word-back
|
||||||
\ cmd-yank
|
\ cmd-yank
|
||||||
|
\ cmds
|
||||||
\ copy
|
\ copy
|
||||||
\ copyfmt
|
\ copyfmt
|
||||||
\ cursoractivefmt
|
\ cursoractivefmt
|
||||||
@@ -86,6 +82,7 @@ syn keyword lfOptions
|
|||||||
\ dirfirst
|
\ dirfirst
|
||||||
\ dironly
|
\ dironly
|
||||||
\ dirpreviews
|
\ dirpreviews
|
||||||
|
\ doc
|
||||||
\ down
|
\ down
|
||||||
\ draw
|
\ draw
|
||||||
\ drawbox
|
\ drawbox
|
||||||
@@ -127,6 +124,7 @@ syn keyword lfOptions
|
|||||||
\ load
|
\ load
|
||||||
\ locale
|
\ locale
|
||||||
\ low
|
\ low
|
||||||
|
\ maps
|
||||||
\ mark-load
|
\ mark-load
|
||||||
\ mark-remove
|
\ mark-remove
|
||||||
\ mark-save
|
\ mark-save
|
||||||
@@ -207,38 +205,33 @@ syn keyword lfOptions
|
|||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"{{{ Special Matching
|
"{{{ Special Matching
|
||||||
syn match lfSpecial '<.*>\|\\.'
|
syn match lfSpecial '\v\<[^>]+\>'
|
||||||
|
syn match lfSpecial '\v\\(["\\abfnrtv]|\o+)'
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"{{{ Shell Script Matching for cmd
|
"{{{ Shell Script Matching for cmd
|
||||||
let s:shell_syntax = get(g:, 'lf_shell_syntax', "syntax/sh.vim")
|
let s:shell_syntax = get(g:, 'lf_shell_syntax', "syntax/sh.vim")
|
||||||
let s:shell_syntax = get(b:, 'lf_shell_syntax', s:shell_syntax)
|
let s:shell_syntax = get(b:, 'lf_shell_syntax', s:shell_syntax)
|
||||||
|
|
||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
exe 'syn include @Shell '.s:shell_syntax
|
exe 'syn include @Shell '.s:shell_syntax
|
||||||
let b:current_syntax = "lf"
|
let b:current_syntax = "lf"
|
||||||
syn region lfIgnore start=".{{\n" end="^}}"
|
|
||||||
\ keepend contains=lfExternalShell,lfExternalPatch
|
syn region lfCommand matchgroup=lfCommandMarker start=' \zs:\ze' end='$' keepend transparent
|
||||||
syn match lfShell '\$[a-zA-Z].*$
|
syn region lfCommand matchgroup=lfCommandMarker start=' \zs:{{\ze' end='}}' keepend transparent
|
||||||
\\|:[a-zA-Z].*$
|
syn region lfShell matchgroup=lfShellMarker start=' \zs[$!%&]\ze' end='$' keepend contains=@Shell
|
||||||
\\|%[a-zA-Z].*$
|
syn region lfShell matchgroup=lfShellMarker start=' \zs[$!%&]{{\ze' end='}}' keepend contains=@Shell
|
||||||
\\|![a-zA-Z].*$
|
|
||||||
\\|&[a-zA-Z].*$'
|
|
||||||
\ transparent contains=@Shell,lfExternalPatch
|
|
||||||
syn match lfExternalShell "^.*$" transparent contained contains=@Shell
|
|
||||||
syn match lfExternalPatch "^\s*cmd\ .*\ .{{$\|^}}$" contained
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"{{{ Link Highlighting
|
"{{{ Link Highlighting
|
||||||
hi def link lfComment Comment
|
hi def link lfComment Comment
|
||||||
hi def link lfVar Type
|
hi def link lfSpecial SpecialChar
|
||||||
hi def link lfSpecial Special
|
|
||||||
hi def link lfString String
|
hi def link lfString String
|
||||||
hi def link lfKeyword Statement
|
hi def link lfKeyword Statement
|
||||||
hi def link lfOptions Constant
|
hi def link lfOptions Constant
|
||||||
hi def link lfConstant Constant
|
hi def link lfCommandMarker Special
|
||||||
hi def link lfExternalShell Normal
|
hi def link lfShellMarker Special
|
||||||
hi def link lfExternalPatch Special
|
|
||||||
hi def link lfIgnore Special
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
let &cpo = s:cpo
|
let &cpo = s:cpo
|
||||||
unlet s:cpo
|
unlet s:cpo
|
||||||
|
Reference in New Issue
Block a user