Skip to content

Commit

Permalink
feat(ui): show unloaded + fix deprecated warn (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorillamoe authored Sep 28, 2024
1 parent 87373e8 commit dc893bc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ require('lazy').setup({
relative = "editor",
border = "rounded",
style = "minimal",
icons = {
modified = "",
},
})
end,
},
Expand Down
3 changes: 3 additions & 0 deletions lua/bafa/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ M.defaults = {
relative = "editor",
border = "rounded",
style = "minimal",
icons = {
modified = "",
},
}

M.options = M.defaults
Expand Down
9 changes: 0 additions & 9 deletions lua/bafa/constants.lua

This file was deleted.

3 changes: 1 addition & 2 deletions lua/bafa/ui.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
local Config = require("bafa.config")
local buffer_utils = require("bafa.utils.buffers")
local constants = require("bafa.constants")
local keymaps = require("bafa.utils.keymaps")
local autocmds = require("bafa.utils.autocmds")

Expand Down Expand Up @@ -121,7 +120,7 @@ function M.toggle()

for _, line_number in ipairs(modified_lines) do
vim.api.nvim_buf_set_extmark(BAFA_BUF_ID, BAFA_NS_ID, line_number - 1, 0, {
virt_text = { { constants.icons.modified } },
virt_text = { { Config.get().icons.modified } },
})
end

Expand Down
7 changes: 3 additions & 4 deletions lua/bafa/utils/buffers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ local M = {}

M.is_valid_buffer = function(buffer_number)
local buffer_name = vim.api.nvim_buf_get_name(buffer_number)
local is_loaded = vim.api.nvim_buf_is_loaded(buffer_number)
local is_listed = vim.api.nvim_buf_get_option(buffer_number, "buflisted") == true
local is_listed = vim.bo[buffer_number].buflisted == true
local is_not_bafa_buffer = buffer_name ~= "bafa-menu"
if buffer_name ~= "" and is_not_bafa_buffer and is_loaded and is_listed then
if buffer_name ~= "" and is_not_bafa_buffer and is_listed then
return true
end
return false
Expand Down Expand Up @@ -53,7 +52,7 @@ M.get_buffers_as_table = function()
local last_used = vim.fn.getbufinfo(buffer_number)[1].lastused
local buffer_name = vim.api.nvim_buf_get_name(buffer_number)
local buffer_file_name = text_utils.get_normalized_path(buffer_name) or "untitled"
local is_modified = vim.api.nvim_buf_get_option(buffer_number, "modified") == true
local is_modified = vim.bo[buffer_number].modified == true
local buffer = {
name = buffer_file_name,
path = buffer_name,
Expand Down

0 comments on commit dc893bc

Please sign in to comment.