Compare commits

...
Sign in to create a new pull request.

10 commits

Author SHA1 Message Date
Ellis Rahhal
6b8d249242 bumped flake 2025-03-04 11:49:15 -08:00
Ellis Rahhal
a66f932a8f minor tweaks 2025-02-28 12:03:09 -08:00
470005d298 fixed startify indent lines; changed cowsay setting 2025-02-23 23:12:00 -08:00
Ellis Rahhal
9f232f8f96 made startify default; working on mini-files 2025-02-23 13:59:49 -08:00
Ellis Rahhal
a222c3d0c0 added more language servers 2025-02-21 21:37:05 -08:00
Ellis Rahhal
0791d5bd92 treesitter configured 2025-02-18 22:07:17 -08:00
Ellis Rahhal
4ad80df1eb fixed luasnip keybindings; made ai plugins an option 2025-02-17 20:15:55 -08:00
Ellis Rahhal
9cf6e96c73 updated avante provider 2025-02-17 10:11:46 -08:00
Ellis Rahhal
51c37ffb23 added several plugins 2025-02-16 23:22:51 -08:00
d67e8fdfc9 Merge pull request 'added colored indent lines' (#1) from colored-lines into main
Reviewed-on: #1
2025-02-16 17:34:12 -08:00
20 changed files with 937 additions and 139 deletions

View file

@ -64,7 +64,7 @@
__raw = ''
function()
vim.cmd([[
if &ft =~ 'javascript\|html\|jade\|json\|css\|less\|php\|python\|sh\|c\|cpp\|markdown\|yaml\|vim\|nix'
if &ft =~ 'javascript\|html\|jade\|json\|css\|less\|php\|python\|sh\|c\|cpp\|markdown\|yaml\|vim\|nix|graphql'
:%s/\s\+$//e
elseif expand('%:t') =~ '\.gltf$' || expand('%:t') =~ '\.glsl$'
:%s/\s\+$//e

164
flake.lock generated
View file

@ -1,6 +1,168 @@
{
"nodes": {
"root": {}
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1738453229,
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"ixx": {
"inputs": {
"flake-utils": [
"nixvim",
"nuschtosSearch",
"flake-utils"
],
"nixpkgs": [
"nixvim",
"nuschtosSearch",
"nixpkgs"
]
},
"locked": {
"lastModified": 1729958008,
"narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=",
"owner": "NuschtOS",
"repo": "ixx",
"rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"ref": "v0.0.6",
"repo": "ixx",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1741010256,
"narHash": "sha256-WZNlK/KX7Sni0RyqLSqLPbK8k08Kq7H7RijPJbq9KHM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ba487dbc9d04e0634c64e3b1f0d25839a0a68246",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1738797219,
"narHash": "sha256-KRwX9Z1XavpgeSDVM/THdFd6uH8rNm/6R+7kIbGa+2s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1da52dd49a127ad74486b135898da2cef8c62665",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2",
"nuschtosSearch": "nuschtosSearch"
},
"locked": {
"lastModified": 1741098523,
"narHash": "sha256-gXDSXDr6tAb+JgxGMvcEjKC9YO8tVOd8hMMZHJLyQ6Q=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "03065fd4708bfdf47dd541d655392a60daa25ded",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils",
"ixx": "ixx",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1738508923,
"narHash": "sha256-4DaDrQDAIxlWhTjH6h/+xfG05jt3qDZrZE/7zDLQaS4=",
"owner": "NuschtOS",
"repo": "search",
"rev": "86e2038290859006e05ca7201425ea5b5de4aecb",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"nixvim": "nixvim"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7

View file

@ -6,7 +6,6 @@
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
};

View file

@ -3,7 +3,13 @@
options.nixvim-config = {
enable = lib.mkEnableOption "Enable nixvim-config";
enable-startify = lib.mkOption {
enable-ai = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable ai plugins";
};
enable-startify-cowsay = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable startify";

74
plugins/avante-custom.nix Normal file
View file

@ -0,0 +1,74 @@
{ config, pkgs,... }:
{
programs.nixvim = if config.nixvim-config.enable-ai then {
extraPlugins = [
(pkgs.vimUtils.buildVimPlugin {
name = "avante-nvim";
src = pkgs.fetchFromGitHub {
owner = "yetone";
repo = "avante.nvim";
rev = "984fe877bfee4cf26e1e5f7e13cc284b6f26bc10";
hash = "sha256-nSXY7qwXuZsc7qGnqXTpLZZFLshzckwVBmq3TWbwLFY=";
};
})
pkgs.vimPlugins.dressing-nvim
pkgs.vimPlugins.nui-nvim
pkgs.vimPlugins.plenary-nvim
];
# Use "post" to make sure dependencies are loaded first
extraConfigLua = ''
require('nui')
require('dressing')
require('plenary')
require('avante_lib').load()
require('avante').setup ({
provider = "copilot",
cursor_applying_provider = "copilot",
behaviour = {
enable_cursor_planning_mode = true,
},
claude = {
api_key_name = "<api_key_name>",
},
openai = {
api_key_name = "<api_key_name>",
},
files = {
auto_include = true, -- Automatically include relevant files
max_files = 50, ---------------- Maximum number of files to include in context
max_size_kb = 1000, -- Maximum total size of files in KB
-- Define which files to include/exclude
include = {
"*.lua",
"*.nix",
"*.rs",
"*.ts",
"*.js",
"*.jsx",
"*.tsx",
-- Add more patterns as needed
},
exclude = {
"node_modules/**",
"dist/**",
".git/**",
},
},
web_search_engine = {
provider = "tavily", -- tavily, serpapi, searchapi, google, kagi
},
-- depends on docker
rag_service = {
enable = true, -- requires OPENAI_API_KEY to be set
},
})
'';
} else {};
}

132
plugins/avante.nix Normal file
View file

@ -0,0 +1,132 @@
{ config, ... }:
{
programs.nixvim.plugins = if config.nixvim-config.enable-ai then {
## required dependencies
dressing.enable = true; # this is archived and may break in the future
nui.enable = true;
## optional dependencies
cmp.enable = true;
copilot-lua.enable = true;
fzf-lua.enable = true;
mini.enable = true;
telescope.enable = true;
web-devicons.enable = true;
avante = {
enable = true;
settings = {
provider = "copilot";
cursor_applying_provider = "copilot";
behaviour = {
enable_cursor_planning_mode = true;
};
web_search_engine = {
provider = "tavily"; # tavily, serpapi, searchapi, google, kagi
};
# depends on docker
rag_service = {
enable = false; # requires OPENAI_API_KEY to be set
};
files = {
auto_include = true; # Automatically include relevant files
max_files = 50; # Maximum number of files to include in context
max_size_kb = 1000; # Maximum total size of files in KB
# Define which files to include/exclude
include = [
"*.lua"
"*.nix"
"*.rs"
"*.ts"
"*.js"
"*.jsx"
"*.tsx"
# Add more patterns as needed
];
exclude = [
"node_modules/**"
"dist/**"
".git/**"
# Add more patterns to exclude
];
};
claude = {
api_key_name = "<api_key_name>";
};
openai = {
api_key_name = "<api_key_name>";
};
vendors = {
ollama = {
api_key_name = "";
endpoint = "http://localhost:11434/v1";
model = "hf.co/unsloth/DeepSeek-R1-Distill-Qwen-1.5B-GGUF";
temperature = "0.6";
parse_curl_args.__raw = ''
function(opts, code_opts)
return {
url = opts.endpoint .. "/chat/completions",
headers = {
["Accept"] = "application/json",
["Content-Type"] = "application/json",
["x-api-key"] = "ollama",
},
body = {
model = opts.model,
messages = require("avante.providers").copilot.parse_messages(code_opts),
max_tokens = opts.max_tokens,
stream = true,
},
}
end'';
parse_response_data.__raw = ''
function(data_stream, event_state, opts)
require("avante.providers").openai.parse_response(data_stream, event_state, opts)
end'';
};
};
## Default keybindings:
# <leader>aa - ask
# <leader>ae - edit
# <leader>ar - refresh
# <leader>af - focus
# co - choose ours
# ct - choose theirs
# ca - choose all theirs
# c0 - choose none
# cb - choose both
# cc - choose cursor
# ]x - previous conflict
# [x - next conflict
# [[ - previous code block
# ]] - next code block
# mappings = {
# ask = "<leader>ca";
# edit = "<leader>ce";
# refresh = "<leader>cr";
# focus = "<leader>cf";
# toggle = {
# default = "<leader>ct";
# debug = "<leader>cd";
# hint = "<leader>ch";
# suggestion = "<leader>cs";
# repomap = "<leader>cR";
# };
# files = {
# add_current = "<leader>cc";
# };
# };
};
};
} else {};
}

24
plugins/bash.nix Normal file
View file

@ -0,0 +1,24 @@
{ pkgs, ... }:
{
programs.nixvim.plugins = {
lsp.servers.bashls = {
enable = true;
filetypes = ["sh" "zsh"];
};
none-ls = {
sources = {
formatting.shfmt.enable = true;
formatting.shellharden.enable = true;
};
};
};
environment.systemPackages = with pkgs; [
shellcheck
shellharden
shfmt
nodePackages.bash-language-server
];
}

View file

@ -1,4 +1,4 @@
{ ... }:
{ config, ... }:
{
programs.nixvim = {
plugins = {
@ -42,6 +42,20 @@
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
keywordLength = 3;
}
] ++ (if config.nixvim-config.enable-ai then [
{ name = "codecompanion"; }
{ name = "copilot"; }
] else []) ++ [
{
name = "path"; # file system paths
keywordLength = 3;
}
{
name = "luasnip"; # snippets
keywordLength = 3;
}
{ name = "cmdline"; }
{ name = "codecompanion"; }
{ name = "copilot"; }
{
name = "path"; # file system paths
@ -156,6 +170,7 @@
"<S-Tab>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
"<C-l>" = ''
cmp.mapping(function()
local luasnip = require('luasnip')
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
@ -163,6 +178,7 @@
'';
"<C-h>" = ''
cmp.mapping(function()
local luasnip = require('luasnip')
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end

View file

@ -1,7 +1,7 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
programs.nixvim = {
keymaps = [
keymaps = if config.nixvim-config.enable-ai then [
{
mode = [ "n" ];
key = "<c-c>";
@ -12,10 +12,10 @@
key = ",c";
action = ":CodeCompanionChat Toggle<CR>";
}
];
] else [];
plugins.codecompanion = {
enable = true;
enable = config.nixvim-config.enable-ai;
settings = {
adapters = {
@ -41,7 +41,7 @@
openai.__raw = ''
function()
return require('codecompanion.adapters').extend('copilot', {
return require('codecompanion.adapters').extend('openai', {
env = {
api_key = "cmd:${pkgs.passage}/bin/passage /apis/ai/openai"
}

View file

@ -1,8 +1,8 @@
{ ... }:
{ config, ... }:
{
programs.nixvim = {
plugins.copilot-lua = {
enable = true;
enable = config.nixvim-config.enable-ai;
settings = {
suggestion.enabled = false;

87
plugins/dap.nix Normal file
View file

@ -0,0 +1,87 @@
{ ... }:
{
programs.nixvim = {
plugins = {
dap.enable = true;
dap-ui.enable = true;
dap-virtual-text.enable = true;
};
extraConfigLua = ''
vim.fn.sign_define("DapBreakpoint", { text = " ", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
vim.fn.sign_define("DapBreakpointCondition", { text = " ", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" })
vim.fn.sign_define("DapLogPoint", { text = " ", texthl = "DiagnosticSignInfo", linehl = "", numhl = "" })
vim.fn.sign_define("DapStopped", { text = " ", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" })
vim.fn.sign_define("DapBreakpointReject", { text = "", texthl = "DiagnosticSignHint", linehl = "", numhl = "" })
'';
keymaps = [
{
mode = "n";
key = "<leader>dB";
action = "<cmd>lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))<cr>";
options.desc = "set breakpoint with condition";
}
{
mode = "n";
key = "<leader>db";
action = "<cmd>lua require('dap').toggle_breakpoint()<cr>";
options.desc = "Toggle Breakpoint";
}
{
mode = "n";
key = "<leader>dc";
action = "<cmd>lua require('dapui').close()<cr>";
options.desc = "Close";
}
{
mode = "n";
key = "<leader>ddr";
action = "<cmd>lua require('dap').repl.open()<cr>";
options.desc = "Repl";
}
{
mode = "n";
key = "<leader>de";
action = "<cmd>lua require('dap').step_out()<cr>";
options.desc = "Step Out";
}
{
mode = "n";
key = "<leader>dlp";
action = "<cmd>lua require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<cr>";
options.desc = "Log Point Message";
}
{
mode = "n";
key = "<leader>dn";
action = "<cmd>lua require('dap').step_over()<cr>";
options.desc = "Step Over";
}
{
mode = "n";
key = "<leader>do";
action = "<cmd>lua require('dapui').open()<cr>";
options.desc = "Open";
}
{
mode = "n";
key = "<leader>dr";
action = "<cmd>lua require('dap').continue()<cr>";
options.desc = "Continue";
}
{
mode = "n";
key = "<leader>ds";
action = "<cmd>lua require('dap').step_into()<cr>";
options.desc = "Step Into";
}
{
mode = "n";
key = "<leader>dt";
action = "<cmd>lua require('dapui').close()<cr>";
options.desc = "Toggle";
}
];
};
}

View file

@ -1,6 +1,9 @@
{ config, ... }:
{ config, pkgs, ... }:
{
imports = [
./avante.nix
# ./avante-custom.nix
./bash.nix
# ./blink-cmp.nix
# ./blink-cmp-copilot.nix
# ./blink-cmp-dictionary.nix
@ -10,59 +13,72 @@
./cmp.nix
./codecompanion.nix
./copilot.nix
./dap.nix
./diffview.nix
./fzf-lua.nix
./indent-blankline.nix
./lazydev.nix
./lsp.nix
./luasnip.nix
# ./mini.nix
# ./mini-files.nix
./nvim-tree.nix
./startify.nix
./telescope.nix
./treesitter.nix
./vim-signify.nix
];
programs.nixvim.plugins = {
comment.enable = true;
fugitive.enable = true;
gitsigns.enable = true;
lightline.enable = false;
lualine.enable = true;
nix.enable = true;
noice.enable = true;
## disable, very annoying as notifications block content and
## are part of the buffer rotation
notify = {
enable = false;
topDown = false;
programs.nixvim = {
plugins = {
comment.enable = true;
## needed by avante. already archived, so may need to migrate to snacks
# dressing.enable = true;
fugitive.enable = true;
gitsigns.enable = true;
lightline.enable = false;
lualine.enable = true;
nix.enable = true;
noice.enable = true;
## disable, very annoying as notifications block content and
## are part of the buffer rotation
notify = {
enable = false;
settings = {
top_down = false;
};
};
## needed by avante.
# nui.enable = true;
nvim-autopairs.enable = true;
nvim-bqf.enable = true;
nvim-lightbulb.enable = true;
# config = ''
# lua << EOF
# require('nvim-lightbulb').setup({
# float = {
# -- "true" causes "invalid buffer id" error
# enabled = false,
# },
# autocmd = {
# enabled = true,
# },
# })
# EOF
# '';
# oil.enable = true;
rainbow-delimiters.enable = true;
render-markdown.enable = true;
sleuth.enable = true;
tmux-navigator.enable = true;
treesitter-context.enable = true;
trouble.enable = true;
ts-autotag.enable = true;
# ## Needed for telescope, nvim-tree, trouble, diffview, bufferline, and other plugins
# ## Only on unstable at the moment
web-devicons.enable = true;
which-key.enable = true;
yanky.enable = true;
};
nvim-autopairs.enable = true;
nvim-lightbulb.enable = true;
# config = ''
# lua << EOF
# require('nvim-lightbulb').setup({
# float = {
# -- "true" causes "invalid buffer id" error
# enabled = false,
# },
# autocmd = {
# enabled = true,
# },
# })
# EOF
# '';
oil.enable = true;
rainbow-delimiters.enable = true;
sleuth.enable = true;
startify.enable = config.nixvim-config.enable-startify;
treesitter.enable = true;
treesitter-context.enable = true;
tmux-navigator.enable = true;
trouble.enable = true;
# ## Needed for telescope, nvim-tree, trouble, diffview, bufferline, and other plugins
# ## Only on unstable at the moment
web-devicons.enable = true;
which-key.enable = true;
yanky.enable = true;
};
}

View file

@ -5,29 +5,53 @@
enable = true;
luaConfig.post = ''
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
vim.g.rainbow_delimiters = { highlight = highlight }
require("ibl").setup { scope = { highlight = highlight } }
require("ibl").setup({
scope = {
highlight = highlight
},
exclude = {
buftypes = {
"terminal",
"quickfix",
"startify",
},
filetypes = {
"",
"checkhealth",
"help",
"lspinfo",
"neogitstatus",
"packer",
"startify",
"TelescopePrompt",
"TelescopeResults",
"yaml",
},
};
})
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
'';

View file

@ -1,5 +1,10 @@
{ ... }:
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.nodePackages.eslint
pkgs.nodePackages.prettier
];
programs.nixvim = {
plugins.lsp = {
enable = true;
@ -25,6 +30,52 @@
end
'';
servers = {
## Needs a package
# awk_ls.enable = true;
bashls.enable = true;
clangd.enable = true;
cmake.enable = true;
## Needs a package
# css_variables.enable = true;
cssls.enable = true;
## Needs a package
# cssmodules_ls.enable = true;
## Needs a package
# custom_elements_ls.enable = true;
denols = {
enable = true;
rootDir = "require('lspconfig').util.root_pattern('deno.json', 'deno.jsonc')";
};
dockerls.enable = true; # Docker
eslint.enable = true;
gopls = { # Golang
enable = true;
autostart = true;
};
## Needs a package
# graphql.enable = true;
html.enable = true;
java_language_server.enable = true;
lua_ls = { # Lua
enable = true;
settings.telemetry.enable = false;
};
marksman.enable = true;
nil_ls.enable = true;
## Using nil_ls
# nixd.enable = true;
postgres_lsp.enable = true;
pyright.enable = true;
rust_analyzer = {
enable = true;
installRustc = true;
installCargo = true;
};
sqls.enable = true;
## Needs a package
# sqlls.enable = true;
stylelint_lsp.enable = true;
tailwindcss.enable = true;
ts_ls = {
enable = true;
rootDir = "require('lspconfig').util.root_pattern('package.json')";
@ -32,57 +83,7 @@
single_file_support = false;
};
};
denols = {
enable = true;
rootDir = "require('lspconfig').util.root_pattern('deno.json', 'deno.jsonc')";
};
cssls.enable = true;
tailwindcss.enable = true;
html.enable = true;
phpactor.enable = true;
pyright.enable = true;
marksman.enable = true;
nil_ls.enable = true;
## Using nil_ls
# nixd.enable = true;
dockerls.enable = true; # Docker
bashls.enable = true; # Bash
clangd.enable = true; # C/C++
csharp_ls.enable = true; # C#
yamlls.enable = true; # YAML
ltex = {
enable = true;
settings = {
enabled = [ "astro" "html" "latex" "markdown" "text" "tex" "gitcommit" ];
completionEnabled = true;
language = "en-US de-DE nl";
# dictionary = {
# "nl-NL" = [
# ":/home/liv/.local/share/nvim/ltex/nl-NL.txt"
# ];
# "en-US" = [
# ":/home/liv/.local/share/nvim/ltex/en-US.txt"
# ];
# "de-DE" = [
# ":/home/liv/.local/share/nvim/ltex/de-DE.txt"
# ];
# };
};
};
gopls = { # Golang
enable = true;
autostart = true;
};
lua_ls = { # Lua
enable = true;
settings.telemetry.enable = false;
};
# Rust
rust_analyzer = {
enable = true;
installRustc = true;
installCargo = true;
};
};
};
};

View file

@ -1,14 +1,14 @@
{ ... }:
{
programs.nixvim = {
# keymaps = [
# {
# mode = "i";
# key = "<c-c>";
# action.__raw = ''function() require("luasnip.extras.select_choice")() end'';
# options.desc = "Search";
# }
# ];
keymaps = [
{
mode = "i";
key = "<c-b>";
action.__raw = ''function() require("luasnip.extras.select_choice")() end'';
options.desc = "Search";
}
];
plugins.luasnip = {
enable = true;
@ -25,16 +25,16 @@
updateevents = ["TextChanged" "TextChangedI"];
region_check_events = "CursorHold";
delete_check_events = "InsertLeave";
# ext_opts.__raw = ''
# {
# [require('luasnip.util.types').choiceNode] = {
# active = {
# virt_text = { { 'choice <c-c>', 'Comment' } },
# hl_mode = 'combine',
# },
# },
# }
# '';
ext_opts.__raw = ''
{
[require('luasnip.util.types').choiceNode] = {
active = {
virt_text = { { 'choice <c-b>', 'Comment' } },
hl_mode = 'combine',
},
},
}
'';
};
};
};

72
plugins/mini-files.nix Normal file
View file

@ -0,0 +1,72 @@
{ pkgs,... }:
{
programs.nixvim = {
extraPlugins = [
pkgs.vimPlugins.mini-files
];
extraFiles = {
"lua/treeutils-mini.lua" = {
source = ./treeutils-mini.lua;
};
};
extraConfigLua = ''
require('mini.files').setup({
});
function _G.mini_files_open_current_buffer()
local MiniFiles = require("mini.files")
local _ = MiniFiles.close()
or MiniFiles.open(vim.api.nvim_buf_get_name(0), false)
vim.defer_fn(function()
MiniFiles.reveal_cwd()
end, 30)
end
function _G.mini_files_toggle()
local MiniFiles = require("mini.files")
local _ = MiniFiles.close()
or MiniFiles.open()
end
function _G.launch_find_files_wrapped()
-- Try custom function first
local handled = require('treeutils-mini').launch_find_files()
if handled == "default" then
-- If custom function didn't handle it, execute default behavior
local default_key = vim.api.nvim_replace_termcodes('<c-f>', true, true, true)
vim.api.nvim_feedkeys(default_key, 'n', false)
end
end
'';
keymaps = [
## Go to current buffer's file in nvim-tree
{
mode = [ "n" ];
key = ",n";
action = "<cmd>lua mini_files_open_current_buffer()<CR>";
}
## Toggle nvim-tree visibility
{
mode = [ "n" ];
key = ",m";
action = "<cmd>lua mini_files_toggle()<CR>";
}
## Search current path
{
mode = [ "n" ];
key = "<c-f>";
action = "<cmd>lua launch_find_files_wrapped()<CR>";
options = { noremap = true; };
}
{
mode = [ "n" ];
key = "<c-g>";
action = "<cmd>lua require('treeutils-mini').launch_live_grep()<CR>";
options = { noremap = true; };
}
];
};
}

75
plugins/mini.nix Normal file
View file

@ -0,0 +1,75 @@
{ ... }:
{
programs.nixvim = {
plugins.mini = {
enable = true;
modules = {
ai = {
n_lines = 50;
search_method = "cover_or_next";
};
## Already handled by another plugin
# comment = {
# mappings = {
# comment = "<leader>/";
# comment_line = "<leader>/";
# comment_visual = "<leader>/";
# textobject = "<leader>/";
# };
# };
diff = {
view = {
style = "sign";
};
};
starter = {
content_hooks = {
"__unkeyed-1.adding_bullet" = {
__raw = "require('mini.starter').gen_hook.adding_bullet()";
};
"__unkeyed-2.indexing" = {
__raw = "require('mini.starter').gen_hook.indexing('all', { 'Builtin actions' })";
};
"__unkeyed-3.padding" = {
__raw = "require('mini.starter').gen_hook.aligning('center', 'center')";
};
};
evaluate_single = true;
header = ''
_______ ____ ____.___ _____
\ \ ____ ___\ \ / /| | / \
/ | \_/ __ \/ _ \ Y / | |/ \ / \
/ | \ ___( <_> ) / | / Y \
\____|__ /\___ >____/ \___/ |___\____|__ /
\/ \/ \/
'';
items = {
"__unkeyed-1.buildtin_actions" = {
__raw = "require('mini.starter').sections.builtin_actions()";
};
"__unkeyed-2.recent_files_current_directory" = {
__raw = "require('mini.starter').sections.recent_files(10, false)";
};
"__unkeyed-3.recent_files" = {
__raw = "require('mini.starter').sections.recent_files(10, true)";
};
# "__unkeyed-4.sessions" = {
# __raw = "require('mini.starter').sections.sessions(5, true)";
# };
};
};
surround = {
mappings = {
add = "gsa";
delete = "gsd";
find = "gsf";
find_left = "gsF";
highlight = "gsh";
replace = "gsr";
update_n_lines = "gsn";
};
};
};
};
};
}

18
plugins/startify.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, ... }:
{
programs.nixvim = {
plugins.startify = {
enable = true;
settings = {
custom_header = if config.nixvim-config.enable-startify-cowsay then null else [
''. _______ ____ ____.___ _____''
''. \ \ ____ ___\ \ / /| | / \''
''. / | \_/ __ \/ _ \ Y / | |/ \ / \''
''. / | \ ___( <_> ) / | / Y \''
''. \____|__ /\___ >____/ \___/ |___\____|__ /''
''. \/ \/ \/''
];
};
};
};
}

37
plugins/treesitter.nix Normal file
View file

@ -0,0 +1,37 @@
{ ... }:
{
programs.nixvim = {
plugins.treesitter = {
enable = true;
settings = {
auto_install = true;
folding = true;
highlight = {
enable = true;
## Can slow down the editor
# additional_vim_regex_highlighting = true;
custom_captures = { };
disable = [
# "rust"
];
};
ignore_install = [
# "rust"
];
incremental_selection = {
enable = true;
keymaps = {
init_selection = false;
node_decremental = "grm";
node_incremental = "grn";
scope_incremental = "grc";
};
};
indent = {
enable = true;
};
};
};
};
}

View file

@ -0,0 +1,55 @@
local MiniFiles = require("mini.files")
local actions = require'telescope.actions'
local action_state = require'telescope.actions.state'
local M = {}
local view_selection = function(prompt_bufnr, map)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
local filename = selection.filename
if (filename == nil) then
filename = selection[1]
end
-- openfile.fn('preview', filename)
end)
return true
end
function M.launch_live_grep(opts)
return M.launch_telescope("live_grep", opts)
end
function M.launch_find_files(opts)
return M.launch_telescope("find_files", opts, { active_only_in_tree = true })
end
function M.launch_telescope(func_name, opts, internal_opts)
internal_opts = internal_opts or {}
local buffname = vim.fn.bufname()
if (internal_opts.active_only_in_tree) then
-- Make sure this is being called in NvimTree
if (string.sub(buffname, 1, string.len('NvimTree')) ~= 'NvimTree') then
return "default"
end
end
local telescope_status_ok, _ = pcall(require, "telescope")
if not telescope_status_ok then
return
end
local node = MiniFiles.get_latest_path()
if (node == nil) then
-- Tree is probably not open
return
end
local is_folder = node.fs_stat and node.fs_stat.type == 'directory' or false
local basedir = is_folder and node.absolute_path or vim.fn.fnamemodify(node.absolute_path, ":h")
opts = opts or {}
opts.cwd = basedir
opts.search_dirs = { basedir }
opts.attach_mappings = view_selection
return require("telescope.builtin")[func_name](opts)
end
return M