bye nixvim

This commit is contained in:
cnst
2024-09-02 19:14:35 +02:00
parent ef04f7df84
commit ba1772e041
44 changed files with 1301 additions and 973 deletions

View File

@@ -40,5 +40,11 @@ in {
};
};
};
xdg.mimeApps.defaultApplications = {
"text/html" = ["firefox.desktop"];
"text/xml" = ["firefox.desktop"];
"x-scheme-handler/http" = ["firefox.desktop"];
"x-scheme-handler/https" = ["firefox.desktop"];
};
};
}

View File

@@ -3,14 +3,14 @@
"${userModules}/browsers/chromium"
"${userModules}/browsers/firefox"
"${userModules}/comm/discord"
#"${userModules}/devtools/neovim"
"${userModules}/devtools/nixvim"
"${userModules}/devtools/neovim"
"${userModules}/devtools/vscode"
"${userModules}/gaming/lutris"
"${userModules}/gaming/mangohud"
"${userModules}/terminal/alacritty"
"${userModules}/terminal/foot"
"${userModules}/terminal/kitty"
"${userModules}/terminal/wezterm"
"${userModules}/terminal/zellij"
"${userModules}/userd/copyq"
"${userModules}/userd/mako"
@@ -21,6 +21,7 @@
"${userModules}/utils/rofi"
"${userModules}/utils/waybar"
"${userModules}/utils/yazi"
"${userModules}/utils/zathura"
"${userModules}/wm/hyprland"
"${userModules}/wm/utils/hypridle"
"${userModules}/wm/utils/hyprlock"

View File

@@ -1,61 +0,0 @@
-- Faster completion
vim.opt.updatetime = 100
-- Line numbers
vim.opt.relativenumber = false -- Relative line numbers
vim.opt.number = true -- Display the absolute line number of the current line
-- Buffer and window options
vim.opt.hidden = true -- Keep closed buffer open in the background
vim.opt.showmode = false -- Do not show the mode in the command line
vim.opt.mouse = "a" -- Enable mouse control
vim.opt.mousemodel = "popup" -- Mouse right-click extends the current selection
vim.opt.splitbelow = true -- A new window is put below the current one
vim.opt.splitright = true -- A new window is put right of the current one
-- List options
vim.opt.list = true
vim.opt.listchars = {
tab = "",
trail = "·",
nbsp = "",
extends = "",
precedes = "",
}
-- Swap and undo files
vim.opt.swapfile = false -- Disable the swap file
vim.opt.modeline = true -- Tags such as 'vim:ft=sh'
vim.opt.modelines = 100 -- Sets the type of modelines
vim.opt.undofile = true -- Automatically save and restore undo history
-- Search options
vim.opt.incsearch = true -- Incremental search: show match for partly typed search command
vim.opt.inccommand = "split" -- Search and replace: preview changes in quickfix list
vim.opt.ignorecase = true -- When the search query is lower-case, match both lower and upper-case patterns
vim.opt.smartcase = true -- Override the 'ignorecase' option if the search pattern contains upper case characters
-- Scrolling and cursor options
vim.opt.scrolloff = 4 -- Number of screen lines to show around the cursor
vim.opt.cursorline = true -- Highlight the screen line of the cursor
vim.opt.cursorcolumn = false -- Highlight the screen column of the cursor
vim.opt.signcolumn = "yes" -- Whether to show the signcolumn
-- Display options
vim.opt.colorcolumn = "" -- Columns to highlight
vim.opt.laststatus = 3 -- When to use a status line for the last window
vim.opt.fileencoding = "utf-8" -- File-content encoding for the current buffer
vim.opt.spell = false -- Highlight spelling mistakes (local to window)
vim.opt.wrap = false -- Prevent text from wrapping
-- Tab options
vim.opt.tabstop = 4 -- Number of spaces a <Tab> in the text stands for (local to buffer)
vim.opt.shiftwidth = 4 -- Number of spaces used for each step of (auto)indent (local to buffer)
vim.opt.expandtab = true -- Expand <Tab> to spaces in Insert mode (local to buffer)
vim.opt.autoindent = true -- Do clever autoindenting
-- Text width
vim.opt.textwidth = 0 -- Maximum width of text that is being inserted
-- Folding
vim.opt.foldlevel = 99 -- Folds with a level higher than this number will be closed

View File

