1
Fork 0

Move from lualine to mini.statusline and more

This commit is contained in:
Matei Adriel 2023-12-13 19:30:04 +01:00
parent d485dfd295
commit 15d06fd26a
No known key found for this signature in database
21 changed files with 181 additions and 219 deletions

View file

@ -13,14 +13,12 @@
"crates": { "branch": "main", "commit": "b8ea20fda2e1029fbbb1bae7a9eab35c84037ca0" },
"dhall-vim": { "branch": "master", "commit": "68500ef46ff3706f46c99db3be7a0c8abcf6a3ae" },
"discord-rich-presence": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"dressing.nvim": { "branch": "master", "commit": "8b7ae53d7f04f33be3439a441db8071c96092d19" },
"femaco": { "branch": "main", "commit": "6af458f0196215f397db31a6e1fb2df795811693" },
"edit-code-block": { "branch": "main", "commit": "5e4e31012eafa113216cb5894f696682833f8e7f" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"flash": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
"ftft": { "branch": "master", "commit": "09a72f9adf8ee7c824c517ef8408c9e687453039" },
"github-actions-yaml.vim": { "branch": "master", "commit": "f2f16243447cea174daa6b4a9ffd3ff9213814ef" },
"gitlinker": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"gitsigns.nvim": { "branch": "main", "commit": "87640f5a877b18bdd49884dbcac220fed924b867" },
"harpoon": { "branch": "master", "commit": "867e212ac153e793f95b316d1731f3ca1894625e" },
"haskell-tools": { "branch": "master", "commit": "92e097c6832405fb64e4c44a7ce8bebe7836cae6" },
@ -35,20 +33,17 @@
"lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lean.nvim": { "branch": "main", "commit": "360908674890f3bd92eb41c5b362510dca8fc4cb" },
"live-command.nvim": { "branch": "main", "commit": "d460067d47948725a6f25b20f31ea8bbfdfe4622" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lualine": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"magma-nvim": { "branch": "main", "commit": "ff3deba8a879806a51c005e50782130246143d06" },
"mini.comment": { "branch": "main", "commit": "3d9c8009615857e982f09bc5357fc95f2a2175f3" },
"mini.files": { "branch": "main", "commit": "173d73f5d0b2a9abbb2d6533a3770fdbbd0c4dcc" },
"mini.operators": { "branch": "main", "commit": "7a97e2528a4c274e9da8953d3ba22f493c360a9f" },
"mini.statusline": { "branch": "main", "commit": "950d9029c7ed901b67c839e74478f784b7432665" },
"mini.surround": { "branch": "main", "commit": "af8129efcabe95fc08a233e9f91569829bed031f" },
"neoconf": { "branch": "main", "commit": "64437787dba70fce50dad7bfbb97d184c5bc340f" },
"neoconf.nvim": { "branch": "main", "commit": "64437787dba70fce50dad7bfbb97d184c5bc340f" },
"neodev.nvim": { "branch": "main", "commit": "c4ce017bd4bacf60bf59330cec9e93c5d5e104a6" },
"neogit": { "branch": "master", "commit": "761e9be2aa7cc4c8ca87f10c8c37108a687b928e" },
"neorg": { "branch": "main", "commit": "baaf13a3145534144b795ad37db22bfffd2ad343" },
"neorg-telescope": { "branch": "main", "commit": "6a7a677c40fa3c348924a4e2a06a513e0b34c056" },
"nui": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
@ -75,7 +70,6 @@
"typst.vim": { "branch": "main", "commit": "5b11b42de1703838ca1bb31dc66e73c002698e49" },
"undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" },
"venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" },
"vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" },
"vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" },

View file

