neovim start

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-04-29 16:09:43 +02:00
parent a64deb9113
commit 31df2f1a03
13 changed files with 439 additions and 67 deletions

63
flake.lock generated
View File

@@ -1,25 +1,5 @@
{ {
"nodes": { "nodes": {
"Hyprspace": {
"inputs": {
"hyprland": [
"hyprland"
]
},
"locked": {
"lastModified": 1713738762,
"narHash": "sha256-wXMqOQosjblsdV3x0DzpH7qSBUs5hT5Ca6eZ2Xp8TOA=",
"owner": "KZDKM",
"repo": "Hyprspace",
"rev": "de3b1ccbf30498b6fcd42b36418e33a2c8c1405a",
"type": "github"
},
"original": {
"owner": "KZDKM",
"repo": "Hyprspace",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -27,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1712386041, "lastModified": 1714043624,
"narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=", "narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff", "rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -82,11 +62,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1713778289, "lastModified": 1714248933,
"narHash": "sha256-h3ufswObZ8qUxQewTc5L173ILfV6JBQ+IaN1aN9RPjY=", "narHash": "sha256-hACvj8q0ucxslZmHf7j6bYlxVeDkJleAW+sCHGv4+2k=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "e1644e91ead7cdef5d08bfe6a579c4478a816a8e", "rev": "2e763764bfdaee2039961c6c220b5d6af31712d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -107,11 +87,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1713607544, "lastModified": 1714219583,
"narHash": "sha256-nbqQmhvYbDVC/5YiZLSGj5r14cOk2k6TGPpP2TtCfhI=", "narHash": "sha256-s6yf/bsAum3sAXSxB5gDCHQoLMn5Skl9EWL8nvsXzog=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprland-plugins", "repo": "hyprland-plugins",
"rev": "9971fec974a9d94a2a1b1d68d5ada5fc59fec053", "rev": "97e9d252ffec654cdc69a2cea8b63a172795706b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -182,11 +162,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1713730424, "lastModified": 1714171579,
"narHash": "sha256-MqYjTvQCxwuDIuAaqIEuyqserm5PYr0auiHHPuYFN/k=", "narHash": "sha256-eaWDIvt8ufUKKz3Lc2a3PyemLJG1m9RYlF+HP3hWbaw=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprwayland-scanner", "repo": "hyprwayland-scanner",
"rev": "7c9c8adfe7e424faa0c5ce6e8be90157fda53c06", "rev": "126dad854f22fe30e6b82cd21808e76903d90ac5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -197,11 +177,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1713537308, "lastModified": 1714076141,
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -213,11 +193,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1713714899, "lastModified": 1714076141,
"narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=", "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6143fc5eeb9c4f00163267708e26191d1e918932", "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -228,11 +208,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1713725259, "lastModified": 1713995372,
"narHash": "sha256-9ZR/Rbx5/Z/JZf5ehVNMoz/s5xjpP0a22tL6qNvLt5E=", "narHash": "sha256-fFE3M0vCoiSwCX02z8VF58jXFRj9enYUSTqjyHAjrds=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a5e4bbcb4780c63c79c87d29ea409abf097de3f7", "rev": "dd37924974b9202f8226ed5d74a252a9785aedf8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -243,7 +223,6 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"Hyprspace": "Hyprspace",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprland-plugins": "hyprland-plugins", "hyprland-plugins": "hyprland-plugins",

View File

@@ -17,11 +17,15 @@
url = "github:hyprwm/hyprland-plugins"; url = "github:hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland"; inputs.hyprland.follows = "hyprland";
}; };
Hyprspace = { # Hyprspace = {
url = "github:KZDKM/Hyprspace"; # url = "github:KZDKM/Hyprspace";
inputs.hyprland.follows = "hyprland"; # inputs.hyprland.follows = "hyprland";
}; # };
# nixvim = {
# url = "github:nix-community/nixvim/nixos-23.11";
# inputs.nixpkgs.follows = "nixpkgs";
# };
}; };
@@ -126,12 +130,16 @@
homeConfigurations = { homeConfigurations = {
"${user}@NxXPS" = let host = "NxXPS"; in home-manager.lib.homeManagerConfiguration { "${user}@NxXPS" = let host = "NxXPS"; in home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ ./home.nix ]; modules = [
./home.nix
];
extraSpecialArgs = { inherit inputs system user host allowed secrets pkgs-unstable rice nvidia; }; extraSpecialArgs = { inherit inputs system user host allowed secrets pkgs-unstable rice nvidia; };
}; };
"${user}@NxNORTH" = let host = "NxNORTH"; in home-manager.lib.homeManagerConfiguration { "${user}@NxNORTH" = let host = "NxNORTH"; in home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ ./home.nix ]; modules = [
./home.nix
];
extraSpecialArgs = { inherit inputs system user host allowed secrets pkgs-unstable rice nvidia; }; extraSpecialArgs = { inherit inputs system user host allowed secrets pkgs-unstable rice nvidia; };
}; };
}; };

