[nvim]: AstroNvim

This commit is contained in:
Sweetbread 2024-04-24 12:15:45 +03:00
parent 3fe1ee2e1c
commit cdb0c3db9b
22 changed files with 14 additions and 660 deletions

260
flake.lock generated
View File

@ -1,136 +1,5 @@
{
"nodes": {
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1711099426,
"narHash": "sha256-HzpgM/wc3aqpnHJJ2oDqPBkNsqWbW0WfWUO8lKu8nGk=",
"owner": "numtide",
"repo": "devshell",
"rev": "2d45b54ca4a183f2fdcf4b19c895b64fbf620ee8",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixvim",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -151,48 +20,6 @@
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712989663,
"narHash": "sha256-r2X/DIAyKOLiHoncjcxUk1TENWDTTaigRBaY53Cts/w=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "40ab43ae98cb3e6f07eaeaa3f3ed56d589da21b0",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1711763326,
"narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1713248628,
@ -225,96 +52,11 @@
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1713294906,
"narHash": "sha256-xJJZdCBzVFpVppaYyUK4lTTNOnbAxrjhodoJL3Oi91E=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "514a51877df9fe41ffc38c5237e3c4e5327e7607",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712897695,
"narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
"nixvim": "nixvim"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
"nixpkgs-stable": "nixpkgs-stable"
}
}
},

View File

@ -10,11 +10,6 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-stable, home-manager, ... }@inputs:
@ -34,7 +29,6 @@
};
modules = [
./nixos/configuration.nix
inputs.nixvim.nixosModules.nixvim
];
};

View File

@ -5,6 +5,7 @@
./htop.nix
./alacritty.nix
./qt.nix
./nvim.nix
./wms/hyprland.nix
./wms/waybar.nix

View File

@ -0,0 +1,11 @@
{ pkgs, ... }: {
xdg.configFile.nvim = {
source = pkgs.fetchFromGitHub {
owner = "AstroNvim";
repo = "template";
rev = "60a8ea905787c27cbd854985e47dc2195e763732";
sha256 = "03bxdzs9zjm1xd0aqwsckm1d2hbz8bsfw6ac5fzx319a2hyiwfp9";
};
recursive = true;
};
}

View File

@ -11,6 +11,5 @@
./hyprland.nix
./trim.nix
./bluetooth.nix
./nixvim/nixvim.nix
];
}

View File

@ -1,10 +0,0 @@
{
programs.nixvim = {
autoCmd = [
{
event = [ "VimEnter" ];
command = ":TransparentEnable";
}
];
};
}

View File

@ -1,68 +0,0 @@
{ config, lib, ... }: {
programs.nixvim = {
globals = {
mapleader = "\\";
maplocalleader = "\\";
};
keymaps = let
normal =
lib.mapAttrsToList
(key: action: {
mode = "n";
inherit action key;
})
{
# Open Neotree
"<leader>n" = ":Neotree<CR>";
# Esc to clear search results
"<esc>" = ":noh<CR>";
# fix Y behaviour
Y = "y$";
# back and fourth between the two most recent files
"<C-c>" = ":b#<CR>";
# close by Ctrl+x
"<C-x>" = ":close<CR>";
# save by \+s or Ctrl+s
"<leader>s" = ":w<CR>";
"<C-s>" = ":w<CR>";
# navigate windows
"<leader>h" = "<C-w>h";
"<leader>j" = "<C-w>j";
"<leader>k" = "<C-w>k";
"<leader>l" = "<C-w>l";
# resize with arrows
"<C-Up>" = ":resize -2<CR>";
"<C-Down>" = ":resize +2<CR>";
"<C-Left>" = ":vertical resize +2<CR>";
"<C-Right>" = ":vertical resize -2<CR>";
# move current line up/down
# M = Alt key
"<M-k>" = ":move-2<CR>";
"<M-j>" = ":move+<CR>";
};
visual =
lib.mapAttrsToList
(key: action: {
mode = "v";
inherit action key;
})
{
# move selected line / block of text in visual mode
"K" = ":m '<-2<CR>gv=gv";
"J" = ":m '>+1<CR>gv=gv";
};
in
config.nixvim.helpers.keymaps.mkKeymaps
{options.silent = true;}
(normal ++ visual);
};
}

View File

@ -1,16 +0,0 @@
{
imports = [
./opts.nix
./keymaps.nix
./autocmds.nix
./plugins/plugins-bundle.nix
];
programs.nixvim = {
enable = true;
defaultEditor = true;
colorschemes.oxocarbon.enable = true;
};
}

View File