@@ -1,39 +0,0 @@
local lspc = require'lspconfig'
-- Setup for LSP servers
lspc.tsserver.setup({
on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
local ts_utils = require("nvim-lsp-ts-utils")
ts_utils.setup({})
ts_utils.setup_client(client)
local buf_map = function(bufnr, mode, lhs, rhs, opts)
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts or { silent = true })
end
buf_map(bufnr, "n", "gs", ":TSLspOrganize<CR>")
buf_map(bufnr, "n", "gi", ":TSLspRenameFile<CR>")
buf_map(bufnr, "n", "go", ":TSLspImportAll<CR>")
-- Custom on_attach functionality
on_attach(client, bufnr)
end,
})
lspc.cssls.setup{}
lspc.clangd.setup{}
lspc.tailwindcss.setup{}
lspc.html.setup{}
lspc.astro.setup{}
lspc.phpactor.setup{}
lspc.pyright.setup{}
lspc.marksman.setup{}
lspc.nixd.setup{}
lspc.dockerls.setup{}
lspc.bashls.setup{}
lspc.csharp_ls.setup{}
lspc.yamlls.setup{}
lspc.lua_ls.setup({
})

View File

@@ -1,73 +0,0 @@
local has_words_before = function()
local line, col = table.unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
sources = {
{ name = "nvim_lsp" },
{ name = "cmp_tabnine" },
{ name = "treesitter" },
{ name = "buffer" },
{ name = "path" },
{ name = "vsnip" },
-- { name = "copilot" },
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
menu = {
buffer = "[Buf]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
treesitter = "[TS]",
cmp_tabnine = "[TN]",
vsnip = "[Snip]",
},
}),
},
mapping = {
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, {
"i",
"s",
}),
},
})

View File

@@ -1,20 +0,0 @@
-- Set colorscheme
vim.cmd("set termguicolors")
-- Configure gruvbox-material
vim.g.gruvbox_material_background = "medium" -- Options: 'hard', 'medium', 'soft'
vim.g.gruvbox_material_palette = "material" -- Options: 'material', 'original', 'palenight'
-- Load the gruvbox-material colorscheme
vim.cmd([[colorscheme gruvbox-material]])
-- Enable colorizer
require("colorizer").setup()
-- set sign
vim.cmd("sign define DiagnosticSignError text= linehl= texthl=DiagnosticSignError numhl=")
vim.cmd("sign define DiagnosticSignHint text= linehl= texthl=DiagnosticSignHint numhl=")
vim.cmd("sign define DiagnosticSignInfo text= linehl= texthl=DiagnosticSignInfo numhl=")
vim.cmd("sign define DiagnosticSignWarn text= linehl= texthl=DiagnosticSignWarn numhl=")
-- set lightline theme to horizon
vim.g.lightline = { colorscheme = "apprentice" }

View File

@@ -1,14 +0,0 @@
require'nvim-treesitter.configs'.setup {
textobjects = {
select = {
enable = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
},
}

View File

@@ -1,25 +0,0 @@
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
disable = {},
},
rainbow = {
enable = true,
extended_mode = true,
},
autotag = {
enable = true,
},
context_commentstring = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
})

View File

@@ -1,39 +0,0 @@
-- telescope
require("telescope").load_extension("fzy_native")
-- null-ls
local nb = require("null-ls").builtins
require("null-ls").setup({
sources = {
nb.formatting.alejandra,
nb.code_actions.statix,
nb.diagnostics.cppcheck,
nb.diagnostics.deadnix,
nb.diagnostics.statix,
nb.diagnostics.eslint,
nb.completion.spell,
},
})
require("gitsigns").setup()
-- autopairs
require("nvim-autopairs").setup({})
-- copy to system clipboard
vim.api.nvim_set_keymap("v", "<Leader>y", '"+y', { noremap = true })
vim.api.nvim_set_keymap("n", "<Leader>y", ":%+y<CR>", { noremap = true })
-- paste from system clipboard
vim.api.nvim_set_keymap("n", "<Leader>p", '"+p', { noremap = true })
-- textyankpost autocmd
vim.api.nvim_create_augroup("highlight_yank", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
group = "highlight_yank",
desc = "Highlight when yanking (copying) text",
callback = function()
vim.highlight.on_yank()
end,
})

View File

