refactor(config): auto-import config files
This commit is contained in:
parent
1c12503ebf
commit
465916d5c1
5 changed files with 126 additions and 109 deletions
|
|
@ -1,13 +1,14 @@
|
||||||
# Use catppuccin mocha variant
|
|
||||||
{
|
{
|
||||||
catppuccin = {
|
colorschemes = {
|
||||||
enable = true;
|
catppuccin = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
flavour = "mocha";
|
flavour = "mocha";
|
||||||
|
|
||||||
# Needed to keep terminal transparency, if any
|
# Needed to keep terminal transparency, if any
|
||||||
transparent_background = true;
|
transparent_background = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
config/default.nix
Normal file
13
config/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{ lib, ... }@args:
|
||||||
|
|
||||||
|
let
|
||||||
|
definitions = lib.attrNames (
|
||||||
|
lib.filterAttrs
|
||||||
|
(filename: kind:
|
||||||
|
filename != "default.nix"
|
||||||
|
&& (kind == "regular" || kind == "directory")
|
||||||
|
)
|
||||||
|
(builtins.readDir ./.)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
lib.mkMerge (map (file: import ./${file}) definitions)
|
||||||
|
|
@ -4,30 +4,32 @@ let
|
||||||
options.desc = "Force write";
|
options.desc = "Force write";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
[
|
{
|
||||||
{
|
keymaps = [
|
||||||
key = "<leader>n";
|
{
|
||||||
action = "<cmd>enew<cr>";
|
key = "<leader>n";
|
||||||
options.desc = "New file";
|
action = "<cmd>enew<cr>";
|
||||||
}
|
options.desc = "New file";
|
||||||
{
|
}
|
||||||
inherit (forceWrite) action options;
|
{
|
||||||
key = "<c-s>";
|
inherit (forceWrite) action options;
|
||||||
}
|
key = "<c-s>";
|
||||||
{
|
}
|
||||||
inherit (forceWrite) options;
|
{
|
||||||
mode = [ "i" "x" ];
|
inherit (forceWrite) options;
|
||||||
key = "<c-s>";
|
mode = [ "i" "x" ];
|
||||||
action = "<esc>${forceWrite.action}";
|
key = "<c-s>";
|
||||||
}
|
action = "<esc>${forceWrite.action}";
|
||||||
{
|
}
|
||||||
key = "|";
|
{
|
||||||
action = "<cmd>vsplit<cr>";
|
key = "|";
|
||||||
options.desc = "Split vertically";
|
action = "<cmd>vsplit<cr>";
|
||||||
}
|
options.desc = "Split vertically";
|
||||||
{
|
}
|
||||||
key = "\\";
|
{
|
||||||
action = "<cmd>split<cr>";
|
key = "\\";
|
||||||
options.desc = "Split horizontally";
|
action = "<cmd>split<cr>";
|
||||||
}
|
options.desc = "Split horizontally";
|
||||||
]
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,102 +2,104 @@
|
||||||
# Use :options to get the list of all options
|
# Use :options to get the list of all options
|
||||||
# Use :h <option> to load help for given <option>
|
# Use :h <option> to load help for given <option>
|
||||||
{
|
{
|
||||||
# Hide command line unless needed
|
opts = {
|
||||||
cmdheight = 0;
|
# Hide command line unless needed
|
||||||
|
cmdheight = 0;
|
||||||
|
|
||||||
# Insert mode completion options
|
# Insert mode completion options
|
||||||
completeopt = [ "menu" "menuone" "noselect" ];
|
completeopt = [ "menu" "menuone" "noselect" ];
|
||||||
|
|
||||||
# Copy previous indentation on autoindenting
|
# Copy previous indentation on autoindenting
|
||||||
copyindent = true;
|
copyindent = true;
|
||||||
|
|
||||||
# Highlight current line
|
# Highlight current line
|
||||||
cursorline = true;
|
cursorline = true;
|
||||||
|
|
||||||
# Expand <Tab> to spaces
|
# Expand <Tab> to spaces
|
||||||
expandtab = true;
|
expandtab = true;
|
||||||
|
|
||||||
# Enable fold with all code unfolded
|
# Enable fold with all code unfolded
|
||||||
foldcolumn = "1";
|
foldcolumn = "1";
|
||||||
foldenable = true;
|
foldenable = true;
|
||||||
foldlevel = 99;
|
foldlevel = 99;
|
||||||
foldlevelstart = 99;
|
foldlevelstart = 99;
|
||||||
|
|
||||||
# Ignore case in search patterns
|
# Ignore case in search patterns
|
||||||
ignorecase = true;
|
ignorecase = true;
|
||||||
|
|
||||||
# Show substitution preview in split window
|
# Show substitution preview in split window
|
||||||
inccommand = "split";
|
inccommand = "split";
|
||||||
|
|
||||||
# Infer casing on word completion
|
# Infer casing on word completion
|
||||||
infercase = true;
|
infercase = true;
|
||||||
|
|
||||||
# Enable list mode
|
# Enable list mode
|
||||||
list = true;
|
list = true;
|
||||||
|
|
||||||
# Set custom strings for list mode
|
# Set custom strings for list mode
|
||||||
# - tabulations are shown as ‒▶
|
# - tabulations are shown as ‒▶
|
||||||
# - trailing spaces are shown as ·
|
# - trailing spaces are shown as ·
|
||||||
# - multiple non-leading consecutive spaces are shown as bullets (·)
|
# - multiple non-leading consecutive spaces are shown as bullets (·)
|
||||||
# - non-breakable spaces are shown as ⎕
|
# - non-breakable spaces are shown as ⎕
|
||||||
listchars = "tab:‒▶,trail:·,multispace:·,lead: ,nbsp:⎕";
|
listchars = "tab:‒▶,trail:·,multispace:·,lead: ,nbsp:⎕";
|
||||||
|
|
||||||
# Show line numbers
|
# Show line numbers
|
||||||
number = true;
|
number = true;
|
||||||
|
|
||||||
# Preserve indentation as much as possible
|
# Preserve indentation as much as possible
|
||||||
preserveindent = true;
|
preserveindent = true;
|
||||||
|
|
||||||
# Height of the popup menu
|
# Height of the popup menu
|
||||||
pumheight = 10;
|
pumheight = 10;
|
||||||
|
|
||||||
# Display line numbers relative to current line
|
# Display line numbers relative to current line
|
||||||
relativenumber = true;
|
relativenumber = true;
|
||||||
|
|
||||||
# Minimal number of lines to keep around the cursor
|
# Minimal number of lines to keep around the cursor
|
||||||
# This has the effect to move the view along with current line
|
# This has the effect to move the view along with current line
|
||||||
#scrolloff = 999;
|
#scrolloff = 999;
|
||||||
|
|
||||||
# Number of spaces to use for indentation
|
# Number of spaces to use for indentation
|
||||||
shiftwidth = 2;
|
shiftwidth = 2;
|
||||||
|
|
||||||
# Always show tabline (TODO: use with heirline?)
|
# Always show tabline (TODO: use with heirline?)
|
||||||
#showtabline = 2;
|
#showtabline = 2;
|
||||||
|
|
||||||
# Show signs instead of number in gutter
|
# Show signs instead of number in gutter
|
||||||
signcolumn = "number";
|
signcolumn = "number";
|
||||||
|
|
||||||
# Override ignorecase if search pattern contains uppercase characters
|
# Override ignorecase if search pattern contains uppercase characters
|
||||||
smartcase = true;
|
smartcase = true;
|
||||||
|
|
||||||
# Number of spaces input on <Tab>
|
# Number of spaces input on <Tab>
|
||||||
softtabstop = 2;
|
softtabstop = 2;
|
||||||
|
|
||||||
# Open horizontal split below (:split)
|
# Open horizontal split below (:split)
|
||||||
splitbelow = true;
|
splitbelow = true;
|
||||||
|
|
||||||
# Open vertical split to the right (:vsplit)
|
# Open vertical split to the right (:vsplit)
|
||||||
splitright = true;
|
splitright = true;
|
||||||
|
|
||||||
# Number of spaces to represent a <Tab>
|
# Number of spaces to represent a <Tab>
|
||||||
tabstop = 2;
|
tabstop = 2;
|
||||||
|
|
||||||
# Enables 24-bit RGB color
|
# Enables 24-bit RGB color
|
||||||
termguicolors = true;
|
termguicolors = true;
|
||||||
|
|
||||||
# Shorter timeout duration
|
# Shorter timeout duration
|
||||||
timeoutlen = 500;
|
timeoutlen = 500;
|
||||||
|
|
||||||
# Set window title to the filename
|
# Set window title to the filename
|
||||||
title = true;
|
title = true;
|
||||||
|
|
||||||
# Save undo history to undo file (in $XDG_STATE_HOME/nvim/undo)
|
# Save undo history to undo file (in $XDG_STATE_HOME/nvim/undo)
|
||||||
undofile = true;
|
undofile = true;
|
||||||
|
|
||||||
# Enable virtual edit in visual block mode
|
# Enable virtual edit in visual block mode
|
||||||
# This has the effect of selecting empty cells beyond lines boundaries
|
# This has the effect of selecting empty cells beyond lines boundaries
|
||||||
virtualedit = "block";
|
virtualedit = "block";
|
||||||
|
|
||||||
# Disable line wrapping
|
# Disable line wrapping
|
||||||
wrap = false;
|
wrap = false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
default.nix
11
default.nix
|
|
@ -1,13 +1,12 @@
|
||||||
{ pkgs, ... }:
|
_:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./plugins ];
|
imports = [
|
||||||
|
./config
|
||||||
|
./plugins
|
||||||
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
colorschemes = import ./config/colorscheme.nix;
|
|
||||||
keymaps = import ./config/keymaps.nix;
|
|
||||||
opts = import ./config/options.nix;
|
|
||||||
|
|
||||||
# Needed for telescope live grep
|
# Needed for telescope live grep
|
||||||
extraPackages = [ pkgs.ripgrep ];
|
extraPackages = [ pkgs.ripgrep ];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue