mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-07 07:49:49 +01:00
Compare commits
21 commits
bd4908edd8
...
467a350e97
Author | SHA1 | Date | |
---|---|---|---|
|
467a350e97 | ||
|
4ffd67bc0f | ||
|
1176ec7584 | ||
46aa168b2d | |||
|
9aad80d5e6 | ||
ac905b8aed | |||
|
90a5a42742 | ||
8bab0497fb | |||
f26744c6ce | |||
62d296a2dc | |||
8c66f10550 | |||
ea3d488cf4 | |||
|
0946d43921 | ||
|
7eb8d07bcf | ||
|
ed69816f68 | ||
bd9fe9eb68 | |||
5b2ab22777 | |||
|
6d07646fae | ||
|
14de965ce9 | ||
|
234ad31909 | ||
|
73cc5edd31 |
10 changed files with 115 additions and 39 deletions
|
@ -13,4 +13,8 @@
|
|||
|
||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||
|
||||
- Add Haskell support under `vim.languages.haskell` using [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`.
|
||||
|
|
|
@ -1729,11 +1729,11 @@
|
|||
"plugin-run-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1732918526,
|
||||
"narHash": "sha256-kiszNmZZDXG8tAPMQKuGJDCkqCMzsWT7BkCvkVsH2lA=",
|
||||
"lastModified": 1734816675,
|
||||
"narHash": "sha256-Wuk5HG+vHXAbifzp5YB5V/FxBhBRNWLeypkRczpXbvQ=",
|
||||
"owner": "diniamo",
|
||||
"repo": "run.nvim",
|
||||
"rev": "d867466e01b8fa4e54a589b9ef446cf43fb966de",
|
||||
"rev": "6cd971afdce6443d7a070dcc23af51da1cc932f9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -37,6 +37,7 @@ in {
|
|||
./csharp.nix
|
||||
./julia.nix
|
||||
./nu.nix
|
||||
./odin.nix
|
||||
];
|
||||
|
||||
options.vim.languages = {
|
||||
|
|
|
@ -92,7 +92,7 @@ in {
|
|||
cmd = ${
|
||||
if isList cfg.dap.package
|
||||
then expToLua cfg.dap.package
|
||||
else ''${cfg.dap.package}/bin/haskell-debug-adapter''
|
||||
else ''{"${cfg.dap.package}/bin/haskell-debug-adapter"}''
|
||||
},
|
||||
},
|
||||
''}
|
||||
|
|
71
modules/plugins/languages/odin.nix
Normal file
71
modules/plugins/languages/odin.nix
Normal 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;
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -57,6 +57,7 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
|
|
|
@ -4,51 +4,33 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.utility.surround;
|
||||
mkLznKey = mode: key: {
|
||||
inherit key mode;
|
||||
inherit mode key;
|
||||
};
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-surround"];
|
||||
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
||||
|
||||
lazy.plugins.nvim-surround = {
|
||||
package = "nvim-surround";
|
||||
|
||||
setupModule = "nvim-surround";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
keys =
|
||||
[
|
||||
(mkLznKey ["i"] cfg.setupOpts.keymaps.insert)
|
||||
(mkLznKey ["i"] cfg.setupOpts.keymaps.insert_line)
|
||||
(mkLznKey ["x"] cfg.setupOpts.keymaps.visual)
|
||||
(mkLznKey ["x"] cfg.setupOpts.keymaps.visual_line)
|
||||
(mkLznKey ["n"] cfg.setupOpts.keymaps.normal)
|
||||
(mkLznKey ["n"] cfg.setupOpts.keymaps.normal_cur)
|
||||
(mkLznKey ["n"] cfg.setupOpts.keymaps.normal_line)
|
||||
(mkLznKey ["n"] cfg.setupOpts.keymaps.normal_cur_line)
|
||||
(mkLznKey ["n"] cfg.setupOpts.keymaps.delete)
|
||||
(mkLznKey ["n"] cfg.setupOpts.keymaps.change)
|
||||
(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)"
|
||||
];
|
||||
keys = [
|
||||
(mkLznKey "i" cfg.setupOpts.keymaps.insert)
|
||||
(mkLznKey "i" cfg.setupOpts.keymaps.insert_line)
|
||||
(mkLznKey "x" cfg.setupOpts.keymaps.visual)
|
||||
(mkLznKey "x" cfg.setupOpts.keymaps.visual_line)
|
||||
(mkLznKey "n" cfg.setupOpts.keymaps.normal)
|
||||
(mkLznKey "n" cfg.setupOpts.keymaps.normal_cur)
|
||||
(mkLznKey "n" cfg.setupOpts.keymaps.normal_line)
|
||||
(mkLznKey "n" cfg.setupOpts.keymaps.normal_cur_line)
|
||||
(mkLznKey "n" cfg.setupOpts.keymaps.delete)
|
||||
(mkLznKey "n" cfg.setupOpts.keymaps.change)
|
||||
(mkLznKey "n" cfg.setupOpts.keymaps.change_line)
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
else
|
||||
mkLuaInline ''
|
||||
function()
|
||||
${optionalString (spec.beforeSetup != null) spec.beforeSetup}
|
||||
${
|
||||
optionalString (spec.setupModule != null)
|
||||
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
|
||||
|
|
|
@ -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 {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
|
|
Loading…
Reference in a new issue