Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set list in ftplugin is overriden for query files #267

Open
2 tasks done
ss-raicangu opened this issue Aug 5, 2024 · 2 comments · May be fixed by #269
Open
2 tasks done

set list in ftplugin is overriden for query files #267

ss-raicangu opened this issue Aug 5, 2024 · 2 comments · May be fixed by #269

Comments

@ss-raicangu
Copy link

ss-raicangu commented Aug 5, 2024

Description

Very niche problem, so thanks in advance for even considering 😅 .

I rely on list-mode characters a fair bit to avoid invisible errant whitespace but DBUI query files setlocal nolist, which I couldn't override with a after/ftplugin/mysql.lua file.

  • Was this a deliberate choice?
  • If so, would you please consider allowing the override of some of these options 🙏 ?

To reproduce

  1. Create after/ftplugin/mysql.vim.
    setlocal list
  2. Open a DBUI query file.
  3. Check that list is disabled.
    verbose set list?
    " nolist
    "     Last set from ~/.local/share/nvim/site/pack/ssraicangu/opt/dadbod_ui/autoload/db_ui/query.vim line 170

Setup

  • NVIM v0.10.0, Build type: Release, LuaJIT 2.1.1720049189
  • vim-dadbod-ui: 0f51d8d (Merge pull request 263 from ArkadyBuryakov/master, 2024-07-22).

Checklist

  • I have searched past issues: list is:issue and ftplugin is:issue
  • I have followed git-blame: 310e57e (Adding initial files., 2020-03-20).

Possible solution

diff --git a/autoload/db_ui/query.vim b/autoload/db_ui/query.vim
index 7aae57b..96ce0f9 100644
--- a/autoload/db_ui/query.vim
+++ b/autoload/db_ui/query.vim
@@ -167,7 +167,7 @@ function! s:query.setup_buffer(db, opts, buffer_name, was_single_win) abort
   endif
 
   if &filetype !=? a:db.filetype || !is_existing_buffer
-    silent! exe 'setlocal filetype='.a:db.filetype.' nolist noswapfile nowrap nospell modifiable'
+    silent! exe 'setlocal nolist noswapfile nowrap nospell modifiable filetype='.a:db.filetype
   endif
   let is_sql = &filetype ==? a:db.filetype
   nnoremap <silent><buffer><Plug>(DBUI_EditBindParameters) :call <sid>method('edit_bind_parameters')<CR>

Ref 1. Setting filetype after nolist seems to load the preference from the ftplugin file.

I'm open to creating a pull request, if desired 🙂 .

@ss-raicangu ss-raicangu changed the title ` set list in ftplugin is overriden for query files Aug 5, 2024
@ss-raicangu
Copy link
Author

Sorry, accidentally submitted too early. Have finished posting issue now.

@kristijanhusak
Copy link
Owner

You can set up a PR that removes it. I don't remember why I added it.

ss-raicangu added a commit to ss-raicangu/vim-dadbod-ui-fork that referenced this issue Aug 7, 2024
This allows filetype plugins, such as `mysql.vim`, to override any of
the special query buffer settings if needed.

A similar pattern of setting `filetype` before other settings is present
for the DBUI drawer. I assume this is more deliberate, and is out of
scope for kristijanhusak#267, so I haven't changed this
part.

This change was not signed off, so might be reverted.

BREAKING-CHANGE: Options set in filetype plugins are now preferred for
		 query buffers.
Link: https://github.com/kristijanhusak/vim-dadbod-ui/blob/0f51d8de368c8c6220973e8acd156d17da746f4c/autoload/db_ui/drawer.vim?plain=1#L38
@ss-raicangu ss-raicangu linked a pull request Aug 7, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants