2024-05-05 19:39:35 +02:00
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
2020-12-30 01:05:51 +00:00
|
|
|
programs.nixvim = {
|
2023-01-10 13:41:47 +01:00
|
|
|
# This just enables NixVim.
|
2020-12-30 01:05:51 +00:00
|
|
|
# If all you have is this, then there will be little visible difference
|
|
|
|
# when compared to just installing NeoVim.
|
|
|
|
enable = true;
|
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
keymaps = [
|
2020-12-30 01:05:51 +00:00
|
|
|
# Equivalent to nnoremap ; :
|
2023-09-10 09:59:22 +02:00
|
|
|
{
|
|
|
|
key = ";";
|
|
|
|
action = ":";
|
|
|
|
}
|
|
|
|
|
2020-12-30 01:05:51 +00:00
|
|
|
# Equivalent to nmap <silent> <buffer> <leader>gg <cmd>Man<CR>
|
2023-09-10 09:59:22 +02:00
|
|
|
{
|
|
|
|
key = "<leader>gg";
|
2022-10-04 00:13:08 +01:00
|
|
|
action = "<cmd>Man<CR>";
|
2023-09-10 09:59:22 +02:00
|
|
|
options = {
|
|
|
|
silent = true;
|
|
|
|
remap = false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
# Etc...
|
|
|
|
];
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
# We can set the leader key:
|
2023-10-22 14:28:36 +02:00
|
|
|
globals.mapleader = ",";
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
# We can create maps for every mode!
|
|
|
|
# There is .normal, .insert, .visual, .operator, etc!
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
# We can also set options:
|
2024-03-29 20:58:44 +00:00
|
|
|
opts = {
|
2023-09-10 09:59:22 +02:00
|
|
|
tabstop = 4;
|
|
|
|
shiftwidth = 4;
|
|
|
|
expandtab = false;
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
mouse = "a";
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
# etc...
|
|
|
|
};
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
# Of course, we can still use comfy vimscript:
|
|
|
|
extraConfigVim = builtins.readFile ./init.vim;
|
|
|
|
# Or lua!
|
|
|
|
extraConfigLua = builtins.readFile ./init.lua;
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
# One of the big advantages of NixVim is how it provides modules for
|
|
|
|
# popular vim plugins
|
|
|
|
# Enabling a plugin this way skips all the boring configuration that
|
|
|
|
# some plugins tend to require.
|
|
|
|
plugins = {
|
|
|
|
lightline = {
|
|
|
|
enable = true;
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
# This is optional - it will default to your enabled colorscheme
|
2024-08-23 09:17:11 -05:00
|
|
|
settings = {
|
|
|
|
colorscheme = "wombat";
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2024-08-23 09:17:11 -05:00
|
|
|
# This is one of lightline's example configurations
|
|
|
|
active = {
|
|
|
|
left = [
|
|
|
|
[
|
|
|
|
"mode"
|
|
|
|
"paste"
|
|
|
|
]
|
|
|
|
[
|
|
|
|
"readonly"
|
|
|
|
"filename"
|
|
|
|
"modified"
|
|
|
|
"helloworld"
|
|
|
|
]
|
|
|
|
];
|
|
|
|
};
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2024-08-23 09:17:11 -05:00
|
|
|
component = {
|
|
|
|
helloworld = "Hello, world!";
|
|
|
|
};
|
2023-09-10 09:59:22 +02:00
|
|
|
};
|
2022-10-04 00:13:08 +01:00
|
|
|
};
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2023-09-10 09:59:22 +02:00
|
|
|
# Of course, there are a lot more plugins available.
|
|
|
|
# You can find an up-to-date list here:
|
|
|
|
# https://nixvim.pta2002.com/plugins
|
2022-10-04 00:13:08 +01:00
|
|
|
};
|
2023-09-10 09:59:22 +02:00
|
|
|
|
|
|
|
# There is a separate namespace for colorschemes:
|
|
|
|
colorschemes.gruvbox.enable = true;
|
|
|
|
|
|
|
|
# What about plugins not available as a module?
|
|
|
|
# Use extraPlugins:
|
2024-05-05 19:39:35 +02:00
|
|
|
extraPlugins = with pkgs.vimPlugins; [ vim-toml ];
|
2020-12-30 01:05:51 +00:00
|
|
|
};
|
|
|
|
}
|