mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
modules/keymaps: refactor + new syntax
This commit is contained in:
parent
382973b627
commit
574fb73258
6 changed files with 716 additions and 521 deletions
111
example.nix
111
example.nix
|
@ -5,74 +5,81 @@
|
|||
# when compared to just installing NeoVim.
|
||||
enable = true;
|
||||
|
||||
maps.normal = {
|
||||
keymaps = [
|
||||
# Equivalent to nnoremap ; :
|
||||
";" = ":";
|
||||
{
|
||||
key = ";";
|
||||
action = ":";
|
||||
}
|
||||
|
||||
# Equivalent to nmap <silent> <buffer> <leader>gg <cmd>Man<CR>
|
||||
"<leader>gg" = {
|
||||
silent = true;
|
||||
remap = false;
|
||||
{
|
||||
key = "<leader>gg";
|
||||
action = "<cmd>Man<CR>";
|
||||
# Etc...
|
||||
};
|
||||
options = {
|
||||
silent = true;
|
||||
remap = false;
|
||||
};
|
||||
}
|
||||
# Etc...
|
||||
];
|
||||
|
||||
# We can set the leader key:
|
||||
leader = ",";
|
||||
# We can set the leader key:
|
||||
leader = ",";
|
||||
|
||||
# We can create maps for every mode!
|
||||
# There is .normal, .insert, .visual, .operator, etc!
|
||||
# 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;
|
||||
# We can also set options:
|
||||
options = {
|
||||
tabstop = 4;
|
||||
shiftwidth = 4;
|
||||
expandtab = false;
|
||||
|
||||
mouse = "a";
|
||||
mouse = "a";
|
||||
|
||||
# etc...
|
||||
};
|
||||
# etc...
|
||||
};
|
||||
|
||||
# Of course, we can still use comfy vimscript:
|
||||
extraConfigVim = builtins.readFile ./init.vim;
|
||||
# Or lua!
|
||||
extraConfigLua = builtins.readFile ./init.lua;
|
||||
# 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;
|
||||
# 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 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!";
|
||||
};
|
||||
# This is one of lightline's example configurations
|
||||
active = {
|
||||
left = [
|
||||
["mode" "paste"]
|
||||
["redaonly" "filename" "modified" "helloworld"]
|
||||
];
|
||||
};
|
||||
|
||||
# Of course, there are a lot more plugins available.
|
||||
# You can find an up-to-date list here:
|
||||
# https://nixvim.pta2002.com/plugins
|
||||
component = {
|
||||
helloworld = "Hello, world!";
|
||||
};
|
||||
};
|
||||
|
||||
# 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];
|
||||
# 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];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue