Compare commits

...

7 commits

Author SHA1 Message Date
bbe8d280c1
Tweak some firefox settings 2023-12-28 18:24:36 +01:00
0b7e8328f5
Add new global variable 2023-12-28 18:24:23 +01:00
cdc88dd4ee
Set default font 2023-12-28 18:23:56 +01:00
56af3a2118
Clean up fish config
add nh alias "nrs" for easy system rebuild
remove custom tide prompt colors (they looked ugly)
remove vim abbreviations
2023-12-28 18:23:28 +01:00
03d2ee2836
Add nvim system defaults
nvim is now default editor
2023-12-28 18:22:05 +01:00
4873555459
CLI tool tweaks
exchange pfetch with neofetch
add tldr command
2023-12-28 18:21:32 +01:00
1259f0a032
Add custom nvim configuration 2023-12-28 18:15:39 +01:00
21 changed files with 541 additions and 71 deletions

View file

@ -5,7 +5,6 @@
./fish.nix
./git.nix
./gpg.nix
./pfetch.nix
./btop.nix
./nix-index.nix
./lazygit.nix
@ -23,6 +22,8 @@
jq # JSON pretty printer and manipulator
timer # To help with my ADHD paralysis
lazydocker # Docker TUI
neofetch
tldr # nice & short manual snippets
nvd # Differ
nix-output-monitor

View file

@ -8,7 +8,6 @@
hasPackage = pname: lib.any (p: p ? pname && p.pname == pname) config.home.packages;
hasRipgrep = hasPackage "ripgrep";
hasExa = hasPackage "eza";
hasNeovim = config.programs.neovim.enable;
hasLazygit = config.programs.lazygit.enable;
hasLazydocker = hasPackage "lazydocker";
hasNixYourShell = hasPackage "nix-your-shell";
@ -53,6 +52,7 @@ in {
hx = "~/Documents/heliox-cli/target/debug/heliox-cli --mode";
slp = "systemctl suspend";
sdn = "shutdown 0";
nrs = "nh os switch ~/.setup";
};
shellAbbrs = rec {
jqless = "jq -C | less -r";
@ -65,41 +65,14 @@ in {
nbn = "nix build nixpkgs#";
nf = "nix flake";
nr = "nixos-rebuild --flake .";
nrs = "nixos-rebuild --flake . switch";
snr = "sudo nixos-rebuild --flake .";
snrs = "sudo nixos-rebuild --flake . switch";
hm = "home-manager --flake .";
hms = "home-manager --flake . switch";
ls = mkIf hasExa "eza";
exa = mkIf hasExa "eza";
vim = mkIf hasNeovim "nvim";
vi = vim;
v = vim;
};
functions = {
# Disable greeting
fish_greeting = "";
fish_init_custom = ''
#Variable names: https://github.com/IlanCosman/tide/blob/main/functions/tide/configure/configs/rainbow.fish
#Tide base
tide configure --auto --style=Rainbow --prompt_colors='True color' --show_time=No --rainbow_prompt_separators=Vertical --powerline_prompt_heads=Slanted --powerline_prompt_tails=Flat --powerline_prompt_style='Two lines, frame' --prompt_connection=Solid --powerline_right_prompt_frame=No --prompt_connection_andor_frame_color=Darkest --prompt_spacing=Compact --icons='Many icons' --transient=Yes
#OS module
set tide_os_bg_color ${config.colorScheme.colors.base07}
#PWD module
set tide_pwd_bg_color ${config.colorScheme.colors.base0D}
set tide_pwd_color_dirs ${config.colorScheme.colors.base02}
set tide_pwd_color_truncated_dirs ${config.colorScheme.colors.base04}
set tide_pwd_color_anchors ${config.colorScheme.colors.base02}
#Git module
set tide_git_bg_color ${config.colorScheme.colors.base0B}
set tide_git_bg_color_unstable ${config.colorScheme.colors.base0A}
set tide_git_bg_color_urgent ${config.colorScheme.colors.base08}
'';
};
};

View file

@ -1,6 +0,0 @@
{pkgs, ...}: {
home = {
packages = with pkgs; [pfetch];
sessionVariables.PF_INFO = "ascii title os kernel uptime shell term desktop scheme palette";
};
}

View file

@ -1,6 +1,6 @@
{pkgs, ...}: {
imports = [
./nvim.nix
./nvim
./vscode.nix
./intellij.nix
];

View file

@ -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
];
};
}

View file

@ -0,0 +1,186 @@
{
config,
lib,
pkgs,
# vars,
...
}: let
vars = import ../../../../vars.nix;
colors = config.colorScheme.colors;
in {
home.sessionVariables.EDITOR = "nvim";
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";
}
];
};
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,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"

View 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)

View 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" },
},
})

