This commit is contained in:
Hadi
2024-05-02 15:40:12 +02:00
parent 92ec6a5ea8
commit 81ab14b256
86 changed files with 227 additions and 146 deletions

132
home/apps/nvim/alpha.nix Normal file
View File

@@ -0,0 +1,132 @@
{ config, ... }: {
programs.nixvim.highlight = {
AlphaHeaderColor.fg = "#${config.theme.colors.primary-bg}";
AlphaTextColor.fg = "#${config.theme.colors.fg}";
AlphaShortcutColor.fg = "#${config.theme.colors.alt-fg}";
};
programs.nixvim.plugins.alpha = {
enable = true;
layout = [
{
type = "padding";
val = 4;
}
{
type = "text";
opts = {
position = "center";
hl = "AlphaHeaderColor";
};
val = [
" "
" "
" "
" "
" "
" "
" "
" "
" "
];
}
{
type = "padding";
val = 4;
}
{
type = "group";
val = [
{
type = "button";
val = "󰭎 Find file";
on_press.__raw = "function() vim.cmd[[Telescope find_files]] end";
opts = {
shortcut = "nf";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "AlphaShortcutColor";
hl = "AlphaTextColor";
};
}
{
type = "button";
val = " New file";
on_press.__raw = "function() vim.cmd[[ene]] end";
opts = {
shortcut = "nn";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "AlphaShortcutColor";
hl = "AlphaTextColor";
};
}
{
type = "button";
val = " NixOs Config";
on_press.__raw = "function() vim.cmd[[e ~/.config/nixos]] end";
opts = {
shortcut = "nc";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "AlphaShortcutColor";
hl = "AlphaTextColor";
};
}
{
type = "button";
val = " Recently used";
on_press.__raw = "function() vim.cmd[[Telescope oldfiles]] end";
opts = {
shortcut = "no";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "AlphaShortcutColor";
hl = "AlphaTextColor";
};
}
{
type = "button";
val = "󰱽 Find text";
on_press.__raw = "function() vim.cmd[[Telescope live_grep]] end";
opts = {
shortcut = "nt";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "AlphaShortcutColor";
hl = "AlphaTextColor";
};
}
{
type = "button";
val = "󰩈 Quit Neovim";
on_press.__raw = "function() vim.cmd[[qa]] end";
opts = {
shortcut = "nq";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "AlphaShortcutColor";
hl = "AlphaTextColor";
};
}
];
}
];
};
}

View File

@@ -0,0 +1 @@
{ programs.nixvim.plugins.nvim-autopairs = { enable = true; }; }

View File

@@ -0,0 +1 @@
{ programs.nixvim.plugins.bufferline = { enable = true; }; }

113
home/apps/nvim/cmp.nix Normal file
View File

@@ -0,0 +1,113 @@
{
programs.nixvim.plugins = {
luasnip.enable = true;
cmp-buffer = { enable = true; };
cmp-emoji = { enable = true; };
cmp-nvim-lsp = { enable = true; };
cmp-path = { enable = true; };
cmp_luasnip = { enable = true; };
cmp = {
enable = true;
settings = {
snippet.expand =
"function(args) require('luasnip').lsp_expand(args.body) end";
sources = [
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "buffer"; }
{ name = "nvim_lua"; }
{ name = "path"; }
];
formatting = {
fields = [ "abbr" "kind" "menu" ];
format =
# lua
''
function(_, item)
local icons = {
Namespace = "󰌗",
Text = "󰉿",
Method = "󰆧",
Function = "󰆧",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈚",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "󰊄",
Table = "",
Object = "󰅩",
Tag = "",
Array = "[]",
Boolean = "",
Number = "",
Null = "󰟢",
String = "󰉿",
Calendar = "",
Watch = "󰥔",
Package = "",
Copilot = "",
Codeium = "",
TabNine = "",
}
local icon = icons[item.kind] or ""
item.kind = string.format("%s %s", icon, item.kind or "")
return item
end
'';
};
window = {
completion = {
winhighlight =
"FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel";
scrollbar = true;
sidePadding = 0;
border = [ "" "" "" "" "" "" "" "" ];
};
documentation = {
border = [ "" "" "" "" "" "" "" "" ];
winhighlight =
"FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel";
};
};
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<Down>" = "cmp.mapping.select_next_item()";
"<Up>" = "cmp.mapping.select_prev_item()";
"<C-j>" = "cmp.mapping.select_next_item()";
"<C-k>" = "cmp.mapping.select_prev_item()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.close()";
"<CR>" =
"cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })";
};
};
};
};
}

View File

@@ -0,0 +1 @@
{ programs.nixvim.plugins.comment = { enable = true; }; }

View File

@@ -0,0 +1,5 @@
{
programs.nixvim.plugins.copilot-vim = {
enable = true;
};
}

View File

@@ -0,0 +1,35 @@
{ pkgs, inputs, ... }: {
imports = [
inputs.nixvim.homeManagerModules.nixvim
./auto-pairs.nix
./options.nix
#./bufferline.nix
./telescope.nix
./nvim-tree.nix
./lightline.nix
./git.nix
./cmp.nix
./none-ls.nix
./wilder.nix
./lsp.nix
./treesitter.nix
./toggleterm.nix
./copilot.nix
./obsidian.nix
./whichkey.nix
./alpha.nix
./keymaps.nix
./comment.nix
./oil.nix
./trouble.nix
];
programs.nixvim = {
enable = true;
colorschemes.catppuccin = {
enable = true;
settings = { transparent_background = true; };
};
};
}

