Compare commits
2 Commits
9f0d9890fd
...
4499dee3d6
Author | SHA1 | Date | |
---|---|---|---|
4499dee3d6 | |||
d75531ae3d |
2
init.lua
2
init.lua
@ -1,8 +1,6 @@
|
|||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
require('statusline')
|
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.fn.system({ 'git', 'clone', '--filter=blob:none',
|
vim.fn.system({ 'git', 'clone', '--filter=blob:none',
|
||||||
|
@ -109,7 +109,7 @@ end
|
|||||||
|
|
||||||
-- Define active statusline, this statusline is dynamic with StatusLineLight
|
-- Define active statusline, this statusline is dynamic with StatusLineLight
|
||||||
-- being updated based on the current mode and only used for current buffer.
|
-- being updated based on the current mode and only used for current buffer.
|
||||||
function statusline.active()
|
function _G.statusline_active()
|
||||||
local mode = get_mode()
|
local mode = get_mode()
|
||||||
if vim.o.buftype == 'help' then
|
if vim.o.buftype == 'help' then
|
||||||
if mode == 'Normal' then mode = 'Help' end
|
if mode == 'Normal' then mode = 'Help' end
|
||||||
@ -138,7 +138,7 @@ function statusline.active()
|
|||||||
return generic('StatusLineLight', mode, true)
|
return generic('StatusLineLight', mode, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function statusline.inactive()
|
function _G.statusline_inactive()
|
||||||
local mode = modes[vim.fn.char2nr(vim.fn.mode())].name
|
local mode = modes[vim.fn.char2nr(vim.fn.mode())].name
|
||||||
local line = ''
|
local line = ''
|
||||||
if vim.o.buftype == 'help' then
|
if vim.o.buftype == 'help' then
|
||||||
@ -169,7 +169,7 @@ vim.api.nvim_create_autocmd({ 'BufEnter', 'WinEnter', 'BufWinEnter' }, {
|
|||||||
pattern = '*',
|
pattern = '*',
|
||||||
group = group,
|
group = group,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd.setlocal("statusline=%{%v:lua.require('statusline').active()%}")
|
vim.cmd.setlocal("statusline=%{%v:lua.statusline_active()%}")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ vim.api.nvim_create_autocmd({ 'BufLeave', 'WinLeave' }, {
|
|||||||
pattern = '*',
|
pattern = '*',
|
||||||
group = group,
|
group = group,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd.setlocal("statusline=%{%v:lua.require('statusline').inactive()%}")
|
vim.cmd.setlocal("statusline=%{%v:lua.statusline_inactive()%}")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user