@ -25,10 +25,11 @@ local M = {
return vim.g.vscode ~= nil
end),
neovide = makeEnv(function()
return vim.g.neovide ~= nil or require("nix.env") == "neovide"
return vim.g.neovide ~= nil or vim.g.nix_neovim_app == "neovide"
end),
firenvim = makeEnv(function()
return vim.g.started_by_firenvim ~= nil or require("nix.env") == "firenvim"
return vim.g.started_by_firenvim ~= nil
or vim.g.nix_neovim_app == "firenvim"
end),
_and = function(a, b)
return makeEnv(function()

View file

@ -24,16 +24,12 @@ function M.setup()
fallback = true,
-- Directory where I store my local plugin projects
path = "~/Projects",
path = vim.g.nix_projects_path,
patterns = { "Mateiadrielrafael" },
},
performance = {
rtp = {
paths = {
-- Extra runtime path specified by nix
os.getenv("NVIM_EXTRA_RUNTIME") or "",
},
paths = { vim.g.nix_extra_runtime },
disabled_plugins = {
"gzip",
"matchit",

View file

@ -110,7 +110,8 @@ return {
keys = { "<C-h>", "<C-j>", "<C-k>", "<C-l>" },
cond = env.vscode.not_active()
and env.neovide.not_active()
and env.firenvim.not_active(),
and env.firenvim.not_active()
and false,
},
{
@ -122,40 +123,6 @@ return {
config = true,
},
{
-- case switching + the subvert command
"tpope/vim-abolish",
event = "VeryLazy",
enabled = false,
},
{
-- automatically set options based on current file
"tpope/vim-sleuth",
event = "BufRead",
cond = env.vscode.not_active(),
},
{
-- generate permalinks for code
"ruifm/gitlinker.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = { mappings = "<leader>yg" },
init = function()
local status, wk = pcall(require, "which-key")
if status then
wk.register({
["<leader>yg"] = {
desc = "[Y]ank [g]it remote url",
},
})
end
end,
cond = env.firenvim.not_active(),
keys = "<leader>yg",
},
-- Live command preview for stuff like :norm
{
"smjonas/live-command.nvim",
@ -167,6 +134,6 @@ return {
})
end,
event = "VeryLazy",
-- cond = false,
cond = false,
},
}

View file

@ -1,7 +1,7 @@
local M = {
"echasnovski/mini.operators",
event = "VeryLazy",
opts = {},
event = "BufReadPost",
config = true,
}
return M

View file

@ -1,6 +1,6 @@
local M = {
"echasnovski/mini.surround",
event = "VeryLazy",
event = "BufReadPost",
}
function M.config()

View file

@ -1,54 +0,0 @@
local M = {
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
dependencies = { "nvim-lua/plenary.nvim", "nvim-neorg/neorg-telescope" },
ft = "norg",
config = function()
require("neorg").setup({
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.integrations.telescope"] = {},
-- {{{ Completions
["core.completion"] = {
config = {
engine = "nvim-cmp",
},
},
-- }}}
-- {{{ Dirman
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/Neorg",
["uni-notes"] = "~/Projects/uni-notes",
},
},
},
-- }}}
-- {{{ Keybinds
["core.keybinds"] = {
config = {
hook = function(keybinds)
-- Binds the `gtd` key in `norg` mode to execute `:echo 'Hello'`
keybinds.map("norg", "n", "gtd", "<cmd>echo 'Hello!'<CR>")
end,
},
},
-- }}}
},
})
-- {{{ Lazy cmp loading
vim.api.nvim_create_autocmd("InsertEnter", {
group = vim.api.nvim_create_augroup("CmpSourceNeorg", {}),
pattern = "*.norg",
callback = function()
require("cmp").setup.buffer({ sources = { { name = "neorg" } } })
end,
})
-- }}}
end,
}
return M

View file

@ -1,32 +0,0 @@
local env = require("my.helpers.env")
local vault = "/home/adrielus/Projects/stellar-sanctum"
return {
"epwalsh/obsidian.nvim",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim",
},
opts = {
dir = vault,
notes_subdir = "chaos",
daily_notes = {
folder = "daily",
date_format = "%Y-%m-%d",
},
completion = {
nvim_cmp = true,
min_chars = 2,
new_notes_location = "current_dir",
prepend_note_id = true,
},
mappings = {},
disable_frontmatter = true,
},
keys = {
{ "<C-O>", "<cmd>ObsidianQuickSwitch<cr>" },
},
cond = env.vscode.not_active()
and env.firenvim.not_active()
and vim.loop.cwd() == vault,
}

