Skip to content

Commit

Permalink
🐛 Fix: Hide sql buffer in bufferline
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen-Hoang-Nam committed Jul 16, 2022
1 parent 21365c3 commit 19e0be5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions lua/setup/bufferline.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
local colors = require('settings').colors
local sidebar = require('sidebar')
local colors = require("settings").colors
local sidebar = require("sidebar")

require('bufferline').setup({
require("bufferline").setup({
options = {
indicator_icon = '',
diagnostics = 'nvim_lsp',
indicator_icon = "",
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, _)
return '(' .. count .. ')'
return "(" .. count .. ")"
end,
offsets = sidebar.sidebar_title,
show_buffer_close_icons = false,
show_close_icon = false,
enforce_reqular_tabs = true,
custom_filter = function(buf_number, _)
if vim.fn.bufname(buf_number) ~= "[no name].sql" then
return true
end
end,
},

highlights = {
Expand All @@ -29,7 +34,7 @@ require('bufferline').setup({
tab_selected = {
guifg = colors.white,
guibg = colors.background,
gui = 'bold',
gui = "bold",
},

buffer_visible = {
Expand All @@ -39,7 +44,7 @@ require('bufferline').setup({
buffer_selected = {
guifg = colors.white,
guibg = colors.background,
gui = 'bold',
gui = "bold",
},

modified = {
Expand Down
2 changes: 1 addition & 1 deletion lua/utils/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function M.sql()
local valid_buf = M.buf_sql and api.nvim_buf_is_valid(M.buf_sql)
local buf = valid_buf and M.buf_sql or api.nvim_create_buf(false, false)

api.nvim_buf_set_name(buf, "run.sql")
api.nvim_buf_set_name(buf, "[no name].sql")

api.nvim_buf_set_option(buf, "buftype", "nowrite")
api.nvim_buf_set_option(buf, "bufhidden", "delete")
Expand Down

0 comments on commit 19e0be5

Please sign in to comment.