From 746df8195a6bf8c679bd20409bdc25e7faf166f1 Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Fri, 23 Jun 2023 16:51:38 -0500 Subject: [PATCH] better symbols using aerial --- config/.config/nvim/lazy-lock.json | 2 +- vim/.vim/lua/config/lualine.lua | 100 ---------------------- vim/.vim/lua/config/symbols-outline.lua | 21 ----- vim/.vim/lua/plugins/base.lua | 29 ++++--- vim/.vim/lua/plugins/lualine.lua | 106 ++++++++++++++++++++++++ 5 files changed, 121 insertions(+), 137 deletions(-) delete mode 100644 vim/.vim/lua/config/lualine.lua delete mode 100644 vim/.vim/lua/config/symbols-outline.lua create mode 100644 vim/.vim/lua/plugins/lualine.lua diff --git a/config/.config/nvim/lazy-lock.json b/config/.config/nvim/lazy-lock.json index f1e03da..3a1b0bb 100644 --- a/config/.config/nvim/lazy-lock.json +++ b/config/.config/nvim/lazy-lock.json @@ -1,4 +1,5 @@ { + "aerial.nvim": { "branch": "master", "commit": "c663d1b55f002930187a09b9eeb5bd0bad0ea23c" }, "ai.nvim": { "branch": "main", "commit": "d7391d4782b90ad3501f6f716f2b308092981787" }, "asyncrun.vim": { "branch": "master", "commit": "7191d0c30dd105e5d7f897b9a6ee19cabe734466" }, "auto-session": { "branch": "main", "commit": "7afbb149f87be279778689596c781882014f7eef" }, @@ -60,7 +61,6 @@ "refactoring.nvim": { "branch": "master", "commit": "9f28801ed1803306ddbe5b8058849da412a90648" }, "registers.nvim": { "branch": "main", "commit": "2ab8372bb837f05fae6b43091f10a0b725d113ca" }, "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, - "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, "telekasten.nvim": { "branch": "main", "commit": "36dad2692974a5cc69813441442ccce8c53fbfd4" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "87dfaa9a9c251388cf4f01b9d4078c29d1fc8803" }, "telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, diff --git a/vim/.vim/lua/config/lualine.lua b/vim/.vim/lua/config/lualine.lua deleted file mode 100644 index 519ebfc..0000000 --- a/vim/.vim/lua/config/lualine.lua +++ /dev/null @@ -1,100 +0,0 @@ -local split = function(inputstr, sep) - local t = {} - for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do - table.insert(t, str) - end - return t -end -local function getCitc() - local fname = vim.api.nvim_buf_get_name(0) - if string.find(fname, "/google/src/cloud/", 1, true) then - local parts = split(fname, "/") - return parts[5] - end -end -local function isCiderLspAttached() - if vim.b["is_cider_lsp_attached"] then - if vim.b["is_cider_lsp_attached"] == "yes" then - return "✓" - else - return "x" - end - else - return "" - end -end - -local function getLightbulb() - return require("nvim-lightbulb").get_status_text() -end - -local function getLGTMs() - local comments = require("google.comments") - local tracker = require("google.comments.tracker") - local dump = require("utils").dump - - print(dump(tracker.get_all_comments())) - local lgtm = comments.get_lgtms() - local appr = comments.get_approvals() - print("lgtms" .. dump(lgtm)) - print("approvals" .. dump(appr)) - return "LGTM:" .. table.concat(lgtm, ",") .. " Approval:" .. table.concat(appr, ",") -end - -local lsp_status = require("lsp-status") - -require("lualine").setup({ - options = { - theme = "auto", - globalstatus = false, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - }, - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { "branch", "diff", getCitc, isCiderLspAttached }, - lualine_c = { getLightbulb, "filename" }, - lualine_x = { - { - "diagnostics", - sources = { "nvim_lsp" }, - symbols = { error = " ", warn = " ", info = " ", hint = " " }, - }, - "encoding", - "filetype", - }, - lualine_y = { "searchcount" }, - lualine_z = { "location" }, - }, - tabline = { - lualine_a = { - { - "tabs", - mode = 1, - max_length = (vim.o.columns / 5) * 4, - fmt = function(name, context) - -- Show + if buffer is modified in tab - local buflist = vim.fn.tabpagebuflist(context.tabnr) - local winnr = vim.fn.tabpagewinnr(context.tabnr) - local bufnr = buflist[winnr] - local mod = vim.fn.getbufvar(bufnr, "&mod") - - return name .. (mod == 1 and " +" or "") - end, - }, - }, - lualine_b = { "branch" }, - lualine_c = { "filename" }, - lualine_c = { - { - "diagnostics", - sources = { "nvim_lsp", "nvim_workspace_diagnostic" }, - symbols = { error = " ", warn = " ", info = " ", hint = " " }, - }, - }, - -- lualine_y = { getLGTMs } - }, -}) diff --git a/vim/.vim/lua/config/symbols-outline.lua b/vim/.vim/lua/config/symbols-outline.lua deleted file mode 100644 index 49ed6ed..0000000 --- a/vim/.vim/lua/config/symbols-outline.lua +++ /dev/null @@ -1,21 +0,0 @@ -require("symbols-outline").setup({ - show_relative_numbers = true, - keymaps = { -- These keymaps can be a string or a table for multiple keys - -- close = {"", "q"}, - goto_location = "", - -- focus_location = "o", - hover_symbol = "", - toggle_preview = "L", - -- rename_symbol = "r", - -- code_actions = "a", - -- fold = "h", - -- unfold = "l", - fold_all = "H", - unfold_all = "L", - fold_reset = "R", - }, -}) - -local map = require("utils").map - -map("n", "so", ":SymbolsOutline") diff --git a/vim/.vim/lua/plugins/base.lua b/vim/.vim/lua/plugins/base.lua index 588a271..223e6bd 100644 --- a/vim/.vim/lua/plugins/base.lua +++ b/vim/.vim/lua/plugins/base.lua @@ -2,8 +2,10 @@ local use_google = require("utils").use_google return { -- Pretty symbols - "kyazdani42/nvim-web-devicons", - + { + "nvim-tree/nvim-web-devicons", + lazy = false, + }, "jghauser/mkdir.nvim", "will133/vim-dirdiff", "renerocksai/calendar-vim", @@ -202,12 +204,17 @@ return { }, }, { "andymass/vim-matchup", event = "VimEnter" }, - { - "simrat39/symbols-outline.nvim", - config = function() - require("config.symbols-outline") - end, + "stevearc/aerial.nvim", + opts = {}, + -- Optional dependencies + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, + cmd = { "AerialToggle", "AerialOn" }, + keys = { + { "so", ":AerialToggle", desc = "[S]ymbols [O]utline" }, + }, }, { "petertriho/nvim-scrollbar", @@ -233,14 +240,6 @@ return { require("libp").setup() end, }, - - { - "nvim-lualine/lualine.nvim", - lazy = false, - config = function() - require("config.lualine") - end, - }, { "rcarriga/nvim-notify", config = function() diff --git a/vim/.vim/lua/plugins/lualine.lua b/vim/.vim/lua/plugins/lualine.lua new file mode 100644 index 0000000..cb4f100 --- /dev/null +++ b/vim/.vim/lua/plugins/lualine.lua @@ -0,0 +1,106 @@ +local split = function(inputstr, sep) + local t = {} + for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do + table.insert(t, str) + end + return t +end +local function getCitc() + local fname = vim.api.nvim_buf_get_name(0) + if string.find(fname, "/google/src/cloud/", 1, true) then + local parts = split(fname, "/") + return parts[5] + end +end +local function isCiderLspAttached() + if vim.b["is_cider_lsp_attached"] then + if vim.b["is_cider_lsp_attached"] == "yes" then + return "✓" + else + return "x" + end + else + return "" + end +end + +local function getLightbulb() + return require("nvim-lightbulb").get_status_text() +end + +local function getLGTMs() + local comments = require("google.comments") + local tracker = require("google.comments.tracker") + local dump = require("utils").dump + + print(dump(tracker.get_all_comments())) + local lgtm = comments.get_lgtms() + local appr = comments.get_approvals() + print("lgtms" .. dump(lgtm)) + print("approvals" .. dump(appr)) + return "LGTM:" .. table.concat(lgtm, ",") .. " Approval:" .. table.concat(appr, ",") +end + +return { + "nvim-lualine/lualine.nvim", + lazy = false, + config = function() + local lsp_status = require("lsp-status") + + require("lualine").setup({ + options = { + theme = "auto", + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", getCitc, isCiderLspAttached }, + lualine_c = { getLightbulb, "filename" }, + lualine_x = { + "aerial", + { + "diagnostics", + sources = { "nvim_lsp" }, + symbols = { error = " ", warn = " ", info = " ", hint = " " }, + }, + "filetype", + }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + tabline = { + lualine_a = { + { + "tabs", + mode = 1, + max_length = (vim.o.columns / 5) * 4, + fmt = function(name, context) + -- Show + if buffer is modified in tab + local buflist = vim.fn.tabpagebuflist(context.tabnr) + local winnr = vim.fn.tabpagewinnr(context.tabnr) + local bufnr = buflist[winnr] + local mod = vim.fn.getbufvar(bufnr, "&mod") + + return name .. (mod == 1 and " +" or "") + end, + }, + }, + lualine_b = { "branch" }, + lualine_c = { "filename" }, + lualine_c = { + { + "diagnostics", + sources = { "nvim_lsp", "nvim_workspace_diagnostic" }, + symbols = { error = " ", warn = " ", info = " ", hint = " " }, + }, + }, + -- lualine_y = { getLGTMs } + }, + }) + end, +}