Compare commits

..

14 Commits

10 changed files with 186 additions and 143 deletions

View File

@@ -1,20 +1,24 @@
# NVIM For Voidfiles
Built using vim.pack and lots of mini plugins
## Installation
### Try with no install
Run the following command:
This config uses nix-wrapper-modules to forego needing to install dotfiles at all. This results in a cleaner,
more consistent experience across systems, in order to make it available to a dendritic nix environment.
### Trying
To try the config:
```bash
nix run git+https://git.voidarc.co.uk/voidarc/nvim#remote
nix run git+https://git.voidarc.co.uk/voidarc/nvim
```
This will use NVIM_APPNAME="nvim-remote", and pull config from the git repo without you having to install it to your system.
You will have to wait for the initial plugin install, so I advise just pressing "always" when prompted. Due to autocommands,
when the plugins have installed you will have to restart nvim with the same run command to enter the editor properly.
### Install into nix config without adding config
### Installing
Add the input to your flake:
You can add the repo to your flake like this:
```nix
{
inputs = {
@@ -22,34 +26,22 @@ You can add the repo to your flake like this:
}
}
```
And then add this to your package list:
```nix
inputs.nvim-voidarc.packages.${stdenv.hostPlatform.system}.remote
```
I don't recommend making it follow the system nixpkgs as treesitter needs unstable in order to work properly.
### Install into nix config and add local config
And then add the package to your system config:
Clone this repo into your nvim config directory (make sure to back up beforehand):
```
git clone https://git.voidarc.co.uk/voidarc/nvim ~/.config/nvim
```
Then add that folder as an input to your flake:
```nix
{
inputs = {
nvim-voidarc.url = "git+file:///home/username/.config/nvim";
}
}
```
Adjust the path and the username to what they are on your system. The input should be the path of the directory
that contains the flake, in this case the flake's path would be `/home/username/.config/nvim/flake.nix`.
Then add the default package to your system package:
```nix
inputs.nvim-voidarc.packages.${stdenv.hostPlatform.system}.default
```
Adding the remote package here will still work, but defeats the point of cloning it locally.
There is also a `minimal` output that doesn't install any lsps, only installing required pacakges so that the plugins
function correctly (ripgrep, luarocks, luajit, etc)
### Editing and Developing
You can clone this repo to `.config/nvim`, and then use a nix-shell to use a local config instead of the provided
bundled binary. This is useful if you want to make modifications to the config and don't want to wait for a push
and rebuild to see your changes. This is the only reason I kept the main config in lua, other than having to rewrite
it in general.
## Usage

37
flake.lock generated
View File

@@ -16,9 +16,44 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1780336545,
"narHash": "sha256-vhVhuXzFrIOfcssC/9hDHx7MHzDKjF3keHuREOQqQiQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4df1b885d76a54e1aa1a318f8d16fd6005b6401f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"wrappers": "wrappers"
}
},
"wrappers": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1782135443,
"narHash": "sha256-vAmbArdCyjqpVW+37aCy/PMBOLIqukUXLQuEKLwUhA4=",
"owner": "BirdeeHub",
"repo": "nix-wrapper-modules",
"rev": "6e7f66fa2cdf4d63162580b438f7fcf87c28a46f",
"type": "github"
},
"original": {
"owner": "BirdeeHub",
"repo": "nix-wrapper-modules",
"type": "github"
}
}
},

View File

