view runtime/ftplugin/obse.vim @ 35792:f4b25cf637e7 v9.1.0616

patch 9.1.0616: filetype: Make syntax highlighting off for MS Makefiles Commit: https://github.com/vim/vim/commit/eb4b903c9b238ebcc1d14cfcb207129b4931a33d Author: Ken Takata <kentkt@csc.jp> Date: Thu Jul 25 21:07:13 2024 +0200 patch 9.1.0616: filetype: Make syntax highlighting off for MS Makefiles Problem: filetype: Make syntax highlighting off for MS Makefiles Solution: Try to detect MS Makefiles and adjust syntax rules to it. (Ken Takata) Highlighting of variable expansion in Microsoft Makefile can be broken. E.g.: https://github.com/vim/vim/blob/2979cfc2627d76a9c09cad46a1647dcd4aa73f5f/src/Make_mvc.mak#L1331 Don't use backslash as escape characters if `make_microsoft` is set. Also fix that `make_no_comments` was not considered if `make_microsoft` was set. Also add description for `make_microsoft` and `make_no_comments` to the documentation and include a very simple filetype test closes: #15341 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Ken Takata <kentkt@csc.jp>
author Christian Brabandt <cb@256bit.org>
date Thu, 25 Jul 2024 21:30:04 +0200
parents 7c7432a53a6c
children
line wrap: on
line source

" Vim filetype plugin file
" Language:    Oblivion Language (obl)
" Original Creator: Kat <katisntgood@gmail.com>
" Maintainer:  Kat <katisntgood@gmail.com>
" Created:     2021 Aug 08
" Last Change: 2022 Nov 13
"              2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')

if exists("b:did_ftplugin")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

let b:undo_ftplugin = "setl com< cms<"

noremap <script> <buffer> <silent> [[ <nop>
noremap <script> <buffer> <silent> ]] <nop>

noremap <script> <buffer> <silent> [] <nop>
noremap <script> <buffer> <silent> ][ <nop>

setlocal commentstring=;\ %s
setlocal comments=:;

function s:NextSection(type, backwards, visual)
    if a:visual
        normal! gv
    endif

  if a:type == 1
    let pattern = '\v(\n\n^\S|%^)'
    let flags = 'e'
  elseif a:type == 2
    let pattern = '\v^\S.*'
    let flags = ''
  endif

  if a:backwards
    let dir = '?'
  else
    let dir = '/'
  endif

  execute 'silent normal! ' . dir . pattern . dir . flags . "\r"
endfunction

noremap <script> <buffer> <silent> ]]
  \ :call <SID>NextSection(1, 0, 0)<cr>

noremap <script> <buffer> <silent> [[
  \ :call <SID>NextSection(1, 1, 0)<cr>

noremap <script> <buffer> <silent> ][
  \ :call <SID>NextSection(2, 0, 0)<cr>

noremap <script> <buffer> <silent> []
  \ :call <SID>NextSection(2, 1, 0)<cr>

vnoremap <script> <buffer> <silent> ]]
  \ :<c-u>call <SID>NextSection(1, 0, 1)<cr>
vnoremap <script> <buffer> <silent> [[
  \ :<c-u>call <SID>NextSection(1, 1, 1)<cr>
vnoremap <script> <buffer> <silent> ][
  \ :<c-u>call <SID>NextSection(2, 0, 1)<cr>
vnoremap <script> <buffer> <silent> []
  \ :<c-u>call <SID>NextSection(2, 1, 1)<cr>

let &cpo = s:cpo_save
unlet s:cpo_save