104 lines
2.8 KiB
Nix
104 lines
2.8 KiB
Nix
{ config, lib, ... }:
|
|
|
|
let
|
|
inherit (lib.mod) leader cmd cr ctrl;
|
|
in
|
|
{
|
|
vim.opt = {
|
|
# Better Unix support
|
|
viewoptions = lib.mkDefault [ "folds" "options" "cursor" "unix" "slash" ];
|
|
encoding = lib.mkDefault "utf-8";
|
|
|
|
# Enable 24-bit color
|
|
termguicolors = lib.mkDefault true;
|
|
|
|
# Other options
|
|
backspace = lib.mkDefault [ "indent" "eol" "start" ];
|
|
laststatus = lib.mkDefault 2;
|
|
showmode = lib.mkDefault false;
|
|
|
|
# Tabs as spaces
|
|
expandtab = lib.mkDefault true;
|
|
tabstop = lib.mkDefault 2;
|
|
softtabstop = lib.mkDefault 2;
|
|
shiftwidth = lib.mkDefault 2;
|
|
|
|
# Fixes broken cursor on Linux
|
|
guicursor = lib.mkDefault "";
|
|
|
|
# Disable mouse / touchpad
|
|
mouse = lib.mkDefault "";
|
|
|
|
# Incremental substitutin
|
|
inccommand = lib.mkDefault "split";
|
|
|
|
# Hide files when leaving them.
|
|
hidden = lib.mkDefault true;
|
|
# Show line numbers.
|
|
number = lib.mkDefault true;
|
|
# Minimum line number column width.
|
|
numberwidth = lib.mkDefault 1;
|
|
# Number of screen lines to use for the commandline.
|
|
cmdheight = lib.mkDefault 2;
|
|
# Lines length limit (0 if no limit).
|
|
textwidth = lib.mkDefault 0;
|
|
# Don't cut lines in the middle of a work.
|
|
linebreak = lib.mkDefault true;
|
|
# Show matching parenthesis.
|
|
showmatch = lib.mkDefault true;
|
|
# Time during which the matching parenthesis is shown.
|
|
matchtime = lib.mkDefault 2;
|
|
# Sensible default line auto cutting and formatting.
|
|
formatoptions = lib.mkDefault "jtcrq";
|
|
# Copy/Past to/from clipboard.
|
|
clipboard = lib.mkDefault "unnamedplus";
|
|
# Highlight line cursor is currently on.
|
|
cursorline = lib.mkDefault true;
|
|
# Invisible characters representation when :set list
|
|
listchars = lib.mkDefault {
|
|
tab = "→ ";
|
|
trail = "~";
|
|
nbsp = "␣";
|
|
eol = "¬";
|
|
};
|
|
|
|
# Search
|
|
# Incremental search.
|
|
incsearch = lib.mkDefault true;
|
|
# Case insensitive.
|
|
ignorecase = lib.mkDefault true;
|
|
# Case insensitive if no uppercase letter in pattern, case sensitive otherwise.
|
|
smartcase = lib.mkDefault true;
|
|
|
|
# Fold level
|
|
foldlevel = lib.mkDefault 99;
|
|
foldlevelstart = lib.mkDefault 99;
|
|
foldminlines = lib.mkDefault 3;
|
|
foldnestmax = lib.mkDefault 5;
|
|
};
|
|
|
|
plugins.navigation.nvim-tree.enable = lib.mkDefault true;
|
|
|
|
vim.keymap.set = with lib.nix2lua; [
|
|
{
|
|
mode = "n";
|
|
lhs = ctrl "z";
|
|
rhs = lambda0 (set "vim.opt.hlsearch" false);
|
|
desc = "Clear search highlighting";
|
|
}
|
|
]
|
|
++ lib.optionals config.plugins.navigation.nvim-tree.enable [
|
|
{
|
|
mode = "n";
|
|
lhs = "${leader}nt";
|
|
rhs = "${cmd}NvimTreeToggle${cr}";
|
|
desc = "Open/Close file tree";
|
|
}
|
|
{
|
|
mode = "n";
|
|
lhs = "${leader}nf";
|
|
rhs = "${cmd}NvimTreeFindFile${cr}";
|
|
desc = "Open file tree and find current file";
|
|
}
|
|
];
|
|
}
|