@@ -1,52 +0,0 @@
-- Updated Which-Key Spec
local wk = require("which-key")
wk.setup {}
wk.register({
["<leader>"] = {
["/"] = { "<cmd>Telescope live_grep<cr>", "Live Grep" },
P = { '"+P', "Paste from clipboard before cursor" },
a = { "<cmd>lua require('telescope.builtin').lsp_code_actions()<cr>", "Code Actions" },
ac = { "<cmd>CopilotChatToggle<CR>", "Toggle Copilot chat" },
b = { "<cmd>Telescope buffers<cr>", "Buffers" },
d = { "<cmd>lua require('telescope.builtin').lsp_document_diagnostics()<cr>", "LSP Diagnostics" },
f = { "<cmd>Telescope find_files<cr>", "Find File" },
g = {
b = { "<cmd>ToggleBlameLine<cr>", "Toggle BlameLine" },
c = { "<cmd>Neogit commit<cr>", "Commit" },
i = { "<cmd>lua require('telescope').extensions.gh.issues()<cr>", "Github Issues" },
name = "Git / VCS",
p = { "<cmd>lua require('telescope').extensions.gh.pull_request()<cr>", "Github PRs" },
s = { "<cmd>Neogit kind=split<cr>", "Staging" }
},
k = { "<cmd>lua vim.lsp.buf.signature_help()<cr>", "Signature Help" },
l = {
e = { "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<cr>", "Show Line Diagnostics" },
f = { "<cmd>lua vim.lsp.buf.formatting_sync()<cr>", "Format file" },
name = "LSP",
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Set Loclist" }
},
p = { '"+p', "Paste from clipboard" },
qc = { "<cmd>lua local input = vim.fn.input('Quick Chat: '); if input ~= '' then require('CopilotChat').ask(input, { selection = require('CopilotChat.select').buffer }) end<CR>", "CopilotChat - Quick chat" },
y = { '"+y', "Yank to clipboard" }
},
g = {
e = { "G", "Bottom" },
h = { "0", "Line start" },
l = { "$", "Line end" },
s = { "^", "First non-blank in line" }
},
i = {
["<C-v>"] = { "<esc>p", "Paste in Insert Mode" }
},
v = {
["<"] = { "<gv", "Indent Left" },
["<C-c>"] = { "y", "Yank Selection" },
["<S-TAB>"] = { "<gv", "Indent Left" },
["<TAB>"] = { ">gv", "Indent Right" },
[">"] = { ">gv", "Indent Right" },
J = { ":m '>+1<CR>gv=gv", "Move Down" },
K = { ":m '<-2<CR>gv=gv", "Move Up" }
}
}, { prefix = "" })

View File

