forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.nix
75 lines (61 loc) · 1.95 KB
/
example.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ pkgs, ... }:
{
programs.nixvim = {
# This just enables NixVim.
# If all you have is this, then there will be little visible difference
# when compared to just installing NeoVim.
enable = true;
maps.normal = {
# Equivalent to nnoremap ; :
";" = ":";
# Equivalent to nmap <silent> <buffer> <leader>gg <cmd>Man<CR>
"<leader>gg" = { silent = true; remap = false; action = "<cmd>Man<CR>"
# Etc...
};
# We can set the leader key:
leader = ",";
# We can create maps for every mode!
# There is .normal, .insert, .visual, .operator, etc!
# We can also set options:
options = {
tabstop = 4;
shiftwidth = 4;
expandtab = false;
mouse = "a";
# etc...
};
# Of course, we can still use comfy vimscript:
extraConfigVim = builtins.readFile ./init.vim;
# Or lua!
extraConfigLua = builtins.readFile ./init.lua;
# 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;
# This is optional - it will default to your enabled colorscheme
colorscheme = "wombat";
# This is one of lightline's example configurations
active = {
left = [
[ "mode", "paste" ]
[ "redaonly", "filename", "modified", "helloworld" ]
];
};
component = {
helloworld = "Hello, world!";
};
};
# Of course, there are a lot more plugins available.
# You can find an up-to-date list here:
# https://nixvim.pta2002.com/plugins
};
# 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 ];
};
}