View 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,
})

View file

@ -0,0 +1,10 @@
local lualine = require("lualine")
local config = {
options = {
theme = "base16",
globalstatus = true,
},
}
lualine.setup(config)

View 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, {})

View file

@ -0,0 +1 @@

View 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, {})

View 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.
},
})

View file

@ -0,0 +1,9 @@
require("nvim-treesitter.configs").setup({
ensure_installed = {},
auto_install = false,
highlight = { enable = true },
indent = { enable = true },
})

View file

@ -12,6 +12,20 @@
y = 5;
};
};
font = {
normal = {
family = "${config.fontProfiles.monospace.family}";
style = "Medium";
};
bold = {
family = "${config.fontProfiles.monospace.family}";
style = "Bold";
};
italic = {
family = "${config.fontProfiles.monospace.family}";
style = "MediumItalic";
};
};
colors = with config.colorScheme.colors; {
bright = {
black = "0x${base00}";

View file

@ -2,6 +2,7 @@
imports = [
./firefox.nix
./alacritty.nix
./font.nix
./playerctl.nix
];
}

View file

@ -18,6 +18,8 @@
bitwarden
ublock-origin
darkreader
tabliss
consent-o-matic
];
search.engines = {
@ -117,10 +119,56 @@
"dom.security.https_only_mode" = true;
"browser.download.panel.shown" = true;
"signon.rememberSignons" = false;
"browser.formfill.enable" = false;
"signon. prefillForms" = false;
"browser.shell.checkDefaultBrowser" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.uiCustomization.state" = ''{"placements":{"widget-overflow-fixed-list":[],"unified-extensions-area":["addon_darkreader_org-browser-action","plasma-browser-integration_kde_org-browser-action","_506e023c-7f2b-40a3-8066-bc5deb40aebe_-browser-action","_testpilot-containers-browser-action","7esoorv3_alefvanoon_anonaddy_me-browser-action","_a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7_-browser-action","gdpr_cavi_au_dk-browser-action","firefoxcolor_mozilla_com-browser-action","firefox-translations-addon_mozilla_org-browser-action"],"nav-bar":["back-button","forward-button","stop-reload-button","urlbar-container","downloads-button","unified-extensions-button","ublock0_raymondhill_net-browser-action","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action"],"toolbar-menubar":["menubar-items"],"TabsToolbar":["tabbrowser-tabs","new-tab-button","alltabs-button"],"PersonalToolbar":["personal-bookmarks"]},"seen":["save-to-pocket-button","developer-button","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action","addon_darkreader_org-browser-action","ublock0_raymondhill_net-browser-action","plasma-browser-integration_kde_org-browser-action","_506e023c-7f2b-40a3-8066-bc5deb40aebe_-browser-action","_testpilot-containers-browser-action","7esoorv3_alefvanoon_anonaddy_me-browser-action","_a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7_-browser-action","gdpr_cavi_au_dk-browser-action","firefoxcolor_mozilla_com-browser-action","firefox-translations-addon_mozilla_org-browser-action"],"dirtyAreaCache":["nav-bar","PersonalToolbar","toolbar-menubar","TabsToolbar","unified-extensions-area"],"currentVersion":20,"newElementCount":4}'';
};
arkenfox = {
enable = true;
"0000".enable = true;
"0000".enable = true;
"0100" = {
enable = true;
# Allow setting homepage
"0102"."browser.startup.page".value = 1;
};
"0200" = {
enable = true;
};
"0300".enable = true;
# We keep safebrowsing
"0400".enable = false;
"0600" = {
enable = true;
"0610"."browser.send_pings".enable = true;
};
"0700" = {
enable = true;
# Disable DNS over HTTPS
"0710"."network.trr.mode".value = 5;
};
# "0800" = {
# enable = true;
# # Keep using url bar as search bar
# "0801"."keyword.enabled".value = true;
# };
"0900".enable = true;
"1000" = {
enable = true;
# Enable disk cache for performance reasons
"1001"."browser.cache.disk.enable".enable = true;
"1001"."browser.cache.disk.enable".value = true;
};
"1200".enable = true;
# I don't use container tabs
"1700".enable = false;
"2600" = {
enable = true;
# The recent documents feature is useful
"2653".enable = false;
};
"2700".enable = true;
};
};
};

View file

@ -0,0 +1,13 @@
{pkgs, ...}: {
fontProfiles = {
enable = true;
monospace = {
family = "JetBrains Mono Nerd Font";
package = pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];};
};
regular = {
family = "Fira Sans";
package = pkgs.fira;
};
};
}

View file

@ -1,5 +1,6 @@
{
# Global variables used in NixOS and HomeManager which will probably never change
user = "ghoscht";
dir_name = ".setup";
location = "$HOME/.setup";
}