[2024-10-04] nvim custom status bar, minor updates to

alacritty
This commit is contained in:
Andrew Conlin 2024-10-04 16:55:18 +01:00
parent 4f8211dc18
commit 5684f8c6ec
9 changed files with 169 additions and 28 deletions

View File

@ -1,4 +1,4 @@
import = ["/home/andrew/.config/alacritty/themes/gruvbox-dark.toml"] #import = ["/home/aconlin/.config/alacritty/themes/gruxbox-dark.toml"]
[cursor.style] [cursor.style]
blinking = "On" blinking = "On"
@ -8,13 +8,12 @@ shape = "Beam"
shape = "Block" shape = "Block"
[font] [font]
size = 11.0 size = 13.0
[font.normal] [font.normal]
family = "Geist Mono Nerd Font" family = "JetBrains Mono"
style = "Regular" style = "Regular"
[window] [window]
opacity = 0.8 opacity = 0.8
dimensions = { columns = 75, lines = 25 } dimensions = { columns = 75, lines = 25 }
resize_increments = true

View File

@ -0,0 +1,30 @@
# Colors (Gruvbox dark)
# Default colors
[colors.primary]
# hard contrast background = = '#1d2021'
background = '#282828'
# soft contrast background = = '#32302f'
foreground = '#ebdbb2'
# Normal colors
[colors.normal]
black = '#282828'
red = '#cc241d'
green = '#98971a'
yellow = '#d79921'
blue = '#458588'
magenta = '#b16286'
cyan = '#689d6a'
white = '#a89984'
# Bright colors
[colors.bright]
black = '#928374'
red = '#fb4934'
green = '#b8bb26'
yellow = '#fabd2f'
blue = '#83a598'
magenta = '#d3869b'
cyan = '#8ec07c'
white = '#ebdbb2'

23
nvim/colors/mine.vim Normal file
View File

@ -0,0 +1,23 @@
" load the quiet colorscheme
runtime colors/quiet.vim
let g:colors_name = 'mine'
" adjust
if &background ==# 'light'
highlight Normal guibg=#FFFFFF
highlight Special guifg=#666666
highlight NormalFloat guibg=#333333
endif
highlight Title gui=bold
highlight Special gui=bold
highlight SpellBad guibg=Normal guifg=Normal gui=undercurl guisp=red
highlight SpellCap guibg=Normal guifg=Normal gui=undercurl guisp=blue
highlight SpellLocal guibg=Normal guifg=Normal gui=undercurl guisp=pink
highlight SpellRare guibg=Normal guifg=Normal gui=undercurl guisp=aqua
highlight Keyword gui=bold
highlight Comment gui=italic
highlight Constant guifg=#999999
highlight NormalFloat guibg=#666666
highlight CursorLineNr guibg=NONE gui=bold
highlight StatusLine guibg=Normal guifg=Normal

View File

@ -8,9 +8,9 @@ call plug#begin()
Plug 'nvim-lua/plenary.nvim' Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-tree/nvim-web-devicons' Plug 'nvim-tree/nvim-web-devicons'
Plug 'MunifTanjim/nui.nvim' Plug 'MunifTanjim/nui.nvim'
Plug 'nvim-neo-tree/neo-tree.nvim', { 'branch': 'v3.x' } "Plug 'nvim-neo-tree/neo-tree.nvim', { 'branch': 'v3.x' }
Plug 'lewis6991/gitsigns.nvim' " OPTIONAL: for git status Plug 'lewis6991/gitsigns.nvim' " OPTIONAL: for git status
Plug 'nvim-tree/nvim-web-devicons' " OPTIONAL: for file icons " Plug 'nvim-tree/nvim-web-devicons' " OPTIONAL: for file icons
Plug 'freddiehaddad/feline.nvim' Plug 'freddiehaddad/feline.nvim'
Plug 'neovim/nvim-lspconfig' Plug 'neovim/nvim-lspconfig'
" main one " main one
@ -27,12 +27,16 @@ Plug 'luukvbaal/statuscol.nvim'
call plug#end() call plug#end()
if exists("g:neovide") if exists("g:neovide")
set guifont=GeistMono_Nerd_Font:h10:cANSI:qDRAFT set guifont=JetBrains_Mono:h13:cANSI:qDRAFT
endif endif
colo mine
set noshowmode set noshowmode
set laststatus=3 set laststatus=3
set cmdheight=1 set cmdheight=0
set statusline=%{%v:lua.require('plugins.statusline').statusline()%}
set winbar=%{%v:lua.require('plugins.statusline').winbar()%}
" .config/nvim/lua/init.lua " .config/nvim/lua/init.lua
lua require('init') lua require('init')

