Compare commits
11 Commits
0ad3049af0
...
7de01201e8
| Author | SHA1 | Date | |
|---|---|---|---|
| 7de01201e8 | |||
| 1dd3e16674 | |||
| 388beee1b4 | |||
| 447dd9c22f | |||
| 45739fc4cf | |||
| a2cc4a6c45 | |||
| ab1f2bf154 | |||
| 7dde0c9e27 | |||
| d96d14b91c | |||
| e46d931775 | |||
| d34bc98d24 |
102
README.md
Normal file
102
README.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# NVIM For Voidfiles
|
||||
Built using vim.pack and lots of mini plugins
|
||||
|
||||
## Installation
|
||||
### Try with no install
|
||||
|
||||
Run the following command:
|
||||
```bash
|
||||
nix run git+https://git.voidarc.co.uk/voidarc/nvim#remote
|
||||
```
|
||||
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
|
||||
|
||||
You can add the repo to your flake like this:
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nvim-voidarc.url = "git+https://git.voidarc.co.uk/voidarc/nvim"
|
||||
}
|
||||
}
|
||||
```
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
## Usage
|
||||
|
||||
This is a very esoteric config. I am quite opinionated, so there isn't any nice stuff like a homepage or which-keys.
|
||||
Instead, there is efficiency. This is the minimum amount of pacakges required in order to support full functionality,
|
||||
while also being highly extensible and adaptable to any programming language that I could want to program in.
|
||||
|
||||
### Keybinds
|
||||
|
||||
All keybinds can be found in the `lua/config/binds.lua` file, with a few exceptions. The `Keybind` function is a shorthand for the vim api.
|
||||
All default vim bindings remain untouched, with almost all of the set binds having a leader prefix.
|
||||
|
||||
The leader key is space, configurable at the top of the `init.lua` file. When referring to the leader key, assume I mean space.
|
||||
|
||||
#### Navigation
|
||||
|
||||
- \<leader\>ff - Open Telescope fuzzy finder
|
||||
- \<leader\>fn - Open Telescope file manager
|
||||
- \<leader\>fg - Telescope live grep (only works in git repos afaik)
|
||||
- \<leader\>fb - Telescope list of open buffers
|
||||
- \<leader\>bd - Delete focused buffer
|
||||
|
||||
If a file is open, Telescope is configured to jump to the pane/tab where that file is open, rather than open it in the current pane.
|
||||
This allows for a more consistent editing experience, such as having seperate tabs for backend and frontend files.
|
||||
|
||||
- \<C-t\>l - Next tab
|
||||
- \<C-t\>h - Previous tab
|
||||
- \<C-t\>j - New tab to the right
|
||||
- \<C-t\>q - Close tab (Keeps buffers open)
|
||||
|
||||
Instead of using \<C-t\>j, I prefer to find the file in Telescope and use <C-t>, which opens the file in a new tab. This ovverides the
|
||||
regular Telescope behaviour of jumping to the relevant pane, which only applies to enter. Similarly, <C-v> in Telescope opens the
|
||||
selected file in a split to the right in the current tab. All <C-w> binds for navigating windows remain unchanged
|
||||
|
||||
#### Editing
|
||||
|
||||
- \<leader\>d - Open vim.lsp.diagnostic float menu
|
||||
- gd - Go to definition of function
|
||||
- ss - Open flash.nvim menu
|
||||
|
||||
Flash nvim has no leader key for ease of access. Non-text based flash functions are available according to the binds, but I don't use them.
|
||||
|
||||
#### Session management
|
||||
|
||||
- \<leader\>qj - Save session and exit
|
||||
- \<leader\>qd - Delete session and exit
|
||||
|
||||
Both of these commands run `wqa`, meaning that even when deleting a session no data is ever lost (not that autosave isn't on by default lol).
|
||||
When opening nvim in a folder with a `.session` file, the session will automatically be restored, including window layout. For more info, see
|
||||
the mini.sessions documentation. Sessions autosave, but it is faster to use the save keybind than quit all windows one by one or run `:wqa`
|
||||
43
flake.lock
generated
43
flake.lock
generated
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1777578337,
|
||||
"narHash": "sha256-Ad49moKWeXtKBJNy2ebiTQUEgdLyvGmTeykAQ9xM+Z4=",
|
||||
"lastModified": 1782467914,
|
||||
"narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "15f4ee454b1dce334612fa6843b3e05cf546efab",
|
||||
"rev": "e73de5be04e0eff4190a1432b946d469c794e7b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
110
flake.nix
110
flake.nix
@@ -3,68 +3,60 @@
|
||||
|
||||
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; };
|
||||
pkgList = with pkgs; [
|
||||
# LSPs
|
||||
lua-language-server
|
||||
vscode-langservers-extracted
|
||||
emmet-language-server
|
||||
svelte-language-server
|
||||
rust-analyzer
|
||||
ast-grep
|
||||
prettier
|
||||
black
|
||||
nixfmt
|
||||
rustfmt
|
||||
nil
|
||||
python313Packages.python-lsp-server
|
||||
typescript-language-server
|
||||
tailwindcss-language-server
|
||||
stylua
|
||||
nixd
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
} @ inputs: let
|
||||
# Define the systems you want to support
|
||||
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
|
||||
|
||||
# other tools
|
||||
lua5_1
|
||||
tree-sitter
|
||||
ripgrep
|
||||
gcc
|
||||
fzf
|
||||
gnumake
|
||||
imagemagick
|
||||
luarocks
|
||||
];
|
||||
# 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
|
||||
vscode-langservers-extracted
|
||||
emmet-language-server
|
||||
svelte-language-server
|
||||
rust-analyzer
|
||||
ast-grep
|
||||
prettier
|
||||
black
|
||||
alejandra
|
||||
rustfmt
|
||||
python313Packages.python-lsp-server
|
||||
typescript-language-server
|
||||
tailwindcss-language-server
|
||||
stylua
|
||||
nixd
|
||||
|
||||
nvim-wrapped = pkgs.symlinkJoin {
|
||||
name = "nvim-with-lsp";
|
||||
paths = [ pkgs.neovim ];
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nvim \
|
||||
--prefix PATH : ${pkgs.lib.makeBinPath pkgList} \
|
||||
--set TREE_SITTER_LIB_PATH "${pkgs.tree-sitter}/lib"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.${system}.default = nvim-wrapped;
|
||||
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
|
||||
packages = [
|
||||
nvim-wrapped
|
||||
# other tools
|
||||
lua5_1
|
||||
tree-sitter
|
||||
ripgrep
|
||||
gcc
|
||||
fzf
|
||||
gnumake
|
||||
imagemagick
|
||||
luarocks
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export TREE_SITTER_LIB_PATH="${pkgs.tree-sitter}/lib"
|
||||
echo "Neovim LSP environment loaded"
|
||||
export DEVSHELL_NAME=" flake/#89dceb"
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
# Define the default package for this system
|
||||
default = inputs.wrappers.wrappers.neovim.wrap {
|
||||
inherit pkgs;
|
||||
runtimePkgs = pkgList;
|
||||
settings.config_directory = ./.;
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,6 +29,19 @@ Keymap("i", "<C-BS>", "<C-W>") -- C-Backscpace for whole words
|
||||
Keymap("n", "<leader>d", "<cmd>lua vim.diagnostic.open_float()<CR>") -- Diagnostics for Linter
|
||||
Keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>") -- Diagnostics for Linter
|
||||
|
||||
-- Terminal Keymaps
|
||||
Keymap("n", "<leader>tj", function() -- open term in new pane
|
||||
vim.cmd.vnew()
|
||||
vim.cmd.term()
|
||||
vim.cmd.startinsert()
|
||||
end)
|
||||
Keymap("n", "<leader>tk", function() -- open term in new tab
|
||||
vim.cmd.tabnew()
|
||||
vim.cmd.term()
|
||||
vim.cmd.startinsert()
|
||||
end)
|
||||
Keymap("t", "<C-D>", "<C-\\><C-n>") -- escape terminal with c-d
|
||||
|
||||
-- Flash keymaps
|
||||
Keymap("n", "ss", function()
|
||||
require("flash").jump()
|
||||
|
||||
@@ -12,7 +12,7 @@ require("conform").setup({
|
||||
html = { "prettier" },
|
||||
svelte = { "prettier" },
|
||||
python = { "black" },
|
||||
nix = { "nixfmt" },
|
||||
nix = { "alejandra" },
|
||||
css = { "prettier" },
|
||||
rust = { "rustfmt" },
|
||||
},
|
||||
|
||||
@@ -4,6 +4,32 @@ vim.pack.add({
|
||||
{ src = "https://github.com/saghen/blink.lib", name = "blink-lib" },
|
||||
})
|
||||
|
||||
local hostname = vim.uv.os_gethostname()
|
||||
local lowerHostname = string.lower(hostname)
|
||||
|
||||
vim.lsp.config("nixd", {
|
||||
cmd = { "nixd" },
|
||||
filetypes = { "nix" },
|
||||
root_markers = { "flake.nix", ".git" },
|
||||
settings = {
|
||||
nixd = {
|
||||
nixpkgs = {
|
||||
expr = "import <nixpkgs> { }",
|
||||
},
|
||||
formatting = {
|
||||
command = { "alejandra" },
|
||||
},
|
||||
options = {
|
||||
nixos = {
|
||||
expr = '(builtins.getFlake "~/.dotfiles/.nixos").nixosConfigurations.'
|
||||
.. lowerHostname
|
||||
.. ".options",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
@@ -43,6 +69,7 @@ require("blink.cmp").setup({
|
||||
trigger = {
|
||||
show_on_insert = true,
|
||||
show_on_trigger_character = true,
|
||||
show_on_keyword = true,
|
||||
show_on_backspace = true,
|
||||
},
|
||||
list = {
|
||||
|
||||
@@ -22,6 +22,7 @@ require("telescope").setup({
|
||||
},
|
||||
n = {
|
||||
["<CR>"] = actions.select_drop,
|
||||
["d"] = actions.delete_buffer,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -5,23 +5,23 @@
|
||||
"src": "https://github.com/okuuva/auto-save.nvim"
|
||||
},
|
||||
"blink": {
|
||||
"rev": "2ef3db111181c5eef22a462aa0122349a6027f28",
|
||||
"rev": "3db7326f54b73df4789e0fd6274bedda33975fea",
|
||||
"src": "https://github.com/saghen/blink.cmp"
|
||||
},
|
||||
"blink-lib": {
|
||||
"rev": "f29d8bac6549bc1e7d699c83f680823d7def98bd",
|
||||
"rev": "b127d48bf8e9ac9cf41f6e0fbead317503f76558",
|
||||
"src": "https://github.com/saghen/blink.lib"
|
||||
},
|
||||
"catppuccin": {
|
||||
"rev": "426dbebe06b5c69fd846ceb17b42e12f890aedf1",
|
||||
"rev": "0303a7208dba448c459767486a38a6ec05c4216b",
|
||||
"src": "https://github.com/catppuccin/nvim"
|
||||
},
|
||||
"conform": {
|
||||
"rev": "dca1a190aa85f9065979ef35802fb77131911106",
|
||||
"rev": "619363c30309d29ffa631e67c8183f2a72caa373",
|
||||
"src": "https://github.com/stevearc/conform.nvim"
|
||||
},
|
||||
"devicons": {
|
||||
"rev": "2795c26c916bb3c57dde308b82be51971fa92747",
|
||||
"rev": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c",
|
||||
"src": "https://github.com/nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
"flash": {
|
||||
@@ -33,15 +33,15 @@
|
||||
"src": "https://github.com/folke/lazydev.nvim"
|
||||
},
|
||||
"lint": {
|
||||
"rev": "eab58b48eb11d7745c11c505e0f3057165902461",
|
||||
"rev": "99cbc3ca8a76845fca50e496be7212bebf907dd3",
|
||||
"src": "https://github.com/mfussenegger/nvim-lint"
|
||||
},
|
||||
"lspconfig": {
|
||||
"rev": "451d4ef9abd4f0f08e379ef0d55d1c391b6125a7",
|
||||
"rev": "229b79051b380377664edc4cbd534930154921a1",
|
||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
"lualine": {
|
||||
"rev": "131a558e13f9f28b15cd235557150ccb23f89286",
|
||||
"rev": "221ce6b2d999187044529f49da6554a92f740a96",
|
||||
"src": "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
"lualine-time": {
|
||||
@@ -49,7 +49,7 @@
|
||||
"src": "https://github.com/archibate/lualine-time"
|
||||
},
|
||||
"mini": {
|
||||
"rev": "a5fda91040763cf9ad70bdce1c656b0f4ba1d16e",
|
||||
"rev": "d5e6f5b843f1d813d9c4bfb242b751dc5ab6f8ae",
|
||||
"src": "https://github.com/echasnovski/mini.nvim"
|
||||
},
|
||||
"noice": {
|
||||
@@ -69,7 +69,7 @@
|
||||
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
"remember": {
|
||||
"rev": "85aff6dc0a5adab088ef6b9210585ded31c32c7b",
|
||||
"rev": "e73350b07afdd4242a57e2e7c2b7cd38fce31d59",
|
||||
"src": "https://github.com/vladdoster/remember.nvim"
|
||||
},
|
||||
"scrolleof": {
|
||||
@@ -77,7 +77,7 @@
|
||||
"src": "https://github.com/Aasim-A/scrollEOF.nvim"
|
||||
},
|
||||
"telescope": {
|
||||
"rev": "f04ab730b8f9c6bf3f54a206d0dcddfd70c52d59",
|
||||
"rev": "7d324792b7943e4aa16ad007212e6acc6f9fe335",
|
||||
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
"telescope-file-browser": {
|
||||
@@ -89,7 +89,7 @@
|
||||
"src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
|
||||
},
|
||||
"telescope-nerdy": {
|
||||
"rev": "97b0914dece80204a777f04c94b9980da0f7ac88",
|
||||
"rev": "8fd18f0075c480b4e0865464dcd4fb7a42c6889e",
|
||||
"src": "https://github.com/2kabhishek/nerdy.nvim"
|
||||
},
|
||||
"telescope-symbols": {
|
||||
@@ -105,7 +105,7 @@
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
"vimade": {
|
||||
"rev": "9b2eacd9c97c0bb547f6f3a27e8b5b7a70ad4d03",
|
||||
"rev": "a5323f4930e3f1f48c0329e50bd218ba61577aaf",
|
||||
"src": "https://github.com/tadaa/vimade"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user