diff --git a/hm/vim/code.nix b/hm/vim/code.nix index e577957..bc7d93a 100644 --- a/hm/vim/code.nix +++ b/hm/vim/code.nix @@ -44,6 +44,12 @@ in showbreak = "↪"; }; plugins = { + # Underline all instances of the underlined word + cursorline = { + enable = true; + cursorline.enable = false; + }; + # Catches attention when cursor changed position specs = { enable = true; @@ -61,7 +67,6 @@ in }; # indent = true; # Not very working last time I tried apparently }; - # TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects indent-blankline.enable = true; # Show indent guides rainbow-delimiters.enable = true; # Randomly colore paired brackets diff --git a/hm/vim/decoration.nix b/hm/vim/decoration.nix index 6dc2d47..6975e5d 100644 --- a/hm/vim/decoration.nix +++ b/hm/vim/decoration.nix @@ -7,12 +7,8 @@ { event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; } { event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; } ]; - extraConfigLua = builtins.readFile ./feline.lua; extraPlugins = with pkgs.vimPlugins; [ nvim-scrollview # Scroll bar - # Status line - feline-nvim # Customizable status line. - # TODO Abandonned. Maybe use lualine? ]; keymaps = [ # barbar @@ -36,13 +32,111 @@ # TODO Other useful options? ]; options = { - title = true; + showmode = false; number = true; relativenumber = true; + title = true; }; plugins = { - # Tabline + # Tablinee barbar.enable = true; + # TODO Investigate bufferline? + # Status line + lualine = with config.lib.stylix.colors.withHashtag; let + normal = { fg = base05; bg = base01; }; + inverted = { fg = base00; bg = base03; }; + normal_ina = { fg = base02; bg = base01; }; + inverted_ina = { fg = base00; bg = base02; }; + in + rec { + enable = true; + inactiveSections = sections; + sections = { + lualine_a = [ + { + name = ''string.format('%d', vim.fn.line('$'))''; + } + "location" + ]; + lualine_b = [ + "mode" + ]; + lualine_c = [{ + name = "filename"; + extraConfig = { + path = 1; # Relative path + symbols = { + modified = "●"; + newfile = "󰻭"; + readonly = "󰏯"; + unnamed = "󱀶"; + }; + }; + }]; + lualine_x = (lib.mapAttrsToList + (diag_name: diag_color: { + name = "diagnostics"; + extraConfig = { + color.bg = diag_color; + colored = false; + separator = { left = ""; right = ""; }; + sections = [ diag_name ]; + }; + }) + { + error = base08; + warn = base0A; + hint = base0C; + info = base0B; + }); + lualine_y = [{ + name = "diff"; + extraConfig = { + diff_color = { + added.fg = base0B; + modified.fg = base0A; + removed.fg = base08; + }; + symbols = { + added = " "; + modified = " "; + removed = " "; + }; + }; + } + "branch"]; + lualine_z = [ + "filetype" + "fileformat" + "encoding" + ]; + }; + theme = (lib.mapAttrs + (mode_name: mode_color: { + a = inverted; + b = inverted // { bg = mode_color; gui = "bold"; }; + c = normal; + x = inverted; + y = inverted; + z = inverted // { bg = mode_color; }; + }) + { + normal = base0D; + insert = base0B; + visual = base0F; + replace = base08; + command = base0E; + }) // { + inactive = { + a = inverted_ina; + b = normal_ina // { bg = base00; gui = "bold"; }; + c = normal_ina; + x = inverted_ina; + y = inverted_ina; + z = normal_ina // { bg = base00; }; + }; + }; + }; }; }; }; diff --git a/hm/vim/feline.lua b/hm/vim/feline.lua deleted file mode 100644 index 41460d4..0000000 --- a/hm/vim/feline.lua +++ /dev/null @@ -1,165 +0,0 @@ -vim.cmd([[ - set noshowmode - set laststatus=2 -]]) -local base16_colors = require('base16-colorscheme').colors -local vi_mode_utils = require('feline.providers.vi_mode') -local lsp = require('feline.providers.lsp') -require('feline').setup({ - default_bg = 'base01', - default_fg = 'base04', - theme = { - base00 = base16_colors.base00, - base01 = base16_colors.base01, - base02 = base16_colors.base02, - base03 = base16_colors.base03, - base04 = base16_colors.base04, - base05 = base16_colors.base05, - base06 = base16_colors.base06, - base07 = base16_colors.base07, - base08 = base16_colors.base08, - base09 = base16_colors.base09, - base0A = base16_colors.base0A, - base0B = base16_colors.base0B, - base0C = base16_colors.base0C, - base0D = base16_colors.base0D, - base0E = base16_colors.base0E, - base0F = base16_colors.base0F, - }, - components = { - active = { - { - { - provider = function() return string.format(' %d ', vim.fn.line('$')) end, - -- If you can, make it depend on the actual bar size - left_sep = { - {str = 'block', fg = 'base05'} - }, - hl = { - fg = 'base01', - bg = 'base04', - }, - }, - { - provider = 'vi_mode', - hl = function() - return { - name = vi_mode_utils.get_mode_highlight_name(), - bg = vi_mode_utils.get_mode_color(), - fg = 'white', - style = 'bold', - } - end, - left_sep = {'█'}, - right_sep = {'█'}, - }, - { - provider='', - hl = function() - return { - bg = vi_mode_utils.get_mode_color(), - fg = (vim.bo.modified and 'base09') or 'base0D', - } - end, - }, - { - provider = 'file_info', - type = 'relative', - hl = function() - return { - fg = 'base06', - bg = (vim.bo.modified and 'base09') or 'base0D', - style = 'bold', - } - end, - left_sep = {'█'}, - right_sep = {'█'}, - }, - { - provider='', - hl = function() - return { - bg = 'base02', - fg = (vim.bo.modified and 'base09') or 'base0D', - } - end, - }, - { - provider = 'position', - hl = { fg = 'base05', bg = 'base02' }, - right_sep = {'█'}, - }, - -- If it miraculously became easy to do, add LSP position here - { - provider='', - hl = { bg = 'base01', fg = 'base02' }, - }, - }, - { - { - provider='', - hl = { bg = 'base03', fg = 'base01', }, - }, - { - provider='z', - enabled = function() return next(vim.lsp.buf_get_clients()) == nil end, - hl = { bg = 'base03', fg = 'base01', }, - left_sep = '█', - }, - { - provider = 'diagnostic_errors', - enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) end, - hl = { fg = 'red', bg = 'base03', }, - left_sep = '█', - }, - { - provider = 'diagnostic_warnings', - enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) end, - hl = { fg = 'yellow', bg = 'base03', }, - left_sep = '█', - }, - { - provider = 'diagnostic_hints', - enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) end, - hl = { fg = 'cyan', bg = 'base03', }, - left_sep = '█', - }, - { - provider = 'diagnostic_info', - enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) end, - hl = { fg = 'skyblue', bg = 'base03', }, - left_sep = '█', - }, - { - provider='█', - hl = { bg = 'base02', fg = 'base03', }, - }, - { - provider = 'git_diff_added', - hl = { fg = 'green', bg = 'base02', }, - left_sep = '█', - enabled = function() return vim.b.gitsigns_status_dict end, - }, - { - provider = 'git_diff_changed', - hl = { fg = 'orange', bg = 'base02', }, - left_sep = '█', - enabled = function() return vim.b.gitsigns_status_dict end, - }, - { - provider = 'git_diff_removed', - hl = { fg = 'red', bg = 'base02', }, - left_sep = '█', - enabled = function() return vim.b.gitsigns_status_dict end, - }, - { - provider = 'git_branch', - hl = { fg = 'base05', bg = 'base02', style = 'bold', }, - right_sep = '█', - left_sep = '█', - enabled = function() return vim.b.gitsigns_status_dict end, - }, - } - }, - } -})