Compare commits

...

14 Commits

10 changed files with 186 additions and 143 deletions

View File

@@ -1,20 +1,24 @@
# NVIM For Voidfiles # NVIM For Voidfiles
Built using vim.pack and lots of mini plugins Built using vim.pack and lots of mini plugins
## Installation ## 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 ```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 ```nix
{ {
inputs = { 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 ```nix
inputs.nvim-voidarc.packages.${stdenv.hostPlatform.system}.default 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 ## Usage

37
flake.lock generated
View File

@@ -16,9 +16,44 @@
"type": "github" "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": { "root": {
"inputs": { "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 = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
wrappers.url = "github:BirdeeHub/nix-wrapper-modules";
}; };
outputs = outputs = {
{ self, nixpkgs }: self,
let nixpkgs,
system = "x86_64-linux"; # change if needed ...
pkgs = import nixpkgs { inherit system; }; } @ 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; [ pkgList = with pkgs; [
# LSPs # LSPs
lua-language-server lua-language-server
@@ -33,62 +44,40 @@
tree-sitter tree-sitter
ripgrep ripgrep
gcc gcc
cargo
fzf fzf
gnumake gnumake
imagemagick imagemagick
luarocks luarocks
]; ];
in {
nvimRemoteConfig = pkgs.runCommand "nvim-remote-config" { } '' # Define the default package for this system
mkdir -p $out/nvim-remote default = inputs.wrappers.wrappers.neovim.wrap {
cp ${./init.lua} $out/nvim-remote/init.lua inherit pkgs;
cp -r ${./lua} $out/nvim-remote/lua env = {
''; "CONFIG_ROOT" = ./.;
"NVIM_APPNAME" = "nvim-voidarc-remote";
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}
'';
}; };
runtimePkgs = pkgList;
nvim-wrapped = mkWrappedNvim { name = "nvim"; }; settings.config_directory = ./.;
nvim-remote = mkWrappedNvim {
name = "nvim-remote";
extraWrapArgs = ''
--set NVIM_APPNAME "nvim-remote" \
--set XDG_CONFIG_HOME "${nvimRemoteConfig}"
'';
}; };
in minimal = inputs.wrappers.wrappers.neovim.wrap {
{ inherit pkgs;
packages.${system} = { env = {
default = nvim-wrapped; "CONFIG_ROOT" = ./.;
remote = nvim-remote; "NVIM_APPNAME" = "nvim-voidarc-remote";
}; };
runtimePkgs = with pkgs; [
devShells.${system}.default = pkgs.mkShell { lua5_1
tree-sitter
packages = [ ripgrep
nvim-wrapped gcc
fzf
luarocks
]; ];
settings.config_directory = ./.;
shellHook = ''
export TREE_SITTER_LIB_PATH="${pkgs.tree-sitter}/lib"
export DEVSHELL_NAME="󱄅 flake/#89dceb| neovim/green"
'';
}; };
}
);
}; };
} }

View File

@@ -10,7 +10,7 @@ require("config.autocmd")
require("config.binds") require("config.binds")
-- Colorcheme -- Colorcheme
vim.cmd.colorscheme("catppuccin-mocha") vim.cmd.colorscheme("catppuccin-nvim")
-- Line numbers -- Line numbers
vim.opt.cursorline = true vim.opt.cursorline = true
@@ -39,6 +39,7 @@ vim.opt.undofile = true
-- Better Highlighting -- Better Highlighting
vim.opt.hlsearch = false vim.opt.hlsearch = false
vim.opt.incsearch = true vim.opt.incsearch = true
vim.opt.termguicolors = true
-- Nowrap -- Nowrap
vim.opt.wrap = false vim.opt.wrap = false
@@ -52,3 +53,10 @@ vim.keymap.set("n", "<leader>u", require("undotree").open)
-- Local project config -- Local project config
vim.o.exrc = true 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, end,
}) })
vim.api.nvim_create_autocmd("FileType", { -- vim.api.nvim_create_autocmd("FileType", {
pattern = { "svelte" }, -- pattern = { "svelte" },
callback = function() -- callback = function()
vim.treesitter.start() -- vim.treesitter.start()
end, -- end,
}) -- })
local cursorline_group = vim.api.nvim_create_augroup("CursorLineControl", { clear = true }) local cursorline_group = vim.api.nvim_create_augroup("CursorLineControl", { clear = true })
@@ -80,3 +80,11 @@ vim.api.nvim_create_autocmd("User", {
print("AutoSave disabled") print("AutoSave disabled")
end, 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'") vim.cmd("echo 'Buffer deleted'")
end) end)
for _, bind in ipairs({ "i", "a", "A" }) do for _, bind in ipairs({ "i", "a", "A", "I" }) do
-- Pass { expr = true } as the fourth argument
Keymap("n", bind, function() Keymap("n", bind, function()
if vim.fn.getline("."):match("^%s*$") then if vim.fn.getline("."):match("^%s*$") then
return [["_cc]] return [["_cc]]
@@ -44,7 +43,14 @@ Keymap("t", "<C-D>", "<C-\\><C-n>") -- escape terminal with c-d
-- Flash keymaps -- Flash keymaps
Keymap("n", "ss", function() Keymap("n", "ss", function()
require("flash").jump() require("flash").jump({
search = {
mode = "fuzzy",
},
highlight = {
backdrop = true,
},
})
end) end)
Keymap("n", "S", function() Keymap("n", "S", function()
require("flash").treesitter() require("flash").treesitter()

View File

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

View File

@@ -55,11 +55,19 @@ vim.lsp.enable({
"emmet_language_server", "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({ 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 = { signature = {
enabled = false, enabled = false,
@@ -86,10 +94,6 @@ require("blink.cmp").setup({
}, },
}, },
-- Keymaps
keymap = {
["<Tab>"] = { "select_next", "snippet_forward", "fallback" },
},
sources = { sources = {
default = { default = {
"lsp", -- (Equivalent to cmp-nvim-lsp) "lsp", -- (Equivalent to cmp-nvim-lsp)
@@ -97,14 +101,6 @@ require("blink.cmp").setup({
"buffer", -- (Equivalent to cmp-buffer) "buffer", -- (Equivalent to cmp-buffer)
"path", -- (Equivalent to cmp-path) "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 = {} local plugins = {}
-- 1. Setup paths -- 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" local plugin_dir = lua_path .. "/plugins"
-- 2. Use ** to search recursively for all .lua files -- 2. Use ** to search recursively for all .lua files

View File

@@ -4,15 +4,23 @@ vim.pack.add({
}) })
require("catppuccin").setup({ require("catppuccin").setup({
flavour = "mocha",
transparent_background = true, -- disables setting the background color. transparent_background = true, -- disables setting the background color.
float = { float = {
transparent = true, -- enable transparent floating windows 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 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({ require("vimade").setup({
recipe = { "minimalist", { animate = true } }, recipe = { "minimalist", { animate = true } },
fadelevel = 0.6, fadelevel = 0.8,
}) })