@@ -1,81 +1,224 @@
# Yanked from Misterio77's great config: https://github.com/Misterio77/nix-config
{
pkgs,
lib,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.devtools.neovim;
in {
imports = [
./plugins
./lsp.nix
./syntaxes.nix
];
options = {
modules.devtools.neovim.enable = mkEnableOption "Enables neovim";
modules.devtools.neovim.enable = mkEnableOption "Enable neovim";
};
config = mkIf cfg.enable {
programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
vimdiffAlias = true;
extraConfig =
/*
vim
*/
''
"Use system clipboard
set clipboard=unnamedplus
"colorscheme
colorscheme gruvbox-material
set number
"Lets us easily trigger completion from binds
set wildcharm=<tab>
"Folding
set foldmethod=manual
"Should be expr, but it's slow. So just use ':set fdm=expr' when it's needed.
"Tabs
set tabstop=4 "4 char-wide tab
set expandtab "Use spaces
set softtabstop=0 "Use same length as 'tabstop'
set shiftwidth=0 "Use same length as 'tabstop'
"2 char-wide overrides
augroup two_space_tab
autocmd!
autocmd FileType json,html,htmldjango,hamlet,nix,scss,typescript,php,haskell,terraform setlocal tabstop=2
augroup END
"Set tera to use htmldjango syntax
augroup tera_htmldjango
autocmd!
autocmd BufRead,BufNewFile *.tera setfiletype htmldjango
augroup END
"Options when composing mutt mail
augroup mail_settings
autocmd FileType mail set noautoindent wrapmargin=0 textwidth=0 linebreak wrap formatoptions +=w
augroup END
"Fix nvim size according to terminal
"(https://github.com/neovim/neovim/issues/11330)
augroup fix_size
autocmd VimEnter * silent exec "!kill -s SIGWINCH" getpid()
augroup END
"Scroll up and down
nmap <C-j> <C-e>
nmap <C-k> <C-y>
"Buffers
nmap <space>b :buffers<CR>
nmap <C-l> :bnext<CR>
nmap <C-h> :bprev<CR>
nmap <C-q> :bdel<CR>
"Navigate
nmap <space>e :e<space>
nmap <space>e :e %:h<tab>
"CD to current dir
nmap <space>c :cd<space>
nmap <space>C :cd %:h<tab>
"Loclist
nmap <space>l :lwindow<cr>
nmap [l :lprev<cr>
nmap ]l :lnext<cr>
nmap <space>L :lhistory<cr>
nmap [L :lolder<cr>
nmap ]L :lnewer<cr>
"Quickfix
nmap <space>q :cwindow<cr>
nmap [q :cprev<cr>
nmap ]q :cnext<cr>
nmap <space>Q :chistory<cr>
nmap [Q :colder<cr>
nmap ]Q :cnewer<cr>
"Make
nmap <space>m :make<cr>
"Grep (replace with ripgrep)
nmap <space>g :grep<space>
if executable('rg')
set grepprg=rg\ --vimgrep
set grepformat=%f:%l:%c:%m
endif
"Close other splits
nmap <space>o :only<cr>
"Sudo save
cmap w!! w !sudo tee > /dev/null %
'';
extraLuaConfig =
/*
lua
*/
''
vim.g.have_nerd_font = true
vim.wo.relativenumber = false
vim.opt.cursorline = true
vim.keymap.set("n", "<C-a>", "ggVG", { desc = "Select all" })
vim.keymap.set("n", "<C-v>", "p", { desc = "Paste" })
vim.keymap.set("i", "<C-v>", "<esc>p", { desc = "Paste" })
vim.keymap.set("v", "<C-c>", "y", { desc = "Yank" })
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" })
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" })
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Hover Documentation" })
vim.keymap.set("n", "<space>a", vim.lsp.buf.code_action, { desc = "Code action" })
-- Diagnostic
vim.keymap.set("n", "<space>d", vim.diagnostic.open_float, { desc = "Floating diagnostic" })
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" })
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" })
vim.keymap.set("n", "gl", vim.diagnostic.setloclist, { desc = "Diagnostics on loclist" })
vim.keymap.set("n", "gq", vim.diagnostic.setqflist, { desc = "Diagnostics on quickfix" })
function add_sign(name, text)
vim.fn.sign_define(name, { text = text, texthl = name, numhl = name })
end
add_sign("DiagnosticSignError", "󰅚 ")
add_sign("DiagnosticSignWarn", " ")
add_sign("DiagnosticSignHint", "󰌶 ")
add_sign("DiagnosticSignInfo", " ")
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- When it releases
-- vim.opt.foldexpr = "v:lua.vim.treesitter.foldtext()"
-- Highlight when yanking (copying) text
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
'';
plugins = with pkgs.vimPlugins; [
vim-table-mode
editorconfig-nvim
vim-surround
gruvbox-material-nvim
nvim-web-devicons
comment-nvim
cmp-buffer
cmp-nvim-lsp
cmp-path
cmp-spell
cmp-treesitter
cmp-vsnip
friendly-snippets
gitsigns-nvim
lightline-vim
lspkind-nvim
neogit
null-ls-nvim
nvim-autopairs
nvim-cmp
nvim-colorizer-lua
nvim-lspconfig
nvim-tree-lua
(nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
plenary-nvim
rainbow-delimiters-nvim
telescope-fzy-native-nvim
telescope-nvim
vim-floaterm
vim-sneak
vim-vsnip
which-key-nvim
copilot-lua
copilot-cmp
statix
phpactor
{
plugin = nvim-autopairs;
type = "lua";
config =
/*
lua
*/
''
require("nvim-autopairs").setup({})
'';
}
];
};
extraPackages = with pkgs; [nixd gcc ripgrep fd deadnix lua-language-server yaml-language-server bash-language-server];
extraConfig = let
luaRequire = module:
builtins.readFile (builtins.toString
./config
+ "/${module}.lua");
luaConfig = builtins.concatStringsSep "\n" (map luaRequire [
"init"
"lspconfig"
"nvim-cmp"
"theming"
"treesitter"
"treesitter-textobjects"
"utils"
"which-key"
]);
in ''
lua << 
${luaConfig}

'';
xdg.desktopEntries = {
nvim = {
name = "Neovim";
genericName = "Text Editor";
comment = "Edit text files";
exec = "nvim %F";
icon = "nvim";
mimeType = [
"text/english"
"text/plain"
"text/x-makefile"
"text/x-c++hdr"
"text/x-c++src"
"text/x-chdr"
"text/x-csrc"
"text/x-java"
"text/x-moc"
"text/x-pascal"
"text/x-tcl"
"text/x-tex"
"application/x-shellscript"
"text/x-c"
"text/x-c++"
];
terminal = true;
type = "Application";
categories = [
"Utility"
"TextEditor"
];
};
};
};
}

View File

@@ -0,0 +1,144 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
# LSP and completions for injected langs
otter-nvim
phpactor
# LSP
{
plugin = nvim-lspconfig;
type = "lua";
config =
/*
lua
*/
''
local lspconfig = require("lspconfig")
function add_lsp(server, options)
if not options["cmd"] then
options["cmd"] = server["document_config"]["default_config"]["cmd"]
end
if not options["capabilities"] then
options["capabilities"] = require("cmp_nvim_lsp").default_capabilities()
end
if vim.fn.executable(options["cmd"][1]) == 1 then
server.setup(options)
end
end
-- Add LSPs with lsp-format attached
add_lsp(lspconfig.lua_ls, {})
add_lsp(lspconfig.nixd, {
settings = {
nixd = {
formatting = {
command = { "alejandra" },
},
},
},
})
-- Other LSPs
add_lsp(lspconfig.bashls, {})
add_lsp(lspconfig.clangd, {})
add_lsp(lspconfig.dartls, {})
add_lsp(lspconfig.dockerls, {})
add_lsp(lspconfig.gopls, {})
add_lsp(lspconfig.hls, {})
add_lsp(lspconfig.jdtls, {})
add_lsp(lspconfig.kotlin_language_server, {})
add_lsp(lspconfig.phpactor, { init_options = { ["language_server_php_cs_fixer.enabled"] = true } })
add_lsp(lspconfig.rust_analyzer, {})
add_lsp(lspconfig.pylsp, {})
add_lsp(lspconfig.solargraph, {})
add_lsp(lspconfig.terraformls, {})
add_lsp(lspconfig.texlab, { chktex = {
onEdit = true,
onOpenAndSave = true,
} })
add_lsp(lspconfig.tsserver, {})
add_lsp(lspconfig.typst_lsp, {})
add_lsp(lspconfig.elixirls, { cmd = { "elixir-ls" } })
'';
}
{
plugin = ltex_extra-nvim;
type = "lua";
config =
/*
lua
*/
''
local ltex_extra = require("ltex_extra")
add_lsp(lspconfig.ltex, {
on_attach = function(client, bufnr)
ltex_extra.setup({
path = vim.fn.expand("~") .. "/.local/state/ltex",
})
end,
})
'';
}
# Snippets
luasnip
# Completions
cmp-nvim-lsp
cmp_luasnip
cmp-rg
cmp-buffer
cmp-path
{
plugin = cmp-git;
type = "lua";
config =
/*
lua
*/
''
require("cmp_git").setup({})
'';
}
lspkind-nvim
{
plugin = nvim-cmp;
type = "lua";
config =
/*
lua
*/
''
local cmp = require("cmp")
cmp.setup({
formatting = {
format = require("lspkind").cmp_format({
before = function(entry, vim_item)
return vim_item
end,
}),
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({}),
sources = {
{ name = "otter" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "git" },
{ name = "buffer", option = { get_bufnrs = vim.api.nvim_list_bufs } },
{ name = "path" },
{ name = "rg" },
},
})
'';
}
];
}

