From d169551792fc3c51bf44ec02abd0244ec053c5eb Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Tue, 12 Apr 2022 20:50:45 +0200 Subject: Improve the db with completition and status line --- after/plugin/completition.lua | 12 ++++++++++++ after/plugin/dbui.lua | 2 ++ after/plugin/lualine.lua | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'after/plugin') diff --git a/after/plugin/completition.lua b/after/plugin/completition.lua index 6b3dd22..1b403f1 100644 --- a/after/plugin/completition.lua +++ b/after/plugin/completition.lua @@ -73,6 +73,7 @@ cmp.setup { nvim_lua = "[api]", path = "[path]", luasnip = "[snip]", + ["vim-dadbod-completion"] = "[DB]", -- copilot = "[copilot]", } } @@ -84,6 +85,17 @@ cmp.setup { ghost_text = true, } } + +vim.api.nvim_create_autocmd( + "FileType", + { + pattern = "sql,mysql,plsql", + callback = function() + require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} }) + end + } +) + -- Setup lspconfig. local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- Replace with each lsp server you've enabled. diff --git a/after/plugin/dbui.lua b/after/plugin/dbui.lua index eaa141c..7715875 100644 --- a/after/plugin/dbui.lua +++ b/after/plugin/dbui.lua @@ -1,6 +1,8 @@ vim.g.db_ui_use_nerd_fonts = 1 vim.g.db_ui_show_database_icon = 1 vim.g.db_ui_force_echo_notifications = 1 +vim.g.db_ui_win_position = 'right' +vim.g.db_ui_winwidth = 80 vim.g.db_ui_table_helpers = { mysql = { diff --git a/after/plugin/lualine.lua b/after/plugin/lualine.lua index 5a10c46..948c493 100644 --- a/after/plugin/lualine.lua +++ b/after/plugin/lualine.lua @@ -12,7 +12,7 @@ lualine.setup{ extensions = {'quickfix', 'fugitive'}, sections = { lualine_a = { { 'mode', upper = true } }, - lualine_b = { { 'branch', icon = '' }, 'diff' }, + lualine_b = { { 'branch', icon = '' }, { 'db_ui#statusline' }, 'diff' }, lualine_c = { { 'filename', file_status = true, path = 1 } }, lualine_x = { { 'diagnostics', sources = { 'nvim_diagnostic' } },'encoding', 'fileformat', 'filetype' }, lualine_y = { 'progress' }, -- cgit v1.2.3