From c1fe17012b907300d11d07a1c0fb05458eab3335 Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Thu, 26 Sep 2024 04:58:13 +0200 Subject: [PATCH] feat(lualine): Add winbar and modify overseer --- nvim/ftplugin/c.lua | 10 +++++- nvim/plugin/lualine.lua | 72 +++++++++++++++++++++++++++++------------ 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/nvim/ftplugin/c.lua b/nvim/ftplugin/c.lua index 088b3d9..f20e468 100644 --- a/nvim/ftplugin/c.lua +++ b/nvim/ftplugin/c.lua @@ -1,3 +1,8 @@ +if vim.g.did_load_c_plugin then + return +end +vim.g.did_load_c_plugin = true + -- Exit if the language server isn't available if vim.fn.executable('clangd') ~= 1 then return @@ -16,7 +21,10 @@ vim.lsp.start { cmd = { 'clangd' }, root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]), capabilities = require('user.lsp').make_client_capabilities(), -} + on_attach = function(client, bufnr) + require("nvim-navic").attach(client, bufnr) + end +} local dap = require("dap") local pickers = require("telescope.pickers") diff --git a/nvim/plugin/lualine.lua b/nvim/plugin/lualine.lua index 57139cd..e005722 100644 --- a/nvim/plugin/lualine.lua +++ b/nvim/plugin/lualine.lua @@ -3,8 +3,8 @@ if vim.g.did_load_lualine_plugin then end vim.g.did_load_lualine_plugin = true --- local navic = require('nvim-navic') --- avic.setup {} +local navic = require('nvim-navic') +navic.setup {} ---Indicators for special modes, ---@return string status @@ -30,11 +30,15 @@ end require('lualine').setup { globalstatus = true, sections = { - lualine_c = { - -- nvim-navic - -- { navic.get_location, cond = navic.is_available }, - }, - lualine_y = { "overseer" }, + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { "overseer" }, + -- lualine_c = { + -- -- nvim-navic + -- navic.get_location, cond = navic.is_available + -- }, + lualine_x = { 'encoding', 'fileformat', 'filetype' }, + lualine_y = { 'progress' }, lualine_z = { -- (see above) { extra_mode_status }, @@ -43,9 +47,9 @@ require('lualine').setup { options = { theme = 'auto', -- component_separators = { left = '', right = ''}, - component_separators = { left = '', right = ''}, + component_separators = { left = '', right = '' }, -- section_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, + section_separators = { left = '', right = '' }, ignore_focus = { "dapui_scopes", "dapui_breakpoints", @@ -63,7 +67,6 @@ require('lualine').setup { -- mode = 1, -- }, -- }, - -- lualine_b = { -- lualine_a = { -- { -- 'buffers', @@ -82,20 +85,47 @@ require('lualine').setup { -- }, -- }, -- }, + -- lualine_b = { -- lualine_c = {}, -- lualine_x = {}, -- lualine_y = {}, - -- -- lualine_z = {}, -- Commented out so that buffers and file path are on the same line - -- }, - -- winbar = { - -- lualine_z = { - -- { - -- 'filename', - -- path = 1, - -- file_status = true, - -- newfile_status = true, - -- }, - -- }, + -- lualine_z = {}, -- Commented out so that buffers and file path are on the same line -- }, + winbar = { + lualine_a = { + -- { + -- "navic", + -- color_correction = nil, + -- navic_opts = nil + -- } + }, + lualine_b = {}, + lualine_c = { + { + 'filename', + path = 1, + file_status = true, + newfile_status = true, + }, + { + function() + return navic.get_location() + end, + cond = function() + return navic.is_available() + end + }, + }, + -- lualine_x = { + -- { + -- 'filename', + -- path = 1, + -- file_status = true, + -- newfile_status = true, + -- }, + -- }, + lualine_y = {'searchcount','selectioncount'}, + lualine_z = {'location'}, + }, extensions = { 'fugitive', 'fzf', 'toggleterm', 'quickfix' }, }