vim-patch:fc762df: runtime(sql, mysql): fix E169: Command too recursive with sql_type_default = "mysql"

Problem: When setting "let g:sql_type_default = "mysql", editing .sql
file reports "E169: Command too recursive" error

Solution:

- Add 'let b:did_ftplugin = 1' at the top of ftplugin/sql.vim
- Add 'if exists("b:did_ftplugin") | finish | endif' in ftplugin/mysql.vim
- Add missing header information in ftplugin/mysql.vim
- Remove redundant code in ftplugin/sql.vim

fixes: vim/vim#15474
closes: vim/vim#15475

fc762dfc9f

Signed-off-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
Signed-off-by: Riley Bruins <ribru17@hotmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yinzuo Jiang 2024-08-15 18:28:01 +08:00 committed by GitHub
parent 40bc48479d
commit f3677c71f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 16 deletions

View File

@ -1 +1,9 @@
" Vim filetype plugin
" Language: MySQL
" Maintainer: Riley Bruins <ribru17@gmail.com>
" Last Change: 2024 Aug 12
if exists("b:did_ftplugin")
finish
endif
runtime ftplugin/sql.vim runtime ftplugin/sql.vim

View File

@ -3,8 +3,9 @@
" Version: 12.0 " Version: 12.0
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Last Change: 2017 Mar 07 " Last Change: 2017 Mar 07
" 2024 Jan 14 by Vim Project (browsefilter) " 2024 Jan 14 by Vim Project: browsefilter
" 2024 May 18 by Vim Project (set comment options) " 2024 May 18 by Vim Project: set comment options
" 2024 Aug 14 by Vim Project: remove redundant code
" Download: http://vim.sourceforge.net/script.php?script_id=454 " Download: http://vim.sourceforge.net/script.php?script_id=454
" For more details please use: " For more details please use:
@ -92,13 +93,19 @@
" Only do this when not done yet for this buffer " Only do this when not done yet for this buffer
" This ftplugin can be used with other ftplugins. So ensure loading " This ftplugin can be used with other ftplugins. So ensure loading
" happens if all elements of this plugin have not yet loaded. " happens if all elements of this plugin have not yet loaded.
if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql' if exists("b:did_ftplugin")
finish finish
endif endif
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
let b:undo_ftplugin = "setl comments< commentstring< formatoptions< define< omnifunc<" .
\ " | unlet! b:browsefilter b:match_words"
" Disable autowrapping for code, but enable for comments " Disable autowrapping for code, but enable for comments
" t Auto-wrap text using textwidth " t Auto-wrap text using textwidth
" c Auto-wrap comments using textwidth, inserting the current comment " c Auto-wrap comments using textwidth, inserting the current comment
@ -263,19 +270,6 @@ elseif exists("g:sql_type_default")
endif endif
endif endif
" If the above runtime command succeeded, do not load the default settings
" as they should have already been loaded from a previous run.
if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql'
finish
endif
let b:undo_ftplugin = "setl comments< commentstring< formatoptions< define< omnifunc<" .
\ " | unlet! b:browsefilter b:match_words"
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let b:current_ftplugin = 'sql'
" Win32 and GTK can filter files in the browse dialog " Win32 and GTK can filter files in the browse dialog
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" let b:browsefilter = "SQL Files (*.sql)\t*.sql\n"