View File

@@ -58,10 +58,10 @@ in
xwayland.enable = true; xwayland.enable = true;
systemd.enable = true; systemd.enable = true;
plugins = [ plugins = [
# inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo
# inputs.hyprfocus.packages.${pkgs.system}.hyprfocus # inputs.hyprfocus.packages.${pkgs.system}.hyprfocus
# inputs.hycov.packages.${pkgs.system}.hycov # inputs.hycov.packages.${pkgs.system}.hycov
inputs.Hyprspace.packages.${pkgs.system}.Hyprspace # inputs.Hyprspace.packages.${pkgs.system}.Hyprspace
]; ];
settings = { settings = {
@@ -349,8 +349,8 @@ in
## ROW 2: ## ROW 2:
#bind = SUPER, TAB, hycov:toggleoverview #bind = SUPER, TAB, hycov:toggleoverview
"SUPER, TAB, overview:toggle" # "SUPER, TAB, overview:toggle"
# "SUPER SHIFT, TAB, hyprexpo:expo, toggle" "SUPER, TAB, hyprexpo:expo, toggle"
"ALT, TAB, focuscurrentorlast" "ALT, TAB, focuscurrentorlast"
"SUPER, Q, killactive" "SUPER, Q, killactive"
"SUPER, W, exec, waybar_mode set '󰈹 '" "SUPER, W, exec, waybar_mode set '󰈹 '"
@@ -759,18 +759,18 @@ in
# plugin { plugin {
# hyprexpo { hyprexpo {
# columns = 5 columns = 5
# gap_size = ${builtins.toString rice.gap-size} gap_size = ${builtins.toString rice.gap-size}
# bg_col = rgb(${rice.lib.nohash rice.color.background}) bg_col = rgb(${rice.lib.nohash rice.color.background})
# workspace_method = first 10 # [center/first] [workspace] e.g. first 1 or center m+1 workspace_method = first 10 # [center/first] [workspace] e.g. first 1 or center m+1
# enable_gesture = false # laptop touchpad, 4 fingers enable_gesture = false # laptop touchpad, 4 fingers
# gesture_distance = 300 # how far is the "max" gesture_distance = 300 # how far is the "max"
# gesture_positive = true # positive = swipe down. Negative = swipe up. gesture_positive = true # positive = swipe down. Negative = swipe up.
# } }
# } }
plugin { plugin {

128
home-modules/nixvim.nix Normal file
View File

@@ -0,0 +1,128 @@
{ config, pkgs, inputs, system, rice, ... }:
{
imports = [
inputs.nixvim.homeManagerModules.nixvim
];
home.packages = [
pkgs.neovide
];
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
clipboard.providers.wl-copy.enable = true;
options = {
number = true;
relativenumber = true;
shiftwidth = 2;
};
colorschemes.catppuccin = {
enable = true;
settings = {
mocha = {
base = "#ff0000";
};
disable_underline = true;
flavour = "mocha";
integrations = {
cmp = true;
gitsigns = true;
mini = {
enabled = true;
indentscope_color = "";
};
notify = false;
nvimtree = true;
treesitter = true;
};
styles = {
booleans = [
"bold"
"italic"
];
conditionals = [
"bold"
];
};
term_colors = true;
};
};
# colorschemes.base16 = {
# enable = true;
# setUpBar = true;
# colorscheme = "onedark";
# customColorScheme = {
# base00 = rice.color.background;
# base01 = rice.color.bright-black;
# base02 = rice.color.blue;
# base03 = rice.color.bright-blue;
# base04 = rice.color.cyan;
# base05 = rice.color.bright-cyan;
# base06 = rice.color.green;
# base07 = rice.color.bright-green;
# base08 = rice.color.magenta;
# base09 = rice.color.bright-magenta;
# base0A = rice.color.red;
# base0B = rice.color.bright-red;
# base0C = rice.color.white;
# base0D = rice.color.bright-white;
# base0E = rice.color.yellow;
# base0F = rice.color.bright-yellow;
# };
# };
opts = {
termguicolors = true;
};
globals = {
mapleader = " ";
};
plugins = {
telescope = {
enable = true;
extensions = {
fzf-native.enable = true;
};
keymaps = {
"<C-o>" = { action = "find_files"; };
"<leader>fg" = { action = "live_grep"; };
};
};
lightline = {
enable = true;
# colorscheme = "base16";
# active = {
# left = [
# ["mode" "paste"]
# ["readonly" "filename" "modified"]
# ];
# right = [
# [ "lineinfo" ]
# [ "percent" ]
# [ "fileformat" "fileencoding" "filetype" "charvaluehex" ]
# [ "git" ]
# ];
# };
};
nix.enable = true;
lsp-lines.enable = true;
lspkind.enable = true;
};
extraPlugins = [ ];
keymaps =
let
mkKeymap = mode: key: action: { inherit mode key action; };
mkKeymapWithOpts = mode: key: action: opts: (mkKeymap mode key action) // { options = opts; };
in
[
(mkKeymap "" "<Space>" "<Nop>")
(mkKeymap "n" "<leader>ff" "builtin.find_files")
];
};
}
## vl clipboard?

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,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,48 @@
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('neodev').setup()
require('lspconfig').lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
root_dir = function()
return vim.loop.cwd()
end,
cmd = { "lua-lsp" },
settings = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
}
}
require('lspconfig').rnix.setup {
on_attach = on_attach,
capabilities = capabilities,
}

View File

@@ -0,0 +1,11 @@
-- Lualine
require("lualine").setup({
icons_enabled = true,
theme = 'onedark',
})
-- Colorscheme
vim.cmd("colorscheme gruvbox")
-- Comment
require("Comment").setup()

View File

@@ -0,0 +1,13 @@
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"
}
}
})
require('telescope').load_extension('fzf')

