2023-11-20 04:00:33 +00:00
|
|
|
args @ { config, pkgs, lib, ... }:
|
2023-11-17 11:58:33 +00:00
|
|
|
let
|
2023-11-20 04:00:33 +00:00
|
|
|
utils = import ./utils.nix args;
|
2023-11-17 22:02:07 +00:00
|
|
|
|
2023-11-30 13:17:58 +00:00
|
|
|
colorscheme = {
|
2023-11-30 03:22:47 +00:00
|
|
|
plugin = utils.pluginGit
|
|
|
|
"eb82712f86319272f4b7b9dbb4ec6df650e6987f"
|
|
|
|
"EdenEast/nightfox.nvim";
|
|
|
|
config = ''
|
2024-03-05 03:10:57 +00:00
|
|
|
vim.cmd("colorscheme nordfox")
|
2023-11-30 03:22:47 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-11-30 13:17:58 +00:00
|
|
|
lualine = {
|
|
|
|
plugin = pkgs.vimPlugins.lualine-nvim;
|
|
|
|
config = ''
|
2024-03-05 03:10:57 +00:00
|
|
|
require("lualine").setup {
|
2023-11-30 13:17:58 +00:00
|
|
|
sections = {
|
2024-03-05 03:10:57 +00:00
|
|
|
lualine_x = { "encoding", "filetype" },
|
2023-11-30 13:17:58 +00:00
|
|
|
lualine_y = {
|
2024-03-05 03:10:57 +00:00
|
|
|
require("utils.statusline").get_active_lsp,
|
|
|
|
require("utils.statusline").get_dap_status,
|
|
|
|
require("utils.statusline").get_autoexpand_status,
|
2023-11-30 13:17:58 +00:00
|
|
|
},
|
2024-03-05 03:10:57 +00:00
|
|
|
lualine_z = { "%c:%l:%%%p" },
|
2023-11-30 13:17:58 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-01-04 17:21:22 +00:00
|
|
|
luasnip = {
|
|
|
|
plugin = pkgs.vimPlugins.luasnip;
|
|
|
|
config = ''
|
2024-03-05 03:10:57 +00:00
|
|
|
require("utils.luasnip").setup()
|
|
|
|
require("luasnip").add_snippets("all", require("utils.utf8"), {
|
2024-01-26 00:47:12 +00:00
|
|
|
type = "autosnippets",
|
|
|
|
})
|
2024-01-04 17:21:22 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-11-18 23:08:50 +00:00
|
|
|
nvim-cmp = {
|
|
|
|
plugin = pkgs.vimPlugins.nvim-cmp;
|
|
|
|
config = ''
|
2024-03-05 03:10:57 +00:00
|
|
|
require("utils.cmp").setup()
|
2023-11-18 23:08:50 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-11-17 11:58:33 +00:00
|
|
|
nvim-dap = {
|
2023-11-20 04:00:33 +00:00
|
|
|
plugin = utils.pluginGit
|
2024-03-05 02:55:49 +00:00
|
|
|
"fc880e82059eb21c0fa896be60146e5f17680648"
|
2023-11-17 22:02:07 +00:00
|
|
|
"mfussenegger/nvim-dap";
|
2023-11-23 14:04:20 +00:00
|
|
|
config = ''
|
2024-03-05 02:55:49 +00:00
|
|
|
require("dap").defaults.fallback.terminal_win_cmd = function()
|
|
|
|
return vim.api.nvim_create_buf(
|
|
|
|
true, -- listed
|
|
|
|
true -- scratch
|
|
|
|
)
|
|
|
|
end
|
2023-12-03 19:54:43 +00:00
|
|
|
${config.programs.neovim.nvim-dap}
|
2023-11-23 14:04:20 +00:00
|
|
|
'';
|
2023-11-17 11:58:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nvim-lspconfig = {
|
|
|
|
plugin = pkgs.vimPlugins.nvim-lspconfig;
|
2023-11-17 18:00:35 +00:00
|
|
|
config = config.programs.neovim.nvim-lspconfig;
|
2023-11-17 11:58:33 +00:00
|
|
|
};
|
|
|
|
|
2023-11-24 15:21:43 +00:00
|
|
|
nvim-telescope = {
|
|
|
|
plugin = pkgs.vimPlugins.telescope-nvim;
|
|
|
|
config = ''
|
2024-03-05 03:10:57 +00:00
|
|
|
require("utils.telescope").setup()
|
2023-11-24 15:21:43 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-11-17 11:58:33 +00:00
|
|
|
nvim-treesitter = {
|
|
|
|
plugin = (pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
|
|
|
ps: with ps; [
|
2023-11-20 15:13:13 +00:00
|
|
|
bash
|
2023-11-22 13:11:41 +00:00
|
|
|
c
|
2023-11-20 16:32:20 +00:00
|
|
|
elixir
|
2023-11-30 13:58:10 +00:00
|
|
|
heex
|
|
|
|
html
|
2023-11-17 11:58:33 +00:00
|
|
|
lua
|
2023-11-22 21:59:01 +00:00
|
|
|
markdown
|
2023-11-17 11:58:33 +00:00
|
|
|
nix
|
|
|
|
python
|
2023-11-20 15:13:13 +00:00
|
|
|
typescript
|
2023-11-17 11:58:33 +00:00
|
|
|
]
|
|
|
|
));
|
|
|
|
config = ''
|
2024-03-05 03:10:57 +00:00
|
|
|
require("utils.treesitter").setup()
|
2023-11-17 11:58:33 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2023-11-17 18:00:35 +00:00
|
|
|
options.programs.neovim = {
|
|
|
|
nvim-dap = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
|
|
|
example = ''
|
2024-03-05 03:10:57 +00:00
|
|
|
require("...").nvim_dap()
|
2023-11-17 18:00:35 +00:00
|
|
|
'';
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Language-specific configurations for the `nvim-dap` plugin.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
nvim-lspconfig = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
|
|
|
example = ''
|
2024-03-05 03:10:57 +00:00
|
|
|
require("...").nvim_lspconfig()
|
2023-11-17 18:00:35 +00:00
|
|
|
'';
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Language-specific configurations for the `nvim-lspconfig` plugin.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2023-11-24 15:21:43 +00:00
|
|
|
home.packages = with pkgs; [
|
|
|
|
ripgrep
|
|
|
|
];
|
|
|
|
|
2023-11-17 18:00:35 +00:00
|
|
|
programs.neovim = {
|
2023-11-18 19:45:36 +00:00
|
|
|
defaultEditor = true;
|
2023-11-17 22:02:07 +00:00
|
|
|
plugins = map (p:
|
|
|
|
if builtins.hasAttr "config" p then {
|
|
|
|
inherit (p) plugin;
|
|
|
|
config = "lua << EOF\n${p.config}\nEOF";
|
|
|
|
} else p) [
|
2023-11-30 13:17:58 +00:00
|
|
|
colorscheme # Is always first.
|
|
|
|
lualine
|
2024-01-04 17:21:22 +00:00
|
|
|
luasnip
|
2023-11-18 23:08:50 +00:00
|
|
|
nvim-cmp
|
2023-11-17 18:00:35 +00:00
|
|
|
nvim-dap
|
|
|
|
nvim-lspconfig
|
2023-11-24 15:21:43 +00:00
|
|
|
nvim-telescope
|
2023-11-17 18:00:35 +00:00
|
|
|
nvim-treesitter
|
2023-11-18 23:08:50 +00:00
|
|
|
pkgs.vimPlugins.cmp-buffer
|
|
|
|
pkgs.vimPlugins.cmp-nvim-lsp
|
2023-11-18 23:41:39 +00:00
|
|
|
pkgs.vimPlugins.cmp_luasnip
|
2023-11-30 13:17:58 +00:00
|
|
|
pkgs.vimPlugins.nvim-web-devicons
|
2023-12-03 19:54:43 +00:00
|
|
|
pkgs.vimPlugins.vim-prettier
|
2023-11-17 18:00:35 +00:00
|
|
|
];
|
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
};
|
|
|
|
|
2023-11-30 03:22:47 +00:00
|
|
|
xdg.configFile."nvim/init.lua".text =
|
|
|
|
let
|
2024-01-04 17:01:01 +00:00
|
|
|
config = import ./config { inherit pkgs; };
|
2023-11-30 03:22:47 +00:00
|
|
|
in
|
|
|
|
lib.mkMerge [
|
|
|
|
# Extra Lua configuration to be prepended to `init.lua`. Extend the
|
|
|
|
# Lua loader to search for our /nix/store/.../?.lua files.
|
|
|
|
(lib.mkBefore ''
|
2024-03-05 03:10:57 +00:00
|
|
|
package.path = "${config}/?.lua;" .. package.path
|
2023-11-30 03:22:47 +00:00
|
|
|
'')
|
|
|
|
# Extra Lua configuration to be appended to `init.lua`.
|
|
|
|
(lib.mkAfter ''
|
2024-03-05 03:10:57 +00:00
|
|
|
vim.g.mapleader = " "
|
|
|
|
vim.g.maplocalleader = "\\"
|
|
|
|
vim.o.colorcolumn = "80,100"
|
|
|
|
vim.o.equalalways = false -- Disable auto window resize.
|
|
|
|
vim.o.expandtab = true -- Spaces instead of tabs.
|
|
|
|
vim.o.list = true -- Show hidden characters.
|
|
|
|
vim.o.shiftwidth = 2 -- # of spaces to use for each (auto)indent.
|
|
|
|
vim.o.tabstop = 2 -- # of spaces a <Tab> in the file counts for.
|
2024-03-21 20:36:05 +00:00
|
|
|
|
|
|
|
-- "Zoom" in on a window
|
|
|
|
vim.keymap.set("n", "<c-w>z", ":tabedit %<CR>")
|
2024-03-21 20:38:56 +00:00
|
|
|
-- Open working directory.
|
|
|
|
vim.keymap.set("n", "-", ":Explore<CR>")
|
2023-11-30 03:22:47 +00:00
|
|
|
'')
|
|
|
|
];
|
2023-11-17 11:58:33 +00:00
|
|
|
};
|
|
|
|
}
|