refactor(plugins/astrocore): move some settings out of plugin
This commit is contained in:
parent
2b6a512de0
commit
1677fceed9
15 changed files with 720 additions and 778 deletions
|
|
@ -1,35 +0,0 @@
|
||||||
let
|
|
||||||
forceWrite = {
|
|
||||||
action = "<cmd>silent! update! | redraw<cr>";
|
|
||||||
options.desc = "Force write";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
key = "<leader>n";
|
|
||||||
action = "<cmd>enew<cr>";
|
|
||||||
options.desc = "New file";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
inherit (forceWrite) action options;
|
|
||||||
key = "<c-s>";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
inherit (forceWrite) options;
|
|
||||||
mode = [ "i" "x" ];
|
|
||||||
key = "<c-s>";
|
|
||||||
action = "<esc>${forceWrite.action}";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "|";
|
|
||||||
action = "<cmd>vsplit<cr>";
|
|
||||||
options.desc = "Split vertically";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "\\";
|
|
||||||
action = "<cmd>split<cr>";
|
|
||||||
options.desc = "Split horizontally";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
164
config/keymaps/buffers.nix
Normal file
164
config/keymaps/buffers.nix
Normal file
|
|
@ -0,0 +1,164 @@
|
||||||
|
# Manage buffers
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L56-L89
|
||||||
|
[
|
||||||
|
{
|
||||||
|
key = "<leader>c";
|
||||||
|
options.desc = "Close buffer";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>C";
|
||||||
|
options.desc = "Force close buffer";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close(0, true)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "]b";
|
||||||
|
options.desc = "Next buffer in tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").nav(vim.v.count1)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "[b";
|
||||||
|
options.desc = "Previous buffer in tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").nav(-vim.v.count1)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = ">b";
|
||||||
|
options.desc = "Move buffer tab right";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").move(vim.v.count1)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<b";
|
||||||
|
options.desc = "Move buffer tab left";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").move(-vim.v.count1)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>bc";
|
||||||
|
options.desc = "Close all buffers except current";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close_all(true)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>bC";
|
||||||
|
options.desc = "Close all buffers";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close_all()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>bl";
|
||||||
|
options.desc = "Close all buffers to the left";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close_left()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>bp";
|
||||||
|
options.desc = "Previous buffer";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").prev()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>br";
|
||||||
|
options.desc = "Close all buffers to the right";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close_right()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>bse";
|
||||||
|
options.desc = "By extension";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "extension"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>bsr";
|
||||||
|
options.desc = "By relative path";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "unique_path"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>bsp";
|
||||||
|
options.desc = "By full path";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "full_path"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>bsi";
|
||||||
|
options.desc = "By buffer number";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "bufnr"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>bsm";
|
||||||
|
options.desc = "By modification";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "modified"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
10
config/keymaps/default.nix
Normal file
10
config/keymaps/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
keymaps =
|
||||||
|
(import ./buffers.nix)
|
||||||
|
++ (import ./diagnostics.nix)
|
||||||
|
++ (import ./splits.nix)
|
||||||
|
++ (import ./standard.nix)
|
||||||
|
++ (import ./tabs.nix)
|
||||||
|
++ (import ./terminal.nix)
|
||||||
|
++ (import ./toggles.nix);
|
||||||
|
}
|
||||||
44
config/keymaps/diagnostics.nix
Normal file
44
config/keymaps/diagnostics.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
# Diagnostics
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L92-L100
|
||||||
|
[
|
||||||
|
{
|
||||||
|
key = "<Leader>ld";
|
||||||
|
options.desc = "Hover diagnostics";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.diagnostic.open_float()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "[d";
|
||||||
|
options.desc = "Previous diagnostic";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.diagnostic.goto_prev()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "]d";
|
||||||
|
options.desc = "Next diagnostic";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.diagnostic.goto_next()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "gl";
|
||||||
|
options.desc = "Hover diagnostics";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.diagnostic.open_float()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
44
config/keymaps/splits.nix
Normal file
44
config/keymaps/splits.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
# Split navigation
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L107-L114
|
||||||
|
[
|
||||||
|
{
|
||||||
|
key = "<C-H>";
|
||||||
|
action = "<C-w>h";
|
||||||
|
options.desc = "Move to left split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-J>";
|
||||||
|
action = "<C-w>j";
|
||||||
|
options.desc = "Move to below split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-K>";
|
||||||
|
action = "<C-w>k";
|
||||||
|
options.desc = "Move to above split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-L>";
|
||||||
|
action = "<C-w>l";
|
||||||
|
options.desc = "Move to right split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-Up>";
|
||||||
|
action = "<Cmd>resize -2<CR>";
|
||||||
|
options.desc = "Resize split up";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-Down>";
|
||||||
|
action = "<Cmd>resize +2<CR>";
|
||||||
|
options.desc = "Resize split down";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-Left>";
|
||||||
|
action = "<Cmd>vertical resize -2<CR>";
|
||||||
|
options.desc = "Resize split left";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-Right>";
|
||||||
|
action = "<Cmd>vertical resize +2<CR>";
|
||||||
|
options.desc = "Resize split right";
|
||||||
|
}
|
||||||
|
]
|
||||||
97
config/keymaps/standard.nix
Normal file
97
config/keymaps/standard.nix
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
let
|
||||||
|
forceWrite = {
|
||||||
|
action = "<cmd>silent! update! | redraw<cr>";
|
||||||
|
options.desc = "Force write";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
[
|
||||||
|
# Standard operations
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L27-L44
|
||||||
|
{
|
||||||
|
key = "j";
|
||||||
|
mode = [ "n" "x" ];
|
||||||
|
action = "v:count == 0 ? 'gj' : 'j'";
|
||||||
|
|
||||||
|
options = {
|
||||||
|
desc = "Move cursor down";
|
||||||
|
expr = true;
|
||||||
|
silent = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "k";
|
||||||
|
mode = [ "n" "x" ];
|
||||||
|
action = "v:count == 0 ? 'gk' : 'k'";
|
||||||
|
|
||||||
|
options = {
|
||||||
|
desc = "Move cursor up";
|
||||||
|
expr = true;
|
||||||
|
silent = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>w";
|
||||||
|
action = "<cmd>w<cr>";
|
||||||
|
options.desc = "Save";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>q";
|
||||||
|
action = "<cmd>confirm q<cr>";
|
||||||
|
options.desc = "Quit window";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>Q";
|
||||||
|
action = "<cmd>confirm qall<cr>";
|
||||||
|
options.desc = "Exit neovim";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>n";
|
||||||
|
action = "<cmd>enew<cr>";
|
||||||
|
options.desc = "New file";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
inherit (forceWrite) action options;
|
||||||
|
key = "<c-s>";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
inherit (forceWrite) options;
|
||||||
|
key = "<c-s>";
|
||||||
|
mode = [ "i" "x" ];
|
||||||
|
action = "<esc>" + forceWrite.action;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<c-q>";
|
||||||
|
action = "<cmd>q!<cr>";
|
||||||
|
options.desc = "Force quit";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "|";
|
||||||
|
action = "<cmd>vsplit<cr>";
|
||||||
|
options.desc = "Vertical split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "\\";
|
||||||
|
action = "<cmd>split<cr>";
|
||||||
|
options.desc = "Horizontal split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "gx";
|
||||||
|
action.__raw = "require('astrocore').system_open";
|
||||||
|
options.desc = "Open the file under cursor with system app";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stay in indent mode
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L117-L118
|
||||||
|
{
|
||||||
|
key = "<S-Tab>";
|
||||||
|
mode = [ "v" ];
|
||||||
|
action = "<gv";
|
||||||
|
options.desc = "Unindent line";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Tab>";
|
||||||
|
mode = [ "v" ];
|
||||||
|
action = ">gv";
|
||||||
|
options.desc = "Indent line";
|
||||||
|
}
|
||||||
|
]
|
||||||
24
config/keymaps/tabs.nix
Normal file
24
config/keymaps/tabs.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Navigate tabs
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L103-L104
|
||||||
|
[
|
||||||
|
{
|
||||||
|
key = "]t";
|
||||||
|
options.desc = "Next tab";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.cmd.tabnext()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "[t";
|
||||||
|
options.desc = "Previous tab";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.cmd.tabprevious()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
28
config/keymaps/terminal.nix
Normal file
28
config/keymaps/terminal.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Improved terminal navigation
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L121-L124
|
||||||
|
[
|
||||||
|
{
|
||||||
|
key = "<C-H>";
|
||||||
|
mode = [ "t" ];
|
||||||
|
action = "<Cmd>wincmd h<CR>";
|
||||||
|
options.desc = "Terminal left window navigation";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-J>";
|
||||||
|
mode = [ "t" ];
|
||||||
|
action = "<Cmd>wincmd j<CR>";
|
||||||
|
options.desc = "Terminal down window navigation";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-K>";
|
||||||
|
mode = [ "t" ];
|
||||||
|
action = "<Cmd>wincmd k<CR>";
|
||||||
|
options.desc = "Terminal up window navigation";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-L>";
|
||||||
|
mode = [ "t" ];
|
||||||
|
action = "<Cmd>wincmd l<CR>";
|
||||||
|
options.desc = "Terminal right window navigation";
|
||||||
|
}
|
||||||
|
]
|
||||||
164
config/keymaps/toggles.nix
Normal file
164
config/keymaps/toggles.nix
Normal file
|
|
@ -0,0 +1,164 @@
|
||||||
|
# UI/UX toggles
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L128-L145
|
||||||
|
[
|
||||||
|
{
|
||||||
|
key = "<Leader>uA";
|
||||||
|
options.desc = "Toggle rooter autochdir";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").autochdir()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>ub";
|
||||||
|
options.desc = "Toggle background";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").background()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>ud";
|
||||||
|
options.desc = "Toggle diagnostics";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").diagnostics()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>ug";
|
||||||
|
options.desc = "Toggle signcolumn";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").signcolumn()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>u>";
|
||||||
|
options.desc = "Toggle foldcolumn";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").foldcolumn()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>ui";
|
||||||
|
options.desc = "Change indent setting";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").indent()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>ul";
|
||||||
|
options.desc = "Toggle statusline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").statusline()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>un";
|
||||||
|
options.desc = "Change line numbering";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").number()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>uN";
|
||||||
|
options.desc = "Toggle Notifications";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").notifications()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>up";
|
||||||
|
options.desc = "Toggle paste mode";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").paste()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>us";
|
||||||
|
options.desc = "Toggle spellcheck";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").spell()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>uS";
|
||||||
|
options.desc = "Toggle conceal";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").conceal()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>ut";
|
||||||
|
options.desc = "Toggle tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").tabline()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>uu";
|
||||||
|
options.desc = "Toggle URL highlight";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").url_match()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>uw";
|
||||||
|
options.desc = "Toggle wrap";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").wrap()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<Leader>uy";
|
||||||
|
options.desc = "Toggle syntax highlight";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").buffer_syntax()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
@ -3,9 +3,61 @@
|
||||||
# Use :h <option> to load help for given <option>
|
# Use :h <option> to load help for given <option>
|
||||||
{
|
{
|
||||||
opts = {
|
opts = {
|
||||||
|
# Don't stop backspace at insert
|
||||||
|
backspace.__raw = ''
|
||||||
|
vim.list_extend(vim.opt.backspace:get(), { "nostop" })
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Keep visual indentation on wrapped lines
|
||||||
|
breakindent = true;
|
||||||
|
|
||||||
|
# Hide command line unless needed
|
||||||
|
cmdheight = 0;
|
||||||
|
|
||||||
|
# Insert mode completion options
|
||||||
|
completeopt = [ "menu" "menuone" "noselect" ];
|
||||||
|
|
||||||
|
# Raise a dialog asking if you wish to save the current file(s)
|
||||||
|
confirm = true;
|
||||||
|
|
||||||
|
# Copy previous indentation on autoindenting
|
||||||
|
copyindent = true;
|
||||||
|
|
||||||
|
# Highlight current line
|
||||||
|
cursorline = true;
|
||||||
|
|
||||||
|
# Enable linematch diff algorithm
|
||||||
|
diffopt.__raw = ''
|
||||||
|
vim.list_extend(vim.opt.diffopt:get(), { "algorithm:histogram", "linematch:60" })
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Expand <Tab> to spaces
|
||||||
|
expandtab = true;
|
||||||
|
|
||||||
|
# Disable `~` on nonexistent lines
|
||||||
|
fillchars = { eob = " "; };
|
||||||
|
|
||||||
|
# Enable fold with all code unfolded
|
||||||
|
foldcolumn = "1";
|
||||||
|
foldenable = true;
|
||||||
|
foldlevel = 99;
|
||||||
|
foldlevelstart = 99;
|
||||||
|
|
||||||
|
# Ignore case in search patterns
|
||||||
|
ignorecase = true;
|
||||||
|
|
||||||
# Show substitution preview in split window
|
# Show substitution preview in split window
|
||||||
inccommand = "split";
|
inccommand = "split";
|
||||||
|
|
||||||
|
# Infer casing on word completion
|
||||||
|
infercase = true;
|
||||||
|
|
||||||
|
# Global statusline
|
||||||
|
laststatus = 3;
|
||||||
|
|
||||||
|
# Wrap lines at 'breakat'
|
||||||
|
linebreak = true;
|
||||||
|
|
||||||
# Enable list mode
|
# Enable list mode
|
||||||
list = true;
|
list = true;
|
||||||
|
|
||||||
|
|
@ -16,11 +68,81 @@
|
||||||
# - non-breakable spaces are shown as ⎕
|
# - non-breakable spaces are shown as ⎕
|
||||||
listchars = "tab:‒▶,trail:·,multispace:·,lead: ,nbsp:⎕";
|
listchars = "tab:‒▶,trail:·,multispace:·,lead: ,nbsp:⎕";
|
||||||
|
|
||||||
|
# Enable mouse support
|
||||||
|
mouse = "a";
|
||||||
|
|
||||||
|
# Show line numbers
|
||||||
|
number = true;
|
||||||
|
|
||||||
|
# Preserve indentation as much as possible
|
||||||
|
preserveindent = true;
|
||||||
|
|
||||||
|
# Height of the popup menu
|
||||||
|
pumheight = 10;
|
||||||
|
|
||||||
|
# Display line numbers relative to current line
|
||||||
|
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
|
||||||
|
shiftwidth = 2;
|
||||||
|
|
||||||
|
# Disable search count wrap and startup messages
|
||||||
|
shortmess.__raw = ''
|
||||||
|
vim.tbl_deep_extend("force", vim.opt.shortmess:get(), { s = true, I = true })
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Disable showing modes in command line
|
||||||
|
showmode = false;
|
||||||
|
|
||||||
|
# Always show tabline
|
||||||
|
showtabline = 2;
|
||||||
|
|
||||||
|
# Show signs column
|
||||||
|
signcolumn = "yes";
|
||||||
|
|
||||||
|
# Override ignorecase if search pattern contains uppercase characters
|
||||||
|
smartcase = true;
|
||||||
|
|
||||||
# Number of spaces input on <Tab>
|
# Number of spaces input on <Tab>
|
||||||
softtabstop = 2;
|
softtabstop = 2;
|
||||||
|
|
||||||
|
# Open horizontal split below (:split)
|
||||||
|
splitbelow = true;
|
||||||
|
|
||||||
|
# Open vertical split to the right (:vsplit)
|
||||||
|
splitright = true;
|
||||||
|
|
||||||
|
# Number of spaces to represent a <Tab>
|
||||||
|
tabstop = 2;
|
||||||
|
|
||||||
|
# Enables 24-bit RGB color
|
||||||
|
termguicolors = true;
|
||||||
|
|
||||||
|
# Shorter timeout duration
|
||||||
|
timeoutlen = 500;
|
||||||
|
|
||||||
|
# Set window title to the filename
|
||||||
|
title = true;
|
||||||
|
|
||||||
|
# Save undo history to undo file (in $XDG_STATE_HOME/nvim/undo)
|
||||||
|
undofile = true;
|
||||||
|
|
||||||
|
viewoptions.__raw = ''
|
||||||
|
vim.tbl_filter(function(val) return val ~= "curdir" end, vim.opt.viewoptions:get())
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Enable virtual edit in visual block mode
|
||||||
|
# This has the effect of selecting empty cells beyond lines boundaries
|
||||||
|
virtualedit = "block";
|
||||||
|
|
||||||
|
# Disable line wrapping
|
||||||
|
wrap = false;
|
||||||
|
|
||||||
|
# Disable making a backup before overwriting a file
|
||||||
|
writebackup = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@
|
||||||
{ helpers, icons, lib, pkgs, ... }:
|
{ helpers, icons, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
autocmds = import ./autocmds.nix;
|
|
||||||
diagnostics = import ./diagnostics.nix { inherit icons; };
|
diagnostics = import ./diagnostics.nix { inherit icons; };
|
||||||
features = import ./features.nix;
|
features = import ./features.nix;
|
||||||
mappings = import ./mappings.nix;
|
options = import ./options.nix;
|
||||||
options = import ./options.nix { inherit lib; };
|
|
||||||
rooter = import ./rooter.nix;
|
rooter = import ./rooter.nix;
|
||||||
sessions = import ./sessions.nix;
|
sessions = import ./sessions.nix;
|
||||||
in
|
in
|
||||||
|
|
@ -20,7 +18,7 @@ in
|
||||||
require("astrocore").setup({
|
require("astrocore").setup({
|
||||||
diagnostics = ${helpers.toLuaObject diagnostics},
|
diagnostics = ${helpers.toLuaObject diagnostics},
|
||||||
features = ${helpers.toLuaObject features},
|
features = ${helpers.toLuaObject features},
|
||||||
options = ${helpers.toLuaObject options.astrocore},
|
options = ${helpers.toLuaObject options},
|
||||||
rooter = ${helpers.toLuaObject rooter},
|
rooter = ${helpers.toLuaObject rooter},
|
||||||
sessions = ${helpers.toLuaObject sessions},
|
sessions = ${helpers.toLuaObject sessions},
|
||||||
on_keys = {
|
on_keys = {
|
||||||
|
|
@ -36,12 +34,4 @@ in
|
||||||
})
|
})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
rootOpts = {
|
|
||||||
inherit (autocmds) autoGroups autoCmd;
|
|
||||||
inherit (mappings) keymaps;
|
|
||||||
inherit (options) opts;
|
|
||||||
|
|
||||||
plugins.which-key.registrations = mappings.mapSections;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,575 +0,0 @@
|
||||||
let
|
|
||||||
icons = import ../astroui/icons.nix;
|
|
||||||
|
|
||||||
forceWrite = {
|
|
||||||
action = "<cmd>silent! update! | redraw<cr>";
|
|
||||||
options.desc = "Force write";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
keymaps = [
|
|
||||||
# Standard operations
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L27-L44
|
|
||||||
{
|
|
||||||
key = "j";
|
|
||||||
mode = [ "n" "x" ];
|
|
||||||
action = "v:count == 0 ? 'gj' : 'j'";
|
|
||||||
|
|
||||||
options = {
|
|
||||||
desc = "Move cursor down";
|
|
||||||
expr = true;
|
|
||||||
silent = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "k";
|
|
||||||
mode = [ "n" "x" ];
|
|
||||||
action = "v:count == 0 ? 'gk' : 'k'";
|
|
||||||
|
|
||||||
options = {
|
|
||||||
desc = "Move cursor up";
|
|
||||||
expr = true;
|
|
||||||
silent = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>w";
|
|
||||||
action = "<cmd>w<cr>";
|
|
||||||
options.desc = "Save";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>q";
|
|
||||||
action = "<cmd>confirm q<cr>";
|
|
||||||
options.desc = "Quit window";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>Q";
|
|
||||||
action = "<cmd>confirm qall<cr>";
|
|
||||||
options.desc = "Exit neovim";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>n";
|
|
||||||
action = "<cmd>enew<cr>";
|
|
||||||
options.desc = "New file";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
inherit (forceWrite) action options;
|
|
||||||
key = "<c-s>";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
inherit (forceWrite) options;
|
|
||||||
key = "<c-s>";
|
|
||||||
mode = [ "i" "x" ];
|
|
||||||
action = "<esc>" + forceWrite.action;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<c-q>";
|
|
||||||
action = "<cmd>q!<cr>";
|
|
||||||
options.desc = "Force quit";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "|";
|
|
||||||
action = "<cmd>vsplit<cr>";
|
|
||||||
options.desc = "Vertical split";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "\\\\";
|
|
||||||
action = "<cmd>split<cr>";
|
|
||||||
options.desc = "Horizontal split";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "gx";
|
|
||||||
action.__raw = "require('astrocore').system_open";
|
|
||||||
options.desc = "Open the file under cursor with system app";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Manage buffers
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L56-L89
|
|
||||||
{
|
|
||||||
key = "<leader>c";
|
|
||||||
options.desc = "Close buffer";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").close()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>C";
|
|
||||||
options.desc = "Force close buffer";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").close(0, true)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "]b";
|
|
||||||
options.desc = "Next buffer in tabline";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").nav(vim.v.count1)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "[b";
|
|
||||||
options.desc = "Previous buffer in tabline";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").nav(-vim.v.count1)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = ">b";
|
|
||||||
options.desc = "Move buffer tab right";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").move(vim.v.count1)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<b";
|
|
||||||
options.desc = "Move buffer tab left";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").move(-vim.v.count1)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>bc";
|
|
||||||
options.desc = "Close all buffers except current";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").close_all(true)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>bC";
|
|
||||||
options.desc = "Close all buffers";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").close_all()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>bl";
|
|
||||||
options.desc = "Close all buffers to the left";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").close_left()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>bp";
|
|
||||||
options.desc = "Previous buffer";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").prev()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>br";
|
|
||||||
options.desc = "Close all buffers to the right";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").close_right()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>bse";
|
|
||||||
options.desc = "By extension";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").sort "extension"
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>bsr";
|
|
||||||
options.desc = "By relative path";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").sort "unique_path"
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>bsp";
|
|
||||||
options.desc = "By full path";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").sort "full_path"
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>bsi";
|
|
||||||
options.desc = "By buffer number";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").sort "bufnr"
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>bsm";
|
|
||||||
options.desc = "By modification";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.buffer").sort "modified"
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
||||||
# Diagnostics
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L92-L100
|
|
||||||
{
|
|
||||||
key = "<Leader>ld";
|
|
||||||
options.desc = "Hover diagnostics";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
vim.diagnostic.open_float()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "[d";
|
|
||||||
options.desc = "Previous diagnostic";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
vim.diagnostic.goto_prev()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "]d";
|
|
||||||
options.desc = "Next diagnostic";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
vim.diagnostic.goto_next()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "gl";
|
|
||||||
options.desc = "Hover diagnostics";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
vim.diagnostic.open_float()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
||||||
# Navigate tabs
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L103-L104
|
|
||||||
{
|
|
||||||
key = "]t";
|
|
||||||
options.desc = "Next tab";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
vim.cmd.tabnext()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "[t";
|
|
||||||
options.desc = "Previous tab";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
vim.cmd.tabprevious()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
||||||
# Split navigation
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L107-L114
|
|
||||||
{
|
|
||||||
key = "<C-H>";
|
|
||||||
action = "<C-w>h";
|
|
||||||
options.desc = "Move to left split";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-J>";
|
|
||||||
action = "<C-w>j";
|
|
||||||
options.desc = "Move to below split";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-K>";
|
|
||||||
action = "<C-w>k";
|
|
||||||
options.desc = "Move to above split";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-L>";
|
|
||||||
action = "<C-w>l";
|
|
||||||
options.desc = "Move to right split";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-Up>";
|
|
||||||
action = "<Cmd>resize -2<CR>";
|
|
||||||
options.desc = "Resize split up";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-Down>";
|
|
||||||
action = "<Cmd>resize +2<CR>";
|
|
||||||
options.desc = "Resize split down";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-Left>";
|
|
||||||
action = "<Cmd>vertical resize -2<CR>";
|
|
||||||
options.desc = "Resize split left";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-Right>";
|
|
||||||
action = "<Cmd>vertical resize +2<CR>";
|
|
||||||
options.desc = "Resize split right";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Stay in indent mode
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L117-L118
|
|
||||||
{
|
|
||||||
key = "<S-Tab>";
|
|
||||||
mode = [ "v" ];
|
|
||||||
action = "<gv";
|
|
||||||
options.desc = "Unindent line";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Tab>";
|
|
||||||
mode = [ "v" ];
|
|
||||||
action = ">gv";
|
|
||||||
options.desc = "Indent line";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Improved terminal navigation
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L121-L124
|
|
||||||
{
|
|
||||||
key = "<C-H>";
|
|
||||||
mode = [ "t" ];
|
|
||||||
action = "<Cmd>wincmd h<CR>";
|
|
||||||
options.desc = "Terminal left window navigation";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-J>";
|
|
||||||
mode = [ "t" ];
|
|
||||||
action = "<Cmd>wincmd j<CR>";
|
|
||||||
options.desc = "Terminal down window navigation";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-K>";
|
|
||||||
mode = [ "t" ];
|
|
||||||
action = "<Cmd>wincmd k<CR>";
|
|
||||||
options.desc = "Terminal up window navigation";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-L>";
|
|
||||||
mode = [ "t" ];
|
|
||||||
action = "<Cmd>wincmd l<CR>";
|
|
||||||
options.desc = "Terminal right window navigation";
|
|
||||||
}
|
|
||||||
|
|
||||||
# UI/UX toggles
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L128-L145
|
|
||||||
{
|
|
||||||
key = "<Leader>uA";
|
|
||||||
options.desc = "Toggle rooter autochdir";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").autochdir()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>ub";
|
|
||||||
options.desc = "Toggle background";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").background()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>ud";
|
|
||||||
options.desc = "Toggle diagnostics";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").diagnostics()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>ug";
|
|
||||||
options.desc = "Toggle signcolumn";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").signcolumn()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>u>";
|
|
||||||
options.desc = "Toggle foldcolumn";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").foldcolumn()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>ui";
|
|
||||||
options.desc = "Change indent setting";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").indent()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>ul";
|
|
||||||
options.desc = "Toggle statusline";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").statusline()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>un";
|
|
||||||
options.desc = "Change line numbering";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").number()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>uN";
|
|
||||||
options.desc = "Toggle Notifications";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").notifications()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>up";
|
|
||||||
options.desc = "Toggle paste mode";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").paste()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>us";
|
|
||||||
options.desc = "Toggle spellcheck";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").spell()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>uS";
|
|
||||||
options.desc = "Toggle conceal";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").conceal()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>ut";
|
|
||||||
options.desc = "Toggle tabline";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").tabline()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>uu";
|
|
||||||
options.desc = "Toggle URL highlight";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").url_match()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>uw";
|
|
||||||
options.desc = "Toggle wrap";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").wrap()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<Leader>uy";
|
|
||||||
options.desc = "Toggle syntax highlight";
|
|
||||||
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("astrocore.toggles").buffer_syntax()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
mapSections = {
|
|
||||||
"<leader>b".name = "${icons.Tab} Buffers";
|
|
||||||
"<leader>bs".name = "${icons.Sort} Sort Buffers";
|
|
||||||
"<leader>d".name = "${icons.Debugger} Debugger";
|
|
||||||
"<leader>f".name = "${icons.Search} Find";
|
|
||||||
"<leader>g".name = "${icons.Git} Git";
|
|
||||||
"<leader>l".name = "${icons.ActiveLSP} Language Tools";
|
|
||||||
"<leader>S".name = "${icons.Session} Session";
|
|
||||||
"<leader>t".name = "${icons.Terminal} Terminal";
|
|
||||||
"<leader>u".name = "${icons.Window} UI/UX";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,159 +1,11 @@
|
||||||
{ lib, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_options.lua#L49-L53
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_options.lua#L49-L53
|
||||||
astrocore = {
|
g.markdown_recommended_style = 0;
|
||||||
g.markdown_recommended_style = 0;
|
|
||||||
|
|
||||||
t.bufs.__raw = ''
|
t.bufs.__raw = ''
|
||||||
(function()
|
(function()
|
||||||
if not vim.t.bufs then vim.t.bufs = vim.api.nvim_list_bufs() end
|
if not vim.t.bufs then vim.t.bufs = vim.api.nvim_list_bufs() end
|
||||||
return vim.t.bufs
|
return vim.t.bufs
|
||||||
end)()
|
end)()
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_options.lua#L6-L47
|
|
||||||
opts = {
|
|
||||||
# Don't stop backspace at insert
|
|
||||||
backspace = lib.mkDefault {
|
|
||||||
__raw = ''
|
|
||||||
vim.list_extend(vim.opt.backspace:get(), { "nostop" })
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# Wrap indent to match line start
|
|
||||||
breakindent = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Connection to the system clipboard
|
|
||||||
clipboard = lib.mkDefault "unnamedplus";
|
|
||||||
|
|
||||||
# Hide command line unless needed
|
|
||||||
cmdheight = lib.mkDefault 0;
|
|
||||||
|
|
||||||
# Options for insert mode completion
|
|
||||||
completeopt = lib.mkDefault [ "menu" "menuone" "noselect" ];
|
|
||||||
|
|
||||||
# Raise a dialog asking if you wish to save the current file(s)
|
|
||||||
confirm = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Copy the previous indentation on autoindenting
|
|
||||||
copyindent = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Highlight the text line of the cursor
|
|
||||||
cursorline = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Enable linematch diff algorithm
|
|
||||||
diffopt = lib.mkDefault {
|
|
||||||
__raw = ''
|
|
||||||
vim.list_extend(vim.opt.diffopt:get(), { "algorithm:histogram", "linematch:60" })
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable the use of space in tab
|
|
||||||
expandtab = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Disable `~` on nonexistent lines
|
|
||||||
fillchars = lib.mkDefault { eob = " "; };
|
|
||||||
|
|
||||||
# Show foldcolumn
|
|
||||||
foldcolumn = lib.mkDefault "1";
|
|
||||||
|
|
||||||
# Enable fold for nvim-ufo
|
|
||||||
foldenable = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Set high foldlevel for nvim-ufo
|
|
||||||
foldlevel = lib.mkDefault 99;
|
|
||||||
|
|
||||||
# Start with all code unfolded
|
|
||||||
foldlevelstart = lib.mkDefault 99;
|
|
||||||
|
|
||||||
# Case insensitive searching
|
|
||||||
ignorecase = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Infer cases in keyword completion
|
|
||||||
infercase = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Global statusline
|
|
||||||
laststatus = lib.mkDefault 3;
|
|
||||||
|
|
||||||
# Wrap lines at 'breakat'
|
|
||||||
linebreak = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Enable mouse support
|
|
||||||
mouse = lib.mkDefault "a";
|
|
||||||
|
|
||||||
# Show numberline
|
|
||||||
number = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Preserve indent structure as much as possible
|
|
||||||
preserveindent = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Height of the pop up menu
|
|
||||||
pumheight = lib.mkDefault 10;
|
|
||||||
|
|
||||||
# Show relative numberline
|
|
||||||
relativenumber = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Number of space inserted for indentation; when zero the 'tabstop' value will be used
|
|
||||||
shiftwidth = lib.mkDefault 0;
|
|
||||||
|
|
||||||
# Disable search count wrap and startup messages
|
|
||||||
shortmess = lib.mkDefault {
|
|
||||||
__raw = ''
|
|
||||||
vim.tbl_deep_extend("force", vim.opt.shortmess:get(), { s = true, I = true })
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# Disable showing modes in command line
|
|
||||||
showmode = lib.mkDefault false;
|
|
||||||
|
|
||||||
# Always display tabline
|
|
||||||
showtabline = lib.mkDefault 2;
|
|
||||||
|
|
||||||
# Always show the sign column
|
|
||||||
signcolumn = lib.mkDefault "yes";
|
|
||||||
|
|
||||||
# Case sensitive searching
|
|
||||||
smartcase = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Splitting a new window below the current one
|
|
||||||
splitbelow = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Splitting a new window at the right of the current one
|
|
||||||
splitright = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Number of space in a tab
|
|
||||||
tabstop = lib.mkDefault 2;
|
|
||||||
|
|
||||||
# Enable 24-bit RGB color in the TUI
|
|
||||||
termguicolors = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Shorten key timeout length a little bit for which-key
|
|
||||||
timeoutlen = lib.mkDefault 500;
|
|
||||||
|
|
||||||
# Set terminal title to the filename and path
|
|
||||||
title = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Enable persistent undo
|
|
||||||
undofile = lib.mkDefault true;
|
|
||||||
|
|
||||||
# Length of time to wait before triggering the plugin
|
|
||||||
updatetime = lib.mkDefault 300;
|
|
||||||
|
|
||||||
viewoptions = lib.mkDefault {
|
|
||||||
__raw = ''
|
|
||||||
vim.tbl_filter(function(val) return val ~= "curdir" end, vim.opt.viewoptions:get())
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# Allow going past end of line in visual block mode
|
|
||||||
virtualedit = lib.mkDefault "block";
|
|
||||||
|
|
||||||
# Disable wrapping of lines longer than the width of window
|
|
||||||
wrap = lib.mkDefault false;
|
|
||||||
|
|
||||||
# Disable making a backup before overwriting a file
|
|
||||||
writebackup = lib.mkDefault false;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# homepage: https://github.com/folke/which-key.nvim
|
# homepage: https://github.com/folke/which-key.nvim
|
||||||
# nixvim doc: https://nix-community.github.io/nixvim/plugins/which-key/index.html
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/which-key/index.html
|
||||||
_:
|
{ icons, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
opts = {
|
opts = {
|
||||||
|
|
@ -14,6 +14,19 @@ _:
|
||||||
"neo-tree"
|
"neo-tree"
|
||||||
"neo-tree-popup"
|
"neo-tree-popup"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Customize section names (prefixed mappings)
|
||||||
|
registrations = {
|
||||||
|
"<leader>b".name = "${icons.Tab} Buffers";
|
||||||
|
"<leader>bs".name = "${icons.Sort} Sort Buffers";
|
||||||
|
"<leader>d".name = "${icons.Debugger} Debugger";
|
||||||
|
"<leader>f".name = "${icons.Search} Find";
|
||||||
|
"<leader>g".name = "${icons.Git} Git";
|
||||||
|
"<leader>l".name = "${icons.ActiveLSP} Language Tools";
|
||||||
|
"<leader>S".name = "${icons.Session} Session";
|
||||||
|
"<leader>t".name = "${icons.Terminal} Terminal";
|
||||||
|
"<leader>u".name = "${icons.Window} UI/UX";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable catppuccin colors
|
# Enable catppuccin colors
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue