module resyntaxing

This commit is contained in:
cnst
2024-08-31 20:24:08 +02:00
parent b721c5cc25
commit 1beecf1d99
34 changed files with 1567 additions and 438 deletions

View File

@@ -3,6 +3,7 @@
"${userModules}/browsers/chromium"
"${userModules}/browsers/firefox"
"${userModules}/comm/discord"
#"${userModules}/devtools/neovim"
"${userModules}/devtools/nixvim"
"${userModules}/devtools/vscode"
"${userModules}/gaming/lutris"

View File

@@ -0,0 +1,61 @@
-- 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

@@ -0,0 +1,39 @@
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

@@ -0,0 +1,73 @@
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

@@ -0,0 +1,20 @@
-- 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

@@ -0,0 +1,14 @@
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

@@ -0,0 +1,25 @@
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

@@ -0,0 +1,39 @@
-- 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

@@ -0,0 +1,52 @@
-- 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

@@ -0,0 +1,81 @@
{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.devtools.neovim;
in {
options = {
modules.devtools.neovim.enable = mkEnableOption "Enables neovim";
};
config = mkIf cfg.enable {
programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
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
];
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}

'';
};
};
}

View File

@@ -1,51 +1,148 @@
{
programs.nixvim = {
opts.completeopt = ["menu" "menuone" "noselect"];
plugins = {
luasnip.enable = true;
lspkind = {
enable = true;
cmp = {
enable = true;
menu = {
nvim_lsp = "[LSP]";
nvim_lua = "[api]";
path = "[path]";
luasnip = "[snip]";
buffer = "[buffer]";
};
};
};
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";
mapping = {
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.close()";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<CR>" = "cmp.mapping.confirm({ select = true })";
};
experimental = {ghost_text = true;};
snippet.expand = ''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
sources = [
{name = "path";}
{name = "nvim_lsp";}
{name = "luasnip";}
{
name = "buffer";
# Words from other open buffers can also be suggested.
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
}
{name = "nvim_lua";}
{name = "path";}
{name = "copilot";}
];
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,CursorLine:CmpSel,Search:PmenuSel";
scrollbar = false;
sidePadding = 0;
border = ["" "" "" "" "" "" "" ""];
};
settings.documentation = {
border = ["" "" "" "" "" "" "" ""];
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
};
};
mapping = {
"<C-l>" = "cmp.mapping.select_prev_item()";
"<C-ä>" = "cmp.mapping.select_next_item()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<S-Tab>" = "cmp.mapping.close()";
"<Tab>" =
# lua
''
function(fallback)
local line = vim.api.nvim_get_current_line()
if line:match("^%s*$") then
fallback()
elseif cmp.visible() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })
else
fallback()
end
end
'';
"<Down>" =
# lua
''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end
'';
"<Up>" =
# lua
''
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end
'';
};
};
};
};

View File

@@ -12,7 +12,6 @@ in {
inputs.nixvim.homeManagerModules.nixvim
./plugins
./autocmd.nix
./completion.nix
./keymap.nix
./options.nix
./todo.nix
@@ -24,7 +23,7 @@ in {
config = mkIf cfg.enable {
programs.nixvim = {
extraPlugins = [pkgs.vimPlugins.gruvbox-material];
extraPlugins = with pkgs.vimPlugins; [gruvbox-material-nvim nvim-web-devicons];
colorscheme = "gruvbox-material";
enable = true;
defaultEditor = true;
@@ -32,13 +31,8 @@ in {
vimAlias = true;
luaLoader.enable = true;
plugins = {
gitsigns = {
enable = true;
settings.signs = {
add.text = "+";
change.text = "~";
};
};
gitsigns.enable = true;
statuscol.enable = true;
nvim-autopairs.enable = true;
nvim-colorizer = {
enable = true;

View File

@@ -0,0 +1,163 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.modules.devtools.nixvim.plugins.cmp;
in {
options = {
modules.devtools.nixvim.plugins.cmp.enable = mkEnableOption "Enables completion plugin for nixvim";
};
config = mkIf cfg.enable {
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 = {
experimental = {ghost_text = true;};
snippet.expand = ''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
sources = [
{name = "nvim_lsp";}
{name = "luasnip";}
{
name = "buffer";
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
}
{name = "nvim_lua";}
{name = "path";}
{name = "copilot";}
];
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,CursorLine:CmpSel,Search:PmenuSel";
scrollbar = false;
sidePadding = 0;
border = ["" "" "" "" "" "" "" ""];
};
settings.documentation = {
border = ["" "" "" "" "" "" "" ""];
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
};
};
mapping = {
"<C-l>" = "cmp.mapping.select_prev_item()";
"<C-ä>" = "cmp.mapping.select_next_item()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<S-Tab>" = "cmp.mapping.close()";
"<Tab>" =
# lua
''
function(fallback)
local line = vim.api.nvim_get_current_line()
if line:match("^%s*$") then
fallback()
elseif cmp.visible() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })
else
fallback()
end
end
'';
"<Down>" =
# lua
''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end
'';
"<Up>" =
# lua
''
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end
'';
};
};
};
};
};
};
}