View File

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

97
home-modules/nvim.nix Normal file
View File

@@ -0,0 +1,97 @@
{ config, pkgs, rice, ... }:
let
toLua = str: "lua << EOF\n${str}\nEOF\n";
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
in
{
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraPackages = with pkgs; [
lua-language-server
# rnix-lsp
xclip
wl-clipboard
];
plugins = with pkgs.vimPlugins; [
{
plugin = nvim-lspconfig;
config = toLuaFile ./nvim-lua/plugin/lsp.lua;
}
{
plugin = comment-nvim;
config = toLua ''require("Comment").setup()'';
}
{
plugin = gruvbox-nvim;
config = "colorscheme gruvbox";
}
neodev-nvim
nvim-cmp
{
plugin = nvim-cmp;
config = toLuaFile ./nvim-lua/plugin/cmp.lua;
}
{
plugin = telescope-nvim;
config = toLuaFile ./nvim-lua/plugin/telescope.lua;
}
telescope-fzf-native-nvim
cmp_luasnip
cmp-nvim-lsp
luasnip
friendly-snippets
lualine-nvim
nvim-web-devicons
{
plugin = (nvim-treesitter.withPlugins (p: [
p.tree-sitter-nix
p.tree-sitter-vim
p.tree-sitter-bash
p.tree-sitter-lua
p.tree-sitter-python
p.tree-sitter-json
]));
config = toLuaFile ./nvim-lua/plugin/treesitter.lua;
}
vim-nix
# {
# plugin = vimPlugins.own-onedark-nvim;
# config = "colorscheme onedark";
# }
];
extraLuaConfig = ''
${builtins.readFile ./nvim-lua/options.lua}
'';
# extraLuaConfig = ''
# ${builtins.readFile ./nvim-lua/options.lua}
# ${builtins.readFile ./nvim-lua/plugin/lsp.lua}
# ${builtins.readFile ./nvim-lua/plugin/cmp.lua}
# ${builtins.readFile ./nvim-lua/plugin/telescope.lua}
# ${builtins.readFile ./nvim-lua/plugin/treesitter.lua}
# ${builtins.readFile ./nvim-lua/plugin/other.lua}
# '';
};
}

View File

@@ -93,7 +93,8 @@ in
active-only = false; active-only = false;
}; };
"hyprland/window" = { "hyprland/window" = {
format = "${sep}{}"; # format = "${sep}{}";
format = "{}";
separate-outputs = true; separate-outputs = true;
}; };
"custom/cclock" = { "custom/cclock" = {
@@ -124,8 +125,8 @@ in
tooltip = false; tooltip = false;
format = "{icon}${sep}{capacity}%"; format = "{icon}${sep}{capacity}%";
states = { states = {
warning = 25; warning = 15;
critical = 10; critical = 5;
}; };
format-icons = [ format-icons = [
" " " "
@@ -236,7 +237,18 @@ in
#wireplumber.muted { #wireplumber.muted {
color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.blue}); color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.blue});
} }
#battery.warning:not(.charging) {
color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.green});;
}
#battery.critical {
color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.red});;
background: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.bright-red});
}
#battery.charging { color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.green}); }
''; '';
#battery.critical:not(.charging) {
}; };
} }

View File

@@ -24,6 +24,8 @@
./home-modules/kitty.nix ./home-modules/kitty.nix
./home-modules/shell/fish.nix ./home-modules/shell/fish.nix
./home-modules/shell/starship.nix ./home-modules/shell/starship.nix
# ./home-modules/nixvim.nix
./home-modules/nvim.nix
./home-modules/shell/yazi.nix ./home-modules/shell/yazi.nix
./home-modules/shell/zoxide.nix ./home-modules/shell/zoxide.nix
./home-modules/shell/nh.nix ./home-modules/shell/nh.nix
@@ -70,6 +72,7 @@
nodejs nodejs
gnumake gnumake
cmake
speedtest-go speedtest-go