From f1678522c119bb1f88b4a070b310a5fc1d1e84bf Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Wed, 29 Nov 2023 13:50:25 -0700 Subject: [PATCH] Update bootstrap, drop lualine. --- flake.lock | 8 +- flake.nix | 2 +- jrpotter/neovim/default.nix | 10 +- jrpotter/neovim/lua/init/dap.lua | 2 +- jrpotter/neovim/lua/init/evil.lua | 234 ------------------------------ 5 files changed, 7 insertions(+), 249 deletions(-) delete mode 100644 jrpotter/neovim/lua/init/evil.lua diff --git a/flake.lock b/flake.lock index ba45bfa..a5999e9 100644 --- a/flake.lock +++ b/flake.lock @@ -7,17 +7,17 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1701031747, - "narHash": "sha256-4pPmZdvHAmze52z7ftXp2aJYunb5+LPrBRXIOU92RoQ=", + "lastModified": 1701194178, + "narHash": "sha256-+cTvVL9ORg9dXFceHDQeRVUtkcbdCVx1EmgCZsJxFMI=", "owner": "jrpotter", "repo": "bootstrap", - "rev": "ecf4f23589123e2f2ebb5b4c3ca3d1a705791c00", + "rev": "ac84906dad2e7819145f3852d6abbd1e6f369da1", "type": "github" }, "original": { "owner": "jrpotter", - "ref": "v0.1.0", "repo": "bootstrap", + "rev": "ac84906dad2e7819145f3852d6abbd1e6f369da1", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 528d602..2d2d197 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "NixOS Flake"; inputs = { - bootstrap.url = "github:jrpotter/bootstrap/v0.1.0"; + bootstrap.url = "github:jrpotter/bootstrap/ac84906dad2e7819145f3852d6abbd1e6f369da1"; home-manager = { url = "github:nix-community/home-manager/release-23.05"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/jrpotter/neovim/default.nix b/jrpotter/neovim/default.nix index 9d4cca7..78a7362 100644 --- a/jrpotter/neovim/default.nix +++ b/jrpotter/neovim/default.nix @@ -2,13 +2,6 @@ args @ { config, pkgs, lib, ... }: let utils = import ./utils.nix args; - lualine-nvim = { - plugin = pkgs.vimPlugins.lualine-nvim; - config = '' - require('init.evil') - ''; - }; - nvim-cmp = { plugin = pkgs.vimPlugins.nvim-cmp; config = '' @@ -91,7 +84,6 @@ in inherit (p) plugin; config = "lua << EOF\n${p.config}\nEOF"; } else p) [ - lualine-nvim nvim-cmp nvim-dap nvim-lspconfig @@ -101,7 +93,6 @@ in pkgs.vimPlugins.cmp-nvim-lsp pkgs.vimPlugins.cmp_luasnip pkgs.vimPlugins.luasnip - pkgs.vimPlugins.nvim-web-devicons ]; viAlias = true; vimAlias = true; @@ -122,6 +113,7 @@ in in lib.mkBefore '' package.path = '${lua}/?.lua;' .. package.path '') + # Extra Lua configuration to be appended to `init.lua`. (lib.mkAfter '' vim.g.mapleader = ' ' diff --git a/jrpotter/neovim/lua/init/dap.lua b/jrpotter/neovim/lua/init/dap.lua index 5fa834f..6874ca3 100644 --- a/jrpotter/neovim/lua/init/dap.lua +++ b/jrpotter/neovim/lua/init/dap.lua @@ -5,7 +5,7 @@ local dap_ui = require('dap.ui') local dap_ui_widgets = require('dap.ui.widgets') local function query_launch() - local command = vim.fn.input('Executable> ', vim.fn.getcwd() .. '/', 'file') + local command = vim.fn.input('Launch> ', vim.fn.getcwd() .. '/', 'file') vim.api.nvim_echo({ { '', 'None' } }, false, {}) local parts = vim.split(command, '%s+', { trimempty = true }) diff --git a/jrpotter/neovim/lua/init/evil.lua b/jrpotter/neovim/lua/init/evil.lua deleted file mode 100644 index 31e609c..0000000 --- a/jrpotter/neovim/lua/init/evil.lua +++ /dev/null @@ -1,234 +0,0 @@ --- Original configuration: shadmansaleh/glepnir. --- Modifications include LSP and DAP information. -local lualine = require('lualine') - -local colors = { - bg = '#202328', - fg = '#bbc2cf', - yellow = '#ECBE7B', - cyan = '#008080', - darkblue = '#081633', - green = '#98be65', - orange = '#FF8800', - violet = '#a9a1e1', - magenta = '#c678dd', - blue = '#51afef', - red = '#ec5f67', -} - -local conditions = { - buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 - end, - hide_in_width = function() - return vim.fn.winwidth(0) > 80 - end, - check_git_workspace = function() - local filepath = vim.fn.expand('%:p:h') - local gitdir = vim.fn.finddir('.git', filepath .. ';') - return gitdir and #gitdir > 0 and #gitdir < #filepath - end, -} - -local config = { - options = { - -- Disable sections and component separators. - component_separators = '', - section_separators = '', - theme = { - -- We are going to use `lualine_c` an `lualine_x` as left and right - -- sections. - normal = { c = { fg = colors.fg, bg = colors.bg } }, - inactive = { c = { fg = colors.fg, bg = colors.bg } }, - }, - }, - sections = { - -- These are to remove the defaults. - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - -- These will be filled later. - lualine_c = {}, - lualine_x = {}, - }, - inactive_sections = { - -- These are to remove the defaults. - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - lualine_c = {}, - lualine_x = {}, - }, -} - --- Inserts a component in `lualine_c` at left section. -local function ins_left(component) - table.insert(config.sections.lualine_c, component) -end - --- Inserts a component in `lualine_x` at right section. -local function ins_right(component) - table.insert(config.sections.lualine_x, component) -end - --- Allow switching color based on the detected mode. -local function fg_by_mode() - local mode_color = { - n = colors.blue, - i = colors.green, - v = colors.red, - [''] = colors.red, - V = colors.red, - c = colors.magenta, - no = colors.blue, - s = colors.orange, - S = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - R = colors.violet, - Rv = colors.violet, - cv = colors.blue, - ce = colors.blue, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.blue, - t = colors.blue, - } - return { fg = mode_color[vim.fn.mode()] } -end - -ins_left { - function() - return '▊' - end, - color = fg_by_mode, - padding = { left = 0 }, -} - -ins_left { - 'filetype', - cond = conditions.buffer_not_empty, - icon_only = true, - colored = false, - color = fg_by_mode, - padding = { left = 1, right = 1 }, -} - -ins_left { - 'filename', - cond = conditions.buffer_not_empty, - color = fg_by_mode, -} - -ins_left { - 'filesize', - cond = conditions.buffer_not_empty, -} - -ins_left { '%c:%l/%L:%%%p', color = { fg = colors.fg, gui = 'bold' } } - -ins_left { - 'diagnostics', - sources = { 'nvim_diagnostic' }, - symbols = { error = ' ', warn = ' ', info = ' ' }, - diagnostics_color = { - color_error = { fg = colors.red }, - color_warn = { fg = colors.yellow }, - color_info = { fg = colors.cyan }, - }, -} - --- Insert mid section. You can make any number of sections in neovim. -ins_left { - function() - return '%=' - end, -} - -local function get_active_lsp() - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return nil - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client - end - end - return nil -end - -ins_left { - function() - local lsp_name = get_active_lsp().name - local has_dap, dap = pcall(require, 'dap') - if has_dap and dap.status() ~= "" then - return string.format("%s", lsp_name) - else - return lsp_name - end - end, - icon = ' ', - color = { fg = '#ffffff', gui = 'bold' }, - cond = function() - return get_active_lsp() ~= nil - end -} - -ins_left { - function() - return require('dap').status() - end, - icon = '🪲', - color = { fg = '#DB7093', gui = 'bold' }, - cond = function() - local has_dap, dap = pcall(require, 'dap') - return has_dap and dap.status() ~= "" - end, -} - -ins_right { - 'o:encoding', -- same as &encoding in VimL. - fmt = string.upper, - cond = conditions.hide_in_width, - color = { fg = colors.green, gui = 'bold' }, -} - -ins_right { - 'fileformat', - fmt = string.upper, - icons_enabled = false, - color = { fg = colors.green, gui = 'bold' }, -} - -ins_right { - 'branch', - icon = '', - color = { fg = colors.violet, gui = 'bold' }, -} - -ins_right { - 'diff', - symbols = { added = ' ', modified = '柳', removed = ' ' }, - diff_color = { - added = { fg = colors.green }, - modified = { fg = colors.orange }, - removed = { fg = colors.red }, - }, - cond = conditions.hide_in_width, -} - -ins_right { - function() - return '▊' - end, - color = fg_by_mode, - padding = { right = 0 }, -} - -lualine.setup(config)