View File

@@ -1,35 +1,44 @@
{
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.modules.devtools.nixvim.plugins.conform-nvim;
cfg = config.modules.devtools.nixvim.plugins.conform;
in {
options = {
modules.devtools.nixvim.plugins.conform-nvim.enable = mkEnableOption "Enables Conform plugin for nixvim";
modules.devtools.nixvim.plugins.conform.enable = mkEnableOption "Enables Conform plugin for nixvim";
};
config = mkIf cfg.enable {
programs.nixvim.plugins.conform-nvim = {
programs.nixvim.plugins.conform = {
enable = true;
settings = {
notify_on_error = true;
formatters_by_ft = {
liquidsoap = ["liquidsoap-prettier"];
html = [["prettierd" "prettier"]];
css = [["prettierd" "prettier"]];
javascript = [["prettierd" "prettier"]];
javascriptreact = [["prettierd" "prettier"]];
typescript = [["prettierd" "prettier"]];
typescriptreact = [["prettierd" "prettier"]];
html = ["prettierd" "prettier"];
css = ["prettierd" "prettier"];
javascript = ["prettierd" "prettier"];
javascriptreact = ["prettierd" "prettier"];
typescript = ["prettierd" "prettier"];
typescriptreact = ["prettierd" "prettier"];
python = ["black"];
lua = ["stylua"];
nix = ["alejandra"];
markdown = [["prettierd" "prettier"]];
yaml = ["yamllint" "yamlfmt"];
markdown = ["prettierd" "prettier"];
yaml = ["yamlfmt"];
rust = ["rustfmt"];
xml = ["xmllint"];
php = ["php-cs-fixer"];
};
stop_after_first = true;
};
};
home.packages = with pkgs; [
prettierd
yamlfmt
libxml2Python
];
};
}

View File

@@ -19,11 +19,11 @@ in {
copilot-lua = {
enable = true;
suggestion = {
enabled = true;
enabled = false;
autoTrigger = true;
keymap.accept = "<C-CR>";
};
panel.enabled = true;
panel.enabled = false;
};
};
keymaps = [

View File

@@ -3,12 +3,14 @@
"${userModules}/devtools/nixvim/plugins/barbar.nix"
"${userModules}/devtools/nixvim/plugins/comment.nix"
"${userModules}/devtools/nixvim/plugins/conform.nix"
"${userModules}/devtools/nixvim/plugins/cmp.nix"
"${userModules}/devtools/nixvim/plugins/copilot.nix"
"${userModules}/devtools/nixvim/plugins/efm.nix"
"${userModules}/devtools/nixvim/plugins/floaterm.nix"
"${userModules}/devtools/nixvim/plugins/harpoon.nix"
"${userModules}/devtools/nixvim/plugins/lsp.nix"
"${userModules}/devtools/nixvim/plugins/lualine.nix"
"${userModules}/devtools/nixvim/plugins/lightline.nix"
"${userModules}/devtools/nixvim/plugins/markdown-preview.nix"
"${userModules}/devtools/nixvim/plugins/neo-tree.nix"
"${userModules}/devtools/nixvim/plugins/nonels.nix"

View File

@@ -67,6 +67,7 @@ in {
formatter = "black";
};
nix = {
formatter = "alejandra";
linter = "statix";
};
lua = {
@@ -86,12 +87,24 @@ in {
css = {
formatter = "prettier";
};
scss = {
formatter = "prettier";
};
ts = {
formatter = "prettier";
};
gitcommit = {
linter = "gitlint";
};
php = {
formatter = "php_cs_fixer";
};
rust = {
formatter = "rustfmt";
};
sql = {
formatter = "sql-formatter";
};
};
};
};

View File

@@ -0,0 +1,51 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.modules.devtools.nixvim.plugins.lightline;
in {
options = {
modules.devtools.nixvim.plugins.lightline.enable = mkEnableOption "Enables lightline plugin for nixvim";
};
config = mkIf cfg.enable {
programs.nixvim.plugins.lightline = {
enable = true;
settings = {
colorscheme = "apprentice";
active = {
right = [
[
"lineinfo"
]
[
"percent"
]
[
"fileformat"
"fileencoding"
"filetype"
]
];
};
component = {
charvaluehex = "0x%B";
lineinfo = "%3l:%-2v%<";
};
component_function = {
gitbranch = "FugitiveHead";
};
inactive = [];
mode_map = {
"<C-s>" = "SB";
"<C-v>" = "VB";
i = "I";
n = "N";
v = "V";
};
};
};
};
}

View File

@@ -0,0 +1,32 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.modules.devtools.nixvim.plugins.lsp-format;
in {
options = {
modules.devtools.nixvim.plugins.lsp-format = {
enable = mkEnableOption "Enables LSP formatting support for nixvim";
};
};
config = mkIf cfg.enable {
programs.nixvim.plugins.lsp-format = {
enable = true;
lspServersToEnable = [
"rustfmt"
"prettier"
"prettierd"
"php-cs-fixer"
"alejandra"
"xmllint"
"black"
"yamlfmt"
"stylua"
];
};
};
}

View File

@@ -13,54 +13,62 @@ in {
};
config = mkIf cfg.enable {
programs.nixvim.plugins.lsp = {
enable = true;
keymaps = {
silent = true;
diagnostic = {
"<leader>k" = "goto_prev";
"<leader>j" = "goto_next";
};
lspBuf = {
gd = "definition";
gD = "references";
gt = "type_definition";
gi = "implementation";
K = "hover";
"<F2>" = "rename";
};
programs.nixvim.plugins = {
lsp-format = {
enable = true;
lspServersToEnable = [
"rust-analyzer"
];
};
lsp = {
enable = true;
servers = {
# Average webdev LSPs
cssls.enable = true; # CSS
tailwindcss.enable = true; # TailwindCSS
html.enable = true; # HTML
astro.enable = true; # AstroJS
phpactor.enable = true; # PHP
svelte.enable = false; # Svelte
vuels.enable = false; # Vue
pyright.enable = true;
marksman.enable = true;
nixd.enable = true;
dockerls.enable = true;
bashls.enable = true;
clangd.enable = true;
csharp-ls.enable = true;
yamlls.enable = true;
lua-ls = {
enable = true;
settings = {
telemetry.enable = false;
diagnostics = {
globals = ["vim"];
};
keymaps = {
silent = true;
diagnostic = {
"<leader>k" = "goto_prev";
"<leader>j" = "goto_next";
};
lspBuf = {
gd = "definition";
gD = "references";
gt = "type_definition";
gi = "implementation";
K = "hover";
"<F2>" = "rename";
};
};
tsserver = {
enable = false; # TS/JS
servers = {
# Average webdev LSPs
cssls.enable = true; # CSS
tailwindcss.enable = true; # TailwindCSS
html.enable = true; # HTML
astro.enable = true; # AstroJS
phpactor.enable = true; # PHP
svelte.enable = false; # Svelte
vuels.enable = false; # Vue
pyright.enable = true;
marksman.enable = true;
nixd.enable = true;
dockerls.enable = true;
bashls.enable = true;
clangd.enable = true;
csharp-ls.enable = true;
yamlls.enable = true;
lua-ls = {
enable = true;
settings = {
telemetry.enable = false;
diagnostics = {
globals = ["vim"];
};
};
};
tsserver = {
enable = false; # TS/JS
};
};
};
};

View File

@@ -31,22 +31,35 @@ in {
local msg = ""
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
local non_null_ls_clients = {}
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
if client.name ~= "null-ls" then
table.insert(non_null_ls_clients, client)
end
end
if #non_null_ls_clients > 0 then
for _, client in ipairs(non_null_ls_clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
else
for _, client in ipairs(clients) do
if client.name == "null-ls" then
return client.name
end
end
end
return msg
end
'';
icon = "";
color.fg = "#ffffff";
color.fg = "#A89984";
}
"encoding"
"fileformat"
"filetype"
];

View File

@@ -7,7 +7,7 @@
cfg = config.modules.devtools.nixvim.plugins.neo-tree;
in {
options = {
modules.devtools.nixvim.plugins.neo-tree.enable = mkEnableOption "Enables nix-tree plugin for nixvim";
modules.devtools.nixvim.plugins.neo-tree.enable = mkEnableOption "Enables neo-tree plugin for nixvim";
};
config = mkIf cfg.enable {
@@ -18,7 +18,7 @@ in {
closeIfLastWindow = true;
window = {
width = 30;
autoExpandWidth = true;
# autoExpandWidth = true;
};
};
@@ -26,7 +26,7 @@ in {
{
mode = "n";
key = "<leader>n";
action = ":neotree action=focus reveal toggle<CR>";
action = ":Neotree focus toggle<CR>";
options.silent = true;
}
];

View File

@@ -32,12 +32,15 @@ in {
alejandra.enable = true;
stylua.enable = true;
shfmt.enable = true;
nixpkgs_fmt.enable = false;
google_java_format.enable = false;
prettier = {
enable = true;
disableTsServerFormatter = true;
};
prettierd.enable = true;
phpcsfixer.enable = true;
xmllint.enable = true;
yamlfmt.enable = true;
black = {
enable = true;
settings = ''

View File

@@ -1,6 +1,5 @@
{
lib,
pkgs,
config,
...
}:
@@ -13,8 +12,17 @@ in {
config = mkIf cfg.enable {
programs.nixvim = {
plugins = {
rustaceanvim.enable = true;
plugins.rustaceanvim = {
enable = true;
settings.server = {
default_settings.rust-analyzer = {
cargo.features = "all";
checkOnSave = true;
check.command = "clippy";
rustc.source = "discover";
};
};
};
};
};