Skip to content

Commit

Permalink
udpate
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed Jan 4, 2024
1 parent 5d45fc0 commit 47f8be0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
39 changes: 16 additions & 23 deletions lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,35 +59,29 @@ opt.splitright = true
opt.wrap = false

opt.number = true
opt.signcolumn = 'yes'
opt.signcolumn = 'no'
opt.spelloptions = 'camel'

opt.textwidth = 100
opt.colorcolumn = '100'

local function get_signs()
local buf = api.nvim_get_current_buf()
return vim
.iter(api.nvim_buf_get_extmarks(buf, -1, 0, -1, { details = true, type = 'sign' }))
:filter(function(item)
return item[2] == vim.v.lnum - 1
end)
:map(function(item)
return item[4]
end)
:totable()
local function get_signs(name)
local default = name == 'GitSign' and ' ' or ' '
return function()
local bufnr = vim.api.nvim_win_get_buf(vim.g.statusline_winid)
local it = vim
.iter(api.nvim_buf_get_extmarks(bufnr, -1, 0, -1, { details = true, type = 'sign' }))
:find(function(item)
print(item[4].sign_hl_group, vim.v.lnum, item[2], name)
return item[2] == vim.v.lnum - 1 and item[4].sign_hl_group:find(name)
end)
return not it and default or '%#' .. it[4].sign_hl_group .. '#' .. it[4].sign_text .. '%*'
end
end

function _G.show_stc()
local sign = ' '
local gitsign = ' '
for _, s in ipairs(get_signs()) do
if s.sign_hl_group:find('GitSign') then
gitsign = '%#' .. s.sign_hl_group .. '#' .. s.sign_text .. '%*'
else
sign = '%#' .. s.sign_hl_group .. '#' .. s.sign_text .. '%*'
end
end
local stc_diagnostic = get_signs('Diagnostic')
local stc_gitsign = get_signs('GitSign')

local function show_break()
if vim.v.virtnum > 0 then
Expand All @@ -98,8 +92,7 @@ function _G.show_stc()
return vim.v.lnum
end
end

return sign .. '%=' .. show_break() .. gitsign
return stc_diagnostic() .. '%=' .. show_break() .. stc_gitsign()
end

vim.opt.stc = '%!v:lua.show_stc()'
Expand Down
2 changes: 1 addition & 1 deletion lua/keymap/remap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ map.n({
['j'] = 'gj',
['k'] = 'gk',
['<C-s>'] = cmd('write'),
['<C-x>k'] = cmd(vim.bo.buftype == 'terminal' and 'q!' or 'bdelete'),
['<C-x>k'] = cmd(vim.bo.buftype == 'terminal' and 'q!' or 'bdelete!'),
['<C-n>'] = cmd('bn'),
['<C-p>'] = cmd('bp'),
['<C-q>'] = cmd('qa!'),
Expand Down

0 comments on commit 47f8be0

Please sign in to comment.