mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-05 16:59:48 +01:00
Compare commits
24 commits
a91d6d026c
...
b0cbe5ca6f
Author | SHA1 | Date | |
---|---|---|---|
|
b0cbe5ca6f | ||
|
73660af2e3 | ||
4daa920166 | |||
d6cb4e0973 | |||
6567b463ee | |||
c3a4686fa1 | |||
cece170a41 | |||
cd6e672835 | |||
f8e1856620 | |||
781385f991 | |||
48829f9d5b | |||
0327918278 | |||
5db831adb7 | |||
|
9fad42374f | ||
0a3855cdc2 | |||
37dc96575d | |||
a369352365 | |||
ed3be410c5 | |||
bd9fe9eb68 | |||
5b2ab22777 | |||
|
6d07646fae | ||
|
14de965ce9 | ||
|
234ad31909 | ||
|
73cc5edd31 |
14 changed files with 234 additions and 33 deletions
|
@ -14,7 +14,7 @@ indent_style = space
|
|||
indent_size = 2
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{nix,yml,yaml}]
|
||||
[*.{js,nix,yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
tab_width = 2
|
||||
|
|
24
.github/README.md
vendored
24
.github/README.md
vendored
|
@ -69,7 +69,7 @@
|
|||
[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,
|
||||
with additional Lua Support
|
||||
with optional Lua support for robust configurability!
|
||||
- **Reproducible**: Your configuration will behave the same _anywhere_. No
|
||||
surprises, promise!
|
||||
- **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].
|
||||
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
|
||||
customizable through the Nix module system.
|
||||
- Not comfortable with a full-nix config or want to bring your Lua config? You
|
||||
can do just that, no unnecessary restrictions.
|
||||
- Not comfortable with a full-nix config or want to bring your Lua config? You
|
||||
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
|
||||
undocumented, obscure behaviour.
|
||||
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
|
||||
|
@ -167,19 +168,19 @@ fix.
|
|||
|
||||
## 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 open pull requests]: https://github.com/NotAShelf/nvf/pulls
|
||||
|
||||
**Q**: What platforms are supported?
|
||||
<br/> **A**: nvf actively supports Linux and Darwin platforms using standalone
|
||||
Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available
|
||||
installation instructions.
|
||||
<br/> **A**: nvf actively supports **Linux and Darwin** platforms using
|
||||
standalone Nix, NixOS or Home-Manager. Please take a look at the [nvf manual]
|
||||
for available installation instructions.
|
||||
|
||||
**Q**: Can you add _X_?
|
||||
<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
|
||||
**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
|
||||
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
|
||||
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
|
||||
|
||||
### Contributors
|
||||
|
|
|
@ -62,7 +62,8 @@ in
|
|||
# Copy anchor scripts to the script directory in document root.
|
||||
cp -vt "$dest"/script \
|
||||
${./static/script}/anchor-min.js \
|
||||
${./static/script}/anchor-use.js
|
||||
${./static/script}/anchor-use.js \
|
||||
${./static/script}/search.js
|
||||
|
||||
substituteInPlace ./options.md \
|
||||
--subst-var-by OPTIONS_JSON ./config-options.json
|
||||
|
@ -100,6 +101,7 @@ in
|
|||
--script highlightjs/loader.js \
|
||||
--script script/anchor-use.js \
|
||||
--script script/anchor-min.js \
|
||||
--script script/search.js \
|
||||
--toc-depth 2 \
|
||||
--section-toc-depth 1 \
|
||||
manual.md \
|
||||
|
|
10
docs/release-notes/rl-0.8.md
Normal file
10
docs/release-notes/rl-0.8.md
Normal 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
58
docs/static/script/search.js
vendored
Normal 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);
|
||||
});
|
||||
});
|
35
docs/static/style.scss
vendored
35
docs/static/style.scss
vendored
|
@ -189,14 +189,16 @@ th {
|
|||
|
||||
dt {
|
||||
margin: 1.2rem 0 0.8rem;
|
||||
content-visibility: auto;
|
||||
contain-intrinsic-size: auto 42px;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-left: 2rem;
|
||||
content-visibility: auto;
|
||||
contain-intrinsic-size: auto 500px;
|
||||
}
|
||||
|
||||
div.book {
|
||||
}
|
||||
div.book {}
|
||||
|
||||
ul {
|
||||
@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 {
|
||||
margin: 40px 0;
|
||||
|
||||
|
|
17
flake.lock
17
flake.lock
|
@ -1902,6 +1902,22 @@
|
|||
"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": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -2151,6 +2167,7 @@
|
|||
"plugin-tokyonight": "plugin-tokyonight",
|
||||
"plugin-trouble": "plugin-trouble",
|
||||
"plugin-ts-error-translator": "plugin-ts-error-translator",
|
||||
"plugin-typst-preview-nvim": "plugin-typst-preview-nvim",
|
||||
"plugin-vim-dirtytalk": "plugin-vim-dirtytalk",
|
||||
"plugin-vim-fugitive": "plugin-vim-fugitive",
|
||||
"plugin-vim-illuminate": "plugin-vim-illuminate",
|
||||
|
|
|
@ -206,6 +206,11 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
plugin-typst-preview-nvim = {
|
||||
url = "github:chomosuke/typst-preview.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-metals = {
|
||||
url = "github:scalameta/nvim-metals";
|
||||
flake = false;
|
||||
|
|
|
@ -77,6 +77,9 @@ in {
|
|||
-- buffer is a real file on the disk
|
||||
local real_file = vim.fn.filereadable(data.file) == 1
|
||||
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
-- buffer is a [No Name]
|
||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
|
||||
|
@ -84,7 +87,7 @@ in {
|
|||
local filetype = vim.bo[data.buf].ft
|
||||
|
||||
-- only files please
|
||||
if not real_file and not no_name then
|
||||
if not real_file and not directory and not no_name then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -93,6 +96,10 @@ in {
|
|||
return
|
||||
end
|
||||
|
||||
-- cd if buffer is a directory
|
||||
if directory then
|
||||
vim.cmd.cd(data.file)
|
||||
end
|
||||
-- open the tree but don't focus it
|
||||
require("nvim-tree.api").tree.toggle({ focus = false })
|
||||
end
|
||||
|
|
|
@ -7,10 +7,13 @@
|
|||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
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.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
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;
|
||||
|
||||
|
@ -33,6 +36,7 @@
|
|||
}
|
||||
'';
|
||||
};
|
||||
|
||||
tinymist = {
|
||||
package = pkgs.tinymist;
|
||||
lspConfig = ''
|
||||
|
@ -120,6 +124,50 @@ in {
|
|||
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 [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
|
@ -136,5 +184,13 @@ in {
|
|||
vim.lsp.lspconfig.enable = true;
|
||||
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})
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
in {
|
||||
|
@ -16,7 +17,7 @@ in {
|
|||
vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()')
|
||||
|
||||
-- Enable trouble diagnostics viewer
|
||||
require'nvim-lightbulb'.setup()
|
||||
require'nvim-lightbulb'.setup(${toLuaObject cfg.lightbulb.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.lsp = {
|
||||
lightbulb = {
|
||||
enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font";
|
||||
setupOpts = mkPluginSetupOption "nvim-lightbulb" {};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,22 +12,28 @@
|
|||
cfg = config.vim;
|
||||
in {
|
||||
options.vim = {
|
||||
enableLuaLoader = mkEnableOption ''
|
||||
[{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
|
||||
enableLuaLoader = mkOption {
|
||||
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:
|
||||
- overrides loadfile
|
||||
- adds the lua loader using the byte-compilation cache
|
||||
- adds the libs loader
|
||||
- removes the default Neovim loader
|
||||
If `true`, this will enable the experimental Lua module loader which:
|
||||
- overrides loadfile
|
||||
- adds the lua loader using the byte-compilation cache
|
||||
- adds the libs loader
|
||||
- removes the default Neovim loader
|
||||
|
||||
::: {.note}
|
||||
This is disabled by default. Before setting this option, please
|
||||
take a look at the [{option}`official documentation`].
|
||||
:::
|
||||
'';
|
||||
::: {.note}
|
||||
The Lua module loader is *disabled* by default. Before setting this option, please
|
||||
take a look at the [{option}`official documentation`]. This option may be enabled by
|
||||
default in the future.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
additionalRuntimePaths = mkOption {
|
||||
type = listOf (either path str);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"release": "v0.7",
|
||||
"isReleaseBranch": true
|
||||
"release": "v0.8",
|
||||
"isReleaseBranch": false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue