diff options
| author | christianchiarulli <chrisatmachine@gmail.com> | 2021-12-14 18:33:51 -0500 |
|---|---|---|
| committer | ChristianChiarulli <chris.machine@pm.me> | 2021-12-16 07:37:54 -0500 |
| commit | 453274513272d301906db175f8f2e7e22ef7d568 (patch) | |
| tree | 5e07b04c86bd611d0987a638ce8f2c8b01a106ae | |
| parent | 0b689f091596b1f6a06e74d40b379a722953d919 (diff) | |
add lualine
add lualine
f
| -rw-r--r-- | init.lua | 1 | ||||
| -rw-r--r-- | lua/user/bufferline.lua | 8 | ||||
| -rw-r--r-- | lua/user/keymaps.lua | 4 | ||||
| -rw-r--r-- | lua/user/lualine.lua | 93 | ||||
| -rw-r--r-- | lua/user/plugins.lua | 1 |
5 files changed, 99 insertions, 8 deletions
@@ -11,3 +11,4 @@ require "user.comment" require "user.gitsigns" require "user.nvim-tree" require "user.bufferline" +require "user.lualine" diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua index 81015c5..7d98cf0 100644 --- a/lua/user/bufferline.lua +++ b/lua/user/bufferline.lua @@ -92,12 +92,12 @@ bufferline.setup { }, close_button = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, }, close_button_visible = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, }, -- close_button_selected = { -- guifg = {attribute='fg',highlight='TabLineSel'}, diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b4d2195..638cab5 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -67,9 +67,5 @@ keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts) keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts) keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts) --- Comment -keymap("n", "<leader>/", "<cmd>lua require('Comment').toggle()<CR>", opts) -keymap("v", "<leader>/", ":lua require(\"Comment.api\").gc(vim.fn.visualmode())<cr>", opts) - -- Nvimtree keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts) diff --git a/lua/user/lualine.lua b/lua/user/lualine.lua new file mode 100644 index 0000000..50484cb --- /dev/null +++ b/lua/user/lualine.lua @@ -0,0 +1,93 @@ +local status_ok, lualine = pcall(require, "lualine") +if not status_ok then + return +end + +local hide_in_width = function() + return vim.fn.winwidth(0) > 80 +end + +local diagnostics = { + "diagnostics", + sources = { "nvim_diagnostic" }, + sections = { "error", "warn" }, + symbols = { error = " ", warn = " " }, + colored = false, + update_in_insert = false, + always_visible = true, +} + +local diff = { + "diff", + colored = false, + symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols + cond = hide_in_width +} + +local mode = { + "mode", + fmt = function(str) + return "-- " .. str .. " --" + end, +} + +local filetype = { + "filetype", + icons_enabled = false, + icon = nil, +} + +local branch = { + "branch", + icons_enabled = true, + icon = "", +} + +local location = { + "location", + padding = 0, +} + +-- cool function for progress +local progress = function() + local current_line = vim.fn.line(".") + local total_lines = vim.fn.line("$") + local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" } + local line_ratio = current_line / total_lines + local index = math.ceil(line_ratio * #chars) + return chars[index] +end + +local spaces = function() + return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") +end + +lualine.setup({ + options = { + icons_enabled = true, + theme = "auto", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { "dashboard", "NvimTree", "Outline" }, + always_divide_middle = true, + }, + sections = { + lualine_a = { branch, diagnostics }, + lualine_b = { mode }, + lualine_c = {}, + -- lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_x = { diff, spaces, "encoding", filetype }, + lualine_y = { location }, + lualine_z = { progress }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = {}, +}) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 614545c..ef28595 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -50,6 +50,7 @@ return packer.startup(function(use) use "kyazdani42/nvim-tree.lua" use "akinsho/bufferline.nvim" use "moll/vim-bbye" + use 'nvim-lualine/lualine.nvim' -- Colorschemes -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out |