View File

@@ -0,0 +1,38 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = alpha-nvim;
type = "lua";
config =
/*
lua
*/
''
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
}
dashboard.section.header.opts.hl = "Title"
dashboard.section.buttons.val = {
dashboard.button( "n", "󰈔 New file" , ":enew<CR>"),
dashboard.button( "e", " Explore", ":Explore<CR>"),
dashboard.button( "g", " Git summary", ":Git | :only<CR>"),
dashboard.button( "c", " Nix config flake" , ":e ~/.nix-config/flake.nix<CR>"),
}
alpha.setup(dashboard.opts)
vim.keymap.set("n", "<space>h", ":Alpha<CR>", { desc = "Open home dashboard" })
'';
}
];
}

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = bufferline-nvim;
type = "lua";
config =
/*
lua
*/
''
require('bufferline').setup{}
'';
}
];
}

View File

@@ -0,0 +1,22 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = comment-nvim;
type = "lua";
config =
/*
lua
*/
''
require('Comment').setup{
opleader = {
line = '<C-b>'
},
toggler = {
line = '<C-b>'
},
}
'';
}
];
}

View File

@@ -0,0 +1,41 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = conform-nvim;
type = "lua";
config =
/*
lua
*/
''
require("conform").setup({
formatters_by_ft = {
bash = { "shfmt" },
css = { "prettierd" },
html = { "prettierd" },
javascript = { "prettierd" },
json = { "fixjson" },
lua = { "stylua" },
nix = { "alejandra" },
php = { "php_cs_fixer" },
python = { "black" },
rust = { "rustfmt" },
sh = { "shfmt" },
typescript = { "prettierd" },
query = { "sql_formatter" },
yaml = { "prettierd" },
["*"] = { "injected" },
},
})
-- Optionally, set up a command or auto-command to format on save
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*",
callback = function(args)
require("conform").format({ bufnr = args.buf })
end,
})
'';
}
];
}

View File

@@ -0,0 +1,45 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = copilot-lua;
type = "lua";
config =
/*
lua
*/
''
require('copilot').setup({
panel = {
enabled = true,
auto_refresh = true,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>"
},
layout = {
position = "bottom", -- | top | left | right
ratio = 0.4
},
},
suggestion = {
enabled = true,
auto_trigger = true,
hide_during_completion = true,
debounce = 75,
keymap = {
accept = "<C-CR>",
accept_word = false,
accept_line = false,
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
},
})
'';
}
];
}

View File

