nix-community.nixvim/example.nix

86 lines
2.1 KiB
Nix
Raw Normal View History

{pkgs, ...}: {
2020-12-30 01:05:51 +00:00
programs.nixvim = {
# 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:
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:
options = {
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
colorscheme = "wombat";
2020-12-30 01:05:51 +00:00
2023-09-10 09:59:22 +02:00
# This is one of lightline's example configurations
active = {
left = [
["mode" "paste"]
2024-03-07 19:49:30 +01:00
["readonly" "filename" "modified" "helloworld"]
2023-09-10 09:59:22 +02:00
];
2020-12-30 01:05:51 +00:00
};
2023-09-10 09:59:22 +02:00
component = {
helloworld = "Hello, world!";
};
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:
extraPlugins = with pkgs.vimPlugins; [vim-toml];
2020-12-30 01:05:51 +00:00
};
}