@@ -3,13 +3,24 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
wrappers.url = "github:BirdeeHub/nix-wrapper-modules";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux"; # change if needed
pkgs = import nixpkgs { inherit system; };
outputs = {
self,
nixpkgs,
...
} @ inputs: let
# Define the systems you want to support
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
# A helper function to generate outputs for each system
# It imports nixpkgs for the system and passes the resulting 'pkgs' to the function 'f'
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f (import nixpkgs {inherit system;}));
in {
# Use the helper to generate the packages attribute for every system
packages = forAllSystems (
pkgs: let
pkgList = with pkgs; [
# LSPs
lua-language-server
@@ -33,62 +44,40 @@
tree-sitter
ripgrep
gcc
cargo
fzf
gnumake
imagemagick
luarocks
];
nvimRemoteConfig = pkgs.runCommand "nvim-remote-config" { } ''
mkdir -p $out/nvim-remote
cp ${./init.lua} $out/nvim-remote/init.lua
cp -r ${./lua} $out/nvim-remote/lua
'';
mkWrappedNvim =
{
name,
extraWrapArgs ? "",
}:
pkgs.symlinkJoin {
inherit name;
paths = [ pkgs.neovim ];
buildInputs = [ pkgs.makeWrapper ];
meta.mainProgram = "nvim";
postBuild = ''
wrapProgram $out/bin/nvim \
--prefix PATH : ${pkgs.lib.makeBinPath pkgList} \
--set TREE_SITTER_LIB_PATH "${pkgs.tree-sitter}/lib" \
${extraWrapArgs}
'';
in {
# Define the default package for this system
default = inputs.wrappers.wrappers.neovim.wrap {
inherit pkgs;
env = {
"CONFIG_ROOT" = ./.;
"NVIM_APPNAME" = "nvim-voidarc-remote";
};
nvim-wrapped = mkWrappedNvim { name = "nvim"; };
nvim-remote = mkWrappedNvim {
name = "nvim-remote";
extraWrapArgs = ''
--set NVIM_APPNAME "nvim-remote" \
--set XDG_CONFIG_HOME "${nvimRemoteConfig}"
'';
runtimePkgs = pkgList;
settings.config_directory = ./.;
};
in
{
packages.${system} = {
default = nvim-wrapped;
remote = nvim-remote;
minimal = inputs.wrappers.wrappers.neovim.wrap {
inherit pkgs;
env = {
"CONFIG_ROOT" = ./.;
"NVIM_APPNAME" = "nvim-voidarc-remote";
};
devShells.${system}.default = pkgs.mkShell {
packages = [
nvim-wrapped
runtimePkgs = with pkgs; [
lua5_1
tree-sitter
ripgrep
gcc
fzf
luarocks
];
shellHook = ''
export TREE_SITTER_LIB_PATH="${pkgs.tree-sitter}/lib"
export DEVSHELL_NAME="󱄅 flake/#89dceb| neovim/green"
'';
settings.config_directory = ./.;
};
}
);
};
}

View File

@@ -10,7 +10,7 @@ require("config.autocmd")
require("config.binds")
-- Colorcheme
vim.cmd.colorscheme("catppuccin-mocha")
vim.cmd.colorscheme("catppuccin-nvim")
-- Line numbers
vim.opt.cursorline = true
@@ -39,6 +39,7 @@ vim.opt.undofile = true
-- Better Highlighting
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
-- Nowrap
vim.opt.wrap = false
@@ -52,3 +53,10 @@ vim.keymap.set("n", "<leader>u", require("undotree").open)
-- Local project config
vim.o.exrc = true
-- Ignore case and some flash nvim stuff
vim.o.ignorecase = true
vim.o.smartcase = true
vim.api.nvim_set_hl(0, "FlashMatch", { fg = "#cba6f7", bold = true }) -- overlay0
vim.api.nvim_set_hl(0, "FlashLabel", { fg = "#1e1e2e", bg = "#f38ba8", bold = false }) -- overlay0
vim.api.nvim_set_hl(0, "FlashCurrent", { bg = "#cba6f7", fg = "#1e1e2e", bold = true }) -- overlay0

View File

@@ -27,12 +27,12 @@ vim.api.nvim_create_autocmd("VimEnter", {
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "svelte" },
callback = function()
vim.treesitter.start()
end,
})
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = { "svelte" },
-- callback = function()
-- vim.treesitter.start()
-- end,
-- })
local cursorline_group = vim.api.nvim_create_augroup("CursorLineControl", { clear = true })
@@ -80,3 +80,11 @@ vim.api.nvim_create_autocmd("User", {
print("AutoSave disabled")
end,
})
-- Center cursor on screen whenver insert mode is activated
-- (Stops fucky wucky shit with scrollEOF)
vim.api.nvim_create_autocmd("InsertEnter", {
callback = function()
vim.cmd("normal! zz")
end,
})

View File

@@ -13,8 +13,7 @@ Keymap("n", "<leader>bd", function() -- delete buffer
vim.cmd("echo 'Buffer deleted'")
end)
for _, bind in ipairs({ "i", "a", "A" }) do
-- Pass { expr = true } as the fourth argument
for _, bind in ipairs({ "i", "a", "A", "I" }) do
Keymap("n", bind, function()
if vim.fn.getline("."):match("^%s*$") then
return [["_cc]]
@@ -44,7 +43,14 @@ Keymap("t", "<C-D>", "<C-\\><C-n>") -- escape terminal with c-d
-- Flash keymaps
Keymap("n", "ss", function()
require("flash").jump()
require("flash").jump({
search = {
mode = "fuzzy",
},
highlight = {
backdrop = true,
},
})
end)
Keymap("n", "S", function()
require("flash").treesitter()

View File

@@ -9,6 +9,7 @@ require("conform").setup({
javascript = { "prettier" },
typescriptreact = { "prettier" },
typescript = { "prettier" },
markdown = { "prettier" },
html = { "prettier" },
svelte = { "prettier" },
python = { "black" },

View File

@@ -55,11 +55,19 @@ vim.lsp.enable({
"emmet_language_server",
})
vim.o.pumborder = "rounded"
vim.o.winborder = "rounded"
vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { fg = "#89b4fa" })
require("blink.cmp").build():pwait()
require("blink.cmp").setup({
fuzzy = { implementation = "rust" },
appearance = { use_nvim_cmp_as_default = true },
fuzzy = { implementation = "lua" },
keymap = {
["<Tab>"] = { "select_next", "snippet_forward", "fallback" },
},
signature = {
enabled = false,
@@ -86,10 +94,6 @@ require("blink.cmp").setup({
},
},
-- Keymaps
keymap = {
["<Tab>"] = { "select_next", "snippet_forward", "fallback" },
},
sources = {
default = {
"lsp", -- (Equivalent to cmp-nvim-lsp)
@@ -97,14 +101,6 @@ require("blink.cmp").setup({
"buffer", -- (Equivalent to cmp-buffer)
"path", -- (Equivalent to cmp-path)
},
providers = {
-- lazydev = {
-- name = "LazyDev",
-- module = "lazydev.integrations.blink",
-- -- make lazydev completions top priority (see `:h blink.cmp`)
-- score_offset = 100,
-- },
},
},
})

View File

@@ -1,7 +1,7 @@
local plugins = {}
-- 1. Setup paths
local lua_path = vim.fn.stdpath("config") .. "/lua"
local lua_path = os.getenv("CONFIG_ROOT") .. "/lua"
local plugin_dir = lua_path .. "/plugins"
-- 2. Use ** to search recursively for all .lua files

View File

@@ -4,15 +4,23 @@ vim.pack.add({
})
require("catppuccin").setup({
flavour = "mocha",
transparent_background = true, -- disables setting the background color.
float = {
transparent = true, -- enable transparent floating windows
solid = false, -- use solid styling for floating windows, see |winborder|
solid = true, -- use solid styling for floating windows, see |winborder|
},
show_end_of_buffer = true, -- shows the '~' characters after the end of buffers
term_colors = false,
auto_integrations = true,
integrations = {
cmp = true,
blink_cmp = {
style = "bordered",
},
},
})
require("vimade").setup({
recipe = { "minimalist", { animate = true } },
fadelevel = 0.6,
fadelevel = 0.8,
})