View file

@ -14,7 +14,11 @@ function M.config()
catppuccin.setup({
transparent_background = T.transparent.terminal,
integrations = { nvimtree = true, telescope = true },
integrations = {
nvimtree = true,
telescope = true,
mini = { enabled = true },
},
})
vim.cmd([[highlight NotifyINFOIcon guifg=#d6b20f]])
@ -23,7 +27,13 @@ function M.config()
vim.cmd("colorscheme catppuccin")
if T.transparent.terminal then
vim.cmd([[highlight FloatBorder blend=0]])
vim.cmd([[highlight FloatBorder blend=0 guibg=NONE]])
-- vim.cmd([[highlight MiniStatuslineInactive blend=0 guibg=NONE]])
vim.cmd([[highlight MiniStatuslineFilename blend=0 guibg=NONE]])
-- vim.cmd([[highlight MiniStatuslineFileinfo blend=0 guibg=NONE]])
-- vim.cmd([[highlight MiniStatuslineDevInfo blend=0 guibg=NONE]])
vim.cmd([[highlight Statusline blend=0 guibg=NONE]])
vim.cmd([[highlight StatuslineNC blend=0 guibg=NONE]])
end
end

View file

@ -75,34 +75,26 @@ let
] ++ config.satellite.neovim.generated.dependencies;
# }}}
# {{{ extraRuntime
extraRuntimePaths = env: [
extraRuntimePaths = [
# Base16 theme
(config.satellite.lib.lua.writeFile
"lua/nix" "theme"
config.satellite.colorscheme.lua
)
# Provide hints as to what app we are in
# (Useful because neovide does not provide the info itself right away)
(pkgs.writeTextDir
"lua/nix/env.lua"
"return '${env}'"
)
# Experimental nix module generation
config.satellite.neovim.generated.all
];
extraRuntime = env:
let
generated = pkgs.symlinkJoin {
name = "nixified-neovim-lua-modules";
paths = extraRuntimePaths env;
};
extraRuntimeJoinedPaths = pkgs.symlinkJoin {
name = "nixified-neovim-lua-modules";
paths = extraRuntimePaths;
};
snippets = config.satellite.dev.path "home/features/neovim/snippets";
extraRuntime =
let snippets = config.satellite.dev.path "home/features/neovim/snippets";
in
lib.concatStringsSep "," [ generated snippets ];
lib.concatStringsSep "," [ extraRuntimeJoinedPaths snippets ];
# }}}
# {{{ Client wrapper
# Wraps a neovim client, providing the dependencies
@ -112,6 +104,14 @@ let
# I cannot just install those dirs using the builtin package support because
# my package manager (lazy.nvim) disables those.
wrapClient = { base, name, binName ? name, extraArgs ? "" }:
let startupScript = pkgs.writeText "startup.lua" /* lua */''
vim.g.nix_extra_runtime = ${nlib.encode extraRuntime}
vim.g.nix_projects_dir = ${nlib.encode config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}
-- Provide hints as to what app we are running in
-- (Useful because neovide does not provide the info itself right away)
vim.g.nix_neovim_app = ${nlib.encode name}
'';
in
pkgs.symlinkJoin {
inherit (base) name meta;
paths = [ base ];
@ -119,7 +119,7 @@ let
postBuild = ''
wrapProgram $out/bin/${binName} \
--prefix PATH : ${lib.makeBinPath extraPackages} \
--set NVIM_EXTRA_RUNTIME ${extraRuntime name} \
--add-flags ${lib.escapeShellArg ''--cmd "lua dofile('${startupScript}')"''} \
${extraArgs}
'';
};
@ -156,7 +156,10 @@ in
satellite.toggles.neovim.enable = true;
xdg.configFile.nvim.source = config.satellite.dev.path "home/features/neovim/config";
home.sessionVariables.EDITOR = "nvim";
home.sessionVariables = {
EDITOR = "nvim";
NVIM_GENERATED_RUNTIME = extraRuntimeJoinedPaths;
};
home.packages = [
neovim
@ -247,34 +250,36 @@ in
keys.action = "<cmd>NvimTreeToggle<cr>";
};
# }}}
# {{{ lualine
satellite.neovim.lazy.lualine = {
package = "nvim-lualine/lualine.nvim";
# {{{ mini.statusline
satellite.neovim.lazy.mini-statusline = {
package = "echasnovski/mini.statusline";
name = "mini.statusline";
dependencies.lua = [ lazy.web-devicons.package ];
env.blacklist = [ "vscode" "firenvim" ];
event = "VeryLazy";
lazy = false;
opts = {
options = {
component_separators = { left = ""; right = ""; };
section_separators = { left = ""; right = ""; };
theme = "auto";
disabled_filetypes = [ "undotree" ];
};
opts.content.inactive = nlib.thunk /* lua */ ''
require("mini.statusline").combine_groups({
{ hl = "MiniStatuslineFilename", strings = { vim.fn.expand("%:t") } },
})
'';
sections = {
lualine_a = [ "branch" ];
lualine_b = [ "filename" ];
lualine_c = [ "filetype" ];
lualine_x = [ "diagnostics" "diff" ];
lualine_y = [ ];
lualine_z = [ ];
};
opts.content.active = nlib.thunk /* lua */ ''
local st = require("mini.statusline");
local mode, mode_hl = st.section_mode({ trunc_width = 120 })
local git = st.section_git({ trunc_width = 75 })
local diagnostics = st.section_diagnostics({ trunc_width = 75 })
# Integration with other plugins
extensions = [ "nvim-tree" ];
};
return st.combine_groups({
{ hl = mode_hl, strings = { mode } },
{ hl = "MiniStatuslineDevinfo", strings = { git } },
{ hl = "MiniStatuslineFilename", strings = { vim.fn.expand("%:t") } },
"%=", -- End left alignment
{ hl = "MiniStatuslineFilename", strings = { diagnostics } },
{ hl = "MiniStatuslineDevinfo", strings = { vim.bo.filetype } },
})
'';
};
# }}}
# {{{ winbar
@ -282,7 +287,7 @@ in
package = "fgheng/winbar.nvim";
env.blacklist = [ "vscode" "firenvim" ];
event = "VeryLazy";
event = "BufReadPost";
opts.enabled = true;
};
@ -627,8 +632,9 @@ in
satellite.neovim.lazy.wakatime = {
package = "wakatime/vim-wakatime";
env.blacklist = [ "vscode" "firenvim" ];
event = "VeryLazy";
event = "BufReadPost";
};
# }}}
# {{{ discord rich presence
satellite.neovim.lazy.discord-rich-presence = {
@ -636,7 +642,7 @@ in
main = "presence";
env.blacklist = [ "vscode" "firenvim" ];
event = "VeryLazy";
event = "BufReadPost";
setup = true;
};
# }}}
@ -662,6 +668,41 @@ in
opts.provider = "paste.rs";
};
# }}}
# {{{ obsidian
satellite.neovim.lazy.obsidian =
let vault = "${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}/stellar-sanctum";
in
{
package = "epwalsh/obsidian.nvim";
dependencies.lua = [ lazy.plenary.package ];
env.blacklist = [ "vscode" "firenvim" ];
cond = nlib.lua /* lua */ "vim.loop.cwd() == ${nlib.encode vault}";
event = "VeryLazy";
keys.mapping = "<C-O>";
keys.action = "<cmd>ObsidianQuickSwitch<cr>";
opts = {
dir = vault;
notes_subdir = "chaos";
daily_notes = {
folder = "daily";
date_format = "%Y-%m-%d";
};
completion = {
nvim_cmp = true;
min_chars = 2;
new_notes_location = "current_dir";
prepend_note_id = true;
};
mappings = { };
disable_frontmatter = true;
};
};
# }}}
# }}}
# }}}
# {{{ Persistence