View File

@ -1,11 +1,14 @@
--vim.cmd('colorscheme default') --vim.cmd('colorscheme default')
--require('plugins.gruvbox') --require('plugins.gruvbox')
require('plugins.feline') --require('plugins.feline')
require('gitsigns').setup() require('gitsigns').setup({numhl = true})
require('plugins.matlab_ls') require('plugins.matlab_ls')
require('plugins.lua_ls') require('plugins.lua_ls')
require('plugins.treesitter') require('plugins.treesitter')
require('battery').setup() require('battery').setup({
show_status_when_no_battery = false,
show_percent = true
})
--require('plugins.noice') --require('plugins.noice')
require('plugins.statuscol') require('plugins.statuscol')
vim.diagnostic.config({ vim.diagnostic.config({

View File

@ -18,16 +18,19 @@ status_components.active[1][1] = {
} }
end, end,
left_sep = { str = 'block' }, left_sep = { str = 'block' },
right_sep = { str = 'block' },
-- Use the name of the mode instead of the icon -- Use the name of the mode instead of the icon
icon = '' icon = ''
} }
status_components.active[1][2] = { status_components.active[1][2] = {
provider = 'git_branch', provider = 'git_branch',
right_sep = 'block' left_sep = 'block',
icon = ''
} }
status_components.active[1][3] = { status_components.active[1][3] = {
provider = 'lsp_client_names' provider = 'lsp_client',
left_sep = 'block',
icon = '',
update = {'WinClosed','BufDelete'}
} }
status_components.active[3][1] = { status_components.active[3][1] = {
provider = 'battery', provider = 'battery',
@ -44,7 +47,8 @@ status_components.active[3][3] = {
local custom_providers = { local custom_providers = {
time = function() time = function()
local time = tostring(vim.fn.strftime('%H:%M')) local time = tostring(vim.fn.strftime('%H:%M'))
return '' .. time --return ' ' .. time
return time
end, end,
word_count = function() word_count = function()
if vim.api.nvim_buf_get_option(0, 'filetype') == 'markdown' then if vim.api.nvim_buf_get_option(0, 'filetype') == 'markdown' then
@ -59,13 +63,27 @@ local custom_providers = {
battery = function() battery = function()
return require('battery').get_status_line() return require('battery').get_status_line()
end, end,
lsp_progress = function() lsp_client = function()
--if not lsp.is_lsp_attached() then return ' 󱏎 LSP ' end local clients = vim.lsp.buf_get_clients()
return string.format(' %s ', require('lsp-progress').progress()) if next(clients) ~= nil then
local name = string.format('%s',clients[1].name)
--if name == 'matlab_ls' then
-- local root = clients[1].root_dir
-- local sandbox = root:match(".+/([^/]+)$")
-- local handle = io.popen('p4 opened | grep tnrCRCDecode | sed \'s/^[^#]*//g\'')
-- local result = handle:read("*a")
-- return string.format('%s -> %s%s',name,result,sandbox)
--else
return name
--end
else
return ''
end
end end
} }
status_config.components = status_components status_config.components = status_components
status_config.custom_providers = custom_providers status_config.custom_providers = custom_providers
status_config.highlight_reset_triggers = {'ColorScheme'}
require('feline').setup(status_config) require('feline').setup(status_config)
-- Initialize the win_components table -- Initialize the win_components table
local win_components = { local win_components = {
@ -81,14 +99,12 @@ win_components.active[1][1] = {
provider = { provider = {
name = 'file_info', name = 'file_info',
opts = { opts = {
type = 'unique', type = 'unique'
} }
}, },
left_sep = { icon = '',
str = 'block' left_sep = 'block'
}, }
right_sep = { str = 'block' }
}
win_components.active[1][2] = { win_components.active[1][2] = {
provider = 'file_size', provider = 'file_size',
left_sep = 'block', left_sep = 'block',

View File

@ -4,6 +4,7 @@ require('lspconfig').matlab_ls.setup(
coq.lsp_ensure_capabilities({ coq.lsp_ensure_capabilities({
cmd = { "node", os.getenv("HOME") .. "/MATLAB-language-server/out/index.js", "--stdio" }, cmd = { "node", os.getenv("HOME") .. "/MATLAB-language-server/out/index.js", "--stdio" },
root_dir = util.root_pattern('mw_anchor'), root_dir = util.root_pattern('mw_anchor'),
single_file_support = true,
settings = { settings = {
MATLAB = { MATLAB = {
indexWorkspace = false, indexWorkspace = false,

View File

@ -0,0 +1,65 @@
local M = {}
M.modeMap = {
n = "NORMAL", i = "INSERT", R = "REPLACE", v = "VISUAL", V = "V-LINE", [''] = "V-BLOCK",
c = "COMMAND", s = "SELECT", S = "S-LINE", [''] = "S-BLOCK", t = "TERMINAL"
}
GetMode = function()
local m = vim.api.nvim_get_mode().mode
return M.modeMap[m] .. " "
end
GetDate = function()
return tostring(vim.fn.strftime('%Y-%m-%d'))
end
GetTime = function()
local time = tostring(vim.fn.strftime('%H:%M:%S'))
return time
end
GetLSP = function()
local clients = vim.lsp.buf_get_clients()
if next(clients) ~= nil then
local name = string.format('%s',clients[1].name)
local root = clients[1].root_dir
if name == 'matlab_ls' and root ~= nil then
local sandbox = root:match(".+/([^/]+)$")
--local handle = io.popen('p4 opened | grep tnrCRCDecode | sed \'s/^[^#]*//g\'')
--local result = handle:read("*a")
return string.format('[%s -> %s]',name,sandbox)
else
return "[" .. name .. "] "
end
else
return ''
end
end
GetGitStatus = function()
local signs = vim.b.gitsigns_status_dict or {head = '', added = 0, changed = 0, removed = 0}
local inRepo = signs.head ~= ''
return inRepo and string.format(
'[%s: +%s ~%s -%s] ',
signs.head, signs.added, signs.changed, signs.removed
) or ''
end
function M.statusline()
local sline = " "
sline = sline .. GetMode() .. GetGitStatus() .. GetLSP() .. "%=" .. GetDate() .. " " .. GetTime() .. " "
return sline
end
function M.winbar()
return "%< %f %y%h%m%r%=%-5.(L%l C%c%V%) %P "
end
local timer = vim.uv.new_timer()
timer:start(0, 10000, vim.schedule_wrap(function()
vim.cmd("let &stl=&stl")
end))
return M

View File

@ -3,18 +3,18 @@ local hex = function(n)
return string.format("#%06x", n) return string.format("#%06x", n)
end end
local fg = function(n) local fg = function(n)
colour = vim.api.nvim_get_hl_by_name(n, true) local colour = vim.api.nvim_get_hl_by_name(n, true)
return hex(colour.foreground) return hex(colour.foreground)
end end
local bg = function(n) local bg = function(n)
colour = vim.api.nvim_get_hl_by_name(n, true) local colour = vim.api.nvim_get_hl_by_name(n, true)
return hex(colour.background) return hex(colour.background)
end end
return { return {
bg = fg("StatusLine"), bg = bg("StatusLine"),
black = '#000000', black = '#000000',
fg = bg("StatusLine"), fg = fg("StatusLine"),
green = fg("DiagnosticOk"), green = fg("DiagnosticOk"),
blue = fg("DiagnosticHint"), blue = fg("DiagnosticHint"),
orange = fg("DiagnosticWarn"), orange = fg("DiagnosticWarn"),