fix alignment and add basic nvim config

This commit is contained in:
Noa Aarts 2024-02-28 12:39:47 +01:00
parent 3a71fb8ce2
commit 2bc79f165e
3 changed files with 293 additions and 164 deletions

18
flake.lock generated
View file

@ -155,17 +155,17 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1708976249,
"narHash": "sha256-bA0rrmxj5K1W/EWgzpk1NUvEIyAk1hqsmxcRCmmXFuw=",
"owner": "NixOS",
"lastModified": 1708984720,
"narHash": "sha256-gJctErLbXx4QZBBbGp78PxtOOzsDaQ+yw1ylNQBuSUY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d8e0944e6d2ce0f326040e654c07a410e2617d47",
"rev": "13aff9b34cc32e59d35c62ac9356e4a41198a538",
"type": "github"
},
"original": {
"owner": "NixOS",
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"rev": "d8e0944e6d2ce0f326040e654c07a410e2617d47",
"type": "github"
}
},
@ -181,11 +181,11 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1709054170,
"narHash": "sha256-er3hOsSa6nOiOYHpCUukLZcbaORSdifxpzAmMBLT1HM=",
"lastModified": 1709109026,
"narHash": "sha256-gW1UIlzNnk9F6M04GAqF9sctGAz0CZrGlIPy7IDqAQI=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "81f20bd2f5f53883d4fb386752196ea0a3ddd053",
"rev": "bb9d56087dda932274e25702ce32b725295d926d",
"type": "github"
},
"original": {

View file

@ -2,9 +2,9 @@
description = "Nixos config flake";
inputs = {
# nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/d8e0944e6d2ce0f326040e654c07a410e2617d47";
# nixpkgs.url = "github:NixOS/nixpkgs/d8e0944e6d2ce0f326040e654c07a410e2617d47";
home-manager = {
url = "github:nix-community/home-manager";

View file

@ -23,30 +23,31 @@
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = [
pkgs.file
pkgs.unzip
pkgs.zip
home.packages = with pkgs; [
file
unzip
zip
pkgs.dig
pkgs.mtr
dig
mtr
pkgs.firefox
(pkgs.writeShellScriptBin "spotify" ''
firefox
(writeShellScriptBin "spotify" ''
exec ${pkgs.spotify}/bin/spotify --enable-features=UseOzonePlatform --ozone-platform=wayland
'')
pkgs.hyprland
pkgs.dunst
pkgs.waybar
hyprland
dunst
waybar
wl-clipboard
(pkgs.writeShellScriptBin "discord" ''
(writeShellScriptBin "discord" ''
exec ${pkgs.discord}/bin/discord --enable-features=UseOzonePlatform --ozone-platform=wayland
'')
pkgs.kitty
pkgs.wofi
pkgs.pipewire
pkgs.lsd
kitty
wofi
pipewire
lsd
];
@ -96,7 +97,8 @@
enable=true;
shellAliases = {
ll = "lsd -l";
update = "sudo nixos-rebuild switch --flake /etc/nixos#default";
lt = "lsd -l --tree";
update = "sudo nixos-rebuild switch --flake $HOME/nixos#default";
};
history = {
path = "${config.xdg.dataHome}/zsh/history";
@ -197,68 +199,184 @@
};
# TODO move to seperate file
# TODO create neovim config
programs.nixvim = {
enable = true;
vimAlias = true;
globals = {
mapleader = " ";
maplocalleader = " ";
};
colorschemes.catppuccin.enable = true;
# Configure neovim options...
options = {
tabstop = 4;
shiftwidth = 4;
relativenumber = true;
incsearch = true;
hlsearch = true;
number = true;
mouse = "a";
showmode = false;
breakindent = true;
undofile = true;
ignorecase = true;
smartcase = true;
signcolumn = "yes";
updatetime = 250;
timeoutlen = 300;
splitright = true;
splitbelow = true;
list = true;
listchars = {
tab = "> ";
trail = ".";
nbsp = "_";
};
inccommand = "nosplit";
cursorline = true;
scrolloff = 8;
};
# ...mappings...
keymaps = [
{
mode = "n";
key = "<C-s>";
action = ":w<CR>";
key = "<Esc>";
action = "<cmd>nohlsearch<CR>";
options.desc = "Remove search highlights";
}
{
mode = "t";
key = "<Esc><Esc>";
action = "<C-\\><C-n>";
options.desc = "Exit terminal mode";
}
{
mode = "n";
key = "<esc>";
action = ":noh<CR>";
options.silent = true;
key = "<C-h>";
action = "<C-w><C-h>";
options.desc = "Move focus to the left window";
}
{
mode = "v";
key = ">";
action = ">gv";
mode = "n";
key = "<C-l>";
action = "<C-w><C-l>";
options.desc = "Move focus to the right window";
}
{
mode = "v";
key = "<";
action = "<gv";
mode = "n";
key = "<C-j>";
action = "<C-w><C-j>";
options.desc = "Move focus to the lower window";
}
{
mode = "n";
key = "<C-k>";
action = "<C-w><C-k>";
options.desc = "Move focus to the upper window";
}
{
mode = "n";
key = "<leader>pv";
lua = true;
action = "vim.cmd.Ex";
options.desc = "Open the integrated file explorer";
}
];
plugins = {
telescope.enable = true;
fugitive.enable = true;
comment-nvim.enable = true;
nvim-colorizer.enable = true;
telescope = {
enable = true;
keymaps = {
"<leader>sh" = {
action = "help_tags";
desc = "[S]earch [H]elp";
};
"<leader>sk" = {
action = "keymaps";
desc = "[S]earch [K]eymaps";
};
"<leader>sf" = {
action = "find_files";
desc = "[S]earch [F]iles";
};
"<leader>ss" = {
action = "builtin";
desc = "[S]earch [S]elect Telescope";
};
"<leader>sw" = {
action = "grep_string";
desc = "[S]earch current [W]ord";
};
"<leader>sg" = {
action = "live_grep";
desc = "[S]earch by [G]rep";
};
"<leader>sd" = {
action = "diagnostics";
desc = "[S]earch [D]iagnostics";
};
"<leader>sr" = {
action = "resume";
desc = "[S]earch [R]esume";
};
"<leader>s." = {
action = "oldfiles";
desc = "[S]earch recent files (\".\" for repeat)";
};
"<leader><leader>" = {
action = "buffers";
desc = "[ ] Find existing buffers";
};
};
};
treesitter = {
enable = true;
indent = true;
};
lsp = {
enable = true;
enabledServers = [
"lua_ls"
];
keymaps = {
silent = true;
diagnostic = {
"<leader>k" = "goto_prev";
"<leader>j" = "goto_next";
"[d" = {
action = "goto_prev";
desc = "Go to previous [D]iagnostic message";
};
lspBuf = {
gd = "definition";
K = "hover";
"]d" = {
action = "goto_next";
desc = "Go to next [D]iagnostic message";
};
"<leader>e" = {
action = "open_float";
desc = "Show diagnostic [E]rror messages";
};
servers = {
bashls.enable = true;
clangd.enable = true;
nil_ls.enable = true;
"<leader>q" = {
action = "setloclist";
desc = "Open diagnostic [Q]uickfix list";
};
};
};
};
gitsigns = {
enable = true;
signs = {
add = { text = "+"; };
change = { text = "~"; };
delete = { text = "_"; };
topdelete = { text = "T"; };
changedelete = { text = "~"; };
};
};
};
# ... and even highlights and autocommands !
highlight.ExtraWhitespace.bg = "red";
match.ExtraWhitespace = "\\s\\+$";
autoCmd = [
{
@ -266,6 +384,17 @@
pattern = "nix";
command = "setlocal tabstop=2 shiftwidth=2";
}
{
event = "LspAttach";
callback = ''
function (event)
local map = function(keys, func, desc)
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end
'';
}
];
extraPlugins = with pkgs.vimPlugins; [
];
};