From f9c644070e2f967e5aac120bcce720f1e99b967e Mon Sep 17 00:00:00 2001 From: Benjamin Chaussé Date: Tue, 16 Jul 2024 19:47:58 -0400 Subject: Better tabline and lualine + conform-mason.nvim --- lua/core/init.lua | 1 - lua/plugins/lsp.lua | 11 +++++++++ lua/plugins/lualine.lua | 61 +++++++++++++++++++++++++++++++++++++------------ 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/lua/core/init.lua b/lua/core/init.lua index fd1b257..2d13632 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -5,7 +5,6 @@ vim.opt.number = true vim.opt.relativenumber = true vim.opt.ruler = true vim.opt.lazyredraw = true -vim.opt.laststatus = 0 vim.opt.showmode = false vim.opt.splitbelow = true vim.opt.splitright = true diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index ad14988..5dc67cb 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -199,7 +199,10 @@ return { -- Define your formatters formatters_by_ft = { lua = { "stylua" }, + javascript = { "prettierd" }, + php = { "pretty-php" }, go = { "gofumpt", "gci", "goimports" }, + yaml = { "yamlfix" }, }, -- Set up format-on-save format_on_save = { timeout_ms = 500, lsp_format = "fallback" }, @@ -215,4 +218,12 @@ return { vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" end, }, + { + "zapling/mason-conform.nvim", + dependencies = { + "williamboman/mason.nvim", + "stevearc/conform.nvim", + }, + config = true, + }, } diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 445f056..ec8ea62 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -3,40 +3,71 @@ return { dependencies = "nvim-tree/nvim-web-devicons", event = { "BufReadPre", "BufNewFile" }, config = function() + -- See :help statusline for more information + local filepath = "%=%m %f" + -- Map to shorten mode names + local modes = { + ["NORMAL"] = "N", + ["INSERT"] = "I", + ["VISUAL"] = "V", + ["V-LINE"] = "VL", + ["V-BLOCK"] = "VB", + ["REPLACE"] = "R", + ["COMMAND"] = "C", + ["EX"] = "EX", + ["MORE"] = "M", + ["CONFIRM"] = "CF", + ["TERMINAL"] = "T", + } + require("lualine").setup({ options = { - theme = "no-clown-fiesta", + theme = "auto", icons_enabled = true, section_separators = { left = "", right = "" }, component_separators = { left = "", right = "" }, - globalstatus = false, + globalstatus = true, ignore_focus = {}, - always_divide_middle = true, + always_divide_middle = false, refresh = { statusline = 500, tabline = 500, - winbar = 500, + winbar = 0, }, }, sections = { - lualine_a = { "mode" }, + lualine_a = { + { + "mode", + fmt = function(str) + return modes[str] + end, + }, + }, lualine_b = { "branch" }, - lualine_c = { "filename" }, - lualine_x = { "filetype" }, - lualine_y = { "progress" }, + lualine_c = { filepath }, + lualine_x = {}, + lualine_y = { "filetype" }, lualine_z = { "location" }, }, inactive_sections = { - lualine_a = {}, + lualine_a = { filepath }, lualine_b = {}, - lualine_c = { "filename" }, - lualine_x = { "location" }, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = { "location" }, + }, + tabline = { + lualine_a = { "getcwd" }, + lualine_b = { "branch" }, + lualine_c = { "diff" }, + lualine_x = {}, lualine_y = {}, - lualine_z = {}, + lualine_z = { "tabs" }, }, - tabline = {}, winbar = {}, - extensions = { "fugitive" }, + extensions = { "fugitive", "quickfix" }, }) -- Remove duplicate information that clutters the bottom of the screen -- "-- INSERT --" on the left: @@ -45,5 +76,7 @@ return { vim.opt.ruler = false -- commands on the right: vim.opt.showcmd = false + -- only show tabline when there is more than one tab + vim.opt.showtabline = 1 end, } -- cgit v1.2.3