diff --git a/.config/nvim/after/plugin/heirline.lua b/.config/nvim/after/plugin/heirline.lua index 1e8b21e..1ca2966 100644 --- a/.config/nvim/after/plugin/heirline.lua +++ b/.config/nvim/after/plugin/heirline.lua @@ -1,345 +1,345 @@ - -local augroup = vim.api.nvim_create_augroup('config', {clear = false}) - --- stolen from https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/plugin/heirline.lua - - ---[[ - _ _ _ _ _ -| |__ ___(_)_ __| (_)_ __ ___ _ ____ _(_)_ __ ___ -| '_ \ / _ \ | '__| | | '_ \ / _ \ | '_ \ \ / / | '_ ` _ \ -| | | | __/ | | | | | | | | __/_| | | \ V /| | | | | | | -|_| |_|\___|_|_| |_|_|_| |_|\___(_)_| |_|\_/ |_|_| |_| |_| ---]] - -local devicons = require 'nvim-web-devicons' - ---[[/* CONSTANTS */]] - --- Defined in https://github.com/Iron-E/nvim-highlite -local BLACK = '#202020' -local BLUE = '#7766ff' -local CYAN = '#33dbc3' -local GRAY_DARK = '#353535' -local GRAY_LIGHT = '#c0c0c0' -local GREEN = '#22ff22' -local GREEN_DARK = '#70d533' -local GREEN_LIGHT = '#99ff99' -local ICE = '#95c5ff' -local MAGENTA = '#d5508f' -local MAGENTA_DARK = '#bb0099' -local ORANGE = '#ff8900' -local ORANGE_LIGHT = '#f0af00' -local PINK = '#ffa6ff' -local PINK_LIGHT = '#ffb7b7' -local PURPLE = '#cf55f0' -local PURPLE_LIGHT = '#af60af' -local RED = '#ee4a59' -local RED_DARK = '#a80000' -local RED_LIGHT = '#ff4090' -local TAN = '#f4c069' -local TEAL = '#60afff' -local TURQOISE = '#2bff99' -local WHITE = '#ffffff' -local YELLOW = '#f0df33' - -local SIDEBAR = BLACK -local MIDBAR = GRAY_DARK -local TEXT = GRAY_LIGHT - ---[[/* HELPERS */]] - ---- The width of the screen -local columns = vim.api.nvim_get_option_value('columns', {}) -vim.api.nvim_create_autocmd('VimResized', { - callback = function() columns = vim.api.nvim_get_option_value('columns', {}) end, - group = 'config', -}) - -do - local command = 'doautocmd User BufEnterOrGitSignsUpdate' - vim.api.nvim_create_autocmd('BufEnter', {command = command, group = 'config'}) - vim.api.nvim_create_autocmd('User', {command = command, group = 'config', pattern = 'GitSignsUpdate'}) -end - ---- Set buffer variables for file icon and color. ---- @return {color: string, icon: string} -local function buf_init_devicons() - local icon, color = devicons.get_icon(vim.fn.expand '%:t', vim.fn.expand '%:e', {default = true}) - local dev_icons = {color = vim.api.nvim_get_hl(0, {link = false, name = color}).fg, icon = icon} - - vim.b.dev_icons = dev_icons - return dev_icons -end - ---- @return {color: string, icon: string} -local function filetype_info() - return vim.b.dev_icons or buf_init_devicons() -end - ---- Redraw the statusline -local redrawstatus = vim.schedule_wrap(function() vim.api.nvim_command 'redrawstatus' end) - ---[[/* HEIRLINE CONFIG */]] - ---- Components separated by this component will be padded with an equal number of spaces. -local ALIGN = {provider = '%='} - ---- A left separator. -local LEFT_SEPARATOR = {provider = ''} - ---- A right separator. -local RIGHT_SEPARATOR = {provider = ''} - -require('heirline').setup({statusline = -{ - -- LEFT {{{ - { -- ViMode {{{ - hl = function(self) - vim.api.nvim_set_hl(0, self.group, {bg = SIDEBAR, fg = self.color, bold = true}) - return self.group - end, - init = function(self) - if vim.g.libmodalActiveModeName then - self.name = vim.g.libmodalActiveModeName - self.color = self.modes[self.name] - else - local current_mode = self.modes[vim.api.nvim_get_mode().mode] - - self.name = current_mode[1] - self.color = current_mode[2] - end - end, - provider = function(self) return '▊ ' .. self.name .. ' ' end, - static = - { -- {{{ - group = 'HeirlineViMode', - modes = - { - ['c'] = {'COMMAND-LINE', RED}, - ['ce'] = {'NORMAL EX', RED_DARK}, - ['cv'] = {'EX', RED_LIGHT}, - - ['i'] = {'INSERT', GREEN}, - - ['ic'] = {'INS-COMPLETE', GREEN_LIGHT}, - ['ix'] = {'INS-COMPLETE', GREEN_LIGHT}, - ['Rc'] = {'REP-COMPLETE', GREEN_LIGHT}, - ['Rvc'] = {'VIRT-REP-COMPLETE', GREEN_LIGHT}, - ['Rvx'] = {'VIRT-REP-COMPLETE', GREEN_LIGHT}, - ['Rx'] = {'REP-COMPLETE', GREEN_LIGHT}, - - ['n'] = {'NORMAL', PURPLE_LIGHT}, - ['niI'] = {'INS-NORMAL', PURPLE_LIGHT}, - ['niR'] = {'REP-NORMAL', PURPLE_LIGHT}, - ['niV'] = {'VIRT-REP-NORMAL', PURPLE_LIGHT}, - ['nt'] = {'TERM-NORMAL', PURPLE_LIGHT}, - ['ntT'] = {'TERM-NORMAL', PURPLE_LIGHT}, - - ['no'] = {'OPERATOR-PENDING', PURPLE}, - ['nov'] = {'CHAR OPERATOR-PENDING', PURPLE}, - ['noV'] = {'LINE OPERATOR-PENDING', PURPLE}, - ['no'] = {'BLOCK OPERATOR-PENDING', PURPLE}, - - ['R'] = {'REPLACE', PINK}, - ['Rv'] = {'VIRT-REPLACE', PINK_LIGHT}, - - ['r'] = {'HIT-ENTER', CYAN}, - ['rm'] = {'--MORE', CYAN}, - ['r?'] = {':CONFIRM', CYAN}, - - ['s'] = {'SELECT', TURQOISE}, - ['S'] = {'SELECT LINE', TURQOISE}, - [''] = {'SELECT', TURQOISE}, - - ['v'] = {'VISUAL', BLUE}, - ['vs'] = {'SEL-VISUAL', BLUE}, - ['V'] = {'VISUAL LINE', BLUE}, - ['Vs'] = {'SEL-VISUAL LINE', BLUE}, - [''] = {'VISUAL BLOCK', BLUE}, - ['s'] = {'VISUAL BLOCK', BLUE}, - - ['t'] = {'TERMINAL', ORANGE}, - ['!'] = {'SHELL', YELLOW}, - - -- libmodal - ['BUFFERS'] = TEAL, - ['TABLES'] = ORANGE_LIGHT, - ['TABS'] = TAN, - } - }, -- }}} - update = {'ModeChanged', callback = redrawstatus, pattern = '*:*'}, - }, -- }}} - - { -- File Icon {{{ - hl = function(self) return {bg = SIDEBAR, fg = self.file.color} end, - init = function(self) self.file = filetype_info() end, - update = 'BufEnter', - - LEFT_SEPARATOR, - { - hl = function(self) return {bg = self.file.color, fg = SIDEBAR} end, - provider = function(self) return ' ' .. self.file.icon .. ' %Y ' end, - }, - - RIGHT_SEPARATOR, - }, -- }}} - - { -- File Info {{{ - hl = {bg = SIDEBAR, bold = true, fg = TEXT}, - - -- File name - {provider = ' %t '}, - { -- Readonly {{{ - condition = function() return vim.api.nvim_get_option_value('readonly', {buf = 0}) end, - provider = ' ', - update = {'OptionSet', pattern = 'readonly'}, - }, -- }}} - - { -- Modified {{{ - condition = function() return vim.api.nvim_get_option_value('modified', {}) end, - provider = ' ', - update = 'BufModifiedSet', - }, -- }}} - - { -- File size {{{ - init = function(self) self.stat = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0)) end, - update = {'BufEnter', 'BufWritePost'}, - - { - condition = function(self) return self.stat end, - provider = function(self) - local size = self.stat.size - - local i = 1 - while size > self.conversion and i < #self.units do - size = size / self.conversion - i = i + 1 - end - - return ('%.2f%sb '):format(size, self.units[i]) - end, - static = {conversion = 1024, units = {'', 'k', 'm', 'g', 't', 'p', 'e', 'z', 'y'}}, - }, - }, -- }}} - - {hl = {fg = MIDBAR}, LEFT_SEPARATOR}, - }, -- }}} - -- }}} - - -- MIDDLE {{{ - {hl = {bg = MIDBAR}, ALIGN}, - - { -- Diagnostics {{{ - hl = {bg = MIDBAR, fg = SIDEBAR}, - init = function(self) - local diagnostics = vim.diagnostic.get(0) --- @type Diagnostic[] - - if #diagnostics < 1 then - self.diagnostics = nil - else - self.diagnostics = {0, 0, 0, 0} - for _, diagnostic in ipairs(diagnostics) do - self.diagnostics[diagnostic.severity] = self.diagnostics[diagnostic.severity] + 1 - end - end - end, - update = {'BufEnter', 'DiagnosticChanged'}, - - { - condition = function(self) return self.diagnostics end, - - LEFT_SEPARATOR, - { - hl = {bg = SIDEBAR}, - static = - { -- {{{ - icons = {' ', ' ', ' ', ' '}, - - --- @param severity 1|2|3|4 - --- @return nil|string - provide = function(self, severity) - if self.diagnostics[severity] > 0 then - local str = self.icons[severity] .. self.diagnostics[severity] - - for i = severity + 1, #self.diagnostics do - if self.diagnostics[i] > 0 then - str = str .. ' ' - break - end - end - - return str - end - end, - }, -- }}} - - {hl = {fg = RED}, provider = function(self) return self:provide(vim.diagnostic.severity.ERROR) end}, - {hl = {fg = ORANGE}, provider = function(self) return self:provide(vim.diagnostic.severity.WARN) end}, - {hl = {fg = PINK_LIGHT}, provider = function(self) return self:provide(vim.diagnostic.severity.INFO) end}, - {hl = {fg = MAGENTA}, provider = function(self) return self:provide(vim.diagnostic.severity.HINT) end}, - }, - - RIGHT_SEPARATOR, - }, - }, -- }}} - -- }}} - - -- RIGHT {{{ - {hl = {bg = MIDBAR}, ALIGN}, - - { -- Git {{{ - init = function(self) self.status = vim.b.gitsigns_status_dict end, - update = {'User', callback = redrawstatus, pattern = 'BufEnterOrGitSignsUpdate'}, - - { -- Diff {{{ - hl = {bg = MIDBAR}, - - { - condition = function(self) return self.status end, - static = - { - --- @param sign string - --- @param change string - --- @return nil|string - provide = function(self, sign, change) - local count = self.status[change] or 0 - if count > 0 then return sign .. count end - end, - }, - - {hl = {fg = GREEN}, provider = function(self) return self:provide('+', 'added') end}, - {hl = {fg = ORANGE_LIGHT}, provider = function(self) return self:provide('~', 'changed') end}, - {hl = {fg = RED_LIGHT}, provider = function(self) return self:provide('-', 'removed') end}, - {provider = ' '}, - }, - }, -- }}} - - { -- Branch {{{ - hl = {bg = GREEN_DARK}, - - {hl = {fg = MIDBAR}, RIGHT_SEPARATOR}, - {provider = ' '}, - { - condition = function(self) return self.status end, - hl = {fg = SIDEBAR, bold = true}, - provider = function(self) return ' ' .. self.status.head .. ' ' end, - }, - - {hl = {fg = SIDEBAR}, LEFT_SEPARATOR}, - }, -- }}} - }, -- }}} - - -- Column Number - {hl = {fg = TEXT, bg = SIDEBAR}, provider = '  %v '}, - - { -- Line Percentage {{{ - hl = {bg = MAGENTA_DARK}, - - {hl = {fg = SIDEBAR}, RIGHT_SEPARATOR}, - {hl = {fg = WHITE}, provider = ' %p%% '}, - }, -- }}} - - -- }}} -}}) - + -- + -- local augroup = vim.api.nvim_create_augroup('config', {clear = false}) + -- + -- -- stolen from https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/plugin/heirline.lua + -- + -- + -- --[[ + -- _ _ _ _ _ + -- | |__ ___(_)_ __| (_)_ __ ___ _ ____ _(_)_ __ ___ + -- | '_ \ / _ \ | '__| | | '_ \ / _ \ | '_ \ \ / / | '_ ` _ \ + -- | | | | __/ | | | | | | | | __/_| | | \ V /| | | | | | | + -- |_| |_|\___|_|_| |_|_|_| |_|\___(_)_| |_|\_/ |_|_| |_| |_| + -- --]] + -- + -- local devicons = require 'nvim-web-devicons' + -- + -- --[[/* CONSTANTS */]] + -- + -- -- Defined in https://github.com/Iron-E/nvim-highlite + -- local BLACK = '#202020' + -- local BLUE = '#7766ff' + -- local CYAN = '#33dbc3' + -- local GRAY_DARK = '#353535' + -- local GRAY_LIGHT = '#c0c0c0' + -- local GREEN = '#22ff22' + -- local GREEN_DARK = '#70d533' + -- local GREEN_LIGHT = '#99ff99' + -- local ICE = '#95c5ff' + -- local MAGENTA = '#d5508f' + -- local MAGENTA_DARK = '#bb0099' + -- local ORANGE = '#ff8900' + -- local ORANGE_LIGHT = '#f0af00' + -- local PINK = '#ffa6ff' + -- local PINK_LIGHT = '#ffb7b7' + -- local PURPLE = '#cf55f0' + -- local PURPLE_LIGHT = '#af60af' + -- local RED = '#ee4a59' + -- local RED_DARK = '#a80000' + -- local RED_LIGHT = '#ff4090' + -- local TAN = '#f4c069' + -- local TEAL = '#60afff' + -- local TURQOISE = '#2bff99' + -- local WHITE = '#ffffff' + -- local YELLOW = '#f0df33' + -- + -- local SIDEBAR = BLACK + -- local MIDBAR = GRAY_DARK + -- local TEXT = GRAY_LIGHT + -- + -- --[[/* HELPERS */]] + -- + -- --- The width of the screen + -- local columns = vim.api.nvim_get_option_value('columns', {}) + -- vim.api.nvim_create_autocmd('VimResized', { + -- callback = function() columns = vim.api.nvim_get_option_value('columns', {}) end, + -- group = 'config', + -- }) + -- + -- do + -- local command = 'doautocmd User BufEnterOrGitSignsUpdate' + -- vim.api.nvim_create_autocmd('BufEnter', {command = command, group = 'config'}) + -- vim.api.nvim_create_autocmd('User', {command = command, group = 'config', pattern = 'GitSignsUpdate'}) + -- end + -- + -- --- Set buffer variables for file icon and color. + -- --- @return {color: string, icon: string} + -- local function buf_init_devicons() + -- local icon, color = devicons.get_icon(vim.fn.expand '%:t', vim.fn.expand '%:e', {default = true}) + -- local dev_icons = {color = vim.api.nvim_get_hl(0, {link = false, name = color}).fg, icon = icon} + -- + -- vim.b.dev_icons = dev_icons + -- return dev_icons + -- end + -- + -- --- @return {color: string, icon: string} + -- local function filetype_info() + -- return vim.b.dev_icons or buf_init_devicons() + -- end + -- + -- --- Redraw the statusline + -- local redrawstatus = vim.schedule_wrap(function() vim.api.nvim_command 'redrawstatus' end) + -- + -- --[[/* HEIRLINE CONFIG */]] + -- + -- --- Components separated by this component will be padded with an equal number of spaces. + -- local ALIGN = {provider = '%='} + -- + -- --- A left separator. + -- local LEFT_SEPARATOR = {provider = ''} + -- + -- --- A right separator. + -- local RIGHT_SEPARATOR = {provider = ''} + -- + -- require('heirline').setup({statusline = + -- { + -- -- LEFT {{{ + -- { -- ViMode {{{ + -- hl = function(self) + -- vim.api.nvim_set_hl(0, self.group, {bg = SIDEBAR, fg = self.color, bold = true}) + -- return self.group + -- end, + -- init = function(self) + -- if vim.g.libmodalActiveModeName then + -- self.name = vim.g.libmodalActiveModeName + -- self.color = self.modes[self.name] + -- else + -- local current_mode = self.modes[vim.api.nvim_get_mode().mode] + -- + -- self.name = current_mode[1] + -- self.color = current_mode[2] + -- end + -- end, + -- provider = function(self) return '▊ ' .. self.name .. ' ' end, + -- static = + -- { -- {{{ + -- group = 'HeirlineViMode', + -- modes = + -- { + -- ['c'] = {'COMMAND-LINE', RED}, + -- ['ce'] = {'NORMAL EX', RED_DARK}, + -- ['cv'] = {'EX', RED_LIGHT}, + -- + -- ['i'] = {'INSERT', GREEN}, + -- + -- ['ic'] = {'INS-COMPLETE', GREEN_LIGHT}, + -- ['ix'] = {'INS-COMPLETE', GREEN_LIGHT}, + -- ['Rc'] = {'REP-COMPLETE', GREEN_LIGHT}, + -- ['Rvc'] = {'VIRT-REP-COMPLETE', GREEN_LIGHT}, + -- ['Rvx'] = {'VIRT-REP-COMPLETE', GREEN_LIGHT}, + -- ['Rx'] = {'REP-COMPLETE', GREEN_LIGHT}, + -- + -- ['n'] = {'NORMAL', PURPLE_LIGHT}, + -- ['niI'] = {'INS-NORMAL', PURPLE_LIGHT}, + -- ['niR'] = {'REP-NORMAL', PURPLE_LIGHT}, + -- ['niV'] = {'VIRT-REP-NORMAL', PURPLE_LIGHT}, + -- ['nt'] = {'TERM-NORMAL', PURPLE_LIGHT}, + -- ['ntT'] = {'TERM-NORMAL', PURPLE_LIGHT}, + -- + -- ['no'] = {'OPERATOR-PENDING', PURPLE}, + -- ['nov'] = {'CHAR OPERATOR-PENDING', PURPLE}, + -- ['noV'] = {'LINE OPERATOR-PENDING', PURPLE}, + -- ['no'] = {'BLOCK OPERATOR-PENDING', PURPLE}, + -- + -- ['R'] = {'REPLACE', PINK}, + -- ['Rv'] = {'VIRT-REPLACE', PINK_LIGHT}, + -- + -- ['r'] = {'HIT-ENTER', CYAN}, + -- ['rm'] = {'--MORE', CYAN}, + -- ['r?'] = {':CONFIRM', CYAN}, + -- + -- ['s'] = {'SELECT', TURQOISE}, + -- ['S'] = {'SELECT LINE', TURQOISE}, + -- [''] = {'SELECT', TURQOISE}, + -- + -- ['v'] = {'VISUAL', BLUE}, + -- ['vs'] = {'SEL-VISUAL', BLUE}, + -- ['V'] = {'VISUAL LINE', BLUE}, + -- ['Vs'] = {'SEL-VISUAL LINE', BLUE}, + -- [''] = {'VISUAL BLOCK', BLUE}, + -- ['s'] = {'VISUAL BLOCK', BLUE}, + -- + -- ['t'] = {'TERMINAL', ORANGE}, + -- ['!'] = {'SHELL', YELLOW}, + -- + -- -- libmodal + -- ['BUFFERS'] = TEAL, + -- ['TABLES'] = ORANGE_LIGHT, + -- ['TABS'] = TAN, + -- } + -- }, -- }}} + -- update = {'ModeChanged', callback = redrawstatus, pattern = '*:*'}, + -- }, -- }}} + -- + -- { -- File Icon {{{ + -- hl = function(self) return {bg = SIDEBAR, fg = self.file.color} end, + -- init = function(self) self.file = filetype_info() end, + -- update = 'BufEnter', + -- + -- LEFT_SEPARATOR, + -- { + -- hl = function(self) return {bg = self.file.color, fg = SIDEBAR} end, + -- provider = function(self) return ' ' .. self.file.icon .. ' %Y ' end, + -- }, + -- + -- RIGHT_SEPARATOR, + -- }, -- }}} + -- + -- { -- File Info {{{ + -- hl = {bg = SIDEBAR, bold = true, fg = TEXT}, + -- + -- -- File name + -- {provider = ' %t '}, + -- { -- Readonly {{{ + -- condition = function() return vim.api.nvim_get_option_value('readonly', {buf = 0}) end, + -- provider = ' ', + -- update = {'OptionSet', pattern = 'readonly'}, + -- }, -- }}} + -- + -- { -- Modified {{{ + -- condition = function() return vim.api.nvim_get_option_value('modified', {}) end, + -- provider = ' ', + -- update = 'BufModifiedSet', + -- }, -- }}} + -- + -- { -- File size {{{ + -- init = function(self) self.stat = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0)) end, + -- update = {'BufEnter', 'BufWritePost'}, + -- + -- { + -- condition = function(self) return self.stat end, + -- provider = function(self) + -- local size = self.stat.size + -- + -- local i = 1 + -- while size > self.conversion and i < #self.units do + -- size = size / self.conversion + -- i = i + 1 + -- end + -- + -- return ('%.2f%sb '):format(size, self.units[i]) + -- end, + -- static = {conversion = 1024, units = {'', 'k', 'm', 'g', 't', 'p', 'e', 'z', 'y'}}, + -- }, + -- }, -- }}} + -- + -- {hl = {fg = MIDBAR}, LEFT_SEPARATOR}, + -- }, -- }}} + -- -- }}} + -- + -- -- MIDDLE {{{ + -- {hl = {bg = MIDBAR}, ALIGN}, + -- + -- { -- Diagnostics {{{ + -- hl = {bg = MIDBAR, fg = SIDEBAR}, + -- init = function(self) + -- local diagnostics = vim.diagnostic.get(0) --- @type Diagnostic[] + -- + -- if #diagnostics < 1 then + -- self.diagnostics = nil + -- else + -- self.diagnostics = {0, 0, 0, 0} + -- for _, diagnostic in ipairs(diagnostics) do + -- self.diagnostics[diagnostic.severity] = self.diagnostics[diagnostic.severity] + 1 + -- end + -- end + -- end, + -- update = {'BufEnter', 'DiagnosticChanged'}, + -- + -- { + -- condition = function(self) return self.diagnostics end, + -- + -- LEFT_SEPARATOR, + -- { + -- hl = {bg = SIDEBAR}, + -- static = + -- { -- {{{ + -- icons = {' ', ' ', ' ', ' '}, + -- + -- --- @param severity 1|2|3|4 + -- --- @return nil|string + -- provide = function(self, severity) + -- if self.diagnostics[severity] > 0 then + -- local str = self.icons[severity] .. self.diagnostics[severity] + -- + -- for i = severity + 1, #self.diagnostics do + -- if self.diagnostics[i] > 0 then + -- str = str .. ' ' + -- break + -- end + -- end + -- + -- return str + -- end + -- end, + -- }, -- }}} + -- + -- {hl = {fg = RED}, provider = function(self) return self:provide(vim.diagnostic.severity.ERROR) end}, + -- {hl = {fg = ORANGE}, provider = function(self) return self:provide(vim.diagnostic.severity.WARN) end}, + -- {hl = {fg = PINK_LIGHT}, provider = function(self) return self:provide(vim.diagnostic.severity.INFO) end}, + -- {hl = {fg = MAGENTA}, provider = function(self) return self:provide(vim.diagnostic.severity.HINT) end}, + -- }, + -- + -- RIGHT_SEPARATOR, + -- }, + -- }, -- }}} + -- -- }}} + -- + -- -- RIGHT {{{ + -- {hl = {bg = MIDBAR}, ALIGN}, + -- + -- { -- Git {{{ + -- init = function(self) self.status = vim.b.gitsigns_status_dict end, + -- update = {'User', callback = redrawstatus, pattern = 'BufEnterOrGitSignsUpdate'}, + -- + -- { -- Diff {{{ + -- hl = {bg = MIDBAR}, + -- + -- { + -- condition = function(self) return self.status end, + -- static = + -- { + -- --- @param sign string + -- --- @param change string + -- --- @return nil|string + -- provide = function(self, sign, change) + -- local count = self.status[change] or 0 + -- if count > 0 then return sign .. count end + -- end, + -- }, + -- + -- {hl = {fg = GREEN}, provider = function(self) return self:provide('+', 'added') end}, + -- {hl = {fg = ORANGE_LIGHT}, provider = function(self) return self:provide('~', 'changed') end}, + -- {hl = {fg = RED_LIGHT}, provider = function(self) return self:provide('-', 'removed') end}, + -- {provider = ' '}, + -- }, + -- }, -- }}} + -- + -- { -- Branch {{{ + -- hl = {bg = GREEN_DARK}, + -- + -- {hl = {fg = MIDBAR}, RIGHT_SEPARATOR}, + -- {provider = ' '}, + -- { + -- condition = function(self) return self.status end, + -- hl = {fg = SIDEBAR, bold = true}, + -- provider = function(self) return ' ' .. self.status.head .. ' ' end, + -- }, + -- + -- {hl = {fg = SIDEBAR}, LEFT_SEPARATOR}, + -- }, -- }}} + -- }, -- }}} + -- + -- -- Column Number + -- {hl = {fg = TEXT, bg = SIDEBAR}, provider = '  %v '}, + -- + -- { -- Line Percentage {{{ + -- hl = {bg = MAGENTA_DARK}, + -- + -- {hl = {fg = SIDEBAR}, RIGHT_SEPARATOR}, + -- {hl = {fg = WHITE}, provider = ' %p%% '}, + -- }, -- }}} + -- + -- -- }}} + -- }}) + -- diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index efb8d00..a5a4d69 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -48,3 +48,20 @@ require "lspconfig".pylsp.setup { } } +require "lspconfig".pyright.setup { +-- on_attach = on_attach, + settings = { +-- pyright = {autoImportCompletion = true,}, + python = { + analysis = { +-- autoSearchPaths = true, +-- diagnosticMode = 'openFilesOnly', +-- useLibraryCodeForTypes = true, +-- typeCheckingMode = 'off', + diagnosticSeverityOverrides = { + reportMissingImports = false + } + } + } + } +} diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua index 4c81f89..e9652ef 100644 --- a/.config/nvim/after/plugin/treesitter.lua +++ b/.config/nvim/after/plugin/treesitter.lua @@ -1,6 +1,6 @@ require'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "javascript", "python" }, + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "javascript", "python", "comment" }, --ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, -- Install parsers synchronously (only applied to `ensure_installed`) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index d576b04..c6ee3cd 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -2,9 +2,9 @@ "LuaSnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "gitsigns.nvim": { "branch": "main", "commit": "de18f6b749f6129eb9042a2038590872df4c94a9" }, - "heirline.nvim": { "branch": "master", "commit": "0d797435e54645a5f98bad7ad6046aac1ef95c1e" }, "lazy.nvim": { "branch": "main", "commit": "eb4957442e3182f051b0ae11da32e06d22c190e3" }, "lsp-zero.nvim": { "branch": "v3.x", "commit": "16de3b18c5f7b6230d89b8e64ce9a4801b6f8d08" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" }, "mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" }, "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, @@ -13,7 +13,9 @@ "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "telescope.nvim": { "branch": "master", "commit": "f12b15e1b3a33524eb06a1ae7bc852fb1fd92197" }, + "todo-comments.nvim": { "branch": "main", "commit": "51e10f838e84b4756c16311d0b1ef0972c6482d2" }, "tokyonight.nvim": { "branch": "main", "commit": "024621763d91bb48f2b486df529c7aaeb8d6d355" }, + "trouble.nvim": { "branch": "main", "commit": "3609bb9a82bbab1ef95cf2c27ce7e52267a7d40d" }, "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, "vim-better-whitespace": { "branch": "master", "commit": "029f35c783f1b504f9be086b9ea757a36059c846" }, "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" } diff --git a/.config/nvim/lua/erik/colorscheme.lua b/.config/nvim/lua/erik/colorscheme.lua index 5aa10a9..b8052d0 100644 --- a/.config/nvim/lua/erik/colorscheme.lua +++ b/.config/nvim/lua/erik/colorscheme.lua @@ -26,13 +26,20 @@ require("tokyonight").setup({ --- You can override specific color groups to use other groups or a hex color --- function will be called with a ColorScheme table ---@param colors ColorScheme - on_colors = function(colors) end, + on_colors = function(colors) + colors.hint = colors.magenta2 + end, --- You can override specific highlights to use other groups or a hex color --- function will be called with a Highlights and ColorScheme table ---@param highlights Highlights ---@param colors ColorScheme - on_highlights = function(highlights, colors) end, + on_highlights = function(hl, colors) + hl.Todo = { + fg=colors.bg_dark, + bg=colors.magenta2, + } + end, }) vim.cmd[[colorscheme tokyonight]] diff --git a/.config/nvim/lua/erik/lazy.lua b/.config/nvim/lua/erik/lazy.lua index 27c5d71..c1381a0 100644 --- a/.config/nvim/lua/erik/lazy.lua +++ b/.config/nvim/lua/erik/lazy.lua @@ -28,43 +28,166 @@ require("lazy").setup({ end, }, +-- -- does this work if it goes this late in the file? +-- +-- { +-- "folke/todo-comments.nvim", +-- lazy = false, +-- dependencies = { "nvim-lua/plenary.nvim" }, +-- opts = { +-- signs = true, -- show icons in the signs column +-- sign_priority = 8, -- sign priority +-- -- keywords recognized as todo comments +-- keywords = { +-- FIX = { +-- icon = " ", -- icon used for the sign, and in search results +-- color = "error", -- can be a hex color, or a named color (see below) +-- alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords +-- -- signs = false, -- configure signs for some keywords individually +-- }, +-- TODO = { icon = " ", color = "info" }, +-- HACK = { icon = " ", color = "warning" }, +-- WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, +-- PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, +-- NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, +-- TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, +-- }, +-- gui_style = { +-- fg = "NONE", -- The gui style to use for the fg highlight group. +-- bg = "BOLD", -- The gui style to use for the bg highlight group. +-- }, +-- merge_keywords = true, -- when true, custom keywords will be merged with the defaults +-- -- highlighting of the line containing the todo comment +-- -- * before: highlights before the keyword (typically comment characters) +-- -- * keyword: highlights of the keyword +-- -- * after: highlights after the keyword (todo text) +-- highlight = { +-- multiline = true, -- enable multine todo comments +-- multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword +-- multiline_context = 10, -- extra lines that will be re-evaluated when changing a line +-- before = "", -- "fg" or "bg" or empty +-- keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) +-- after = "fg", -- "fg" or "bg" or empty +-- pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) +-- comments_only = true, -- uses treesitter to match keywords in comments only +-- max_line_len = 400, -- ignore lines longer than this +-- exclude = {}, -- list of file types to exclude highlighting +-- }, +-- -- list of named colors where we try to extract the guifg from the +-- -- list of highlight groups or use the hex color if hl not found as a fallback +-- colors = { +-- error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, +-- warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, +-- info = { "DiagnosticInfo", "#2563EB" }, +-- hint = { "DiagnosticHint", "#10B981" }, +-- default = { "Identifier", "#7C3AED" }, +-- test = { "Identifier", "#FF00FF" } +-- }, +-- search = { +-- command = "rg", +-- args = { +-- "--color=never", +-- "--no-heading", +-- "--with-filename", +-- "--line-number", +-- "--column", +-- }, +-- -- regex that will be used to match keywords. +-- -- don't replace the (KEYWORDS) placeholder +-- pattern = [[\b(KEYWORDS):]], -- ripgrep regex +-- -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives +-- }, +-- +-- } +-- }, + + { "folke/tokyonight.nvim", lazy = false, priority = 1000, opts = {} }, - { - "nvim-treesitter/nvim-treesitter", - lazy = false, - config = function() - vim.cmd('TSUpdate') - end, - }, + { + "nvim-treesitter/nvim-treesitter", + lazy = false, + config = function() + vim.cmd('TSUpdate') + end, + }, - { "mbbill/undotree", lazy = false }, - { "tpope/vim-fugitive", lazy = false }, + { + "folke/trouble.nvim", + lazy = false, + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, + }, - { "ntpeters/vim-better-whitespace", lazy = false }, + { "mbbill/undotree", lazy = false }, --- { "glepnir/galaxyline.nvim", lazy = false }, - { - "rebelot/heirline.nvim", - lazy = false, - dependencies = {'gitsigns.nvim', 'nvim-web-devicons'}, - }, + { "tpope/vim-fugitive", lazy = false }, - { "lewis6991/gitsigns.nvim" }, - { "nvim-tree/nvim-web-devicons" }, + { "ntpeters/vim-better-whitespace", lazy = false }, --- LSP stuff + -- -- { "glepnir/galaxyline.nvim", lazy = false }, + -- { + -- "rebelot/heirline.nvim", + -- lazy = false, + -- dependencies = {'gitsigns.nvim', 'nvim-web-devicons'}, + -- }, + { + 'nvim-lualine/lualine.nvim', + lazy = false, + dependencies = { + 'nvim-tree/nvim-web-devicons' + }, + }, + + { "lewis6991/gitsigns.nvim" }, + { "nvim-tree/nvim-web-devicons" }, + + -- LSP stuff + + --- Uncomment the two plugins below if you want to manage the language servers from neovim + {'williamboman/mason.nvim'}, + {'williamboman/mason-lspconfig.nvim'}, + + {'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, + {'neovim/nvim-lspconfig'}, + {'hrsh7th/cmp-nvim-lsp'}, + {'hrsh7th/nvim-cmp'}, + {'L3MON4D3/LuaSnip'}, - --- Uncomment the two plugins below if you want to manage the language servers from neovim - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, - {'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, - {'neovim/nvim-lspconfig'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/nvim-cmp'}, - {'L3MON4D3/LuaSnip'}, }) diff --git a/.config/nvim/lua/erik/remap.lua b/.config/nvim/lua/erik/remap.lua index 2e6fce6..906ddb2 100644 --- a/.config/nvim/lua/erik/remap.lua +++ b/.config/nvim/lua/erik/remap.lua @@ -4,6 +4,13 @@ vim.keymap.set("n", "ee", vim.cmd.Ex) -- other stuff from https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) -- x to make executable +vim.keymap.set("n", "", + function() + local result = vim.treesitter.get_captures_at_cursor(0) + print(vim.inspect(result)) + end, + { noremap = true, silent = false } +) -- from my original vimrc vim.keymap.set("n", "", vim.cmd.shell) diff --git a/.tmux.conf b/.tmux.conf index 58440bf..4f17ede 100755 --- a/.tmux.conf +++ b/.tmux.conf @@ -84,7 +84,7 @@ set-window-option -g window-status-separator "" # UGH this doesn't work -- tmux # Inactive windows get low-contrast; active window sharper #set -g window-style 'fg=colour246,bg=#152030' -set -g window-style 'fg=colour246,bg=#252731' +set -g window-style 'fg=colour246,bg=#262a3d' #set -g window-active-style 'fg=colour255,bg=black' set -g window-active-style 'fg=colour255,bg=#1e2030'