Skip to content

Commit

Permalink
feat: blacklist buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
tris203 committed May 6, 2024
1 parent b948966 commit e35f5a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/precognition/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local hm = require("precognition.horizontal_motions")
local vm = require("precognition.vertical_motions")
local utils = require("precognition.utils")

local M = {}

Expand Down Expand Up @@ -151,7 +152,7 @@ end
---@return nil
local function apply_gutter_hints(gutter_hints, bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
if vim.api.nvim_get_option_value("buftype", { buf = bufnr }) ~= "" then
if utils.is_blacklisted_buffer(bufnr) then
return
end
for hint, loc in pairs(gutter_hints) do
Expand Down Expand Up @@ -182,6 +183,10 @@ local function apply_gutter_hints(gutter_hints, bufnr)
end

local function on_cursor_hold()
local bufnr = vim.api.nvim_get_current_buf()
if utils.is_blacklisted_buffer(bufnr) then
return
end
local cursorline, cursorcol = unpack(vim.api.nvim_win_get_cursor(0))
cursorcol = cursorcol + 1
if extmark and not dirty then
Expand Down
10 changes: 10 additions & 0 deletions lua/precognition/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@ function M.char_class(char)
return 1 -- scary unicode edge cases go here
end

---@param bufnr? integer
---@return boolean
function M.is_blacklisted_buffer(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
if vim.api.nvim_get_option_value("buftype", { buf = bufnr }) ~= "" then
return true
end
return false
end

return M

0 comments on commit e35f5a3

Please sign in to comment.