Compare commits

..

16 commits

Author SHA1 Message Date
10253909c9
docs: update readme 2024-09-17 02:08:57 -07:00
9832d50fde
feat: set keybinds manually in oil and optimize keybinds 2024-09-17 02:07:12 -07:00
d1db93ef00
feat: add lualine lspprogress autocmd 2024-09-17 01:39:07 -07:00
4fa6fcdd51
style(lualine): reorder and change lsp icon 2024-09-17 01:26:56 -07:00
ee5453c9d1
docs: update readme description 2024-09-17 01:01:30 -07:00
48fb7eb2f7
feat: set up some keymaps for oil 2024-09-17 00:57:12 -07:00
c5f5e6dd9c
chore: format readme 2024-09-17 00:57:05 -07:00
7b6cafd1fc
chore: remove unused yazi plugin 2024-09-17 00:49:59 -07:00
1bc0a35230
fix: path collision 2024-09-17 00:49:49 -07:00
6297ec9225
flake.lock: Update
Flake lock file updates:

• Updated input 'haskell-tools':
    'github:mrcjkb/haskell-tools.nvim/2443c3b2ab049561009d1b5712e839db546b6586' (2024-09-10)
  → 'github:mrcjkb/haskell-tools.nvim/1edf2bb5ced056b5d3d1df783dd02041ce09b087' (2024-09-16)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/1355a0cbfeac61d785b7183c0caaec1f97361b43' (2024-09-10)
  → 'github:nixos/nixpkgs/99dc8785f6a0adac95f5e2ab05cc2e1bf666d172' (2024-09-16)
• Updated input 'nixvim':
    'github:nix-community/nixvim/27a0dd435dd3563f4cf9d788601fadfce8c59db6' (2024-09-12)
  → 'github:nix-community/nixvim/2e3083e42509c399b224239f6d7fa17976b18536' (2024-09-16)
• Updated input 'nixvim/flake-parts':
    'github:hercules-ci/flake-parts/8471fe90ad337a8074e957b69ca4d0089218391d' (2024-08-01)
  → 'github:hercules-ci/flake-parts/bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a' (2024-09-12)
• Updated input 'nixvim/git-hooks':
    'github:cachix/git-hooks.nix/4509ca64f1084e73bc7a721b20c669a8d4c5ebe6' (2024-08-28)
  → 'github:cachix/git-hooks.nix/7570de7b9b504cfe92025dd1be797bf546f66528' (2024-09-05)
• Updated input 'nixvim/home-manager':
    'github:nix-community/home-manager/c2cd2a52e02f1dfa1c88f95abeb89298d46023be' (2024-08-23)
  → 'github:nix-community/home-manager/e524c57b1fa55d6ca9d8354c6ce1e538d2a1f47f' (2024-09-14)
• Updated input 'nixvim/nix-darwin':
    'github:lnl7/nix-darwin/ac5694a0b855a981e81b4d9f14052e3ff46ca39e' (2024-08-25)
  → 'github:lnl7/nix-darwin/21fe31f26473c180390cfa81e3ea81aca0204c80' (2024-09-13)
• Updated input 'nixvim/nuschtosSearch':
    'github:NuschtOS/search/5a08d691de30b6fc28d58ce71a5e420f2694e087' (2024-08-25)
  → 'github:NuschtOS/search/97d34b70deed4878fcb2449ac89dab717d72efa1' (2024-09-15)
• Updated input 'nixvim/treefmt-nix':
    'github:numtide/treefmt-nix/3ffd842a5f50f435d3e603312eefa4790db46af5' (2024-08-28)
  → 'github:numtide/treefmt-nix/9fb342d14b69aefdf46187f6bb80a4a0d97007cd' (2024-09-02)
• Updated input 'render-markdown':
    'github:MeanderingProgrammer/render-markdown.nvim/cdb58fc97c49a1ab75b35d99183c35b5863e845a' (2024-09-13)
  → 'github:MeanderingProgrammer/render-markdown.nvim/2424693c7a4c79641a7ea1e2a838dbc9238d6066' (2024-09-16)