6
home/apps/nvim/git.nix Normal file
View File

@@ -0,0 +1,6 @@
{
programs.nixvim.plugins.gitsigns = {
enable = true;
settings = { current_line_blame = false; };
};
}

View File

@@ -0,0 +1,71 @@
{
programs.nixvim.keymaps = [
{
key = "<leader>e";
action = "<CMD>Neotree toggle<CR>";
}
{
key = "<space>fm";
action = "<CMD>lua vim.lsp.buf.format()<CR>";
}
{
key = "<leader>ot";
action = "<cmd>lua require('obsidian').util.toggle_checkbox()<cr>";
}
{
key = "<leader>oo";
action = "<cmd>ObsidianQuickSwitch<cr>";
}
{
key = "<leader>on";
action = "<cmd>ObsidianNew<cr>";
}
{
key = "<leader>of";
action = "<cmd>ObsidianSearch<cr>";
}
{
key = "<leader>oi";
action = "<cmd>ObsidianPasteImg<cr>";
}
{
key = "<leader>E";
action = "<cmd>Oil<cr>";
}
{
key = "<leader>t";
action = "<cmd>TroubleToggle<cr>";
}
{
key = "<C-h>";
action = "<C-w>h";
}
{
key = "<C-j>";
action = "<C-w>j";
}
{
key = "<C-k>";
action = "<C-w>k";
}
{
key = "<C-l>";
action = "<C-w>l";
}
# Terminal Mappings
{
mode = "t";
key = "<esc>";
action = "<C-\\><C-n>";
}
];
}

View File

@@ -0,0 +1 @@
{ programs.nixvim.plugins.lualine = { enable = true; }; }

24
home/apps/nvim/lsp.nix Normal file
View File

@@ -0,0 +1,24 @@
{
programs.nixvim.plugins = {
lsp-format.enable = true;
lsp = {
enable = true;
servers = {
bashls.enable = true;
clangd.enable = true;
gopls.enable = true;
nixd.enable = true;
tailwindcss.enable = true;
html.enable = true;
svelte.enable = true;
};
keymaps.lspBuf = {
"gd" = "definition";
"gD" = "references";
"gt" = "type_definition";
"gi" = "implementation";
"K" = "hover";
};
};
};
}

View File

@@ -0,0 +1,18 @@
{
programs.nixvim.plugins.none-ls = {
enable = true;
sources = {
diagnostics = {
golangci_lint.enable = true;
statix.enable = true;
};
formatting = {
gofmt.enable = true;
goimports.enable = true;
nixfmt.enable = true;
markdownlint.enable = true;
tidy.enable = true;
};
};
};
}

View File

@@ -0,0 +1,5 @@
{
programs.nixvim.plugins.neo-tree = {
enable = true;
};
}

View File

@@ -0,0 +1,9 @@
{
programs.nixvim.plugins.obsidian = {
enable = true;
settings = {
dir = "~/Nextcloud/obsidian";
disable_frontmatter = true;
};
};
}

6
home/apps/nvim/oil.nix Normal file
View File

@@ -0,0 +1,6 @@
{
programs.nixvim.plugins.oil = {
enable = true;
settings = { default_file_explorer = false; };
};
}

View File

@@ -0,0 +1,37 @@
{
programs.nixvim.globals.mapleader = " ";
programs.nixvim.opts = {
updatetime = 50; # Faster completion
number = true;
relativenumber = true;
autoindent = true;
clipboard = "unnamed,unnamedplus";
expandtab = true;
tabstop = 2;
softtabstop = 2;
shiftwidth = 2;
smartindent = true;
breakindent = true;
ignorecase = true;
incsearch = true;
hlsearch = true;
smartcase = true;
wildmode = "list:longest";
completeopt = [ "menuone" "noselect" ];
signcolumn = "yes";
cursorline = true;
scrolloff = 8;
mouse = "a";
wrap = false;
swapfile = false;
undofile = true;
conceallevel = 2;
};
}

View File

@@ -0,0 +1,13 @@
{
programs.nixvim.plugins.telescope = {
enable = true;
keymaps = {
"<leader>fg" = "live_grep";
#"<C-p>" = {
# action = "git_files";
# desc = "Telescope Git Files";
#};
};
extensions.fzf-native = { enable = true; };
};
}

View File

@@ -0,0 +1,9 @@
{
programs.nixvim.plugins.toggleterm = {
enable = true;
settings = {
open_mapping = "[[<c-t>]]";
direction = "horizontal";
};
};
}

View File

@@ -0,0 +1,10 @@
{
programs.nixvim.plugins = {
treesitter = {
enable = true;
nixGrammars = true;
indent = true;
};
treesitter-context.enable = true;
};
}

View File

@@ -0,0 +1 @@
{ programs.nixvim.plugins.trouble = { enable = true; }; }

View File

@@ -0,0 +1,3 @@
{
programs.nixvim.plugins.which-key.enable=true;
}

View File

@@ -0,0 +1,6 @@
{
programs.nixvim.plugins.wilder = {
enable = true;
modes = [ ":" "/" "?" ];
};
}