Compare commits

..

37 commits

Author SHA1 Message Date
66005a51c3
wrappr/rc: allow strings in vim.options.signcolumn 2024-12-11 00:08:48 +03:00
c19c925f1d
modules/neovim: avoid interpolating strings for vim.preventJunkFiles 2024-12-11 00:01:51 +03:00
07f50e84eb
modules/neovim: deprecate vim.showSignColumn
Prefer the type-safe `vim.options` equivalent.
2024-12-11 00:01:51 +03:00
5a5f49f85f
lib/languages: re-add toVimBool 2024-12-11 00:01:50 +03:00
0650aa31ac
modules/neovim: deprecate vim.enableEditorconfig option
Deprecate shorthand EditorConfig toggle, and encourage the more powerful `vim.globals` option.
2024-12-11 00:01:49 +03:00
Omar Abragh
73660af2e3
lightbulb: add setupOpts option (#492)
Co-authored-by: Ching Pei Yang <59727193+horriblename@users.noreply.github.com>
Co-authored-by: raf <raf@notashelf.dev>
2024-12-11 00:00:51 +03:00
4daa920166
docs: mention non-flakes in FAQ 2024-12-10 23:56:46 +03:00
raf
d6cb4e0973
Merge pull request #493 from NotAShelf/docs-search-bar
docs: add search widget to options page
2024-12-10 23:39:11 +03:00
6567b463ee
docs: update release notes 2024-12-10 23:37:32 +03:00
c3a4686fa1
wrapper/rc: use mkOption in enableLuaLoader description
`mkEnableOption` seems to be clobbering the markdown syntax.
2024-12-10 23:35:57 +03:00
cece170a41
docs: mention lazy-loading capability in README 2024-12-10 23:35:56 +03:00
raf
cd6e672835
Merge branch 'main' into docs-search-bar 2024-12-10 23:10:44 +03:00
f8e1856620
docs: better performance in the resource widget ft. Keira and Michaili 2024-12-10 23:10:05 +03:00
781385f991
docs: perform DOM manipulation in batches; preprocess data 2024-12-10 17:15:23 +03:00
raf
48829f9d5b
Merge pull request #490 from NotAShelf/typst-preview
languages/typst: add live preview for tinymist
2024-12-10 16:35:17 +03:00
raf
0327918278
Merge branch 'main' into typst-preview 2024-12-10 16:35:07 +03:00
raf
5db831adb7
Merge branch 'main' into docs-search-bar 2024-12-10 13:55:53 +03:00
Ching Pei Yang
9fad42374f
docs: fix search bar style in dark mode 2024-12-10 11:34:18 +01:00
0a3855cdc2
docs: properly theme searchbar on prefers-dark 2024-12-10 12:46:50 +03:00
48bcd5d695
visuals/indent-blankline: properly pass setupOpts to mkPluginSetupOption 2024-12-09 17:59:19 +03:00
37dc96575d
docs: add search widget to options page 2024-12-09 17:40:16 +03:00
raf
0c90a7b1c6
configuration: disable superfluous language modules in maximal (#491) 2024-12-09 10:31:59 +00:00
a369352365
languages/typst: add typst-preview.nvim as an extension 2024-12-09 09:28:23 +03:00
ed3be410c5
meta: update release info (0.8) 2024-12-09 09:28:18 +03:00
Omar Abragh
fca55e1db1
lualine: fix builtin_themes list (#486)
Co-authored-by: raf <raf@notashelf.dev>
2024-12-09 05:45:08 +00:00
Ching Pei Yang
f672d3cdee
fix: bad comment keymaps (#488)
Co-authored-by: raf <raf@notashelf.dev>
2024-12-06 12:57:33 +00:00
raf
e798d5a226
Merge pull request #485 from horriblename/fix/null-keymap
keymaps: fix null key problems
2024-12-06 12:17:02 +03:00
Ching Pei Yang
ff07905bb8
nvim-dap: fix bad keymap options 2024-12-05 00:58:23 +01:00
Ching Pei Yang
745da4539e
keymaps: fix null key problems 2024-12-05 00:09:40 +01:00
66d0a81206
docs: github pages compat 2024-12-04 17:46:33 +03:00
raf
8597fb9a5b
Merge pull request #355 from NotAShelf/v0.7
v0.7 at last!
2024-12-04 17:21:44 +03:00
raf
e8018bbd38
Merge branch 'main' into v0.7 2024-12-04 17:16:29 +03:00
94d1a26b1c
meta: mark as release 2024-12-04 17:12:12 +03:00
Soliprem
18bf52e540
languages/gleam: init (#482)
* modules/gleam: init

* gleam: not using formatter

* configuration: gleam set to false

* docs: added changelog entry for gleam

* gleam: fixed lsp and treesitter

* gleam: capitalisation
2024-12-04 02:43:16 +03:00
DamitusThyYeetus123
fd4df3432e
languages/astro: init (#481)
* LSP: Add astro

* LSP: Properly add astro

* LSP: Properly actually add astro

* Flake: Fix mnw

* Update flake/develop.nix

Co-authored-by: raf <raf@notashelf.dev>

* Update configuration.nix

Co-authored-by: raf <raf@notashelf.dev>

* Update astro.nix

* Update rl-0.7.md

---------

Co-authored-by: raf <raf@notashelf.dev>
2024-12-03 23:13:56 +00:00
diniamo
88834cc93f run-nvim: fix keymaps 2024-12-03 16:28:31 +01:00
orangci
ea7469f1c8 docs: fix a typo in installation instructions 2024-11-19 00:27:30 +03:00
25 changed files with 566 additions and 108 deletions

View file

@ -14,7 +14,7 @@ indent_style = space
indent_size = 2 indent_size = 2
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.{nix,yml,yaml}] [*.{js,nix,yml,yaml}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
tab_width = 2 tab_width = 2

20
.github/README.md vendored
View file

@ -69,7 +69,7 @@
[Home-Manager module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-hm [Home-Manager module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-hm
- **Simple**: One language to rule them all! Use Nix to configure everything, - **Simple**: One language to rule them all! Use Nix to configure everything,
with additional Lua Support with optional Lua support for robust configurability!
- **Reproducible**: Your configuration will behave the same _anywhere_. No - **Reproducible**: Your configuration will behave the same _anywhere_. No
surprises, promise! surprises, promise!
- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No - **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No
@ -79,6 +79,7 @@
customizable through the Nix module system. customizable through the Nix module system.
- Not comfortable with a full-nix config or want to bring your Lua config? You - Not comfortable with a full-nix config or want to bring your Lua config? You
can do just that, no unnecessary restrictions. can do just that, no unnecessary restrictions.
- Lazyloading? We got it! Lazyload both internal and external plugins at will.
- **Well-documented**: Documentation is priority. You will _never_ face - **Well-documented**: Documentation is priority. You will _never_ face
undocumented, obscure behaviour. undocumented, obscure behaviour.
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and - **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
@ -167,19 +168,19 @@ fix.
## Frequently Asked Questions ## Frequently Asked Questions
[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose [issue template]: https://github.com/NotAShelf/nvf/issues/new/choose
[list of branches]: https://github.com/NotAShelf/nvf/branches [list of branches]: https://github.com/NotAShelf/nvf/branches
[list of open pull requests]: https://github.com/NotAShelf/nvf/pulls [list of open pull requests]: https://github.com/NotAShelf/nvf/pulls
**Q**: What platforms are supported? **Q**: What platforms are supported?
<br/> **A**: nvf actively supports Linux and Darwin platforms using standalone <br/> **A**: nvf actively supports **Linux and Darwin** platforms using
Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available standalone Nix, NixOS or Home-Manager. Please take a look at the [nvf manual]
installation instructions. for available installation instructions.
**Q**: Can you add _X_? **Q**: Can you add _X_?
<br/> **A**: Maybe! It is not one of our goals to support each and every Neovim <br/> **A**: Maybe! It is not one of our goals to support each and every Neovim
plugin, however, I am always open to new modules and plugin setup additions to plugin, however, I am always open to new modules and plugin setup additions to
**nvf**. Use the [appropriate issue template] and I will consider a module **nvf**. Use the appropriate [issue template] and I will consider a module
addition. As mentioned before, pull requests to add new features are also addition. As mentioned before, pull requests to add new features are also
welcome. welcome.
@ -196,6 +197,13 @@ not noticed any activity on the main branch, consider taking a look at the
_testing_ those release branches to get access to new features ahead of time and _testing_ those release branches to get access to new features ahead of time and
better prepare to breaking changes. better prepare to breaking changes.
**Q**: Will you support non-flake installations?
<br/> **A**: Quite possibly. **nvf** started as "neovim-flake", which does mean
it is and will remain flakes-first but we might consider non-flakes
compatibility. Though keep in mind that **nvf** under non-flake environments
would lose customizability of plugin inputs, which is one of our primary
features.
## Credits ## Credits
### Contributors ### Contributors

View file

@ -1,3 +1,7 @@
# This is the sample configuration for nvf, aiming to give you a feel of the default options
# while certain plugins are enabled. While it may act as one, this is not an overview of nvf's
# module options. To find a complete overview of nvf's options and examples, visit the manual.
# https://notashelf.github.io/nvf/options.html
isMaximal: { isMaximal: {
config.vim = { config.vim = {
viAlias = true; viAlias = true;
@ -31,52 +35,60 @@ isMaximal: {
}; };
}; };
# This section does not include a comprehensive list of available language modules.
# To list all available language module options, please visit the nvf manual.
languages = { languages = {
enableLSP = true; enableLSP = true;
enableFormat = true; enableFormat = true;
enableTreesitter = true; enableTreesitter = true;
enableExtraDiagnostics = true; enableExtraDiagnostics = true;
# Languages that will be supported in default and maximal configurations.
nix.enable = true;
markdown.enable = true;
# Languages that are enabled in the maximal configuration.
bash.enable = isMaximal;
clang.enable = isMaximal;
css.enable = isMaximal;
html.enable = isMaximal;
sql.enable = isMaximal;
java.enable = isMaximal;
kotlin.enable = isMaximal;
ts.enable = isMaximal;
go.enable = isMaximal;
lua.enable = isMaximal;
zig.enable = isMaximal;
python.enable = isMaximal;
typst.enable = isMaximal;
rust = {
enable = isMaximal;
crates.enable = isMaximal;
};
# Language modules that are not as common.
assembly.enable = false;
astro.enable = false;
nu.enable = false;
csharp.enable = false;
julia.enable = false;
vala.enable = false;
scala.enable = false;
r.enable = false;
gleam.enable = false;
dart.enable = false;
ocaml.enable = false;
elixir.enable = false;
tailwind.enable = false;
svelte.enable = false;
# Nim LSP is broken on Darwin and therefore # Nim LSP is broken on Darwin and therefore
# should be disabled by default. Users may still enable # should be disabled by default. Users may still enable
# `vim.languages.vim` to enable it, this does not restrict # `vim.languages.vim` to enable it, this does not restrict
# that. # that.
# See: <https://github.com/PMunch/nimlsp/issues/178#issue-2128106096> # See: <https://github.com/PMunch/nimlsp/issues/178#issue-2128106096>
nim.enable = false; nim.enable = false;
nix.enable = true;
# Assembly is not common, and the asm LSP is a major hit-or-miss
assembly.enable = false;
markdown.enable = isMaximal;
html.enable = isMaximal;
css.enable = isMaximal;
sql.enable = isMaximal;
java.enable = isMaximal;
kotlin.enable = isMaximal;
ts.enable = isMaximal;
svelte.enable = isMaximal;
go.enable = isMaximal;
lua.enable = isMaximal;
elixir.enable = isMaximal;
zig.enable = isMaximal;
ocaml.enable = isMaximal;
python.enable = isMaximal;
dart.enable = isMaximal;
bash.enable = isMaximal;
r.enable = isMaximal;
tailwind.enable = isMaximal;
typst.enable = isMaximal;
clang.enable = isMaximal;
scala.enable = isMaximal;
rust = {
enable = isMaximal;
crates.enable = isMaximal;
};
csharp.enable = isMaximal;
julia.enable = isMaximal;
vala.enable = isMaximal;
nu.enable = false;
}; };
visuals = { visuals = {

View file

@ -62,7 +62,8 @@ in
# Copy anchor scripts to the script directory in document root. # Copy anchor scripts to the script directory in document root.
cp -vt "$dest"/script \ cp -vt "$dest"/script \
${./static/script}/anchor-min.js \ ${./static/script}/anchor-min.js \
${./static/script}/anchor-use.js ${./static/script}/anchor-use.js \
${./static/script}/search.js
substituteInPlace ./options.md \ substituteInPlace ./options.md \
--subst-var-by OPTIONS_JSON ./config-options.json --subst-var-by OPTIONS_JSON ./config-options.json
@ -95,11 +96,12 @@ in
nixos-render-docs manual html \ nixos-render-docs manual html \
--manpage-urls ${path + "/doc/manpage-urls.json"} \ --manpage-urls ${path + "/doc/manpage-urls.json"} \
--revision ${lib.trivial.revisionWithDefault manual-release} \ --revision ${lib.trivial.revisionWithDefault manual-release} \
--stylesheet "$dest"/style.css \ --stylesheet style.css \
--script ./highlightjs/highlight.pack.js \ --script highlightjs/highlight.pack.js \
--script ./highlightjs/loader.js \ --script highlightjs/loader.js \
--script script/anchor-use.js \ --script script/anchor-use.js \
--script script/anchor-min.js \ --script script/anchor-min.js \
--script script/search.js \
--toc-depth 2 \ --toc-depth 2 \
--section-toc-depth 1 \ --section-toc-depth 1 \
manual.md \ manual.md \

View file

@ -362,6 +362,7 @@ The changes are, in no particular order:
- Add LSP and Treesitter support for Assembly under `vim.languages.assembly` - Add LSP and Treesitter support for Assembly under `vim.languages.assembly`
- Move [which-key](https://github.com/folke/which-key.nvim) to the new spec - Move [which-key](https://github.com/folke/which-key.nvim) to the new spec
- Add LSP and Treesitter support for Nushell under `vim.languages.nu` - Add LSP and Treesitter support for Nushell under `vim.languages.nu`
- Add LSP and Treesitter support for Gleam under `vim.languages.gleam`
[Bloxx12](https://github.com/Bloxx12) [Bloxx12](https://github.com/Bloxx12)
@ -386,3 +387,7 @@ The changes are, in no particular order:
[Nowaaru](https://github.com/Nowaaru): [Nowaaru](https://github.com/Nowaaru):
- Add `precognition-nvim`. - Add `precognition-nvim`.
[DamitusThyYeeticus123](https://github.com/DamitusThyYeetus123):
- Add support for [Astro](https://astro.build/) language server.

View file

@ -0,0 +1,10 @@
# Release 0.8 {#sec-release-0.8}
[NotAShelf](https://github.com/notashelf):
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
- Add [typst-preview.nvim] under
`languages.typst.extensions.typst-preview-nvim`.
- Add a search widget to the options page in the nvf manual.

58
docs/static/script/search.js vendored Normal file
View file

@ -0,0 +1,58 @@
document.addEventListener("DOMContentLoaded", () => {
if (!window.location.pathname.endsWith("options.html")) return;
const searchDiv = document.createElement("div");
searchDiv.id = "search-bar";
searchDiv.innerHTML = `
<input type="text" id="search-input" placeholder="Search options by ID..." />
<div id="search-results"></div>
`;
document.body.prepend(searchDiv);
const dtElements = Array.from(document.querySelectorAll("dt"));
const ddElements = Array.from(document.querySelectorAll("dd"));
const dtOptionIds = dtElements.map(
(dt) => dt.querySelector("a")?.id.toLowerCase() || "",
);
if (dtElements.length === 0 || ddElements.length === 0) {
console.warn("Something went wrong, page may be loaded incorrectly.");
return;
}
const dtElementsData = dtElements.map((dt, index) => ({
element: dt,
id: dtOptionIds[index],
ddElement: ddElements[index],
}));
const hiddenClass = "hidden";
const hiddenStyle = document.createElement("style");
hiddenStyle.innerHTML = `.${hiddenClass} { display: none; }`;
document.head.appendChild(hiddenStyle);
let debounceTimeout;
document.getElementById("search-input").addEventListener("input", (event) => {
clearTimeout(debounceTimeout);
debounceTimeout = setTimeout(() => {
const query = event.target.value.toLowerCase();
const matches = [];
const nonMatches = [];
dtElementsData.forEach(({ element, id, ddElement }) => {
const isMatch = id.includes(query);
if (isMatch) {
matches.push(element, ddElement);
} else {
nonMatches.push(element, ddElement);
}
});
requestAnimationFrame(() => {
matches.forEach((el) => el?.classList.remove(hiddenClass));
nonMatches.forEach((el) => el?.classList.add(hiddenClass));
});
}, 200);
});
});

View file

@ -189,14 +189,16 @@ th {
dt { dt {
margin: 1.2rem 0 0.8rem; margin: 1.2rem 0 0.8rem;
content-visibility: auto;
contain-intrinsic-size: auto 42px;
} }
dd { dd {
margin-left: 2rem; margin-left: 2rem;
content-visibility: auto;
contain-intrinsic-size: auto 500px;
} }
div.book { div.book {}
}
ul { ul {
@include margined; @include margined;
@ -233,6 +235,33 @@ li {
} }
} }
#search-bar {
position: sticky;
top: 0;
background: white;
padding: 10px;
border-bottom: 1px solid $color-gray-200;
z-index: 1000;
@media (prefers-color-scheme: dark) {
background: $color-gray-900;
color: $color-gray-50;
border-bottom: 1px solid black;
}
}
#search-input {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
background: inherit;
color: inherit;
}
.hidden {
display: none;
}
div.titlepage { div.titlepage {
margin: 40px 0; margin: 40px 0;

View file

@ -38,11 +38,11 @@
}, },
"mnw": { "mnw": {
"locked": { "locked": {
"lastModified": 1733021555, "lastModified": 1731821965,
"narHash": "sha256-bc+reHXXfdn94MnDsqBrNm2ojOnJfbd64e00nzsP0EI=", "narHash": "sha256-QiGi/HBQRnIRGY4gQPuH7T3hr7NznOpEO7qNpF5ldmE=",
"owner": "Gerg-L", "owner": "Gerg-L",
"repo": "mnw", "repo": "mnw",
"rev": "6841d93fe50eb335da45e11d4dabaa1844f3f79a", "rev": "5fe5c41975ed0af55f55dc37cd28ba906a5d015e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1902,6 +1902,22 @@
"type": "github" "type": "github"
} }
}, },
"plugin-typst-preview-nvim": {
"flake": false,
"locked": {
"lastModified": 1733120663,
"narHash": "sha256-uYMZ2PONiiI3UDvCgNvyy4+jhzmUDbAyxX0phKxELXw=",
"owner": "chomosuke",
"repo": "typst-preview.nvim",
"rev": "0cb5f5627312f50ce089f785ec42b55a85f30ce7",
"type": "github"
},
"original": {
"owner": "chomosuke",
"repo": "typst-preview.nvim",
"type": "github"
}
},
"plugin-vim-dirtytalk": { "plugin-vim-dirtytalk": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -2151,6 +2167,7 @@
"plugin-tokyonight": "plugin-tokyonight", "plugin-tokyonight": "plugin-tokyonight",
"plugin-trouble": "plugin-trouble", "plugin-trouble": "plugin-trouble",
"plugin-ts-error-translator": "plugin-ts-error-translator", "plugin-ts-error-translator": "plugin-ts-error-translator",
"plugin-typst-preview-nvim": "plugin-typst-preview-nvim",
"plugin-vim-dirtytalk": "plugin-vim-dirtytalk", "plugin-vim-dirtytalk": "plugin-vim-dirtytalk",
"plugin-vim-fugitive": "plugin-vim-fugitive", "plugin-vim-fugitive": "plugin-vim-fugitive",
"plugin-vim-illuminate": "plugin-vim-illuminate", "plugin-vim-illuminate": "plugin-vim-illuminate",

View file

@ -206,6 +206,11 @@
flake = false; flake = false;
}; };
plugin-typst-preview-nvim = {
url = "github:chomosuke/typst-preview.nvim";
flake = false;
};
plugin-nvim-metals = { plugin-nvim-metals = {
url = "github:scalameta/nvim-metals"; url = "github:scalameta/nvim-metals";
flake = false; flake = false;

View file

@ -32,7 +32,7 @@
mapConfigOptions mapConfigOptions
// { // {
key = mkOption { key = mkOption {
type = str; type = nullOr str;
description = "The key that triggers this keybind."; description = "The key that triggers this keybind.";
}; };
mode = mkOption { mode = mkOption {

View file

@ -24,6 +24,7 @@ in {
or '<Plug>(comment_toggle_linewise_count)' or '<Plug>(comment_toggle_linewise_count)'
end end
'' { '' {
lua = true;
expr = true; expr = true;
desc = mappings.toggleCurrentLine.description; desc = mappings.toggleCurrentLine.description;
}) })
@ -33,6 +34,7 @@ in {
or '<Plug>(comment_toggle_blockwise_count)' or '<Plug>(comment_toggle_blockwise_count)'
end end
'' { '' {
lua = true;
expr = true; expr = true;
desc = mappings.toggleCurrentBlock.description; desc = mappings.toggleCurrentBlock.description;
}) })

View file

@ -11,6 +11,10 @@
inherit (lib.nvim.dag) entryAnywhere entryAfter; inherit (lib.nvim.dag) entryAnywhere entryAfter;
cfg = config.vim.debugger.nvim-dap; cfg = config.vim.debugger.nvim-dap;
opt = {
silent = true;
lua = true;
};
inherit (options.vim.debugger.nvim-dap) mappings; inherit (options.vim.debugger.nvim-dap) mappings;
in { in {
config = mkMerge [ config = mkMerge [
@ -29,23 +33,23 @@ in {
// mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources; // mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources;
keymaps = [ keymaps = [
(mkKeymap "n" cfg.mappings.continue "require('dap').continue" {desc = mappings.continue.description;}) (mkKeymap "n" cfg.mappings.continue "require('dap').continue" (opt // {desc = mappings.continue.description;}))
(mkKeymap "n" cfg.mappings.restart "require('dap').restart" {desc = mappings.restart.description;}) (mkKeymap "n" cfg.mappings.restart "require('dap').restart" (opt // {desc = mappings.restart.description;}))
(mkKeymap "n" cfg.mappings.terminate "require('dap').terminate" {desc = mappings.terminate.description;}) (mkKeymap "n" cfg.mappings.terminate "require('dap').terminate" (opt // {desc = mappings.terminate.description;}))
(mkKeymap "n" cfg.mappings.runLast "require('dap').run_last" {desc = mappings.runLast.description;}) (mkKeymap "n" cfg.mappings.runLast "require('dap').run_last" (opt // {desc = mappings.runLast.description;}))
(mkKeymap "n" cfg.mappings.toggleRepl "require('dap').repl.toggle" {desc = mappings.toggleRepl.description;}) (mkKeymap "n" cfg.mappings.toggleRepl "require('dap').repl.toggle" (opt // {desc = mappings.toggleRepl.description;}))
(mkKeymap "n" cfg.mappings.hover "require('dap.ui.widgets').hover" {desc = mappings.hover.description;}) (mkKeymap "n" cfg.mappings.hover "require('dap.ui.widgets').hover" (opt // {desc = mappings.hover.description;}))
(mkKeymap "n" cfg.mappings.toggleBreakpoint "require('dap').toggle_breakpoint" {desc = mappings.toggleBreakpoint.description;}) (mkKeymap "n" cfg.mappings.toggleBreakpoint "require('dap').toggle_breakpoint" (opt // {desc = mappings.toggleBreakpoint.description;}))
(mkKeymap "n" cfg.mappings.runToCursor "require('dap').run_to_cursor" {desc = mappings.runToCursor.description;}) (mkKeymap "n" cfg.mappings.runToCursor "require('dap').run_to_cursor" (opt // {desc = mappings.runToCursor.description;}))
(mkKeymap "n" cfg.mappings.stepInto "require('dap').step_into" {desc = mappings.stepInto.description;}) (mkKeymap "n" cfg.mappings.stepInto "require('dap').step_into" (opt // {desc = mappings.stepInto.description;}))
(mkKeymap "n" cfg.mappings.stepOut "require('dap').step_out" {desc = mappings.stepOut.description;}) (mkKeymap "n" cfg.mappings.stepOut "require('dap').step_out" (opt // {desc = mappings.stepOut.description;}))
(mkKeymap "n" cfg.mappings.stepOver "require('dap').step_over" {desc = mappings.stepOver.description;}) (mkKeymap "n" cfg.mappings.stepOver "require('dap').step_over" (opt // {desc = mappings.stepOver.description;}))
(mkKeymap "n" cfg.mappings.stepBack "require('dap').step_back" {desc = mappings.stepBack.description;}) (mkKeymap "n" cfg.mappings.stepBack "require('dap').step_back" (opt // {desc = mappings.stepBack.description;}))
(mkKeymap "n" cfg.mappings.goUp "require('dap').up" {desc = mappings.goUp.description;}) (mkKeymap "n" cfg.mappings.goUp "require('dap').up" (opt // {desc = mappings.goUp.description;}))
(mkKeymap "n" cfg.mappings.goDown "require('dap').down" {desc = mappings.goDown.description;}) (mkKeymap "n" cfg.mappings.goDown "require('dap').down" (opt // {desc = mappings.goDown.description;}))
]; ];
}; };
}) })
@ -59,7 +63,7 @@ in {
inherit (cfg.ui) setupOpts; inherit (cfg.ui) setupOpts;
keys = [ keys = [
(mkKeymap "n" cfg.mappings.toggleDapUI "function() require('dapui').toggle() end" {desc = mappings.toggleDapUI.description;}) (mkKeymap "n" cfg.mappings.toggleDapUI "function() require('dapui').toggle() end" (opt // {desc = mappings.toggleDapUI.description;}))
]; ];
}; };

View file

@ -0,0 +1,159 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.meta) getExe;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
cfg = config.vim.languages.astro;
defaultServer = "astro";
servers = {
astro = {
package = pkgs.astro-language-server;
lspConfig = ''
lspconfig.astro.setup {
capabilities = capabilities;
on_attach = attach_keymaps,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/astro-ls", "--stdio"}''
}
}
'';
};
};
# TODO: specify packages
defaultFormat = "prettier";
formats = {
prettier = {
package = pkgs.nodePackages.prettier;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettier",
})
)
'';
};
biome = {
package = pkgs.biome;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.biome.with({
command = "${cfg.format.package}/bin/biome",
})
)
'';
};
};
# TODO: specify packages
defaultDiagnosticsProvider = ["eslint_d"];
diagnosticsProviders = {
eslint_d = {
package = pkgs.eslint_d;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.eslint_d.with({
command = "${getExe pkg}",
})
)
'';
};
};
in {
options.vim.languages.astro = {
enable = mkEnableOption "Astro language support";
treesitter = {
enable = mkEnableOption "Astro treesitter" // {default = config.vim.languages.enableTreesitter;};
astroPackage = mkGrammarOption pkgs "astro";
};
lsp = {
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "Astro LSP server to use";
type = enum (attrNames servers);
default = defaultServer;
};
package = mkOption {
description = "Astro LSP server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};
format = {
enable = mkEnableOption "Astro formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
description = "Astro formatter to use";
type = enum (attrNames formats);
default = defaultFormat;
};
package = mkOption {
description = "Astro formatter package";
type = package;
default = formats.${cfg.format.type}.package;
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Astro diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Astro";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.astroPackage];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.astro-lsp = servers.${cfg.lsp.server}.lspConfig;
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.astro-format = formats.${cfg.format.type}.nullConfig;
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "astro";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
};
})
]);
}

View file

@ -3,11 +3,13 @@
in { in {
imports = [ imports = [
./asm.nix ./asm.nix
./astro.nix
./bash.nix ./bash.nix
./dart.nix ./dart.nix
./clang.nix ./clang.nix
./css.nix ./css.nix
./elixir.nix ./elixir.nix
./gleam.nix
./go.nix ./go.nix
./hcl.nix ./hcl.nix
./kotlin.nix ./kotlin.nix

View file

@ -0,0 +1,71 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.gleam;
defaultServer = "gleam";
servers = {
gleam = {
package = pkgs.gleam;
lspConfig = ''
lspconfig.gleam.setup{
capabilities = capabilities,
on_attach = default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/gleam", "lsp"}''
}
}
'';
};
};
in {
options.vim.languages.gleam = {
enable = mkEnableOption "Gleam language support";
treesitter = {
enable = mkEnableOption "Gleam treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "gleam";
};
lsp = {
enable = mkEnableOption "Gleam LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
type = enum (attrNames servers);
default = defaultServer;
description = "Gleam LSP server to use";
};
package = mkOption {
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
description = "Gleam LSP server package, or the command to run as a list of strings";
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.gleam-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -7,10 +7,13 @@
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList; inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str; inherit (lib.types) nullOr enum either attrsOf listOf package str;
inherit (lib.attrsets) attrNames; inherit (lib.attrsets) attrNames;
inherit (lib.nvim.lua) expToLua; inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) mkGrammarOption; inherit (lib.meta) getExe;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.languages.typst; cfg = config.vim.languages.typst;
@ -33,6 +36,7 @@
} }
''; '';
}; };
tinymist = { tinymist = {
package = pkgs.tinymist; package = pkgs.tinymist;
lspConfig = '' lspConfig = ''
@ -120,6 +124,50 @@ in {
default = formats.${cfg.format.type}.package; default = formats.${cfg.format.type}.package;
}; };
}; };
extensions = {
typst-preview-nvim = {
enable =
mkEnableOption ''
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
Low latency typst preview for Neovim via [typst-preview.nvim]
''
// {default = true;};
setupOpts = mkPluginSetupOption "typst-preview-nvim" {
open_cmd = mkOption {
type = nullOr str;
default = null;
example = "firefox %s -P typst-preview --class typst-preview";
description = ''
Custom format string to open the output link provided with `%s`
'';
};
dependencies_bin = mkOption {
type = attrsOf str;
default = {
"tinymist" = getExe servers.tinymist.package;
"websocat" = getExe pkgs.websocat;
};
description = ''
Provide the path to binaries for dependencies. Setting this
to a non-null value will skip the download of the binary by
the plugin.
'';
};
extra_args = mkOption {
type = nullOr (listOf str);
default = null;
example = ["--input=ver=draft" "--ignore-system-fonts"];
description = "A list of extra arguments (or `null`) to be passed to previewer";
};
};
};
};
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable { (mkIf cfg.treesitter.enable {
@ -136,5 +184,13 @@ in {
vim.lsp.lspconfig.enable = true; vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.typst-lsp = servers.${cfg.lsp.server}.lspConfig; vim.lsp.lspconfig.sources.typst-lsp = servers.${cfg.lsp.server}.lspConfig;
}) })
# Extensions
(mkIf cfg.extensions.typst-preview-nvim.enable {
vim.startPlugins = ["typst-preview-nvim"];
vim.pluginRC.typst-preview-nvim = entryAnywhere ''
require("typst-preview").setup(${toLuaObject cfg.extensions.typst-preview-nvim.setupOpts})
'';
})
]); ]);
} }

View file

@ -5,6 +5,7 @@
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.lsp; cfg = config.vim.lsp;
in { in {
@ -16,7 +17,7 @@ in {
vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()') vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()')
-- Enable trouble diagnostics viewer -- Enable trouble diagnostics viewer
require'nvim-lightbulb'.setup() require'nvim-lightbulb'.setup(${toLuaObject cfg.lightbulb.setupOpts})
''; '';
}; };
}; };

View file

@ -1,9 +1,11 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in { in {
options.vim.lsp = { options.vim.lsp = {
lightbulb = { lightbulb = {
enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font"; enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font";
setupOpts = mkPluginSetupOption "nvim-lightbulb" {};
}; };
}; };
} }

View file

@ -5,11 +5,10 @@
... ...
}: let }: let
inherit (lib.modules) mkIf mkDefault; inherit (lib.modules) mkIf mkDefault;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding mkSetLuaLznBinding; inherit (lib.nvim.binds) mkKeymap;
cfg = config.vim.runner.run-nvim; cfg = config.vim.runner.run-nvim;
mappingDefinitions = options.vim.runner.run-nvim.mappings; inherit (options.vim.runner.run-nvim) mappings;
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
@ -21,14 +20,17 @@ in {
cmd = "Run"; cmd = "Run";
keys = [ keys = [
(mkSetLznBinding "n" mappings.run "<cmd>Run<CR>") (mkKeymap "n" cfg.mappings.run "<cmd>Run<CR>" {desc = mappings.run.description;})
(mkSetLznBinding "n" mappings.runOverride "<cmd>Run!<CR>") (mkKeymap "n" cfg.mappings.runOverride "<cmd>Run!<CR>" {desc = mappings.runOverride.description;})
(mkSetLuaLznBinding "n" mappings.runCommand '' (mkKeymap "n" cfg.mappings.runCommand ''
function() function()
local input = vim.fn.input("Run command: ") local input = vim.fn.input("Run command: ")
if input ~= "" then require("run").run(input, false) end if input ~= "" then require("run").run(input, false) end
end end
'') '' {
desc = mappings.run.description;
lua = true;
})
]; ];
}; };

View file

@ -13,41 +13,43 @@
builtin_themes = [ builtin_themes = [
"auto" "auto"
"16color" "16color"
"gruvbox"
"ayu_dark" "ayu_dark"
"ayu_light" "ayu_light"
"ayu_mirage" "ayu_mirage"
"ayu" "ayu"
"base16"
"codedark" "codedark"
"dracula" "dracula"
"everforest" "everforest"
"gruvbox" "gruvbox"
"gruvbox_dark" "gruvbox_dark"
"gruvbox_light" "gruvbox_light"
"gruvbox_material" "gruvbox-material"
"horizon" "horizon"
"iceberg_dark" "iceberg_dark"
"iceberg_light" "iceberg_light"
"iceberg" "iceberg"
"jellybeans" "jellybeans"
"material" "material"
"modus_vivendi" "modus-vivendi"
"molokai" "molokai"
"moonfly" "moonfly"
"nightfly" "nightfly"
"nord" "nord"
"oceanicnext" "OceanicNext"
"onedark" "onedark"
"onelight" "onelight"
"palenight" "palenight"
"papercolor_dark" "papercolor_dark"
"papercolor_light" "papercolor_light"
"PaperColor"
"powerline_dark" "powerline_dark"
"powerline" "powerline"
"pywal"
"seoul256" "seoul256"
"solarized_dark" "solarized_dark"
"solarized_light" "solarized_light"
"tomorrow" "Tomorrow"
"wombat" "wombat"
]; ];
in { in {

View file

@ -6,6 +6,7 @@
inherit (lib.modules) mkRenamedOptionModule; inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression; inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) int bool str nullOr either listOf attrsOf; inherit (lib.types) int bool str nullOr either listOf attrsOf;
inherit (lib.nvim.types) mkPluginSetupOption;
cfg = config.vim.visuals; cfg = config.vim.visuals;
in { in {
@ -15,7 +16,7 @@ in {
options.vim.visuals.indent-blankline = { options.vim.visuals.indent-blankline = {
enable = mkEnableOption "indentation guides [indent-blankline]"; enable = mkEnableOption "indentation guides [indent-blankline]";
setupOpts = { setupOpts = mkPluginSetupOption "indent-blankline" {
debounce = mkOption { debounce = mkOption {
type = int; type = int;
description = "Debounce time in milliseconds"; description = "Debounce time in milliseconds";

View file

@ -5,7 +5,7 @@
}: let }: let
inherit (builtins) map mapAttrs filter; inherit (builtins) map mapAttrs filter;
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;
inherit (lib.strings) concatLines concatMapStringsSep optionalString; inherit (lib.strings) concatLines concatMapStringsSep;
inherit (lib.trivial) showWarnings; inherit (lib.trivial) showWarnings;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere; inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
@ -43,7 +43,7 @@ in {
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})"; toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";
keymaps = concatLines (map toLuaKeymap cfg.keymaps); keymaps = concatLines (map toLuaKeymap (filter (x: x.key != null) cfg.keymaps));
in { in {
vim = { vim = {
luaConfigRC = { luaConfigRC = {

View file

@ -6,6 +6,7 @@
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything; inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything;
inherit (lib.trivial) isBool;
inherit (lib.nvim.languages) toVimBool; inherit (lib.nvim.languages) toVimBool;
inherit (lib.nvim.types) dagOf; inherit (lib.nvim.types) dagOf;
inherit (lib.nvim.lua) listToLuaTable; inherit (lib.nvim.lua) listToLuaTable;
@ -13,7 +14,11 @@
cfg = config.vim; cfg = config.vim;
in { in {
options.vim = { options.vim = {
enableLuaLoader = mkEnableOption '' enableLuaLoader = mkOption {
type = bool;
default = false;
example = true;
description = ''
[{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable() [{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
the experimental Lua module loader to speed up the start up process the experimental Lua module loader to speed up the start up process
@ -25,10 +30,12 @@ in {
- removes the default Neovim loader - removes the default Neovim loader
::: {.note} ::: {.note}
This is disabled by default. Before setting this option, please The Lua module loader is *disabled* by default. Before setting this option, please
take a look at the [{option}`official documentation`]. take a look at the [{option}`official documentation`]. This option may be enabled by
default in the future.
::: :::
''; '';
};
additionalRuntimePaths = mkOption { additionalRuntimePaths = mkOption {
type = listOf (either path str); type = listOf (either path str);
@ -224,9 +231,12 @@ in {
}; };
signcolumn = mkOption { signcolumn = mkOption {
type = bool; type = either str bool;
default = true; default = true;
apply = x: toVimBool x; # convert to a yes/no str apply = x:
if isBool x
then toVimBool x # convert to a yes/no str
else x;
description = "Show the sign column"; description = "Show the sign column";
}; };
}; };

View file

@ -1,4 +1,4 @@
{ {
"release": "v0.7", "release": "v0.8",
"isReleaseBranch": false "isReleaseBranch": false
} }