@@ -0,0 +1,24 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
vim-illuminate
];
imports = [
./alpha-nvim.nix
./bufferline-nvim.nix
./comment-nvim.nix
./copilot-lua.nix
./fidget-nvim.nix
./gitsigns-nvim.nix
./treesitter.nix
./conform-nvim.nix
./gx-nvim.nix
./nvim-bqf.nix
./nvim-colorizer-lua.nix
./nvim-web-devicons.nix
./oil.nix
./lualine.nix
./range-highlight-nvim.nix
./vim-fugitive.nix
./which-key.nix
];
}

View File

@@ -0,0 +1,21 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = fidget-nvim;
type = "lua";
config =
/*
lua
*/
''
require('fidget').setup{
progress = {
display = {
progress_icon = { pattern = "dots", period = 1 },
},
},
}
'';
}
];
}

View File

@@ -0,0 +1,23 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = gitsigns-nvim;
type = "lua";
config =
/*
lua
*/
''
require('gitsigns').setup{
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
}
'';
}
];
}

View File

@@ -0,0 +1,28 @@
{pkgs, ...}: let
gx-nvim = pkgs.vimUtils.buildVimPlugin {
name = "gx-nvim";
src = pkgs.fetchFromGitHub {
owner = "chrishrb";
repo = "gx.nvim";
rev = "f29a87454b02880e0d76264c21be8316224a7395";
hash = "sha256-QWJ/cPvSyMTJoWLg51BNFf9+/9i7G+nzennpHP/eQ4g=";
};
};
in {
programs.neovim.plugins = [
{
plugin = gx-nvim;
type = "lua";
config =
/*
lua
*/
''
require('gx').setup{}
vim.keymap.set({"n", "x"}, "gx", ":Browse<CR>", {
desc = "Open the file under cursor with system app"
})
'';
}
];
}

View File

@@ -0,0 +1,54 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = lualine-nvim;
type = "lua";
config =
/*
lua
*/
''
require('lualine').setup{
options = {
icons_enabled = true,
theme = 'gruvbox-material',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
'';
}
];
}

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-bqf;
type = "lua";
config =
/*
lua
*/
''
require('bqf').setup{}
'';
}
];
}

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-colorizer-lua;
type = "lua";
config =
/*
lua
*/
''
require('colorizer').setup{}
'';
}
];
}

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-web-devicons;
type = "lua";
config =
/*
lua
*/
''
require('nvim-web-devicons').setup{}
'';
}
];
}

View File

@@ -0,0 +1,35 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = oil-nvim;
type = "lua";
config =
/*
lua
*/
''
require('oil').setup{
buf_options = {
buflisted = true,
bufhidden = "delete",
},
cleanup_delay_ms = false,
use_default_keymaps = false,
keymaps = {
["<CR>"] = "actions.select",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gc"] = "actions.close",
["gr"] = "actions.refresh",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
["g\\"] = "actions.toggle_trash",
},
}
'';
}
];
}

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = range-highlight-nvim;
type = "lua";
config =
/*
lua
*/
''
require('range-highlight').setup{}
'';
}
];
}

View File

@@ -0,0 +1,25 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-treesitter.withAllGrammars;
type = "lua";
config =
/*
lua
*/
''
require("nvim-treesitter.configs").setup({
-- ensure_installed = { "nix", "lua" },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
disable = function(lang, bufnr)
return vim.fn.getfsize(vim.api.nvim_buf_get_name(bufnr)) > 1048576
end,
},
parser_install_dir = vim.fn.stdpath("data") .. "/parsers",
})
'';
}
];
}

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = vim-fugitive;
type = "viml";
config =
/*
vim
*/
''
nmap <space>G :Git<CR>
'';
}
];
}

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = which-key-nvim;
type = "lua";
config =
/*
lua
*/
''
require('which-key').setup{}
'';
}
];
}

View File

@@ -0,0 +1,54 @@
{
pkgs,
config,
lib,
...
}: {
programs.neovim = {
extraConfig =
lib.mkAfter # vim
''
function! SetCustomKeywords()
syn match Todo /TODO/
syn match Done /DONE/
syn match Start /START/
syn match End /END/
endfunction
autocmd Syntax * call SetCustomKeywords()
'';
plugins = with pkgs.vimPlugins; [
rust-vim
dart-vim-plugin
plantuml-syntax
vim-markdown
vim-nix
vim-toml
kotlin-vim
haskell-vim
pgsql-vim
vim-terraform
vim-jsx-typescript
vim-caddyfile
{
plugin = vimtex;
config = let
viewMethod =
if config.programs.zathura.enable
then "zathura"
else "general";
in
/*
vim
*/
''
let g:vimtex_view_method = '${viewMethod}'
"Don't open automatically
let g:vimtex_quickfix_mode = 0
'';
}
];
};
}

View File