2024-09-17 00:45:29 -07:00
bbdb3aab05
chore: flake.nix formatting 2024-09-17 00:45:01 -07:00
64e46fded8
chore: update flake metadata 2024-09-17 00:44:32 -07:00
74bdb1aa49
chore: remove bundled LSPs 2024-09-17 00:43:09 -07:00
acc0ad0c5a
chore: disable mini.notify lsp_progress integration 2024-09-17 00:43:08 -07:00
2758fd1022
feat: add lsp-progress.nvim
also removes unused yazi dependency
2024-09-17 00:43:08 -07:00
414e46dd15
feat: minor overhaul
* switch to oil.nvim from yazi
* use lualine with custom config
* optimize settings
2024-09-16 23:49:09 -07:00
12 changed files with 247 additions and 74 deletions

View file

@ -1,30 +1,46 @@
# Neovim Configuration Flake
This is the Neovim configuration for all my NixOS and Nix enabled systems (such as with nix-darwin on macOS).
It aims to be minimal and utilitarian; it forgoes many blingful features like status lines, sidebars, or fancy UI enhancements
in favor of native (neo)Vim, while still having everything useful you'd expect, like LSPs, file explorer (`yazi`), completions,
advanced language tools, and QoL enhancements.
This is the Neovim configuration for all my NixOS and Nix enabled systems (such
as with nix-darwin on macOS). It aims to be minimal and utilitarian; it forgoes
many blingful features like sidebars or fancy UI enhancements in favor of
native (neo)Vim, while still having everything useful you'd expect, like LSPs,
file explorer (`oil.nvim`), completions, advanced language tools, and QoL
enhancements.
It uses the [Nixvim](https://nix-community.github.io/nixvim/) project under the hood to declaratively
configure Neovim and its plugins, and installs some LSPs and other tools needed by it (like `yazi`, `fd`, etc).
It uses the [Nixvim](https://nix-community.github.io/nixvim/) project under
the hood to declaratively configure Neovim and its plugins, and installs tools
needed by it (like `ripgrep`, `fd`, etc). However, LSPs are not installed or
handled by the plugin. The user is expected to provide their own LSPs in the
`$PATH`, but since they are using Nix, this is trivial.
It simply outputs a package which provides the binary `nvim`. It can be called just like the regular `nvim` binary, except it bundles
all of my custom configuration and their dependencies with the power of Nix. An entirely self-contained, reproducible, purely functional text editor. Amazing.
The flake simply provides a package that contains the binaries `nvim`, `vim`,
and `vi`. It can be called just like the regular `nvim` binary (`vim` and `vi`
are just symlinks to `nvim`), except it bundles all of my custom configuration
and their dependencies with the power of Nix. Plugins are managed by Nix. An
entirely self-contained, reproducible, purely functional text editor. Amazing.
Feel free to fork or copy the config to use yourself. It's free in the [public domain](./LICENSE).
All plugins are precompiled to Lua bytecode by `Luajit` when the package is
built for maximum speed and efficiency. When possible, plugins are also
combined for a massive efficiency boost. This allows startup times as fast as
lazy loading without all of the hassle.
Thanks to [this gist](https://gist.github.com/siph/288b7c6b5f68a1902d28aebc95fde4c5) for showing me how to
build a Nixvim configuration as a standalone Nix package.
Feel free to fork or copy the config to use yourself. It's free in the [public
domain](./LICENSE).
Thanks to [this
gist](https://gist.github.com/siph/288b7c6b5f68a1902d28aebc95fde4c5) for
showing me how to build a Nixvim configuration as a standalone Nix package.
## Usage
You can test drive my config in just one line (if you have Nix, of course):
```sh
nix run 'github:youwen5/neovim-flake' --extra-experimental-features flakes --extra-experimental-features nix-command
```
If for some reason, you want to install it permanently, add it to your flake inputs,
and install the package in the usual way:
If for some reason, you want to install it permanently, add it to your flake
inputs, and install the package in the usual way:
```nix
# flake.nix
@ -54,7 +70,7 @@ and install the package in the usual way:
```
> [!WARNING]
> This package will add the symlinks `vim -> nvim` and `vi -> nvim` so it will conflict with
> `pkgs.vim` and any programs installing binaries called `vim` or `vi`. You must remove existing
> Neovim and Vim packages to install this.
> This package will add the symlinks `vim -> nvim` and `vi -> nvim`
> so it will conflict with `pkgs.vim` and any programs installing binaries
> called `vim` or `vi`. You must remove existing Neovim and Vim packages to
> install this.

View file

@ -1,4 +1,3 @@
{ pkgs, ... }:
{
imports = [
./plugins
@ -13,7 +12,17 @@
luaLoader.enable = true;
performance = {
combinePlugins.enable = true;
byteCompileLua.enable = true;
combinePlugins = {
enable = true;
standalonePlugins = [
"nvim-treesitter"
"vimplugin-treesitter-grammar-nix"
];
};
byteCompileLua = {
enable = true;
plugins = true;
nvimRuntime = true;
};
};
}

View file

@ -323,10 +323,19 @@
options.desc = "Look through yank history with telescope.";
}
{
action = '':lua require("yazi").yazi()<CR>'';
action = '':Oil<CR>'';
key = "<Leader>e";
options = {
desc = "Open Yazi current nvim working directory";
desc = "Open oil file explorer in current nvim working directory";
noremap = true;
silent = true;
};
}
{
action = '':Oil<CR>'';
key = "<Leader>e";
options = {
desc = "Open oil file explorer in current nvim working directory";
noremap = true;
silent = true;
};
@ -377,15 +386,6 @@
};
}
# {
# action = ":Yazi<CR>";
# key = "<Leader>mf";
# options = {
# desc = "Open Yazi at current file";
# noremap = true;
# silent = true;
# };
# }
# {
# action = "<cmd>lua require'conform'.format({ bufnr = args.bf })<CR>";
# key = "<Leader>cf";
# options = {

View file

@ -1,5 +1,9 @@
{
plugins = {
lspkind = {
enable = true;
cmp.enable = true;
};
cmp-async-path.enable = true;
cmp = {
enable = true;

View file

@ -28,6 +28,16 @@
plugins.conform-nvim = {
enable = true;
# because combinePlugins.enable = true, the collision of `doc` is
# unavoidable. this renames them.
package = pkgs.vimPlugins.conform-nvim.overrideAttrs (oldAttrs: {
postInstall =
(oldAttrs.postInstall or "")
+ ''
mv $out/doc/recipes.md $out/doc/conform-nvim_recipes.md
'';
});
# package = pkgs.vimPlugins.conform-nvim;
settings = {
format_on_save = {
timeoutMs = 500;

View file

@ -1,11 +1,6 @@
# LSP setup
{ pkgs, inputs, ... }:
{
extraPackages = with pkgs; [
rust-analyzer
lua-language-server
];
plugins = {
lsp = {
enable = true;

View file

@ -6,7 +6,9 @@
surround = { };
ai = { };
hipatterns = { };
notify = { };
notify = {
lsp_progress.enable = false;
};
tabline = { };
trailspace = { };
cursorword = { };

View file

@ -1,4 +1,5 @@
# Getting around REALLY FAST
{ pkgs, ... }:
{
plugins = {
telescope = {
@ -35,10 +36,38 @@
};
};
};
yazi = {
oil = {
enable = true;
# because combinePlugins.enable = true, the collision of `doc` is
# unavoidable. this renames them.
package = pkgs.vimPlugins.oil-nvim.overrideAttrs (oldAttrs: {
postInstall =
(oldAttrs.postInstall or "")
+ ''
mv $out/doc/recipes.md $out/doc/oil_recipes.md
'';
});
settings = {
open_for_directories = true;
keymaps = {
"J" = "actions.parent";
"Q" = "actions.close";
"<C-h>" = "actions.select_split";
"<C-l>" = "actions.refresh";
"<C-p>" = "actions.preview";
"<C-s>" = "actions.select_vsplit";
"<C-t>" = "actions.select_tab";
"<CR>" = "actions.select";
"K" = "actions.select";
_ = "actions.open_cwd";
"`" = "actions.cd";
"g." = "actions.toggle_hidden";
"g?" = "actions.show_help";
"g\\" = "actions.toggle_trash";
gs = "actions.change_sort";
gx = "actions.open_external";
"~" = "actions.tcd";
};
use_default_keymaps = false;
};
};
harpoon = {

View file

@ -3,7 +3,6 @@
{
extraPackages = with pkgs; [
ripgrep
yazi
fd
];
@ -22,6 +21,28 @@
enableTelescope = true;
};
trouble.enable = true;
barbecue.enable = true;
lualine = {
enable = true;
settings = {
sections = {
lualine_a = [ "branch" ];
lualine_b = [
{
__unkeyed-1 = {
__raw = ''
function()
return require('lsp-progress').progress()
end,
'';
};
}
];
lualine_c = [ "diff" ];
};
options.globalstatus = true;
};
};
crates-nvim.enable = true;
# git stuff
lazygit.enable = true;
@ -39,5 +60,9 @@
name = "render-markdown.nvim";
src = inputs.render-markdown;
})
(pkgs.vimUtils.buildVimPlugin {
name = "lsp-progress.nvim";
src = inputs.lsp-progress;
})
];
}

View file

@ -3,6 +3,64 @@
extraConfigLua = ''
require("telescope").load_extension("yank_history")
require("telescope").load_extension("ht")
vim.diagnostic.config({ virtual_lines = false });
vim.diagnostic.config({ virtual_lines = false })
require("lsp-progress").setup({
client_format = function(client_name, spinner, series_messages)
if #series_messages == 0 then
return nil
end
return {
name = client_name,
body = spinner .. " " .. table.concat(series_messages, ", "),
}
end,
format = function(client_messages)
--- @param name string
--- @param msg string?
--- @return string
local function stringify(name, msg)
return msg and string.format("%s %s", name, msg) or name
end
local sign = "󰆧" -- nf-fa-gear \uf013
local lsp_clients = vim.lsp.get_active_clients()
local messages_map = {}
for _, climsg in ipairs(client_messages) do
messages_map[climsg.name] = climsg.body
end
if #lsp_clients > 0 then
table.sort(lsp_clients, function(a, b)
return a.name < b.name
end)
local builder = {}
for _, cli in ipairs(lsp_clients) do
if
type(cli) == "table"
and type(cli.name) == "string"
and string.len(cli.name) > 0
then
if messages_map[cli.name] then
table.insert(builder, stringify(cli.name, messages_map[cli.name]))
else
table.insert(builder, stringify(cli.name))
end
end
end
if #builder > 0 then
return sign .. " " .. table.concat(builder, ", ")
end
end
return ""
end,
})
vim.api.nvim_create_augroup("lualine_augroup", { clear = true })
vim.api.nvim_create_autocmd("User", {
group = "lualine_augroup",
pattern = "LspProgressStatusUpdated",
callback = require("lualine").refresh,
})
'';
}

View file

@ -61,11 +61,11 @@
]
},
"locked": {
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"lastModified": 1726153070,
"narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a",
"type": "github"
},
"original": {
@ -109,11 +109,11 @@
]
},
"locked": {
"lastModified": 1724857454,
"narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=",
"lastModified": 1725513492,
"narHash": "sha256-tyMUA6NgJSvvQuzB7A1Sf8+0XCHyfSPRx/b00o6K0uo=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6",
"rev": "7570de7b9b504cfe92025dd1be797bf546f66528",
"type": "github"
},
"original": {
@ -147,11 +147,11 @@
"haskell-tools": {
"flake": false,
"locked": {
"lastModified": 1725935019,
"narHash": "sha256-M+AcprniBOBQFkhXCacAyBtFF5FZyGSG5F6e8ld+r9c=",
"lastModified": 1726521542,
"narHash": "sha256-TyqjJohmIwuqMqy01H3sRRcm8okNeWtAfLqX2Ehr9mQ=",
"owner": "mrcjkb",
"repo": "haskell-tools.nvim",
"rev": "2443c3b2ab049561009d1b5712e839db546b6586",
"rev": "1edf2bb5ced056b5d3d1df783dd02041ce09b087",
"type": "github"
},
"original": {
@ -168,11 +168,11 @@
]
},
"locked": {
"lastModified": 1724435763,
"narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=",
"lastModified": 1726357542,
"narHash": "sha256-p4OrJL2weh0TRtaeu1fmNYP6+TOp/W2qdaIJxxQay4c=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be",
"rev": "e524c57b1fa55d6ca9d8354c6ce1e538d2a1f47f",
"type": "github"
},
"original": {
@ -181,6 +181,22 @@
"type": "github"
}
},
"lsp-progress": {
"flake": false,
"locked": {
"lastModified": 1721008335,
"narHash": "sha256-OafRT5AnxRTOh7MYofRFjti0+pobKQihymZs/kr5w0A=",
"owner": "linrongbin16",
"repo": "lsp-progress.nvim",
"rev": "d5f4d28efe75ce636bfbe271eb45f39689765aab",
"type": "github"
},
"original": {
"owner": "linrongbin16",
"repo": "lsp-progress.nvim",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
@ -189,11 +205,11 @@
]
},
"locked": {
"lastModified": 1724561770,
"narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=",
"lastModified": 1726188813,
"narHash": "sha256-Vop/VRi6uCiScg/Ic+YlwsdIrLabWUJc57dNczp0eBc=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e",
"rev": "21fe31f26473c180390cfa81e3ea81aca0204c80",
"type": "github"
},
"original": {
@ -204,11 +220,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1725983898,
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
"lastModified": 1726463316,
"narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
"rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172",
"type": "github"
},
"original": {
@ -245,11 +261,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1726148694,
"narHash": "sha256-bR7LFVtMjiVlO2OpmDSuLQ2XQr+h+JtVFYObAbThZSs=",
"lastModified": 1726502324,
"narHash": "sha256-I/WFSIBeIjlY3CgSJ6IRYxP2aEJ6b42Y1HAeATlBh48=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "27a0dd435dd3563f4cf9d788601fadfce8c59db6",
"rev": "2e3083e42509c399b224239f6d7fa17976b18536",
"type": "github"
},
"original": {
@ -267,11 +283,11 @@
]
},
"locked": {
"lastModified": 1724584782,
"narHash": "sha256-7FfHv7b1jwMPSu9SPY9hdxStk8E6EeSwzqdvV69U4BM=",
"lastModified": 1726392886,
"narHash": "sha256-9RtOuG7V8KG8IU8nZje5EQ1WSM/inr7+zb3tAgTiHDM=",
"owner": "NuschtOS",
"repo": "search",
"rev": "5a08d691de30b6fc28d58ce71a5e420f2694e087",
"rev": "97d34b70deed4878fcb2449ac89dab717d72efa1",
"type": "github"
},
"original": {
@ -283,11 +299,11 @@
"render-markdown": {
"flake": false,
"locked": {
"lastModified": 1726214512,
"narHash": "sha256-lroID1tHXL91WxTMxy8CsDp/3M5oHVQ4SvwGSGkTa5k=",
"lastModified": 1726511696,
"narHash": "sha256-l0k39OXcpoH7D6UmuQy0LNLj+8HCkKz9R/4zVH4bEt0=",
"owner": "MeanderingProgrammer",
"repo": "render-markdown.nvim",
"rev": "cdb58fc97c49a1ab75b35d99183c35b5863e845a",
"rev": "2424693c7a4c79641a7ea1e2a838dbc9238d6066",
"type": "github"
},
"original": {
@ -300,6 +316,7 @@
"inputs": {
"flake-parts": "flake-parts",
"haskell-tools": "haskell-tools",
"lsp-progress": "lsp-progress",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"render-markdown": "render-markdown",
@ -345,11 +362,11 @@
]
},
"locked": {
"lastModified": 1724833132,
"narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=",
"lastModified": 1725271838,
"narHash": "sha256-VcqxWT0O/gMaeWTTjf1r4MOyG49NaNxW4GHTO3xuThE=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "3ffd842a5f50f435d3e603312eefa4790db46af5",
"rev": "9fb342d14b69aefdf46187f6bb80a4a0d97007cd",
"type": "github"
},
"original": {

View file

@ -1,12 +1,15 @@
{
description = "Personal Neovim configuration.";
description = "A minimal and productive Neovim configuration.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
# Neovim plugins
render-markdown = {
url = "github:MeanderingProgrammer/render-markdown.nvim";
flake = false;
@ -19,6 +22,10 @@
url = "github:mrcjkb/haskell-tools.nvim";
flake = false;
};
lsp-progress = {
url = "github:linrongbin16/lsp-progress.nvim";
flake = false;
};
};
outputs =
@ -54,6 +61,7 @@
nvim = nixvim'.makeNixvimWithModule nixvimModule;
in
{
formatter = pkgs.nixfmt-rfc-style;
checks = {
default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;