diff --git a/jrpotter/neovim/default.nix b/jrpotter/neovim/default.nix index 8c3f496..293e7af 100644 --- a/jrpotter/neovim/default.nix +++ b/jrpotter/neovim/default.nix @@ -2,7 +2,7 @@ args @ { config, pkgs, lib, ... }: let utils = import ./utils.nix args; - nightfox = { + colorscheme = { plugin = utils.pluginGit "eb82712f86319272f4b7b9dbb4ec6df650e6987f" "EdenEast/nightfox.nvim"; @@ -11,6 +11,22 @@ let ''; }; + lualine = { + plugin = pkgs.vimPlugins.lualine-nvim; + config = '' + require('lualine').setup { + sections = { + lualine_x = {'encoding', 'filetype'}, + lualine_y = { + require('init.statusline').get_active_lsp, + require('init.statusline').get_dap_status, + }, + lualine_z = {'%c:%l:%%%p'}, + }, + } + ''; + }; + nvim-cmp = { plugin = pkgs.vimPlugins.nvim-cmp; config = '' @@ -93,7 +109,8 @@ in inherit (p) plugin; config = "lua << EOF\n${p.config}\nEOF"; } else p) [ - nightfox + colorscheme # Is always first. + lualine nvim-cmp nvim-dap nvim-lspconfig @@ -103,6 +120,7 @@ in pkgs.vimPlugins.cmp-nvim-lsp pkgs.vimPlugins.cmp_luasnip pkgs.vimPlugins.luasnip + pkgs.vimPlugins.nvim-web-devicons ]; viAlias = true; vimAlias = true; diff --git a/jrpotter/neovim/lua/default.nix b/jrpotter/neovim/lua/default.nix new file mode 100644 index 0000000..a849a45 --- /dev/null +++ b/jrpotter/neovim/lua/default.nix @@ -0,0 +1,9 @@ +{ pkgs }: +pkgs.stdenv.mkDerivation { + name = "lua"; + src = ./.; + installPhase = '' + mkdir -p $out/ + cp -r ./* $out/ + ''; +} diff --git a/jrpotter/neovim/lua/init/statusline.lua b/jrpotter/neovim/lua/init/statusline.lua new file mode 100644 index 0000000..257b34e --- /dev/null +++ b/jrpotter/neovim/lua/init/statusline.lua @@ -0,0 +1,27 @@ +local M = {} + +function M.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 "" + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return string.format(" %s", client.name) + end + end + return "" +end + +function M.get_dap_status() + local status = require('dap').status() + if string.len(status) > 0 then + return string.format("🪳 %s", status) + else + return "" + end +end + +return M