@ -1,64 +0,0 @@
{
programs.nixvim = {
clipboard = {
register = "unnamedplus";
providers.wl-copy.enable = true;
};
opts = {
updatetime = 100; # Faster completion
relativenumber = true; # Relative line numbers
number = true; # Display the absolute line number of the current line
hidden = true; # Keep closed buffer open in the background
mouse = "a"; # Enable mouse control
mousemodel = "extend"; # Mouse right-click extends the current selection
splitbelow = true; # A new window is put below the current one
splitright = true; # A new window is put right of the current one
swapfile = false; # Disable the swap file
modeline = true; # Tags such as 'vim:ft=sh'
modelines = 100; # Sets the type of modelines
undofile = true; # Automatically save and restore undo history
incsearch = true; # Incremental search: show match for partly typed search command
inccommand = "split"; # Search and replace: preview changes in quickfix list
ignorecase = true; # When the search query is lower-case, match both lower and upper-case
smartcase = true; # Override the 'ignorecase' option if the search pattern contains upper
scrolloff = 12; # Number of screen lines to show around the cursor
cursorline = false; # Highlight the screen line of the cursor
cursorcolumn = false; # Highlight the screen column of the cursor
signcolumn = "yes"; # Whether to show the signcolumn
colorcolumn = "100"; # Columns to highlight
laststatus = 3; # When to use a status line for the last window
fileencoding = "utf-8"; # File-content encoding for the current buffer
termguicolors = false; # Disables 24-bit RGB color in the |TUI|
spell = false; # Highlight spelling mistakes (local to window)
wrap = false; # Prevent text from wrapping
tabstop = 2; # Number of spaces a <Tab> in the text stands for (local to buffer)
shiftwidth = 2; # Number of spaces used for each step of (auto)indent (local to buffer)
expandtab = true; # Expand <Tab> to spaces in Insert mode (local to buffer)
autoindent = true; # Do clever autoindenting
textwidth = 0; # Maximum width of text that is being inserted. A longer line will be
foldlevel = 99; # Folds with a level higher than this number will be closed
completeopt = ["menu" "menuone" "noselect"]; # For CMP plugin
};
};
}

View File

@ -1,12 +0,0 @@
{
programs.nixvim.plugins.barbar = {
enable = true;
keymaps = {
silent = true;
next = "<TAB>";
previous = "<S-TAB>";
# close = "<C-q>";
};
};
}

View File

@ -1,32 +0,0 @@
{
programs.nixvim.plugins.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 })";
};
sources = [
{name = "path";}
{name = "nvim_lsp";}
{name = "cmp_tabby";}
{name = "luasnip";}
{
name = "buffer";
# Words from other open buffers can also be suggested.
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
}
{name = "neorg";}
];
};
};
}

View File

@ -1,10 +0,0 @@
{
programs.nixvim.plugins.comment = {
enable = true;
settings = {
opleader.line = "gcc";
toggler.line = "gcc";
};
};
}

View File

@ -1,12 +0,0 @@
{
programs.nixvim.plugins.floaterm = {
enable = true;
width = 0.8;
height = 0.8;
title = "";
keymaps.toggle = "<C-b>";
};
}

View File

@ -1,46 +0,0 @@
{
programs.nixvim.plugins = {
treesitter = {
enable = true;
nixvimInjections = true;
folding = true;
indent = true;
};
treesitter-refactor = {
enable = true;
highlightDefinitions = {
enable = true;
# Set to false if you have an `updatetime` of ~100.
clearOnCursorMove = false;
};
};
hmts.enable = true;
# lspkind = {
# enable = true;
#
# cmp = {
# enable = true;
# menu = {
# nvim_lsp = "[LSP]";
# nvim_lua = "[api]";
# path = "[path]";
# luasnip = "[snip]";
# buffer = "[buffer]";
# neorg = "[neorg]";
# cmp_tabby = "[Tabby]";
# };
# };
# };
lsp = {
enable = true;
servers = {
nil_ls.enable = true;
};
};
};
}

View File

@ -1,47 +0,0 @@
{
programs.nixvim.plugins.lualine = {
enable = true;
globalstatus = true;
# +-------------------------------------------------+
# | A | B | C X | Y | Z |
# +-------------------------------------------------+
sections = {
lualine_a = ["mode"];
lualine_b = ["branch"];
lualine_c = ["filename" "diff"];
lualine_x = [
"diagnostics"
# Show active language server
{
name.__raw = ''
function()
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
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
end
end
return msg
end
'';
icon = " ";
# color.fg = "#ffffff";
}
"encoding"
"fileformat"
"filetype"
];
};
};
}

View File

@ -1,20 +0,0 @@
{
programs.nixvim.plugins.mini = {
enable = true;
modules = {
align = {};
basics = {
options.extra_ui = true;
};
clue = {};
cursorword = {};
doc = {};
extra = {};
indentscope = {};
trailspace = {};
misc = {};
surround = {};
};
};
}

View File

@ -1,7 +0,0 @@
{
programs.nixvim.plugins.neo-tree = {
enable = true;
filesystem.followCurrentFile.enabled = true;
closeIfLastWindow = true;
};
}

View File

@ -1,3 +0,0 @@
{
programs.nixvim.plugins.nix.enable = true;
}

View File

@ -1,15 +0,0 @@
{
imports = [
./lualine.nix
./transparent.nix
./neotree.nix
./mini.nix
./comment.nix
./floaterm.nix
./telescope.nix
./barbar.nix
./nix.nix
./lsp.nix
./cmp.nix
];
}

View File

@ -1,29 +0,0 @@
{
programs.nixvim.plugins.telescope = {
enable = true;
keymaps = {
"<leader>ff" = "find_files";
"<leader>b" = "buffers";
"<leader>fh" = "help_tags";
"<leader>gf" = "git_files";
"<leader>of" = "oldfiles";
# "<leader>fg" = "live_grep";
# "<leader>fd" = "diagnostics";
};
keymapsSilent = true;
settings.defaults = {
file_ignore_patterns = [
"^.git/"
"^.mypy_cache/"
"^__pycache__/"
"^output/"
"^data/"
"%.ipynb"
];
set_env.COLORTERM = "truecolor";
};
};
}

View File

@ -1,3 +0,0 @@
{
programs.nixvim.plugins.transparent.enable = true;
}

View File

@ -65,6 +65,7 @@
tldr
bat
xdg-utils
neovim
# GUI utils
feh