feat: language injections

This commit is contained in:
2024-06-10 18:30:00 +02:00
parent b24359b712
commit 552e85b6b6
10 changed files with 122 additions and 94 deletions

View File

@@ -22,7 +22,8 @@
};
};
programs.nixvim = {
extraConfigLua = "if vim.g.neovide then vim.opt.linespace = -1 end";
extraConfigLua = # lua
"if vim.g.neovide then vim.opt.linespace = -1 end";
globals.neovide_cursor_vfx_mode = "pixiedust";
};
}

View File

@@ -18,7 +18,8 @@ in
config = lib.mkIf cfg.enable {
userCommands.${cfg.commandName} = {
command = {
__raw = ''
__raw = # lua
''
function(args)
if args.bang then
vim.b.${cfg.varName} = not vim.b.${cfg.varName}
@@ -54,7 +55,8 @@ in
};
};
conform-nvim.formatAfterSave = ''
conform-nvim.formatAfterSave = # lua
''
function(bufnr)
if vim.g.${cfg.varName} or vim.b[bufnr].${cfg.varName} then
return

View File

@@ -23,7 +23,8 @@ in
};
config = lib.mkIf cfg.enable {
extraConfigLua = ''
extraConfigLua = # lua
''
function AutoSave()
if not vim.b.${cfg.varName} and not vim.g.${cfg.varName} then
local bufnr = vim.api.nvim_get_current_buf()
@@ -47,7 +48,8 @@ in
userCommands.${cfg.commandName} = {
bang = true;
command = {
__raw = ''
__raw = # lua
''
function(args)
if args.bang then
vim.b.${cfg.varName} = not vim.b.${cfg.varName}

View File

@@ -18,10 +18,14 @@ in
enable = true;
settings = {
mapping = {
"<C-n>" = "cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select})";
"<C-p>" = "cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select})";
"<C-Space>" = "cmp.mapping.confirm({select = true})";
"<C-Enter>" = "cmp.mapping.complete()";
"<C-n>" = # lua
"cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select})";
"<C-p>" = # lua
"cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select})";
"<C-Space>" = # lua
"cmp.mapping.confirm({select = true})";
"<C-Enter>" = # lua
"cmp.mapping.complete()";
};
sources = [
{ name = "path"; }
@@ -34,7 +38,8 @@ in
"abbr"
"kind"
];
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
snippet.expand = # lua
"function(args) require('luasnip').lsp_expand(args.body) end";
window = {
completion.border = "rounded";
documentation.border = "rounded";

View File

@@ -13,7 +13,8 @@ in
};
config = lib.mkIf cfg.enable {
extraConfigLua = ''
extraConfigLua = # lua
''
require("actions-preview").setup({})
local signs = {
@@ -42,7 +43,8 @@ in
mode = "n";
options.silent = true;
lua = true;
action = "require('actions-preview').code_actions";
action = # lua
"require('actions-preview').code_actions";
}
{
key = "<leader>sx";

View File

@@ -8,11 +8,18 @@ in
};
config = lib.mkIf cfg.enable {
opts.showmode = false;
plugins = {
notify = {
enable = true;
backgroundColour = "#000000";
stages = "static";
};
telescope = {
enable = true;
keymaps."<leader>n" = # vim
"notify";
};
which-key.registrations."<leader>n" = "Notifications";
lualine = {
enable = true;
globalstatus = true;

View File

@@ -23,7 +23,8 @@ in
filteredItems.visible = true;
};
popupBorderStyle = "rounded";
eventHandlers.file_opened = ''
eventHandlers.file_opened = # lua
''
function()
require('neo-tree').close_all()
end

View File

@@ -21,7 +21,8 @@ in
};
config = lib.mkIf cfg.enable {
extraConfigLua = ''
extraConfigLua = # lua
''
LazygitTerminal = require("toggleterm.terminal").Terminal:new({
cmd = "${lib.getExe pkgs.lazygit}",
dir = "git_dir",
@@ -43,7 +44,8 @@ in
userCommands.${cfg.commandName} = {
command = {
__raw = ''
__raw = # lua
''
function()
LazygitTerminal:toggle()
end

View File

@@ -13,31 +13,36 @@ in
key = "<leader>xx";
mode = "n";
lua = true;
action = "require('trouble').toggle";
action = # lua
"require('trouble').toggle";
}
{
key = "<leader>xw";
mode = "n";
lua = true;
action = "function() require('trouble').toggle('workspace_diagnostics') end";
action = # lua
"function() require('trouble').toggle('workspace_diagnostics') end";
}
{
key = "<leader>xd";
mode = "n";
lua = true;
action = "function() require('trouble').toggle('document_diagnostics') end";
action = # lua
"function() require('trouble').toggle('document_diagnostics') end";
}
{
key = "<leader>xq";
mode = "n";
lua = true;
action = "function() require('trouble').toggle('quickfix') end";
action = # lua
"function() require('trouble').toggle('quickfix') end";
}
{
key = "<leader>xl";
mode = "n";
lua = true;
action = "function() require('trouble').toggle('loclist') end";
action = # lua
"function() require('trouble').toggle('loclist') end";
}
];
plugins = {

View File

@@ -10,7 +10,8 @@ in
config = lib.mkIf cfg.enable {
opts = {
undodir = {
__raw = "os.getenv('HOME') .. '/.config/nvim/undodir'";
__raw = # lua
"os.getenv('HOME') .. '/.config/nvim/undodir'";
};
undofile = true;
};