neovim/runtime/autoload/freebasic.vim
Sean Dewar cdb2c10011
vim-patch:8.2.0915: search() cannot skip over matches like searchpair() can
Problem:    Search() cannot skip over matches like searchpair() can.
Solution:   Add an optional "skip" argument. (Christian Brabandt, closes vim/vim#861)
adc17a5f9d

Enable skip arg usage in autoload/freebasic.vim

evalarg_T doesn't really matter because it's deleted in v8.2.0918 (and
reincarnated for Vim9 script in v8.2.1047), but I found out too late :P Anyway:

- Port evalarg_T into eval.h and use const char * and Callback fields
- Use EVALARG_INIT to initialize
- Return bool over OK/FAIL from evalarg functions
- Remove check from evalarg_clean as callback_free ignores None callbacks anyway
- Move eva_buf field into evalarg_get as a local (not sure what reason it has
  being in the struct)

N/A patches for version.c:

vim-patch:8.2.4355: unnecessary call to check_colorcolumn()

Problem:    Unnecessary call to check_colorcolumn().
Solution:   Remove the call. (Sean Dewar, closes vim/vim#9748)
0f7ff851cb
2022-02-12 12:00:36 +00:00

42 lines
1.1 KiB
VimL

" Vim filetype plugin file
" Language: FreeBASIC
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2021 Mar 16
" Dialects can be one of fb, qb, fblite, or deprecated
" Precedence is forcelang > #lang > lang
function! freebasic#GetDialect() abort
if exists("g:freebasic_forcelang")
return g:freebasic_forcelang
endif
if exists("g:freebasic_lang")
let dialect = g:freebasic_lang
else
let dialect = "fb"
endif
" override with #lang directive or metacommand
let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'"
let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"'
let save_cursor = getcurpos()
call cursor(1, 1)
let lnum = search(pat, 'n', '', '', skip)
call setpos('.', save_cursor)
if lnum
let word = matchlist(getline(lnum), pat)[1]
if word =~? '\%(fb\|deprecated\|fblite\|qb\)'
let dialect = word
else
echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum)
endif
endif
return dialect
endfunction
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: