blob: c4ead42c1e9a3d31e0aa3d1b8aadc38b045f2ed3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
local lualine = require("lualine")
local gitsigns = require("gitsigns")
local ibl = require("ibl")
local marks = require("marks")
-- https://github.com/chentoast/marks.nvim/issues/38#issuecomment-1059736459
local function marks_set_buf_state(bufnr, state)
if bufnr == 0 then bufnr = vim.api.nvim_get_current_buf() end
if marks.mark_state ~= nil then
marks.mark_state.opt.buf_signs[bufnr] = state
marks.bookmark_state.opt.buf_signs[bufnr] = state
marks.refresh(true)
end
end
local function toggle_plain()
if vim.g.__plain then
gitsigns.toggle_current_line_blame(false)
vim.o.number = false
vim.o.relativenumber = false
vim.o.cursorline = false
vim.o.list = false
vim.o.foldenable = false
vim.o.foldcolumn = "0"
vim.o.laststatus = 0
vim.diagnostic.disable()
gitsigns.toggle_numhl(false)
gitsigns.toggle_signs(false)
marks_set_buf_state(0, false)
ibl.update({ enabled = false })
lualine.hide()
if vim.fn.exists(":TSContextDisable") > 0 then vim.cmd [[ TSContextDisable ]] end
else
gitsigns.toggle_current_line_blame(true)
vim.o.number = true
vim.o.relativenumber = true
vim.o.cursorline = true
vim.o.list = true
vim.o.foldenable = true
vim.o.foldcolumn = "1"
vim.o.laststatus = 2
vim.diagnostic.enable()
gitsigns.toggle_numhl(true)
gitsigns.toggle_signs(true)
lualine.hide({ unhide = true })
marks_set_buf_state(0, true)
ibl.update({ enabled = true })
if vim.fn.exists(":TSContextEnable") > 0 then vim.cmd [[ TSContextEnable ]] end
end
-- vim.cmd [[ BufferLineGroupToggle ungrouped ]]
end
return { toggle_plain = toggle_plain }
|