From 46f4a60f42990244dd9a9c49abe568112c34e0cb Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Thu, 5 May 2022 17:12:08 -0500 Subject: feat: simplify configs and improve theme --- alacritty/.config/alacritty/colors.yml | 121 +++++++++++++++--------- nvim/.config/nvim/lua/icons.lua | 106 --------------------- nvim/.config/nvim/lua/options.lua | 2 + nvim/.config/nvim/lua/plugins.lua | 5 - nvim/.config/nvim/lua/plugins/alpha.lua | 50 ---------- nvim/.config/nvim/lua/plugins/cmp.lua | 103 +++++--------------- nvim/.config/nvim/lua/plugins/lsp-signature.lua | 3 - nvim/.config/nvim/lua/plugins/lspkind.lua | 28 +----- nvim/.config/nvim/lua/plugins/lualine.lua | 99 ++++--------------- tmux/.config/tmux/tmux.conf | 3 + 10 files changed, 126 insertions(+), 394 deletions(-) delete mode 100644 nvim/.config/nvim/lua/icons.lua delete mode 100644 nvim/.config/nvim/lua/plugins/alpha.lua diff --git a/alacritty/.config/alacritty/colors.yml b/alacritty/.config/alacritty/colors.yml index dbfcd0e..044e139 100644 --- a/alacritty/.config/alacritty/colors.yml +++ b/alacritty/.config/alacritty/colors.yml @@ -1,60 +1,91 @@ schemes: - codelight: &light + vscode_light: &vscode_light primary: - background: '#ffffff' - foreground: '#1e1e1e' + background: "#ffffff" + foreground: "#1e1e1e" cursor: - text: '#d4d4d4' - cursor: '#d4d4d4' + text: "#d4d4d4" + cursor: "#d4d4d4" normal: - black: '#1e1e1e' - red: '#c72e0f' - green: '#009000' - yellow: '#795e25' - blue: '#007acc' - magenta: '#af00db' - cyan: '#56b6c2' - white: '#d4d4d4' + black: "#1e1e1e" + red: "#c72e0f" + green: "#009000" + yellow: "#795e25" + blue: "#007acc" + magenta: "#af00db" + cyan: "#56b6c2" + white: "#d4d4d4" bright: - black: '#1e1e1e' - red: '#c72e0f' - green: '#009000' - yellow: '#795e25' - blue: '#007acc' - magenta: '#af00db' - cyan: '#56b6c2' - white: '#d4d4d4' - - codedark: &dark + black: "#1e1e1e" + red: "#c72e0f" + green: "#009000" + yellow: "#795e25" + blue: "#007acc" + magenta: "#af00db" + cyan: "#56b6c2" + white: "#d4d4d4" + + vscode_dark: &vscode_dark primary: - background: '#1e1e1e' - foreground: '#d4d4d4' + background: "#1e1e1e" + foreground: "#d4d4d4" cursor: - text: '#d4d4d4' - cursor: '#d4d4d4' + text: "#d4d4d4" + cursor: "#d4d4d4" normal: - black: '#1e1e1e' - red: '#f44747' - green: '#608b4e' - yellow: '#dcdcaa' - blue: '#569cd6' - magenta: '#c678dd' - cyan: '#56b6c2' - white: '#d4d4d4' + black: "#1e1e1e" + red: "#f44747" + green: "#608b4e" + yellow: "#dcdcaa" + blue: "#569cd6" + magenta: "#c678dd" + cyan: "#56b6c2" + white: "#d4d4d4" bright: - black: '#545454' - red: '#f44747' - green: '#608b4e' - yellow: '#dcdcaa' - blue: '#569cd6' - magenta: '#c678dd' - cyan: '#56b6c2' - white: '#d4d4d4' - -colors: *dark \ No newline at end of file + black: "#545454" + red: "#f44747" + green: "#608b4e" + yellow: "#dcdcaa" + blue: "#569cd6" + magenta: "#c678dd" + cyan: "#56b6c2" + white: "#d4d4d4" + + gruvbox: &gruvbox # Default colors + primary: + background: "0x1d2021" + foreground: "0xd4be98" + + # Normal colors + normal: + black: "0x544b3c" + red: "0xea6962" + green: "0xa9b665" + yellow: "0xd8a657" + blue: "0x7daea3" + magenta: "0xd3869b" + aqua: "0x89b482" + white: "0xd4be98" + + # Bright colors + bright: + black: "0x4f4738" + red: "0xea6962" + green: "0xa9b665" + yellow: "0xd8a657" + blue: "0x7daea3" + magenta: "0xd3869b" + aqua: "0x89b482" + white: "0xd4be98" + + indexed_colors: + - { index: 16, color: "0xe78a4e" } + - { index: 17, color: "0xc14a4a" } + +colors: *gruvbox diff --git a/nvim/.config/nvim/lua/icons.lua b/nvim/.config/nvim/lua/icons.lua deleted file mode 100644 index 723d24d..0000000 --- a/nvim/.config/nvim/lua/icons.lua +++ /dev/null @@ -1,106 +0,0 @@ --- https://github.com/microsoft/vscode/blob/main/src/vs/base/common/codicons.ts --- go to the above and then enter u and the symbold should appear --- or go here and upload the font file: https://mathew-kurian.github.io/CharacterMap/ --- find more here: https://www.nerdfonts.com/cheat-sheet ---   פּ ﯟ   蘒練 some other good icons -return { - kind = { - Text = "", - -- Method = "m", - -- Function = "", - -- Constructor = "", - Method = "", - Function = "", - Constructor = "", - Field = "", - -- Variable = "", - Variable = "", - Class = "", - Interface = "", - -- Module = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - -- Keyword = "", - Keyword = "", - -- Snippet = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", - }, - type = { - Array = "", - Number = "", - String = "", - Boolean = "蘒", - Object = "", - }, - documents = { - File = "", - Files = "", - Folder = "", - OpenFolder = "", - }, - git = { - Add = "", - Mod = "", - Remove = "", - Ignore = "", - Rename = "", - Diff = "", - Repo = "", - }, - ui = { - Lock = "", - Circle = "", - BigCircle = "", - BigUnfilledCircle = "", - Close = "", - NewFile = "", - Search = "", - Lightbulb = "", - Project = "", - Dashboard = "", - History = "", - Comment = "", - Bug = "", - Code = "", - Telescope = "", - Gear = "", - Package = "", - List = "", - SignIn = "", - Check = "", - Fire = "", - Note = "", - BookMark = "", - Pencil = "", - -- ChevronRight = "", - ChevronRight = ">", - Table = "", - Calendar = "", - }, - diagnostics = { - Error = "", - Warning = "", - Information = "", - Question = "", - Hint = "", - }, - misc = { - Robot = "ﮧ", - Squirrel = "", - Tag = "", - Watch = "", - }, -} diff --git a/nvim/.config/nvim/lua/options.lua b/nvim/.config/nvim/lua/options.lua index 04adf53..c4a32f8 100644 --- a/nvim/.config/nvim/lua/options.lua +++ b/nvim/.config/nvim/lua/options.lua @@ -5,8 +5,10 @@ local exec = vim.api.nvim_exec -- execute Vimscript g.mapleader = " " vim.g.gruvbox_flat_style = "hard" +vim.g.gruvbox_theme = { TabLineSel = { bg = "orange" } } vim.cmd([[colorscheme gruvbox-flat]]) + g.tex_flavor = "latex" -- global options diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 0a3bc0e..9999317 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -230,11 +230,6 @@ return packer.startup(function(use) use("b0o/SchemaStore.nvim") use("windwp/nvim-spectre") - use({ - "goolord/alpha-nvim", - config = [[require('plugins/alpha')]], - }) - use({ "filipdutescu/renamer.nvim", config = [[require('plugins/renamer')]], diff --git a/nvim/.config/nvim/lua/plugins/alpha.lua b/nvim/.config/nvim/lua/plugins/alpha.lua deleted file mode 100644 index 38f147a..0000000 --- a/nvim/.config/nvim/lua/plugins/alpha.lua +++ /dev/null @@ -1,50 +0,0 @@ -local status_ok, alpha = pcall(require, "alpha") -if not status_ok then - return -end - -local status_ok, dashboard = pcall(require, "alpha.themes.dashboard") -if not status_ok then - return -end - --- alpha.setup(dashboard.config) - -local icons = require("icons") - -local dashboard = require("alpha.themes.dashboard") -dashboard.section.header.val = { - [[ __ ]], - [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], - [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], - [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], - [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], - [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], -} -dashboard.section.buttons.val = { - dashboard.button("f", icons.documents.Files .. " Find file", ":Telescope find_files "), - dashboard.button("e", icons.ui.NewFile .. " New file", ":ene startinsert "), - dashboard.button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles "), - dashboard.button("t", icons.ui.List .. " Find text", ":Telescope live_grep "), - dashboard.button("s", icons.ui.SignIn .. " Find Session", ":Telescope sessions save_current=false "), - dashboard.button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua "), - dashboard.button("q", icons.diagnostics.Error .. " Quit", ":qa"), -} -local function footer() - -- NOTE: requires the fortune-mod package to work - -- local handle = io.popen("fortune") - -- local fortune = handle:read("*a") - -- handle:close() - -- return fortune - return "tobyvin.com" -end - -dashboard.section.footer.val = footer() - -dashboard.section.footer.opts.hl = "Type" -dashboard.section.header.opts.hl = "Include" -dashboard.section.buttons.opts.hl = "Keyword" - -dashboard.opts.opts.noautocmd = true --- vim.cmd([[autocmd User AlphaReady echo 'ready']]) -alpha.setup(dashboard.opts) diff --git a/nvim/.config/nvim/lua/plugins/cmp.lua b/nvim/.config/nvim/lua/plugins/cmp.lua index a5ea7b8..63a3320 100644 --- a/nvim/.config/nvim/lua/plugins/cmp.lua +++ b/nvim/.config/nvim/lua/plugins/cmp.lua @@ -3,27 +3,35 @@ if not status_ok then return end --- Require function for tab to work with LUA-SNIP -local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +local get_enabled = function() + -- disable completion in comments + local context = require("cmp.config.context") + -- keep command mode completion enabled when cursor is in a comment + if vim.api.nvim_get_mode().mode == "c" then + return true + else + return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment") + end +end + +local get_snippets = function(args) + require("luasnip").lsp_expand(args.body) end cmp.setup({ + enabled = get_enabled, completion = { completeopt = "menu,menuone,noinsert", }, snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, + expand = get_snippets, }, + -- TODO move mappings to which-key mapping = { - [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.select_next_item(), - -- Add tab support - [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), @@ -34,19 +42,16 @@ cmp.setup({ }), }, formatting = { - format = function(entry, vim_item) - -- fancy icons and a name of kind - vim_item.kind = require("lspkind").presets.default[vim_item.kind] - -- set a name for each source - vim_item.menu = ({ - buffer = "[Buff]", + format = lspkind.cmp_format({ + mode = "symbol_text", + menu = { nvim_lsp = "[LSP]", luasnip = "[LuaSnip]", nvim_lua = "[Lua]", - latex_symbols = "[Latex]", - })[entry.source.name] - return vim_item - end, + buffer = "[Buffer]", + path = "[Path]", + }, + }), }, sources = { { name = "nvim_lsp" }, @@ -54,63 +59,5 @@ cmp.setup({ { name = "path" }, { name = "luasnip" }, { name = "buffer", keyword_length = 1 }, - { name = "calc" }, - }, - experimental = { - -- ghost_text = true, }, }) - --- local luasnip = require("luasnip") - --- local source_mapping = { --- nvim_lsp = "[LSP]", --- nvim_lua = "[Lua]", --- path = "[Path]", --- buffer = "[Buffer]", --- luasnip = "[LuaSnip]", --- nvim_lsp_signature_help = "[LspSignatureHelp]", --- calc = "[Calc]", --- } - --- cmp.setup({ --- snippet = { --- expand = function(args) require('luasnip').lsp_expand(args.body) end --- }, - --- mapping = { --- [''] = cmp.mapping.select_prev_item(), --- [''] = cmp.mapping.select_next_item(), --- -- Add tab support --- [''] = cmp.mapping.select_prev_item(), --- [''] = cmp.mapping.select_next_item(), --- [''] = cmp.mapping.scroll_docs(-4), --- [''] = cmp.mapping.scroll_docs(4), --- [''] = cmp.mapping.complete(), --- [''] = cmp.mapping.close(), --- [''] = cmp.mapping.confirm({ --- behavior = cmp.ConfirmBehavior.Replace, --- select = true, --- }) --- }, - --- formatting = { --- format = function(entry, vim_item) --- vim_item.kind = require("lspkind").presets.default[vim_item.kind] --- local menu = source_mapping[entry.source.name] --- vim_item.menu = menu --- return vim_item --- end, --- }, --- -- Installed sources --- sources = { --- -- { name = 'path' }, --- { name = "nvim_lsp" }, --- { name = "nvim_lua" }, --- { name = 'path' }, --- { name = "luasnip" }, --- { name = "buffer", keyword_length = 1 }, --- { name = 'nvim_lsp_signature_help' }, --- { name = 'calc' }, --- }, --- }) diff --git a/nvim/.config/nvim/lua/plugins/lsp-signature.lua b/nvim/.config/nvim/lua/plugins/lsp-signature.lua index 78162a1..4790366 100644 --- a/nvim/.config/nvim/lua/plugins/lsp-signature.lua +++ b/nvim/.config/nvim/lua/plugins/lsp-signature.lua @@ -3,8 +3,6 @@ if not status_ok then return end -local icons = require("icons") - local cfg = { debug = false, -- set to true to enable debug logging log_path = "debug_log_file_path", -- debug log path @@ -24,7 +22,6 @@ local cfg = { -- this setting will be helpful if you do not want the PUM and floating win overlap fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters hint_enable = true, -- virtual hint enable - hint_prefix = icons.misc.Squirrel .. " ", -- Panda for parameter hint_scheme = "Comment", use_lspsaga = false, -- set to true if you want to use lspsaga popup hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight diff --git a/nvim/.config/nvim/lua/plugins/lspkind.lua b/nvim/.config/nvim/lua/plugins/lspkind.lua index d357d68..8aac636 100644 --- a/nvim/.config/nvim/lua/plugins/lspkind.lua +++ b/nvim/.config/nvim/lua/plugins/lspkind.lua @@ -4,31 +4,5 @@ if not status_ok then end lspkind.init({ - -- enables text annotations (default: 'default') - -- default symbol map can be either 'default' or 'codicons' for codicon preset (requires vscode-codicons font installed) - preset = "codicons", - - -- override preset symbols (default: {}) - symbol_map = { - Text = "", - Method = "ƒ", - Function = "", - Constructor = "", - Variable = "", - Class = "", - Interface = "ﰮ", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "了", - Keyword = "", - Snippet = "﬌", - Color = "", - File = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - }, + symbol_map = { typeparameter = "" }, }) diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/plugins/lualine.lua index 23c9133..2f4172a 100644 --- a/nvim/.config/nvim/lua/plugins/lualine.lua +++ b/nvim/.config/nvim/lua/plugins/lualine.lua @@ -3,73 +3,23 @@ if not status_ok then return end -local status_gps_ok, gps = pcall(require, "nvim-gps") -if not status_gps_ok then - return -end - -local hide_in_width = function() - return vim.fn.winwidth(0) > 80 -end - -local icons = require("icons") - -local diagnostics = { - "diagnostics", - sources = { "nvim_diagnostic" }, - sections = { "error", "warn" }, - symbols = { error = icons.diagnostics.Error .. " ", warn = icons.diagnostics.Warning .. " " }, - colored = false, - update_in_insert = false, - always_visible = true, -} - -local diff = { - "diff", - colored = false, - symbols = { added = icons.git.Add .. " ", modified = icons.git.Mod .. " ", removed = icons.git.Remove .. " " }, -- changes diff symbols - cond = hide_in_width, -} - -local mode = { - "mode", - fmt = function(str) - return "-- " .. str .. " --" - end, -} +local custom_theme = require("gruvbox-flat.lualine.themes.gruvbox_flat") +local gruvbox_config = require("gruvbox.config") +local colors = require("gruvbox.colors").setup(gruvbox_config) -local filetype = { - "filetype", - icons_enabled = false, - icon = nil, -} +custom_theme.normal.a.bg = colors.orange +custom_theme.normal.b.fg = colors.orange +custom_theme.inactive.a.fg = colors.orange -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") +local to_char = function(str) + return str:sub(1, 1) end local nvim_gps = function() + local status_gps_ok, gps = pcall(require, "nvim-gps") + if not status_gps_ok then + return + end local gps_location = gps.get_location() if gps_location == "error" then return "" @@ -78,33 +28,22 @@ local nvim_gps = function() end end +local hide_in_width = function() + return vim.fn.winwidth(0) > 80 +end + lualine.setup({ options = { - icons_enabled = true, - theme = "gruvbox-flat", component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, - disabled_filetypes = { "alpha", "dashboard", "NvimTree", "Outline", "toggleterm" }, - always_divide_middle = true, + disabled_filetypes = { "alpha" }, }, sections = { - lualine_a = { branch }, - lualine_b = { diagnostics }, + lualine_a = { "mode", fmt = to_char }, lualine_c = { { nvim_gps, cond = hide_in_width }, }, - lualine_x = { diff, spaces, "encoding", filetype }, - lualine_y = { location }, - lualine_z = { progress }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {}, - lualine_x = { "location" }, - lualine_y = {}, - lualine_z = {}, }, tabline = {}, - extensions = {}, + extensions = { "fzf", "fugitive", "toggleterm", "NeoTree" }, }) diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf index 0510dbc..343134e 100644 --- a/tmux/.config/tmux/tmux.conf +++ b/tmux/.config/tmux/tmux.conf @@ -2,6 +2,8 @@ set -g mouse on set -g base-index 1 set -g default-terminal "tmux-256color" set -ga terminal-overrides ",alacritty:Tc" +set -ga terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support +set -ga terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0 set -g detach-on-destroy off set -g prefix C-a @@ -16,6 +18,7 @@ set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'tmux-plugins/tmux-pain-control' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @plugin 'lawabidingcactus/tmux-gruvbox-truecolor' set -g @resrrect-dir "$XDG_DATA_DIR/tmux/resurrect" set -g @resurrect-strategy-nvim 'session' -- cgit v1.2.3-70-g09d2