structural-rework #1
13 changed files with 428 additions and 35 deletions
|
@ -1,6 +1,6 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./nvim.nix
|
||||
./nvim
|
||||
./vscode.nix
|
||||
./intellij.nix
|
||||
];
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
vars,
|
||||
...
|
||||
}: let
|
||||
in {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
home = {
|
||||
file.".config/nvim/lua/custom/" = {
|
||||
source = ../../../rsc/config/nvim;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
packages = with pkgs; [
|
||||
gcc
|
||||
black
|
||||
python310Packages.debugpy # is this working?
|
||||
mypy
|
||||
ruff
|
||||
nodePackages.pyright
|
||||
clang-tools_16
|
||||
rnix-lsp
|
||||
rust-analyzer
|
||||
nodePackages.eslint_d
|
||||
nodePackages.jsonlint
|
||||
alejandra
|
||||
];
|
||||
};
|
||||
}
|
154
home/features/coding/nvim/default.nix
Normal file
154
home/features/coding/nvim/default.nix
Normal file
|
@ -0,0 +1,154 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
# vars,
|
||||
...
|
||||
}: let
|
||||
vars = import ../../../../vars.nix;
|
||||
colors = config.colorScheme.colors;
|
||||
in {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
# LSP
|
||||
lua-language-server
|
||||
lua
|
||||
rnix-lsp # nix
|
||||
|
||||
# Formatters
|
||||
stylua # lua
|
||||
black # pyton
|
||||
alejandra # nix
|
||||
clang-tools_16 # c/c++
|
||||
|
||||
# Linters
|
||||
ruff # python
|
||||
nodePackages.jsonlint # json
|
||||
nodePackages.eslint_d # javascript
|
||||
|
||||
# Tools
|
||||
xclip
|
||||
wl-clipboard
|
||||
fzf
|
||||
gcc
|
||||
];
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = neodev-nvim;
|
||||
type = "lua";
|
||||
config = ''
|
||||
require("neodev").setup({
|
||||
override = function(root_dir, library)
|
||||
if root_dir:find("/home/${vars.user + "/" + vars.dir_name}", 1, true) == 1 then
|
||||
library.enabled = true
|
||||
library.plugins = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
config = builtins.readFile ./plugin/lsp.lua;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = comment-nvim;
|
||||
config = "require('Comment').setup()";
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
nvim-cmp
|
||||
{
|
||||
plugin = nvim-cmp;
|
||||
config = builtins.readFile ./plugin/cmp.lua;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = telescope-nvim;
|
||||
config = builtins.readFile ./plugin/telescope.lua;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
telescope-fzf-native-nvim
|
||||
telescope-ui-select-nvim
|
||||
|
||||
cmp_luasnip
|
||||
cmp-nvim-lsp
|
||||
|
||||
luasnip
|
||||
friendly-snippets
|
||||
|
||||
{
|
||||
plugin = nvim-treesitter.withAllGrammars;
|
||||
config = builtins.readFile ./plugin/treesitter.lua;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
vim-nix
|
||||
|
||||
{
|
||||
plugin = nvim-base16;
|
||||
config = ''
|
||||
require('base16-colorscheme').setup({
|
||||
base00 = '#${colors.base00}', base01 = '#${colors.base01}', base02 = '#${colors.base02}', base03 = '#${colors.base03}',
|
||||
base04 = '#${colors.base04}', base05 = '#${colors.base05}', base06 = '#${colors.base06}', base07 = '#${colors.base07}',
|
||||
base08 = '#${colors.base08}', base09 = '#${colors.base09}', base0A = '#${colors.base0A}', base0B = '#${colors.base0B}',
|
||||
base0C = '#${colors.base0C}', base0D = '#${colors.base0D}', base0E = '#${colors.base0E}', base0F = '#${colors.base0F}',
|
||||
})'';
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = lualine-nvim;
|
||||
config = builtins.readFile ./plugin/lualine.lua;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
nvim-web-devicons
|
||||
plenary-nvim
|
||||
nui-nvim
|
||||
{
|
||||
plugin = neo-tree-nvim;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = gitsigns-nvim;
|
||||
config = "require('gitsigns').setup()";
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
diffview-nvim
|
||||
lazygit-nvim
|
||||
|
||||
{
|
||||
plugin = todo-comments-nvim;
|
||||
config = builtins.readFile ./plugin/todo.lua;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = alpha-nvim;
|
||||
config = builtins.readFile ./plugin/alpha.lua;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = none-ls-nvim;
|
||||
config = builtins.readFile ./plugin/none-ls.lua;
|
||||
type = "lua";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
18
home/features/coding/nvim/options.lua
Normal file
18
home/features/coding/nvim/options.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
vim.o.signcolumn = "yes"
|
||||
|
||||
vim.o.tabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
|
||||
vim.o.updatetime = 300
|
||||
|
||||
vim.o.termguicolors = true
|
||||
|
||||
vim.o.mouse = "a"
|
32
home/features/coding/nvim/plugin/alpha.lua
Normal file
32
home/features/coding/nvim/plugin/alpha.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local dashboard = require("alpha.themes.dashboard")
|
||||
local function button(sc, txt, keybind, keybind_opts)
|
||||
local b = dashboard.button(sc, txt, keybind, keybind_opts)
|
||||
b.opts.hl = "Identifier"
|
||||
b.opts.hl_shortcut = "Identifier"
|
||||
return b
|
||||
end
|
||||
|
||||
dashboard.section.buttons.val = {
|
||||
button("r", " > Recent files", ":Telescope oldfiles<CR>"),
|
||||
button("n", " > New file", ":ene <BAR> startinsert <CR>"),
|
||||
button("f", " > Find files", ":Telescope find_files hidden=true<CR>"),
|
||||
button("u", " > Update plugins", ":PackerSync<CR>"),
|
||||
button("q", " > Quit Neovim", ":qa<CR>"),
|
||||
}
|
||||
dashboard.section.footer.val = require("alpha.fortune")
|
||||
dashboard.section.header.val = {
|
||||
[[ ███▄ █ ▓█████ ▒█████ ██▒ █▓ ██▓ ███▄ ▄███▓]],
|
||||
[[ ██ ▀█ █ ▓█ ▀ ▒██▒ ██▒▓██░ █▒▓██▒▓██▒▀█▀ ██▒]],
|
||||
[[▓██ ▀█ ██▒▒███ ▒██░ ██▒ ▓██ █▒░▒██▒▓██ ▓██░]],
|
||||
[[▓██▒ ▐▌██▒▒▓█ ▄ ▒██ ██░ ▒██ █░░░██░▒██ ▒██ ]],
|
||||
[[▒██░ ▓██░░▒████▒░ ████▓▒░ ▒▀█░ ░██░▒██▒ ░██▒]],
|
||||
[[░ ▒░ ▒ ▒ ░░ ▒░ ░░ ▒░▒░▒░ ░ ▐░ ░▓ ░ ▒░ ░ ░]],
|
||||
[[░ ░░ ░ ▒░ ░ ░ ░ ░ ▒ ▒░ ░ ░░ ▒ ░░ ░ ░]],
|
||||
[[ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ▒ ░░ ░ ]],
|
||||
[[ ░ ░ ░ ░ ░ ░ ░ ░ ]],
|
||||
[[ ░ ]],
|
||||
}
|
||||
|
||||
dashboard.section.header.opts.hl = "Function"
|
||||
dashboard.section.footer.opts.hl = "Function"
|
||||
require("alpha").setup(require("alpha.themes.dashboard").opts)
|
46
home/features/coding/nvim/plugin/cmp.lua
Normal file
46
home/features/coding/nvim/plugin/cmp.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
luasnip.config.setup({})
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete({}),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
})
|
45
home/features/coding/nvim/plugin/lsp.lua
Normal file
45
home/features/coding/nvim/plugin/lsp.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
local on_attach = function(_, bufnr)
|
||||
local bufmap = function(keys, func)
|
||||
vim.keymap.set("n", keys, func, { buffer = bufnr })
|
||||
end
|
||||
|
||||
bufmap("<leader>r", vim.lsp.buf.rename)
|
||||
bufmap("<leader>a", vim.lsp.buf.code_action)
|
||||
|
||||
bufmap("gd", vim.lsp.buf.definition)
|
||||
bufmap("gD", vim.lsp.buf.declaration)
|
||||
bufmap("gI", vim.lsp.buf.implementation)
|
||||
bufmap("<leader>D", vim.lsp.buf.type_definition)
|
||||
|
||||
bufmap("gr", require("telescope.builtin").lsp_references)
|
||||
bufmap("<leader>s", require("telescope.builtin").lsp_document_symbols)
|
||||
bufmap("<leader>S", require("telescope.builtin").lsp_dynamic_workspace_symbols)
|
||||
|
||||
bufmap("K", vim.lsp.buf.hover)
|
||||
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, {})
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||
|
||||
require("lspconfig").lua_ls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("lspconfig").rnix.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
10
home/features/coding/nvim/plugin/lualine.lua
Normal file
10
home/features/coding/nvim/plugin/lualine.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local lualine = require("lualine")
|
||||
|
||||
local config = {
|
||||
options = {
|
||||
theme = "base16",
|
||||
globalstatus = true,
|
||||
},
|
||||
}
|
||||
|
||||
lualine.setup(config)
|
37
home/features/coding/nvim/plugin/none-ls.lua
Normal file
37
home/features/coding/nvim/plugin/none-ls.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
local null_ls = require("null-ls")
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
local opts = {
|
||||
sources = {
|
||||
-- Lua
|
||||
null_ls.builtins.formatting.stylua,
|
||||
-- Python
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.diagnostics.ruff,
|
||||
-- Javascript
|
||||
null_ls.builtins.diagnostics.eslint_d,
|
||||
null_ls.builtins.diagnostics.jsonlint,
|
||||
-- C/C++
|
||||
null_ls.builtins.formatting.clang_format,
|
||||
-- Nix
|
||||
null_ls.builtins.formatting.alejandra,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
null_ls.setup(opts)
|
||||
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
|
1
home/features/coding/nvim/plugin/other.lua
Normal file
1
home/features/coding/nvim/plugin/other.lua
Normal file
|
@ -0,0 +1 @@
|
|||
|
20
home/features/coding/nvim/plugin/telescope.lua
Normal file
20
home/features/coding/nvim/plugin/telescope.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
require("telescope").setup({
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown({}),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("telescope").load_extension("fzf")
|
||||
require("telescope").load_extension("ui-select")
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<C-p>", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
|
55
home/features/coding/nvim/plugin/todo.lua
Normal file
55
home/features/coding/nvim/plugin/todo.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
require("todo-comments").setup({
|
||||
signs = true,
|
||||
sign_priority = 8,
|
||||
keywords = {
|
||||
FIX = {
|
||||
icon = " ", -- icon used for the sign, and in search results
|
||||
color = "error", -- can be a hex color, or a named color (see below)
|
||||
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||
-- signs = false, -- configure signs for some keywords individually
|
||||
},
|
||||
TODO = { icon = " ", color = "info" },
|
||||
HACK = { icon = " ", color = "warning" },
|
||||
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||
TEST = { icon = " ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||
},
|
||||
gui_style = {
|
||||
fg = "NONE", -- The gui style to use for the fg highlight group.
|
||||
bg = "BOLD", -- The gui style to use for the bg highlight group.
|
||||
},
|
||||
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||
highlight = {
|
||||
multiline = true, -- enable multine todo comments
|
||||
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
|
||||
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
|
||||
before = "", -- "fg" or "bg" or empty
|
||||
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
|
||||
after = "fg", -- "fg" or "bg" or empty
|
||||
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
|
||||
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||
max_line_len = 400, -- ignore lines longer than this
|
||||
exclude = {}, -- list of file types to exclude highlighting
|
||||
},
|
||||
colors = {
|
||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||
info = { "DiagnosticInfo", "#2563EB" },
|
||||
hint = { "DiagnosticHint", "#10B981" },
|
||||
default = { "Identifier", "#7C3AED" },
|
||||
test = { "Identifier", "#FF00FF" },
|
||||
},
|
||||
search = {
|
||||
command = "rg",
|
||||
args = {
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
},
|
||||
-- pattern = [[\b(KEYWORDS):]], -- ripgrep regex
|
||||
pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon.
|
||||
},
|
||||
})
|
9
home/features/coding/nvim/plugin/treesitter.lua
Normal file
9
home/features/coding/nvim/plugin/treesitter.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {},
|
||||
|
||||
auto_install = false,
|
||||
|
||||
highlight = { enable = true },
|
||||
|
||||
indent = { enable = true },
|
||||
})
|
Loading…
Reference in a new issue