nixos-config/home/modules/nixvim.nix

360 lines
14 KiB
Nix
Raw Normal View History

2024-02-12 20:08:44 +01:00
{
pkgs,
lib,
config,
inputs,
outputs,
...
}: {
programs.nixvim = {
enable = true;
globals.mapleader = " ";
extraConfigLua = builtins.readFile ../config-files/nvim/init.lua;
extraPlugins = with pkgs.vimPlugins; [headlines-nvim];
2024-02-13 22:04:37 +01:00
clipboard.providers.wl-copy.enable = true;
2024-02-13 22:04:37 +01:00
options = {
number = true; # Show line numbers
relativenumber = true; # Show relative line numbers
shiftwidth = 2; # Tab width should be 2
};
2024-02-13 22:04:37 +01:00
colorschemes.catppuccin.enable = true;
plugins = {
2024-03-18 18:23:29 +01:00
comment-nvim = {
2024-03-18 18:25:09 +01:00
enable = true;
2024-03-18 18:23:29 +01:00
};
indent-blankline.enable = true;
lualine.enable = true;
lsp-format = {enable = true;};
2024-03-28 14:00:26 +01:00
copilot-lua = {
enable = true;
suggestion = {
2024-03-30 21:23:52 +01:00
enabled = false;
2024-03-28 14:00:26 +01:00
};
2024-03-30 21:23:52 +01:00
panel.enabled = false;
2024-03-28 14:00:26 +01:00
};
copilot-cmp.enable = true;
lsp = {
enable = true;
servers = {
2024-03-28 14:00:26 +01:00
pylsp.enable = true;
bashls.enable = true;
lua-ls.enable = true;
nushell.enable = true;
clangd.enable = true;
svelte.enable = true;
tsserver.enable = true;
eslint.enable = true;
rust-analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
nil_ls.enable = true;
};
};
gitsigns.enable = true;
fugitive.enable = true;
treesitter = {
enable = true;
folding = true;
indent = true;
nixvimInjections = true;
};
treesitter-refactor = {
enable = true;
smartRename.enable = true;
highlightCurrentScope.enable = true;
navigation.enable = true;
};
cursorline.enable = true;
cmp = {
enable = true;
autoEnableSources = true;
2024-02-13 22:04:37 +01:00
settings = {
snippet = {
2024-03-18 18:23:29 +01:00
expand = "function(args) require('luasnip').lsp_expand(args.body) end";
};
sources = [
{name = "nvim_lsp";}
{name = "path";}
{name = "buffer";}
{name = "luasnip";}
2024-03-28 14:00:26 +01:00
{name = "copilot";}
];
#mapping = {
# __raw = ''
# cmp.mapping.preset.insert({
# ['<Tab>'] =
# })
# '';
#};
mapping = {
"<CR>" = ''
2024-03-18 18:23:29 +01:00
cmp.mapping.confirm({ select = true })
'';
"<Tab>" = ''
function(fallback)
local luasnip = require('luasnip')
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end
'';
};
};
};
telescope.enable = true;
telescope.extensions = {file_browser.enable = true;};
which-key.enable = true;
cmp-nvim-lsp.enable = true;
cmp-nvim-lua.enable = true;
noice.enable = true;
notify.enable = true;
luasnip.enable = true;
cmp_luasnip.enable = true;
neo-tree.enable = true;
presence-nvim.enable = true;
crates-nvim.enable = true;
fidget.enable = true;
alpha = {
enable = true;
theme = null;
iconsEnabled = true;
layout = [
{
type = "padding";
val = 4;
}
{
type = "text";
val = [
2024-03-17 18:13:26 +01:00
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
];
2024-03-17 18:13:26 +01:00
#val = [
# " ███████████████ ██████████████████"
# " ███████████████ ██ "
# " ███████████████ ██████████████████"
# " ███████████████ ██ ██"
# " ███████████████ ██████████████████"
# " ███████████████ █ ██ █ "
# " ███████████████ █ ██ █ "
# " ███████████████ █ ██ █ "
# " ███████████████ "
# " ███████████████ ██████████████████"
# " ███████████████ ██ ██ "
# " ██████████████████████████ ██████████████████"
# " ██████████████████████████ ██ ██"
# " ██████████████████████████ ██████████████████"
# " ██████████████████████████ ██ ██ "
# " ██████████████████████████ ██████████████████"
# " ██████████████████████████ "
# " ██████████████████████████ ▀▀▀▀▀▀▀▀██▀▀▀▀▀▀▀▀"
# " ██████████████████████████ ▀▀▀▀▀▀▀▀██▀▀▀▀▀▀▀▀"
# " ██████████████████████████ ██████████████████"
# " ███████████████▀▀▀▀▀▀▀▀▀▀▀ ██ ██"
# " ███████████████ ██████████████████"
# " ███████████████ ▄▄▄▄▄▄▄▄██▄▄▄▄▄▄▄▄"
# " ████████████████ ▄▄▄▄▄▄▄▄██▄▄▄▄▄▄▄▄"
# " █████████████████ "
# " ██████████████████ ██████████████████"
# " ███████████████████ ██ "
# " ████████████████████ ██ "
# " █████████████████████ ██ "
# " ██████████████████████ ██ "
# " ███████████████████████ ██ "
# " ████████████████████████ ██████████████████"
#];
opts = {
position = "center";
hl = "Type";
};
}
{
type = "text";
# val = [
# " ███▄ █ ██▓▒██ ██▒ ██▒ █▓ ██▓ ███▄ ▄███▓"
# " ██ ▀█ █ ▓██▒▒▒ █ █ ▒░▓██░ █▒▓██▒▓██▒▀█▀ ██▒"
# "▓██ ▀█ ██▒▒██▒░░ █ ░ ▓██ █▒░▒██▒▓██ ▓██░"
# "▓██▒ ▐▌██▒░██░ ░ █ █ ▒ ▒██ █░░░██░▒██ ▒██ "
# "▒██░ ▓██░░██░▒██▒ ▒██▒ ▒▀█░ ░██░▒██▒ ░██▒"
# "░ ▒░ ▒ ▒ ░▓ ▒▒ ░ ░▓ ░ ░ ▐░ ░▓ ░ ▒░ ░ ░"
# "░ ░░ ░ ▒░ ▒ ░░░ ░▒ ░ ░ ░░ ▒ ░░ ░ ░"
# " ░ ░ ░ ▒ ░ ░ ░ ░░ ▒ ░░ ░ "
# " ░ ░ ░ ░ ░ ░ ░ "
# " ░ "
# ];
2024-03-17 18:13:26 +01:00
#val = [
# "TOHA HEAVY INDUSTRIES"
#];
val = [
2024-03-18 08:56:51 +01:00
"git@git.sr.ht:xqtc"
];
opts = {
position = "center";
hl = "Keyword";
};
}
{
type = "padding";
2024-03-17 18:13:26 +01:00
val = 8;
}
{
type = "group";
val = [
{
type = "text";
val = " To browse files press '<leader>ff'";
opts = {
position = "center";
};
}
];
opts = {
position = "center";
};
}
{
type = "padding";
val = 2;
}
{
type = "text";
val = "uwu";
opts = {
position = "center";
hl = "Keyword";
};
}
{
type = "padding";
val = 4;
}
#{
# type = "text";
# val = [
# "      />》, -―‐‐<^}"
# "     ./:::/,≠´::::::ヽ."
# "    /::::〃::::}::丿ハ"
# "   ./:::::i{l|/ ノ/ }::}"
# "   /:::::::瓜イ> ´< ,:ノ"
# "  ./::::::|ノヘ.{、 (_フ_ノイ_"
# "  |:::::::|}`ス / /"
# ". |::::::|(_:::つ/ ThinkPad / neovim!"
# ". ̄ ̄ ̄ ̄ ̄ ̄ ̄\/_____/ ̄ ̄ ̄ ̄ ̄"
# ];
# opts = {
# position = "center";
# hl = "Type";
# };
#}
];
opts = {
#noautocmd = true;
keymap = {
press = "<CR>";
press_queue = "<M-CR>";
};
};
2024-02-12 20:08:44 +01:00
};
bufferline.enable = true;
2024-02-12 20:08:44 +01:00
};
keymaps = [
{
mode = "n";
key = "<leader>ff";
options.silent = true;
action = "<cmd>Telescope file_browser<CR>";
}
{
mode = "n";
key = "<leader>hh";
options.silent = true;
action = "<cmd>Alpha<CR>";
}
{
mode = "n";
key = "<leader>bb";
options.silent = true;
action = "<cmd>Telescope buffers<CR>";
}
{
mode = "n";
key = "<leader>Gp";
action = "<cmd>Git pull<CR>";
}
{
mode = "n";
key = "<leader>GP";
action = "<cmd>Git push<CR>";
}
{
mode = "n";
key = "<leader>Gc";
action = "<cmd>Git commit<CR>";
}
{
mode = "n";
key = "<leader>Ga";
action = "<cmd>Git add .<CR>";
}
{
mode = "n";
key = "<leader>Gd";
action = "<cmd>Git diff<CR>";
}
{
mode = "n";
key = "<leader>nt";
action = "<cmd>Neotree toggle left<CR>";
}
{
mode = "n";
key = "<leader>P";
action = ''"+p'';
}
{
mode = ["n" "v"];
key = "<leader>y";
action = ''[["+y]]'';
}
{
mode = ["n"];
key = "<leader>Y";
action = ''[["+Y]]'';
}
2024-03-18 18:23:29 +01:00
{
mode = ["n"];
key = "<leader>sr";
2024-03-18 18:25:09 +01:00
action = ''
function()
vim.lsp.buf.rename()
end
2024-03-18 18:23:29 +01:00
'';
lua = true;
}
];
};
2024-02-12 20:08:44 +01:00
}