From 226ccaa65a62d8344a61dfe0d7f90725f2371dbe Mon Sep 17 00:00:00 2001 From: Quentin Boyer Date: Sat, 16 Oct 2021 18:00:48 +0200 Subject: [PATCH] rework statusline --- nvim/init.vim | 5 ++-- nvim/lua/plugins.lua | 4 +-- nvim/lua/statusline.lua | 62 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index e3dc205..6d59a75 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,3 +1,6 @@ +set termguicolors +colorscheme moonfly + lua require("plugins") lua require("misc") lua require("tree_sitter") @@ -5,8 +8,6 @@ lua require("lsp") lua require("completion") lua require("statusline") -set termguicolors -colorscheme moonfly set number set tabstop=4 set shiftwidth=4 diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 3e1b843..2f990fa 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -42,7 +42,6 @@ return require('packer').startup(function() use { 'kdheepak/cmp-latex-symbols' } use { 'hrsh7th/nvim-cmp' } - use { 'dpelle/vim-Grammalecte' } use { 'dpelle/vim-LanguageTool' } @@ -54,7 +53,8 @@ return require('packer').startup(function() requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}} } - use 'glepnir/galaxyline.nvim' + -- use 'famiu/feline.nvim' + use 'NTBBloodbath/galaxyline.nvim' use 'drmikehenry/vim-headerguard' use 'andymass/vim-matchup' use 'b3nj5m1n/kommentary' diff --git a/nvim/lua/statusline.lua b/nvim/lua/statusline.lua index f936ced..416862c 100644 --- a/nvim/lua/statusline.lua +++ b/nvim/lua/statusline.lua @@ -1,3 +1,59 @@ +--[[ local vi_mode_utils = require 'feline.providers.vi_mode' + +local vi_mode_colors = { + NORMAL = "#8cc85f", + INSERT = "#ff5454", + VISUAL = "#ae81ff", + OP = "#36c692", + BLOCK = "#80a0ff", + REPLACE = "#d183e8", + ['V-REPLACE'] = "#d183e8", + ENTER = "#74b2ff", + MORE = "#74b2ff", + SELECT = "#de935f", + COMMAND = "#8cc85f", + SHELL = "#8cc85f", + TERM = "#8cc85f", + NONE = "#e3c78a" +} + +local function vimode_hl() + return { + name = vi_mode_utils.get_mode_highlight_name(), + fg = vi_mode_utils.get_mode_color() + } +end + +local cmps = { + vi_mode = { + provider = '▊', + hl = vimode_hl, + right_sep = ' ' + } +} + +local components = { + left = { + active = { + cmps.vi_mode + }, + inactive = {} + }, + mid = { + active = {}, + inactive = {} + }, + right = { + active = {}, + inactive = {} + } +} + +require'feline'.setup { + components = components, + vi_mode_colors = vi_mode_colors +} ]] + local gl = require('galaxyline') local gls = gl.section gl.short_line_list = {'LuaTree','vista','dbui'} @@ -24,6 +80,8 @@ local buffer_not_empty = function() return false end +local fileinfo = require("galaxyline.providers.fileinfo") + -- Start of line gls.left[1] = { FirstElement = { @@ -53,7 +111,7 @@ gls.left[3] ={ FileIcon = { provider = 'FileIcon', condition = buffer_not_empty, - highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.darkblue}, + highlight = {fileinfo.get_file_icon_color,colors.darkblue}, }, } -- File Name @@ -82,7 +140,7 @@ gls.left[6] = { } } -local vcs = require('galaxyline.provider_vcs') +local vcs = require("galaxyline.providers.vcs") local is_file_diff = function () if vcs.diff_add() ~= nil or vcs.diff_modified() ~= nil or vcs.diff_remove() ~= nil then