@@ -1,44 +1,51 @@
{
pkgs,
inputs,
config,
lib,
...
}: let
enable_wayland = "true";
# weztermPkg = pkgs.wezterm;
weztermFlake = inputs.wezterm.packages.${pkgs.system}.default;
weztermPkg = pkgs.wezterm;
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.terminal.wezterm;
in {
programs.wezterm = {
enable = true;
package = weztermFlake;
extraConfig = ''
local wezterm = require 'wezterm';
options = {
modules.terminal.wezterm.enable = mkEnableOption "Enables wezterm terminal";
};
config = mkIf cfg.enable {
programs.wezterm = {
enable = true;
package = weztermPkg;
extraConfig = ''
local wezterm = require 'wezterm';
local config = {
-- font = wezterm.font("Input Mono Compressed"),
font_size = 12,
check_for_updates = false,
color_scheme = 'Gruvbox Material (Gogh)',
default_cursor_style = 'SteadyBar',
enable_scroll_bar = true,
hide_tab_bar_if_only_one_tab = true,
scrollback_lines = 10000,
window_background_opacity = 0.9,
}
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
config.default_prog = { "powershell.exe" }
else
config.enable_wayland = ${enable_wayland}
-- config.window_decorations = "TITLE"
config.window_close_confirmation = "NeverPrompt"
-- config.freetype_load_target = "Light"
-- config.freetype_render_target = "HorizontalLcd"
local f = wezterm.font_with_fallback({
{family="Input Mono Compressed", weight="Light"},
{family="Input Sans Narrow", weight="Light"},
})
config.font = f;
end
return config
'';
local config = {
-- font = wezterm.font("Input Mono Compressed"),
font_size = 12,
check_for_updates = false,
color_scheme = 'Gruvbox Material (Gogh)',
default_cursor_style = 'SteadyBar',
enable_scroll_bar = true,
hide_tab_bar_if_only_one_tab = true,
scrollback_lines = 10000,
window_background_opacity = 0.9,
}
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
config.default_prog = { "powershell.exe" }
else
config.enable_wayland = ${enable_wayland}
-- config.window_decorations = "TITLE"
config.window_close_confirmation = "NeverPrompt"
-- config.freetype_load_target = "Light"
-- config.freetype_render_target = "HorizontalLcd"
local f = wezterm.font_with_fallback({
{family="Input Mono Compressed", weight="Light"},
{family="Input Sans Narrow", weight="Light"},
})
config.font = f;
end
return config
'';
};
};
}

View File

@@ -0,0 +1,61 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.utils.zathura;
in {
options = {
modules.utils.zathura.enable = mkEnableOption "Enables zathura";
};
config = mkIf cfg.enable {
programs.zathura = {
enable = true;
options = {
selection-clipboard = "clipboard";
notification-error-bg = "rgba(40,40,40,1)";
notification-error-fg = "rgba(251,73,52,1)";
notification-warning-bg = "rgba(40,40,40,1)";
notification-warning-fg = "rgba(250,189,47,1)";
notification-bg = "rgba(40,40,40,1)";
notification-fg = "rgba(184,187,38,1)";
completion-bg = "rgba(80,73,69,1)";
completion-fg = "rgba(235,219,178,1)";
completion-group-bg = "rgba(60,56,54,1)";
completion-group-fg = "rgba(146,131,116,1)";
completion-highlight-bg = "rgba(131,165,152,1)";
completion-highlight-fg = "rgba(80,73,69,1)";
index-bg = "rgba(80,73,69,1)";
index-fg = "rgba(235,219,178,1)";
index-active-bg = "rgba(131,165,152,1)";
index-active-fg = "rgba(80,73,69,1)";
inputbar-bg = "rgba(40,40,40,1)";
inputbar-fg = "rgba(235,219,178,1)";
statusbar-bg = "rgba(80,73,69,1)";
statusbar-fg = "rgba(235,219,178,1)";
highlight-color = "rgba(250,189,47,0.5)";
highlight-active-color = "rgba(254,128,25,0.5)";
default-bg = "rgba(40,40,40,1)";
default-fg = "rgba(235,219,178,1)";
render-loading = true;
render-loading-bg = "rgba(40,40,40,1)";
render-loading-fg = "rgba(235,219,178,1)";
recolor-lightcolor = "rgba(40,40,40,1)";
recolor-darkcolor = "rgba(235,219,178,1)";
recolor = true;
recolor-keephue = true;
};
};
xdg.mimeApps.defaultApplications = {
"application/pdf" = "org.pwmt.zathura.desktop";
};
};
}

View File

@@ -1,10 +1,15 @@
{
config,
lib,
pkgs,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.wm.utils.hypridle;
hypridleFlake = inputs.hypridle.packages.${pkgs.system}.hypridle;
# hypridlePkg = pkgs.hypridle;
in {
options = {
modules.wm.utils.hypridle.enable = mkEnableOption "Enables hypridle";
@@ -12,6 +17,7 @@ in {
config = mkIf cfg.enable {
services.hypridle = {
enable = true;
package = hypridleFlake;
settings = {
general = {
lock_cmd = "hyprlock";

View File

@@ -7,6 +7,9 @@
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.wm.utils.hyprlock;
hyprlockFlake = inputs.hyprlock.packages.${pkgs.system}.hyprlock;
# hyprlockPkg = pkgs.hyprlock;
in {
options = {
modules.wm.utils.hyprlock.enable = mkEnableOption "Enables hyprlock";
@@ -14,8 +17,8 @@ in {
config = mkIf cfg.enable {
programs.hyprlock = {
enable = true;
package = inputs.hyprlock.packages.${pkgs.system}.hyprlock;
settings = {
package = hyprlockFlake;
settings = {
general = {
disable_loading_bar = true;
hide_cursor = true;

View File

@@ -1,10 +1,15 @@
{
config,
lib,
pkgs,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.wm.utils.hyprpaper;
hyprpaperFlake = inputs.hyprpaper.packages.${pkgs.system}.default;
# hyprpaperPkg = pkgs.hyprpaper;
in {
options = {
modules.wm.utils.hyprpaper.enable = mkEnableOption "Enables hyprpaper";
@@ -12,6 +17,7 @@ in {
config = mkIf cfg.enable {
services.hyprpaper = {
enable = true;
package = hyprpaperFlake;
settings = {
ipc = "on";
splash = false;

View File

@@ -14,73 +14,8 @@
};
};
devtools = {
nixvim = {
neovim = {
enable = true;
plugins = {
barbar = {
enable = false;
};
comment = {
enable = true;
};
conform = {
enable = false;
};
cmp = {
enable = true;
};
copilot = {
enable = false;
};
efm = {
enable = true;
};
floaterm = {
enable = false;
};
harpoon = {
enable = false;
};
lsp = {
enable = true;
};
lightline = {
enable = false;
};
lualine = {
enable = true;
};
markdown-preview = {
enable = true;
};
neo-tree = {
enable = true;
};
none-ls = {
enable = false;
};
rustaceanvim = {
enable = true;
};
startify = {
enable = true;
};
tagbar = {
enable = false;
};
telescope = {
enable = true;
};
treesitter = {
enable = true;
};
vimtex = {
enable = false;
};
yanky = {
enable = false;
};
};
};
vscode = {
enable = false;

View File

@@ -14,73 +14,8 @@
};
};
devtools = {
nixvim = {
neovim = {
enable = true;
plugins = {
barbar = {
enable = false;
};
comment = {
enable = true;
};
conform = {
enable = false;
};
cmp = {
enable = true;
};
copilot = {
enable = true;
};
efm = {
enable = true;
};
floaterm = {
enable = false;
};
harpoon = {
enable = false;
};
lsp = {
enable = true;
};
lightline = {
enable = false;
};
lualine = {
enable = true;
};
markdown-preview = {
enable = true;
};
neo-tree = {
enable = true;
};
none-ls = {
enable = false;
};
rustaceanvim = {
enable = true;
};
startify = {
enable = true;
};
tagbar = {
enable = false;
};
telescope = {
enable = true;
};
treesitter = {
enable = true;
};
vimtex = {
enable = false;
};
yanky = {
enable = false;
};
};
};
vscode = {
enable = false;
@@ -104,6 +39,9 @@
kitty = {
enable = true;
};
wezterm = {
enable = false;
};
zellij = {
enable = false;
};
@@ -135,6 +73,9 @@
yazi = {
enable = true;
};
zathura = {
enable = true;
};
misc = {
enable = true;
};

View File

@@ -14,73 +14,8 @@
};
};
devtools = {
nixvim = {
neovim = {
enable = true;
plugins = {
barbar = {
enable = false;
};
comment = {
enable = true;
};
conform = {
enable = false;
};
cmp = {
enable = true;
};
copilot = {
enable = false;
};
efm = {
enable = true;
};
floaterm = {
enable = false;
};
harpoon = {
enable = false;
};
lsp = {
enable = true;
};
lightline = {
enable = false;
};
lualine = {
enable = true;
};
markdown-preview = {
enable = true;
};
neo-tree = {
enable = true;
};
none-ls = {
enable = false;
};
rustaceanvim = {
enable = true;
};
startify = {
enable = true;
};
tagbar = {
enable = false;
};
telescope = {
enable = true;
};
treesitter = {
enable = true;
};
vimtex = {
enable = false;
};
yanky = {
enable = false;
};
};
};
vscode = {
enable = true;