Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@ A common use case is adding it to development flakes for a personalized editing
}
```

### Variants

While it is easy to build your own configs using options, two additional variants are available
from the flake for convenience.

#### Langed (All Languages)

Langed comes with all supported languages enabled out of the box. Use it by adding `nvl` instead of
`nv` to your package set.

#### Web

Similar to Langed, Web comes with essential web development languages enabled out of the box. Use it
by adding `nvw` instead of `nv` to your package set.

## Languages

Several languages are supported. You can enable them by setting the
Expand Down
16 changes: 16 additions & 0 deletions docs/index.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#+title: Docs - Opinionated Nixvim Configuration
#+author: Ahmad Raza <pro.se.ahmad.raza.1@gmail.com>
#+filetags: :todo:

* Docs

This document explains the configuration decisions and defaults.

** Reading this document

*** Abbreviations
| Abbr. | Explanation
| ~<L>~ | Leader key, used in keybindings.

** Developer Experience
+ No inlay hints by default. They add visual noise. Use ~<L>uh~ to toggle them.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 40 additions & 17 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,45 @@
pkgs,
system,
...
}: {
yalms = pkgs.vimPlugins.yalms;
default =
(inputs.nixvim.lib.evalNixvim
{
inherit system;
modules = [./modules];
extraSpecialArgs = {
inherit inputs pkgs;
};
}).config.build.package;
}: let
base =
inputs.nixvim.lib.evalNixvim
{
inherit system;
modules = [./modules];
extraSpecialArgs = {
inherit inputs pkgs;
};
};
in {
default = base.config.build.package;
langed =
(base.extendModules {
modules = [
{
nv.langs.enableAll = true;
}
];
}).config.build.package;
web =
(base.extendModules {
modules = [
{
nv.langs.astro.enable = true;
}
];
}).config.build.package;
};
in {
apps = forEachSupportedSystem (
{pkgs, ...}: let
outputs = mkOutputs pkgs;
in {
default = {
in
builtins.mapAttrs (_k: v: {
type = "app";
program = "${outputs.default}/bin/nvim";
};
}
program = "${v}/bin/nvim";
})
outputs
);

devShells = forEachSupportedSystem (
Expand All @@ -103,7 +120,11 @@
);

packages = forEachSupportedSystem (
{pkgs, ...}: mkOutputs pkgs
{pkgs, ...}:
(mkOutputs pkgs)
// {
yalms = pkgs.vimPlugins.yalms;
}
);

overlays.default = nixpkgs.lib.composeManyExtensions [
Expand All @@ -114,6 +135,8 @@
outputs = mkOutputs prev;
in {
nv = outputs.default;
nvl = outputs.langed;
nvw = outputs.web;
}))
];

Expand Down
1 change: 1 addition & 0 deletions modules/keys/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ _: {
Snacks.toggle.diagnostics():map('<leader>c.d')
Snacks.toggle.treesitter():map('<leader>c.t')
Snacks.toggle.indent():map('<leader>ui')
Snacks.toggle.inlay_hints():map('<leader>uh')
Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map('<leader>un')
'';
}
2 changes: 2 additions & 0 deletions modules/langs/astro.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ in {
};

config = lib.mkIf config.nv.langs.astro.enable {
nv.langs.web.enable = lib.mkDefault true;

lsp.servers = {
astro = {
enable = true;
Expand Down
1 change: 1 addition & 0 deletions modules/langs/cpp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

config = lib.mkIf config.nv.langs.cpp.enable {
lsp.servers.clangd.enable = true;
nv.langs.make.enable = lib.mkDefault true;

plugins.treesitter.grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
c
Expand Down
20 changes: 19 additions & 1 deletion modules/langs/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
_: {
{
config,
lib,
...
}: {
imports = [
./astro.nix
./cpp.nix
Expand All @@ -15,4 +19,18 @@ _: {
./web.nix
./xml.nix
];

options.nv.langs.enableAll = lib.mkEnableOption "Enable all langs!";
config = lib.mkIf config.nv.langs.enableAll {
nv.langs = {
astro.enable = true; # astro + web + xml
cpp.enable = true; # c/c++ + make
docker.enable = true;
dotnet.enable = true;
mjml.enable = true;
python.enable = true;
svelte.enable = true;
rust.enable = true;
};
};
}
2 changes: 1 addition & 1 deletion modules/langs/web.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ in {
config = lib.mkIf config.nv.langs.web.enable {
nv = {
langs = {
css.enable = true;
javascript.enable = true;
sql.enable = true;
xml.enable = true;
css.enable = true;
};
};

Expand Down
1 change: 0 additions & 1 deletion modules/lsp.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
_: {
lsp = {
inlayHints.enable = true;
servers = {
lua_ls.enable = true;
jsonls.enable = true;
Expand Down
1 change: 0 additions & 1 deletion modules/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
git-conflict.enable = true;
grug-far.enable = true;
lsp.enable = true;
lsp-signature.enable = true;
lsp-status.enable = true;
lualine.enable = true;
luasnip.enable = true;
Expand Down
2 changes: 1 addition & 1 deletion modules/plugins/edgy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ _: {
}
];

left = let
right = let
size = {
width = 0.15;
};
Expand Down
31 changes: 17 additions & 14 deletions modules/plugins/lualine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,26 @@ _: {
__unkeyed-1 = {
__raw = ''
function()
local msg = ""
local buf_ft = vim.bo[0].filetype
local clients = vim.lsp.get_clients({ bufnr = 0 })
if next(clients) == nil then
return msg
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.name
end
end
return msg
local reg = vim.fn.reg_recording()
return (reg ~= "" and reg) or ""
end
'';
};

icon = "⏺️";
}
{
__unkeyed-1 = {
__raw = ''
function()
local ok, status = pcall(function ()
return require('lsp-status').status()
end)

return (ok and status) or ""
end
'';
};
icon = "  ";
}
"encoding"
"fileformat"
Expand Down
9 changes: 7 additions & 2 deletions modules/xtras/orgmode.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
config,
inputs,
lib,
...
}: {
imports = [./yalms.nix];
imports = [
./yalms.nix
inputs.orgnomics.nixvimModules.orgnomics
];

options.nv.xtras.orgmode.enable = lib.mkOption {
type = lib.types.bool;
Expand All @@ -14,7 +18,6 @@
config = lib.mkIf config.nv.xtras.orgmode.enable {
plugins = {
orgmode.enable = true;

orgnomics = {
enable = true;

Expand Down Expand Up @@ -52,6 +55,8 @@
icon = "";
}
];

yalms.enable = true;
};

keymaps = [
Expand Down
4 changes: 2 additions & 2 deletions modules/xtras/yalms.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
cfg = config;
in {
imports = [
inputs.orgnomics.nixvimModules.orgnomics
inputs.yalms.nixvimModules.yalms
];

options.nv.xtras.yalms.enable = lib.mkOption {
Expand All @@ -17,6 +17,6 @@ in {
};

config = lib.mkIf cfg.nv.xtras.yalms.enable {
plugins.orgnomics.enable = true;
plugins.yalms.enable = true;
};
}
6 changes: 6 additions & 0 deletions todo.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#+title: Opinionated Nixvim Configuration
#+author: Ahmad Raza <pro.se.ahmad.raza.1@gmail.com>
#+filetags: :todo:

* DONE Disable inlay hints by default
Inlay hints often cause too much noise. They can be toggled anytime anyway. Keeping them disabled by default will keep it zen.
Loading