Compare commits

...

42 commits

Author SHA1 Message Date
Ching Pei Yang
4ffd67bc0f
Merge branch 'main' into v0.7 2024-12-23 04:07:01 +01:00
Ching Pei Yang
1176ec7584
format
Co-authored-by: raf <raf@notashelf.dev>
2024-12-23 04:06:47 +01:00
raf
46aa168b2d
Merge pull request #509 from diniamo/update-run
flake: update run.nvim
2024-12-22 00:33:24 +03:00
diniamo
9aad80d5e6 flake: update run.nvim 2024-12-21 22:31:41 +01:00
raf
ac905b8aed
Merge pull request #505 from diniamo/odin
languages/odin: init
2024-12-21 12:41:16 +03:00
diniamo
90a5a42742 languages/odin: init 2024-12-21 10:35:39 +01:00
raf
8bab0497fb
Merge pull request #500 from diniamo/lazy-before-setup
wrapper/lazy: add beforeSetup option
2024-12-21 08:17:41 +03:00
raf
f26744c6ce
Merge branch 'main' into lazy-before-setup 2024-12-21 08:15:08 +03:00
raf
62d296a2dc
Merge pull request #506 from amadaluzia/fix-haskell
languages/haskell: fix DAP command definition
2024-12-21 08:14:43 +03:00
raf
8c66f10550
Merge branch 'main' into fix-haskell 2024-12-21 08:14:31 +03:00
raf
ea3d488cf4
Merge pull request #504 from diniamo/surround-cleanup
surround: cleanup
2024-12-21 08:14:14 +03:00
Artur Manuel
0946d43921 languages/haskell: fix DAP command definition 2024-12-21 01:00:02 +00:00
diniamo
7eb8d07bcf surround: cleanup 2024-12-21 01:14:52 +01:00
raf
52042f624c
Merge pull request #498 from NotAShelf/fix-mdpw-ft
preview/markdown-preview: convert `mkdp_filetypes` to correct format
2024-12-20 20:01:21 +03:00
raf
af31021ce4
Merge branch 'main' into fix-mdpw-ft 2024-12-20 20:00:57 +03:00
raf
5c69fbd951
Merge pull request #501 from diniamo/nvim-notify-cleanup
nvim-notify: fix some stuff
2024-12-20 19:00:04 +03:00
diniamo
5d898da816 nvim-notify: fix some stuff 2024-12-20 16:27:44 +01:00
diniamo
ed69816f68 wrapper/lazy: add beforeSetup option
Useful for avoiding a million require calls in setupOpts.
2024-12-20 10:43:36 +01:00
Yoni Firroloni
99a4eafa34
languages/typescript: prevent ts_ls from formatting (#495)
* ts_ls: prevent from formatting

prevent ts_ls from touching the formating.

ts formatting: remove useless indent

* fix unnecessary whitespace

---------

Co-authored-by: raf <raf@notashelf.dev>
2024-12-20 04:11:18 +00:00
Artur Manuel
e715463257
plugins/languages: add haskell support (#499)
* plugins/languages: add haskell support

Closes #426

* fix docs

---------

Co-authored-by: Artur Manuel <balkenix@outlook.com>
Co-authored-by: raf <raf@notashelf.dev>
2024-12-20 03:50:38 +00:00
4f61628399
preview/markdown-preview: convert mkdp_filetypes to correct format 2024-12-19 09:53:15 +03:00
a0a57757a0
wrapper/rc: explicitly add tabstop & shiftwidth to vim.options
Defaults are taken from Neovim's :help tags for those options to avoid intrusive/confusing behaviour.
2024-12-12 20:16:27 +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
29 changed files with 568 additions and 146 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

24
.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
@ -77,8 +77,9 @@
- Options to install [standalone], [NixOS module] or [Home-Manager module]. - Options to install [standalone], [NixOS module] or [Home-Manager module].
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully - **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
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,54 +35,61 @@ 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;
haskell.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;
astro.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;
gleam.enable = false;
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
@ -100,6 +101,7 @@ in
--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

@ -0,0 +1,20 @@
# 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.
[amadaluzia](https://github.com/amadaluzia):
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
- Add Haskell support under `vim.languages.haskell` using [haskell-tools.nvim].
[diniamo](https://github.com/diniamo):
- Add Odin support under `vim.languages.odin`.

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

@ -684,6 +684,22 @@
"type": "github" "type": "github"
} }
}, },
"plugin-haskell-tools-nvim": {
"flake": false,
"locked": {
"lastModified": 1734222260,
"narHash": "sha256-gZVN9ADPO5wFOaf19FydCneb7aKTT9K1vcLoBURPEjk=",
"owner": "mrcjkb",
"repo": "haskell-tools.nvim",
"rev": "943b77b68a79d3991523ba4d373063c9355c6f55",
"type": "github"
},
"original": {
"owner": "mrcjkb",
"repo": "haskell-tools.nvim",
"type": "github"
}
},
"plugin-highlight-undo": { "plugin-highlight-undo": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1713,11 +1729,11 @@
"plugin-run-nvim": { "plugin-run-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1732918526, "lastModified": 1734816675,
"narHash": "sha256-kiszNmZZDXG8tAPMQKuGJDCkqCMzsWT7BkCvkVsH2lA=", "narHash": "sha256-Wuk5HG+vHXAbifzp5YB5V/FxBhBRNWLeypkRczpXbvQ=",
"owner": "diniamo", "owner": "diniamo",
"repo": "run.nvim", "repo": "run.nvim",
"rev": "d867466e01b8fa4e54a589b9ef446cf43fb966de", "rev": "6cd971afdce6443d7a070dcc23af51da1cc932f9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1902,6 +1918,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": {
@ -2075,6 +2107,7 @@
"plugin-gitsigns-nvim": "plugin-gitsigns-nvim", "plugin-gitsigns-nvim": "plugin-gitsigns-nvim",
"plugin-glow-nvim": "plugin-glow-nvim", "plugin-glow-nvim": "plugin-glow-nvim",
"plugin-gruvbox": "plugin-gruvbox", "plugin-gruvbox": "plugin-gruvbox",
"plugin-haskell-tools-nvim": "plugin-haskell-tools-nvim",
"plugin-highlight-undo": "plugin-highlight-undo", "plugin-highlight-undo": "plugin-highlight-undo",
"plugin-hop-nvim": "plugin-hop-nvim", "plugin-hop-nvim": "plugin-hop-nvim",
"plugin-icon-picker-nvim": "plugin-icon-picker-nvim", "plugin-icon-picker-nvim": "plugin-icon-picker-nvim",
@ -2151,6 +2184,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;
@ -715,5 +720,10 @@
url = "github:otavioschwanck/new-file-template.nvim"; url = "github:otavioschwanck/new-file-template.nvim";
flake = false; flake = false;
}; };
plugin-haskell-tools-nvim = {
url = "github:mrcjkb/haskell-tools.nvim";
flake = false;
};
}; };
} }

