mirror of
https://github.com/nmasur/dotfiles
synced 2025-02-07 05:12:02 +00:00
neovim first init
This commit is contained in:
parent
8819bb9b9b
commit
bb1a36330b
@ -1,7 +1,18 @@
|
||||
_final: prev:
|
||||
|
||||
let
|
||||
lib = prev.lib;
|
||||
packages = lib.pipe [
|
||||
(lib.filesystem.listFilesRecursive ../pkgs)
|
||||
(builtins.filter (name: (lib.hasSuffix "package.nix" name)))
|
||||
(builtins.map (package: prev.callPackage package))
|
||||
];
|
||||
in
|
||||
|
||||
{
|
||||
loadkey = prev.callPackage ../pkgs/tools/misc/loadkey.nix;
|
||||
aws-ec2 = prev.callPackage ../pkgs/tools/misc/aws-ec2/;
|
||||
docker-cleanup = prev.callPackage ../pkgs/tools/misc/docker-cleanup/;
|
||||
|
||||
loadkey = prev.callPackage ../pkgs/tools/misc/loadkey.nix { };
|
||||
aws-ec2 = prev.callPackage ../pkgs/tools/misc/aws-ec2 { };
|
||||
docker-cleanup = prev.callPackage ../pkgs/tools/misc/docker-cleanup { };
|
||||
nmasur-neovim = prev.callPackage ../pkgs/applications/editors/neovim/nmasur/neovim { };
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
description = "Attrset of base16 colorscheme key value pairs.";
|
||||
};
|
||||
|
||||
config = {
|
||||
config = lib.mkIf config.colors {
|
||||
plugins = [ pkgs.vimPlugins.base16-nvim ];
|
||||
setup.base16-colorscheme = config.colors;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
{
|
||||
pkgs,
|
||||
colors,
|
||||
colors ? null,
|
||||
terraform ? false,
|
||||
github ? false,
|
||||
kubernetes ? false,
|
||||
@ -46,17 +46,17 @@ pkgs.neovimBuilder {
|
||||
kubernetes
|
||||
;
|
||||
imports = [
|
||||
../config/align.nix
|
||||
../config/bufferline.nix
|
||||
../config/colors.nix
|
||||
../config/completion.nix
|
||||
../config/gitsigns.nix
|
||||
../config/lsp.nix
|
||||
../config/misc.nix
|
||||
../config/statusline.nix
|
||||
../config/syntax.nix
|
||||
../config/telescope.nix
|
||||
../config/toggleterm.nix
|
||||
../config/tree.nix
|
||||
./config/align.nix
|
||||
./config/bufferline.nix
|
||||
./config/colors.nix
|
||||
./config/completion.nix
|
||||
./config/gitsigns.nix
|
||||
./config/lsp.nix
|
||||
./config/misc.nix
|
||||
./config/statusline.nix
|
||||
./config/syntax.nix
|
||||
./config/telescope.nix
|
||||
./config/toggleterm.nix
|
||||
./config/tree.nix
|
||||
];
|
||||
}
|
@ -194,7 +194,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
xdg.desktopEntries.aerc = lib.mkIf (pkgs.stdenv.isLinux && config.gui.enable) {
|
||||
xdg.desktopEntries.aerc = lib.mkIf (pkgs.stdenv.isLinux) {
|
||||
name = "aerc";
|
||||
exec = "${config.terminalLaunchCommand} aerc %u";
|
||||
};
|
||||
|
@ -0,0 +1,78 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.neovim;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.neovim = {
|
||||
enable = lib.mkEnableOption "Neovim text editor";
|
||||
package = lib.mkPackageOption pkgs "neovim" { };
|
||||
colors = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
description = "Base16 color scheme.";
|
||||
default = config.theme.colors;
|
||||
};
|
||||
github.enable = lib.mkEnableOption "GitHub integration";
|
||||
terraform.enable = lib.mkEnableOption "Terraform integration";
|
||||
kubernetes.enable = lib.mkEnableOption "Kubernetes integration";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
cfg.package = lib.mkDefault pkgs.nmasur-neovim.override {
|
||||
colors = cfg.colors;
|
||||
github = cfg.github.enable;
|
||||
terraform = cfg.terraform.enable;
|
||||
kubernetes = cfg.kubernetes.enable;
|
||||
};
|
||||
|
||||
# Use Neovim as the editor for git commit messages
|
||||
programs.git.extraConfig.core.editor = "${lib.getExe cfg.package}";
|
||||
programs.jujutsu.settings.ui.editor = "${lib.getExe cfg.package}";
|
||||
|
||||
# Set Neovim as the default app for text editing and manual pages
|
||||
home.sessionVariables = {
|
||||
EDITOR = "${lib.getExe cfg.package}";
|
||||
MANPAGER = "${lib.getExe cfg.package} +Man!";
|
||||
};
|
||||
|
||||
# Create quick aliases for launching Neovim
|
||||
programs.fish = {
|
||||
shellAliases = {
|
||||
vim = "${lib.getExe cfg.package}";
|
||||
nvim = "${lib.getExe cfg.package}";
|
||||
};
|
||||
shellAbbrs = {
|
||||
v = lib.mkForce "nvim";
|
||||
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
|
||||
vll = "nvim -c 'Telescope oldfiles'";
|
||||
};
|
||||
};
|
||||
|
||||
# Create a desktop option for launching Neovim from a file manager
|
||||
# (Requires launching the terminal and then executing Neovim)
|
||||
xdg.desktopEntries.nvim = lib.mkIf (pkgs.stdenv.isLinux) {
|
||||
name = "Neovim wrapper";
|
||||
exec = "${lib.getExe config.nmasur.presets.services.i3.terminal} nvim %F"; # TODO: change to generic
|
||||
mimeType = [
|
||||
"text/plain"
|
||||
"text/markdown"
|
||||
];
|
||||
};
|
||||
xdg.mimeApps.defaultApplications = {
|
||||
"text/plain" = [ "nvim.desktop" ];
|
||||
"text/markdown" = [ "nvim.desktop" ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user