View file

@ -78,7 +78,7 @@ in {
local real_file = vim.fn.filereadable(data.file) == 1 local real_file = vim.fn.filereadable(data.file) == 1
-- buffer is a directory -- buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1 local directory = vim.fn.isdirectory(data.file) == 1
-- buffer is a [No Name] -- buffer is a [No Name]
local no_name = data.file == "" and vim.bo[data.buf].buftype == "" local no_name = data.file == "" and vim.bo[data.buf].buftype == ""

View file

@ -14,6 +14,7 @@ in {
./hcl.nix ./hcl.nix
./kotlin.nix ./kotlin.nix
./html.nix ./html.nix
./haskell.nix
./java.nix ./java.nix
./lua.nix ./lua.nix
./markdown.nix ./markdown.nix
@ -36,6 +37,7 @@ in {
./csharp.nix ./csharp.nix
./julia.nix ./julia.nix
./nu.nix ./nu.nix
./odin.nix
]; ];
options.vim.languages = { options.vim.languages = {

View file

@ -0,0 +1,104 @@
{
config,
lib,
pkgs,
...
}: let
inherit (builtins) isList;
inherit (lib.types) either package listOf str;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.strings) optionalString;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.lua) expToLua;
inherit (pkgs) haskellPackages;
cfg = config.vim.languages.haskell;
in {
options.vim.languages.haskell = {
enable = mkEnableOption "Haskell support";
treesitter = {
enable = mkEnableOption "Treesitter support for Haskell" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "haskell";
};
lsp = {
enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.languages.enableLSP;};
package = mkOption {
description = "Haskell LSP package or command to run the Haskell LSP";
example = ''[ (lib.getExe pkgs.haskellPackages.haskell-language-server) "--debug" ]'';
default = haskellPackages.haskell-language-server;
type = either package (listOf str);
};
};
dap = {
enable = mkEnableOption "DAP support for Haskell" // {default = config.vim.languages.enableDAP;};
package = mkOption {
description = "Haskell DAP package or command to run the Haskell DAP";
default = haskellPackages.haskell-debug-adapter;
type = either package (listOf str);
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter = {
enable = true;
grammars = [cfg.treesitter.package];
};
})
(mkIf (cfg.dap.enable || cfg.lsp.enable) {
vim = {
startPlugins = ["haskell-tools-nvim"];
luaConfigRC.haskell-tools-nvim =
entryAfter
["lsp-setup"]
''
vim.g.haskell_tools = {
${optionalString cfg.lsp.enable ''
-- LSP
tools = {
hover = {
enable = true,
},
},
hls = {
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper"}''
},
on_attach = function(client, bufnr, ht)
default_on_attach(client, bufnr, ht)
local opts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set('n', '<localleader>cl', vim.lsp.codelens.run, opts)
vim.keymap.set('n', '<localleader>hs', ht.hoogle.hoogle_signature, opts)
vim.keymap.set('n', '<localleader>ea', ht.lsp.buf_eval_all, opts)
vim.keymap.set('n', '<localleader>rr', ht.repl.toggle, opts)
vim.keymap.set('n', '<localleader>rf', function()
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
end, opts)
vim.keymap.set('n', '<localleader>rq', ht.repl.quit, opts)
end,
},
''}
${optionalString cfg.dap.enable ''
dap = {
cmd = ${
if isList cfg.dap.package
then expToLua cfg.dap.package
else ''{"${cfg.dap.package}/bin/haskell-debug-adapter"}''
},
},
''}
}
'';
};
})
]);
}

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) either listOf package str enum;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption;
defaultServer = "ols";
servers = {
ols = {
package = pkgs.ols;
lspConfig = ''
lspconfig.ols.setup {
capabilities = capabilities,
on_attach = default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else "{'${cfg.lsp.package}/bin/ols'}"
}
}
'';
};
};
cfg = config.vim.languages.odin;
in {
options.vim.languages.odin = {
enable = mkEnableOption "Odin language support";
treesitter = {
enable = mkEnableOption "Odin treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "odin";
};
lsp = {
enable = mkEnableOption "Odin LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
type = enum (attrNames servers);
default = defaultServer;
description = "Odin LSP server to use";
};
package = mkOption {
description = "Ols package, or the command to run as a list of strings";
type = either package (listOf str);
default = pkgs.ols;
};
};
};
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.odin-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -13,7 +13,7 @@
inherit (lib.types) bool package str listOf either enum; inherit (lib.types) bool package str listOf either enum;
inherit (lib.nvim.types) mkGrammarOption; inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua; inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAfter entryAnywhere;
cfg = config.vim.languages.rust; cfg = config.vim.languages.rust;
@ -127,7 +127,7 @@ in {
vim = { vim = {
startPlugins = ["rustaceanvim"]; startPlugins = ["rustaceanvim"];
luaConfigRC.rustaceanvim = entryAnywhere '' pluginRC.rustaceanvim = entryAfter ["lsp-setup"] ''
vim.g.rustaceanvim = { vim.g.rustaceanvim = {
${optionalString cfg.lsp.enable '' ${optionalString cfg.lsp.enable ''
-- LSP -- LSP

View file

@ -23,8 +23,11 @@
package = pkgs.typescript-language-server; package = pkgs.typescript-language-server;
lspConfig = '' lspConfig = ''
lspconfig.ts_ls.setup { lspconfig.ts_ls.setup {
capabilities = capabilities; capabilities = capabilities,
on_attach = attach_keymaps, on_attach = function(client, bufnr)
attach_keymaps(client, bufnr);
client.server_capabilities.documentFormattingProvider = false;
end,
cmd = ${ cmd = ${
if isList cfg.lsp.package if isList cfg.lsp.package
then expToLua cfg.lsp.package then expToLua cfg.lsp.package
@ -79,6 +82,7 @@
ls_sources, ls_sources,
null_ls.builtins.formatting.prettier.with({ null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettier", command = "${cfg.format.package}/bin/prettier",
filetypes = { "typescript" },
}) })
) )
''; '';

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

@ -57,6 +57,7 @@ in {
}; };
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable { (mkIf cfg.treesitter.enable {
vim.treesitter.enable = true; vim.treesitter.enable = true;

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

@ -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

@ -14,17 +14,9 @@ in {
startPlugins = ["nvim-notify"]; startPlugins = ["nvim-notify"];
pluginRC.nvim-notify = entryAnywhere '' pluginRC.nvim-notify = entryAnywhere ''
require('notify').setup(${toLuaObject cfg.setupOpts}) local notify = require("notify")
notify.setup(${toLuaObject cfg.setupOpts})
-- required to fix offset_encoding errors vim.notify = notify
local notify = vim.notify
vim.notify = function(msg, ...)
if msg:match("warning: multiple different client offset_encodings") then
return
end
notify(msg, ...)
end
''; '';
}; };
}; };

View file

@ -28,7 +28,7 @@ in {
}; };
stages = mkOption { stages = mkOption {
type = enum ["fade_in_slide_out" "fade_in" "slide_out" "none"]; type = enum ["fade_in_slide_out" "fade" "slide" "static"];
default = "fade_in_slide_out"; default = "fade_in_slide_out";
description = "The stages of the notification"; description = "The stages of the notification";
}; };
@ -41,7 +41,7 @@ in {
background_colour = mkOption { background_colour = mkOption {
type = str; type = str;
default = "#000000"; default = "NotifyBackground";
description = "The background colour of the notification"; description = "The background colour of the notification";
}; };

View file

@ -4,8 +4,8 @@
lib, lib,
... ...
}: let }: let
inherit (lib.strings) concatMapStringsSep;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
cfg = config.vim.utility.preview.markdownPreview; cfg = config.vim.utility.preview.markdownPreview;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -15,7 +15,7 @@ in {
mkdp_auto_start = cfg.autoStart; mkdp_auto_start = cfg.autoStart;
mkdp_auto_close = cfg.autoClose; mkdp_auto_close = cfg.autoClose;
mkdp_refresh_slow = cfg.lazyRefresh; mkdp_refresh_slow = cfg.lazyRefresh;
mkdp_filetypes = [(concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes)]; mkdp_filetypes = cfg.filetypes;
mkdp_command_for_global = cfg.alwaysAllowPreview; mkdp_command_for_global = cfg.alwaysAllowPreview;
mkdp_open_to_the_world = cfg.broadcastServer; mkdp_open_to_the_world = cfg.broadcastServer;
mkdp_open_ip = cfg.customIP; mkdp_open_ip = cfg.customIP;

View file

@ -4,51 +4,33 @@
... ...
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.utility.surround; cfg = config.vim.utility.surround;
mkLznKey = mode: key: { mkLznKey = mode: key: {
inherit key mode; inherit mode key;
}; };
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["nvim-surround"];
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
lazy.plugins.nvim-surround = { lazy.plugins.nvim-surround = {
package = "nvim-surround"; package = "nvim-surround";
setupModule = "nvim-surround"; setupModule = "nvim-surround";
inherit (cfg) setupOpts; inherit (cfg) setupOpts;
keys = keys = [
[ (mkLznKey "i" cfg.setupOpts.keymaps.insert)
(mkLznKey ["i"] cfg.setupOpts.keymaps.insert) (mkLznKey "i" cfg.setupOpts.keymaps.insert_line)
(mkLznKey ["i"] cfg.setupOpts.keymaps.insert_line) (mkLznKey "x" cfg.setupOpts.keymaps.visual)
(mkLznKey ["x"] cfg.setupOpts.keymaps.visual) (mkLznKey "x" cfg.setupOpts.keymaps.visual_line)
(mkLznKey ["x"] cfg.setupOpts.keymaps.visual_line) (mkLznKey "n" cfg.setupOpts.keymaps.normal)
(mkLznKey ["n"] cfg.setupOpts.keymaps.normal) (mkLznKey "n" cfg.setupOpts.keymaps.normal_cur)
(mkLznKey ["n"] cfg.setupOpts.keymaps.normal_cur) (mkLznKey "n" cfg.setupOpts.keymaps.normal_line)
(mkLznKey ["n"] cfg.setupOpts.keymaps.normal_line) (mkLznKey "n" cfg.setupOpts.keymaps.normal_cur_line)
(mkLznKey ["n"] cfg.setupOpts.keymaps.normal_cur_line) (mkLznKey "n" cfg.setupOpts.keymaps.delete)
(mkLznKey ["n"] cfg.setupOpts.keymaps.delete) (mkLznKey "n" cfg.setupOpts.keymaps.change)
(mkLznKey ["n"] cfg.setupOpts.keymaps.change) (mkLznKey "n" cfg.setupOpts.keymaps.change_line)
(mkLznKey ["n"] cfg.setupOpts.keymaps.change_line) ];
]
++ map (mkLznKey ["n" "i" "v"]) [
"<Plug>(nvim-surround-insert)"
"<Plug>(nvim-surround-insert-line)"
"<Plug>(nvim-surround-normal)"
"<Plug>(nvim-surround-normal-cur)"
"<Plug>(nvim-surround-normal-line)"
"<Plug>(nvim-surround-normal-cur-line)"
"<Plug>(nvim-surround-visual)"
"<Plug>(nvim-surround-visual-line)"
"<Plug>(nvim-surround-delete)"
"<Plug>(nvim-surround-change)"
"<Plug>(nvim-surround-change-line)"
];
}; };
}; };
}; };

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

@ -76,6 +76,7 @@
else else
mkLuaInline '' mkLuaInline ''
function() function()
${optionalString (spec.beforeSetup != null) spec.beforeSetup}
${ ${
optionalString (spec.setupModule != null) optionalString (spec.setupModule != null)
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})" "require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"

View file

@ -74,6 +74,15 @@
''; '';
}; };
beforeSetup = mkOption {
type = nullOr lines;
default = null;
description = ''
Lua code to run after the plugin is loaded, but before the setup
function is called.
'';
};
setupModule = mkOption { setupModule = mkOption {
type = nullOr str; type = nullOr str;
default = null; default = null;

View file

@ -12,22 +12,28 @@
cfg = config.vim; cfg = config.vim;
in { in {
options.vim = { options.vim = {
enableLuaLoader = mkEnableOption '' enableLuaLoader = mkOption {
[{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable() type = bool;
default = false;
example = true;
description = ''
[{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
If `true`, this will enable the experimental Lua module loader which: If `true`, this will enable the experimental Lua module loader which:
- overrides loadfile - overrides loadfile
- adds the lua loader using the byte-compilation cache - adds the lua loader using the byte-compilation cache
- adds the libs loader - adds the libs loader
- 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);
@ -120,16 +126,14 @@ in {
example = {"some_variable" = 42;}; example = {"some_variable" = 42;};
description = '' description = ''
An attribute set containing global variable values A freeform attribute set containing global variable values for setting vim
for storing vim variables as early as possible. If variables as early as possible. If populated, this option will set vim variables
populated, this option will set vim variables in the in the built {option}`luaConfigRC` as the first item.
built luaConfigRC as the first item.
::: {.note} ::: {.note}
`{foo = "bar";}` will set `vim.g.foo` to "bar", where `{foo = "bar";}` will set `vim.g.foo` to "bar", where the type of `bar` in the
the type of `bar` in the resulting Lua value will be resulting Lua value will be inferred from the type of the value in the
inferred from the type of the value in the `{name = value;}` `{name = value;}` pair passed to the option.
pair passed to the option.
::: :::
''; '';
}; };
@ -206,21 +210,39 @@ in {
default = true; default = true;
description = "Enable word wrapping."; description = "Enable word wrapping.";
}; };
tabstop = mkOption {
type = int;
default = 8; # Neovim default
description = ''
Number of spaces that a `<Tab>` in the file counts for. Also see
the {command}`:retab` command, and the {option}`softtabstop` option.
'';
};
shiftwidth = mkOption {
type = int;
default = 8; # Neovim default
description = ''
Number of spaces to use for each step of (auto)indent. Used for
{option}`cindent`, `>>`, `<<`, etc.
When zero the {option}`tabstop` value will be used.
'';
};
}; };
}; };
example = {visualbell = true;}; example = {visualbell = true;};
description = '' description = ''
An attribute set containing vim options to be set A freeform attribute set containing vim options to be set as early as possible.
as early as possible. If populated, this option will If populated, this option will set vim options in the built {option}`luaConfigRC`
set vim options in the built luaConfigRC after `basic` after `basic` and before `pluginConfigs` DAG entries.
and before `pluginConfigs` DAG entries.
::: {.note} ::: {.note}
`{foo = "bar";}` will set `vim.o.foo` to "bar", where `{foo = "bar";}` will set `vim.o.foo` to "bar", where the type of `bar` in the
the type of `bar` in the resulting Lua value will be resulting Lua value will be inferred from the type of the value in the
inferred from the type of the value in the`{name = value;}` `{name = value;}` pair passed to the option.
pair passed to the option.
::: :::
''; '';
}; };

View file

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