refactor: complete overhaul
Complete overhaul of repo structure based on nvix. See https://github.com/niksingh710/nvix Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
ff2c59724a
commit
61feed4086
75 changed files with 2916 additions and 2314 deletions
43
plugins/common/colorscheme.nix
Normal file
43
plugins/common/colorscheme.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
colorschemes = {
|
||||
catppuccin = {
|
||||
enable = false;
|
||||
settings = {
|
||||
integrations.native_lsp = {
|
||||
enabled = true;
|
||||
underlines = {
|
||||
errors = [ "undercurl" ];
|
||||
hints = [ "undercurl" ];
|
||||
warnings = [ "undercurl" ];
|
||||
information = [ "undercurl" ];
|
||||
};
|
||||
};
|
||||
flavor = "mocha";
|
||||
italic = true;
|
||||
bold = true;
|
||||
dimInactive = false;
|
||||
transparent_background = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
colorschemes.tokyonight = {
|
||||
enable = true;
|
||||
settings = {
|
||||
style = "night";
|
||||
transparent = config.myvim.transparent;
|
||||
styles = {
|
||||
floats = if config.myvim.transparent then "transparent" else "dark";
|
||||
sidebars = if config.myvim.transparent then "transparent" else "dark";
|
||||
comments.italic = true;
|
||||
functions.italic = true;
|
||||
variables.italic = true;
|
||||
keyword = {
|
||||
italic = true;
|
||||
bold = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
149
plugins/common/default.nix
Normal file
149
plugins/common/default.nix
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (config.myvim) icons;
|
||||
inherit (lib.nixvim) mkRaw;
|
||||
in
|
||||
{
|
||||
imports =
|
||||
with builtins;
|
||||
with lib;
|
||||
map (fn: ./${fn}) (
|
||||
filter (fn: (fn != "default.nix" && hasSuffix ".nix" "${fn}")) (attrNames (readDir ./.))
|
||||
);
|
||||
|
||||
luaLoader.enable = false;
|
||||
|
||||
extraConfigLua =
|
||||
with icons.diagnostics;
|
||||
# lua
|
||||
''
|
||||
local function my_paste(reg)
|
||||
return function(lines)
|
||||
local content = vim.fn.getreg('"')
|
||||
return vim.split(content, '\n')
|
||||
end
|
||||
end
|
||||
if (os.getenv('SSH_TTY') ~= nil)
|
||||
then
|
||||
vim.g.clipboard = {
|
||||
name = 'OSC 52',
|
||||
copy = {
|
||||
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
|
||||
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
|
||||
},
|
||||
paste = {
|
||||
["+"] = my_paste("+"),
|
||||
["*"] = my_paste("*"),
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
|
||||
vim.opt.whichwrap:append("<>[]hl")
|
||||
vim.opt.listchars:append("space:·")
|
||||
|
||||
-- below part set's the Diagnostic icons/colors
|
||||
local signs = {
|
||||
Hint = "${BoldHint}",
|
||||
Info = "${BoldInformation}",
|
||||
Warn = "${BoldWarning}",
|
||||
Error = "${BoldError}",
|
||||
}
|
||||
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
'';
|
||||
|
||||
globals = {
|
||||
mapleader = config.myvim.leader;
|
||||
floating_window_options.border = config.myvim.border;
|
||||
};
|
||||
|
||||
opts = {
|
||||
clipboard = "unnamedplus";
|
||||
cursorline = true;
|
||||
cursorlineopt = "number";
|
||||
|
||||
pumblend = 0;
|
||||
pumheight = 10;
|
||||
|
||||
expandtab = true;
|
||||
shiftwidth = 2;
|
||||
smartindent = true;
|
||||
tabstop = 2;
|
||||
softtabstop = 2;
|
||||
|
||||
ignorecase = true;
|
||||
smartcase = true;
|
||||
mouse = "a";
|
||||
cmdheight = 0;
|
||||
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
numberwidth = 2;
|
||||
ruler = false;
|
||||
|
||||
signcolumn = "yes";
|
||||
splitbelow = true;
|
||||
splitright = true;
|
||||
splitkeep = "screen";
|
||||
termguicolors = true;
|
||||
|
||||
conceallevel = 2;
|
||||
|
||||
undofile = true;
|
||||
|
||||
wrap = false;
|
||||
|
||||
virtualedit = "block";
|
||||
winminwidth = 5;
|
||||
fileencoding = "utf-8";
|
||||
list = true;
|
||||
smoothscroll = true;
|
||||
autoread = true;
|
||||
autowrite = true;
|
||||
swapfile = false;
|
||||
fillchars = {
|
||||
eob = " ";
|
||||
};
|
||||
|
||||
updatetime = 500;
|
||||
};
|
||||
|
||||
autoCmd = [
|
||||
{
|
||||
desc = "Highlight on yank";
|
||||
event = [ "TextYankPost" ];
|
||||
callback =
|
||||
# lua
|
||||
mkRaw ''
|
||||
function()
|
||||
vim.highlight.on_yank()
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
desc = "Check file changes";
|
||||
event = [
|
||||
"FocusGained"
|
||||
"BufEnter"
|
||||
"CursorHold"
|
||||
];
|
||||
pattern = [ "*" ];
|
||||
callback =
|
||||
# lua
|
||||
mkRaw ''
|
||||
function()
|
||||
if vim.fn.mode() ~= "c" then
|
||||
vim.cmd("checktime")
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraLuaPackages = lp: with lp; [ luarocks ];
|
||||
}
|
||||
40
plugins/common/functions.nix
Normal file
40
plugins/common/functions.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
myvim.mkKey = rec {
|
||||
# set of functions that returns attrs for keymap list
|
||||
mkKeymap = mode: key: action: desc: {
|
||||
inherit mode key action;
|
||||
|
||||
options = {
|
||||
inherit desc;
|
||||
silent = true;
|
||||
noremap = true;
|
||||
remap = true;
|
||||
};
|
||||
};
|
||||
|
||||
# use when no description is to be passed
|
||||
mkKeymap' =
|
||||
mode: key: action:
|
||||
mkKeymap mode key action null;
|
||||
|
||||
mkKeymapWithOpts =
|
||||
mode: key: action: desc: opts:
|
||||
(mkKeymap mode key action desc) // { options = opts; };
|
||||
|
||||
# for which-key icon generation
|
||||
# accepts a list of strings and returns a list of objects
|
||||
# [{ __unkeyed, icon, group, hidden <optional boolean> }]
|
||||
wKeyObj =
|
||||
with builtins;
|
||||
list:
|
||||
{
|
||||
__unkeyed = elemAt list 0;
|
||||
icon = elemAt list 1;
|
||||
group = elemAt list 2;
|
||||
}
|
||||
// lib.optionalAttrs (length list > 3) {
|
||||
hidden = elemAt list 3;
|
||||
};
|
||||
};
|
||||
}
|
||||
193
plugins/common/icons.nix
Normal file
193
plugins/common/icons.nix
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
{
|
||||
config.myvim.icons = {
|
||||
kind = {
|
||||
Array = "";
|
||||
Boolean = "";
|
||||
Class = "";
|
||||
Color = "";
|
||||
Constant = "";
|
||||
Constructor = "";
|
||||
Enum = "";
|
||||
EnumMember = "";
|
||||
Event = "";
|
||||
Field = "";
|
||||
File = "";
|
||||
Folder = "";
|
||||
Function = "";
|
||||
Interface = "";
|
||||
Key = "";
|
||||
Keyword = "";
|
||||
Method = "";
|
||||
Module = "";
|
||||
Namespace = "";
|
||||
Null = "ﳠ";
|
||||
Number = "";
|
||||
Object = "";
|
||||
Operator = "";
|
||||
Package = "";
|
||||
Property = "";
|
||||
Reference = "";
|
||||
Snippet = "";
|
||||
String = "";
|
||||
Struct = "";
|
||||
Text = "";
|
||||
TypeParameter = "";
|
||||
Unit = "";
|
||||
Value = "";
|
||||
Variable = "";
|
||||
Copilot = "";
|
||||
TabNine = "⌬";
|
||||
};
|
||||
git = {
|
||||
LineAdded = "";
|
||||
LineModified = "";
|
||||
LineRemoved = "";
|
||||
FileDeleted = "";
|
||||
FileIgnored = "";
|
||||
FileRenamed = "";
|
||||
FileStaged = "✓";
|
||||
FileUnmerged = "";
|
||||
FileMerged = "";
|
||||
FileUnstaged = "";
|
||||
FileUntracked = "◌";
|
||||
FileChanged = "";
|
||||
Copied = "";
|
||||
Diff = "";
|
||||
Repo = "";
|
||||
Octoface = "";
|
||||
Branch = "";
|
||||
Added = " ";
|
||||
Conflict = " ";
|
||||
Deleted = "";
|
||||
Ignored = " ";
|
||||
Modified = " ";
|
||||
Renamed = "";
|
||||
Staged = "";
|
||||
Unstaged = "";
|
||||
Untracked = " ";
|
||||
};
|
||||
ui = {
|
||||
lazy = {
|
||||
ft = "";
|
||||
lazy = " ";
|
||||
loaded = "";
|
||||
not_loaded = "";
|
||||
};
|
||||
ArrowCircleDown = "";
|
||||
ArrowCircleLeft = "";
|
||||
ArrowCircleRight = "";
|
||||
ArrowCircleUp = "";
|
||||
BoldArrowDown = "";
|
||||
BoldArrowLeft = "";
|
||||
BoldArrowRight = "";
|
||||
BoldArrowUp = "";
|
||||
BoldClose = "";
|
||||
BoldDividerLeft = "";
|
||||
BoldDividerRight = "";
|
||||
BoldLineLeft = "▎";
|
||||
BookMark = "";
|
||||
BoxChecked = "";
|
||||
Bug = "";
|
||||
Stacks = "";
|
||||
Scopes = "";
|
||||
Watches = "";
|
||||
DebugConsole = "";
|
||||
Calendar = "";
|
||||
Check = "";
|
||||
ChevronRight = ">";
|
||||
ChevronShortDown = "";
|
||||
ChevronShortLeft = "";
|
||||
ChevronShortRight = "";
|
||||
ChevronShortUp = "";
|
||||
Circle = "";
|
||||
Close = "";
|
||||
CloudDownload = "";
|
||||
Code = "";
|
||||
Comment = "";
|
||||
Dashboard = "";
|
||||
DividerLeft = "";
|
||||
DividerRight = "";
|
||||
DoubleChevronRight = "»";
|
||||
Ellipsis = "";
|
||||
EmptyFolder = "";
|
||||
EmptyFolderOpen = "";
|
||||
ExitCircle = "";
|
||||
File = "";
|
||||
FileSymlink = "";
|
||||
Files = "";
|
||||
FileRename = "";
|
||||
FindFile = "";
|
||||
FindText = "";
|
||||
Fire = "";
|
||||
Folder = "";
|
||||
FolderOpen = "";
|
||||
FolderSymlink = "";
|
||||
Forward = "";
|
||||
Gear = "";
|
||||
History = "";
|
||||
Lightbulb = "";
|
||||
LineLeft = "▏";
|
||||
LineMiddle = "│";
|
||||
List = "";
|
||||
Lock = "";
|
||||
NewFile = "";
|
||||
Note = "";
|
||||
Package = "";
|
||||
Pencil = "";
|
||||
Plus = "";
|
||||
Project = "";
|
||||
Search = "";
|
||||
SignIn = "";
|
||||
SignOut = "";
|
||||
Tab = "";
|
||||
Table = "";
|
||||
Target = "";
|
||||
Telescope = "";
|
||||
Text = "";
|
||||
Tree = "";
|
||||
Triangle = "";
|
||||
TriangleShortArrowDown = "";
|
||||
TriangleShortArrowLeft = "";
|
||||
TriangleShortArrowRight = "";
|
||||
TriangleShortArrowUp = "";
|
||||
};
|
||||
diagnostics = {
|
||||
BoldError = "";
|
||||
Error = "";
|
||||
BoldWarning = "";
|
||||
Warning = "";
|
||||
BoldInformation = "";
|
||||
Information = "";
|
||||
BoldQuestion = "";
|
||||
Question = "";
|
||||
BoldHint = "";
|
||||
Hint = "";
|
||||
Debug = "";
|
||||
Trace = "✎";
|
||||
};
|
||||
misc = {
|
||||
Robot = "ﮧ";
|
||||
Squirrel = "";
|
||||
Tag = "";
|
||||
Watch = "";
|
||||
Smiley = "";
|
||||
Package = "";
|
||||
CircuitBoard = "";
|
||||
LualineFmt = "";
|
||||
};
|
||||
nvtree_chad = {
|
||||
default = "";
|
||||
symlink = "";
|
||||
folder = {
|
||||
default = "";
|
||||
empty = "";
|
||||
empty_open = "";
|
||||
open = "";
|
||||
symlink = "";
|
||||
symlink_open = "";
|
||||
arrow_open = "";
|
||||
arrow_closed = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
13
plugins/common/illuminate.nix
Normal file
13
plugins/common/illuminate.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
plugins.illuminate = {
|
||||
enable = true;
|
||||
underCursor = false;
|
||||
filetypesDenylist = [
|
||||
"Outline"
|
||||
"TelescopePrompt"
|
||||
"alpha"
|
||||
"harpoon"
|
||||
"reason"
|
||||
];
|
||||
};
|
||||
}
|
||||
309
plugins/common/mappings.nix
Normal file
309
plugins/common/mappings.nix
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (config.myvim.mkKey) mkKeymap mkKeymapWithOpts wKeyObj;
|
||||
inherit (lib.nixvim) mkRaw;
|
||||
|
||||
# general mappings
|
||||
v = [
|
||||
(mkKeymap "v" "<c-s>" "<esc>:w<cr>" "Saving File")
|
||||
(mkKeymap "v" "<c-c>" "<esc>" "Escape")
|
||||
|
||||
(mkKeymap "v" "<a-j>" ":m '>+1<cr>gv-gv" "Move Selected Line Down")
|
||||
(mkKeymap "v" "<a-k>" ":m '<lt>-2<CR>gv-gv" "Move Selected Line Up")
|
||||
|
||||
(mkKeymap "v" "<" "<gv" "Indent out")
|
||||
(mkKeymap "v" ">" ">gv" "Indent in")
|
||||
|
||||
(mkKeymap "v" "<space>" "<Nop>" "Mapped to Nothing")
|
||||
];
|
||||
|
||||
xv = [
|
||||
(mkKeymapWithOpts "x" "j" ''v:count || mode(1)[0:1] == "no" ? "j" : "gj"'' "Move down" {
|
||||
expr = true;
|
||||
})
|
||||
(mkKeymapWithOpts "x" "k" ''v:count || mode(1)[0:1] == "no" ? "k" : "gk"'' "Move up" {
|
||||
expr = true;
|
||||
})
|
||||
];
|
||||
|
||||
insert = [
|
||||
(mkKeymap "i" "jk" "<esc>" "Normal Mode")
|
||||
(mkKeymap "i" "<c-s>" "<esc>:w ++p<cr>" "Save file")
|
||||
(mkKeymap "i" "<a-j>" "<esc>:m .+1<cr>==gi" "Move Line Down")
|
||||
(mkKeymap "i" "<a-k>" "<esc>:m .-2<cr>==gi" "Move Line Up")
|
||||
];
|
||||
|
||||
normal = [
|
||||
(mkKeymap "n" "<c-a-h>" ":lua require('smart-splits').resize_left()<cr>" "Resize Left")
|
||||
(mkKeymap "n" "<c-a-j>" ":lua require('smart-splits').resize_down()<cr>" "Resize Down")
|
||||
(mkKeymap "n" "<c-a-k>" ":lua require('smart-splits').resize_up()<cr>" "Resize Up")
|
||||
(mkKeymap "n" "<c-a-l>" ":lua require('smart-splits').resize_right()<cr>" "Resize Right")
|
||||
(mkKeymap "n" "?" (
|
||||
# lua
|
||||
mkRaw ''
|
||||
function()
|
||||
require('flash').jump({
|
||||
forward = true, wrap = true, multi_window = true
|
||||
})
|
||||
end
|
||||
''
|
||||
) "Flash Search")
|
||||
|
||||
(mkKeymap "n" "<c-h>" ":lua require('smart-splits').move_cursor_left()<cr>" "Move Cursor Left")
|
||||
(mkKeymap "n" "<c-j>" ":lua require('smart-splits').move_cursor_down()<cr>" "Move Cursor Down")
|
||||
(mkKeymap "n" "<c-k>" ":lua require('smart-splits').move_cursor_up()<cr>" "Move Cursor Up")
|
||||
(mkKeymap "n" "<c-l>" ":lua require('smart-splits').move_cursor_right()<cr>" "Move Cursor Right")
|
||||
(mkKeymap "n" "<c-\\>" ":lua require('smart-splits').move_cursor_previous()<cr>"
|
||||
"Move Cursor Previous"
|
||||
)
|
||||
(mkKeymap "n" "<leader>dd"
|
||||
(
|
||||
# lua
|
||||
mkRaw ''
|
||||
function()
|
||||
local any_diff = false
|
||||
for _, w in ipairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||
if vim.api.nvim_win_get_option(w, "diff") then
|
||||
any_diff = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if any_diff then
|
||||
vim.cmd("windo diffoff")
|
||||
else
|
||||
vim.cmd("windo diffthis")
|
||||
end
|
||||
end
|
||||
''
|
||||
)
|
||||
|
||||
"Toggle Diff the opened windows"
|
||||
)
|
||||
|
||||
(mkKeymap "n" "<c-s>" "<cmd>w ++p<cr>" "Save the file")
|
||||
(mkKeymap "n" "<a-+>" "<C-a>" "Increase Number")
|
||||
(mkKeymap "n" "<a-->" "<C-x>" "Decrease Number")
|
||||
|
||||
(mkKeymap "n" "<a-j>" "<cmd>m .+1<cr>==" "Move line Down")
|
||||
(mkKeymap "n" "<a-k>" "<cmd>m .-2<cr>==" "Move line up")
|
||||
|
||||
(mkKeymap "n" "<leader>qq" "<cmd>quitall!<cr>" "Quit!")
|
||||
(mkKeymap "n" "<leader>qw" (
|
||||
# lua
|
||||
mkRaw ''
|
||||
function()
|
||||
local wins = vim.api.nvim_tabpage_list_wins(0)
|
||||
if #wins > 1 then
|
||||
local ok, err = pcall(vim.cmd, 'close')
|
||||
if not ok then
|
||||
vim.notify("Cannot close the last window!", vim.log.levels.WARN)
|
||||
end
|
||||
else
|
||||
vim.notify("Cannot close the last window!", vim.log.levels.WARN)
|
||||
end
|
||||
end
|
||||
''
|
||||
) "Close Window!")
|
||||
|
||||
(mkKeymap "n" "<leader><leader>" "<cmd>nohl<cr>" "no highlight!")
|
||||
(mkKeymap "n" "<esc>" "<esc>:nohlsearch<cr>" "escape")
|
||||
(mkKeymap "n" "<leader>A" "ggVG" "select All")
|
||||
|
||||
(mkKeymap "n" "<leader>|" "<cmd>vsplit<cr>" "vertical split")
|
||||
(mkKeymap "n" "<leader>-" "<cmd>split<cr>" "horizontal split")
|
||||
|
||||
# quickfix
|
||||
(mkKeymap "n" "<leader>cn" "<cmd>cnext<cr>" "quickfix next")
|
||||
(mkKeymap "n" "<leader>cp" "<cmd>cprev<cr>" "quickfix prev")
|
||||
(mkKeymap "n" "<leader>cq" "<cmd>cclose<cr>" "quit quickfix")
|
||||
|
||||
(mkKeymap "n" "<leader>id" (
|
||||
# lua
|
||||
mkRaw ''
|
||||
function()
|
||||
local date = "# " .. os.date("%d-%m-%y")
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
|
||||
-- Insert date at cursor position
|
||||
local new_line = line:sub(1, col) .. date .. line:sub(col + 1)
|
||||
vim.api.nvim_set_current_line(new_line)
|
||||
|
||||
-- Move cursor to next line
|
||||
vim.api.nvim_win_set_cursor(0, { row + 1, 0 })
|
||||
end
|
||||
''
|
||||
) "Insert Date at cursor position")
|
||||
|
||||
(mkKeymap "n" "n" "nzzzv" "Move to center")
|
||||
(mkKeymap "n" "N" "Nzzzv" "Moving to center")
|
||||
(mkKeymap "n" "<leader>uC" (
|
||||
# lua
|
||||
mkRaw ''
|
||||
require('stay-centered').toggle
|
||||
''
|
||||
) "Toggle stay-centered.nvim")
|
||||
(mkKeymap "n" "<leader>ft" (
|
||||
# lua
|
||||
mkRaw ''
|
||||
function()
|
||||
vim.ui.input({ prompt = "Enter FileType: " }, function(input)
|
||||
local ft = input
|
||||
if not input or input == "" then
|
||||
ft = vim.bo.filetype
|
||||
end
|
||||
vim.o.filetype = ft
|
||||
end)
|
||||
end
|
||||
''
|
||||
) "Set Filetype")
|
||||
|
||||
(mkKeymap "n" "<leader>o" (
|
||||
# lua
|
||||
mkRaw ''
|
||||
function()
|
||||
local word = vim.fn.expand("<cfile>") -- Gets file-like word under cursor
|
||||
|
||||
if word:match("^https?://") then
|
||||
-- Detect OS and choose browser opener
|
||||
local open_cmd
|
||||
if vim.fn.has("macunix") == 1 then
|
||||
open_cmd = "open"
|
||||
elseif vim.fn.has("unix") == 1 then
|
||||
open_cmd = "xdg-open"
|
||||
elseif vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1 then
|
||||
open_cmd = "start"
|
||||
else
|
||||
print("Unsupported OS")
|
||||
return
|
||||
end
|
||||
|
||||
vim.fn.jobstart({ open_cmd, word }, { detach = true })
|
||||
|
||||
elseif vim.fn.filereadable(word) == 1 or vim.fn.isdirectory(word) == 1 then
|
||||
-- It's a file or directory; open in current window
|
||||
vim.cmd("edit " .. vim.fn.fnameescape(word))
|
||||
else
|
||||
print("Not a valid file or URL: " .. word)
|
||||
end
|
||||
end
|
||||
''
|
||||
) "Open")
|
||||
|
||||
(mkKeymapWithOpts "n" "j" ''v:count || mode(1)[0:1] == "no" ? "j" : "gj"'' "Move down" {
|
||||
expr = true;
|
||||
})
|
||||
(mkKeymapWithOpts "n" "k" ''v:count || mode(1)[0:1] == "no" ? "k" : "gk"'' "Move up" {
|
||||
expr = true;
|
||||
})
|
||||
|
||||
];
|
||||
in
|
||||
{
|
||||
keymaps = insert ++ normal ++ v ++ xv;
|
||||
|
||||
wKeyList = [
|
||||
(wKeyObj [
|
||||
"<leader>A"
|
||||
""
|
||||
""
|
||||
"true"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader><leader>"
|
||||
""
|
||||
""
|
||||
"true"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>q"
|
||||
""
|
||||
"quit/session"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>i"
|
||||
""
|
||||
"Insert"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>v"
|
||||
""
|
||||
"Insert"
|
||||
])
|
||||
(wKeyObj [
|
||||
"z"
|
||||
""
|
||||
"fold"
|
||||
])
|
||||
(wKeyObj [
|
||||
"g"
|
||||
""
|
||||
"goto"
|
||||
])
|
||||
(wKeyObj [
|
||||
"["
|
||||
""
|
||||
"next"
|
||||
])
|
||||
(wKeyObj [
|
||||
"]"
|
||||
""
|
||||
"prev"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>u"
|
||||
""
|
||||
"ui"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>o"
|
||||
""
|
||||
"Open"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>d"
|
||||
""
|
||||
"diff"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>|"
|
||||
""
|
||||
"vsplit"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>-"
|
||||
""
|
||||
"split"
|
||||
])
|
||||
(wKeyObj [
|
||||
"<leader>c"
|
||||
""
|
||||
"quickfix"
|
||||
])
|
||||
];
|
||||
|
||||
extraConfigLua = # lua
|
||||
''
|
||||
-- Use black hole register for 'x', 'X', 'c', 'C'
|
||||
vim.api.nvim_set_keymap('n', 'x', '"_x', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', 'X', '"_X', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', 'c', '"_c', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', 'C', '"_C', { noremap = true, silent = true })
|
||||
|
||||
-- Visual mode
|
||||
vim.api.nvim_set_keymap('v', 'x', '"_d', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', 'X', '"_d', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', 'c', '"_c', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', 'C', '"_c', { noremap = true, silent = true })
|
||||
|
||||
-- In visual mode, paste from the clipboard without overwriting it
|
||||
vim.api.nvim_set_keymap("v", "p", '"_dP', { noremap = true, silent = true })
|
||||
|
||||
-- Only this hack works in command mode
|
||||
vim.cmd([[
|
||||
cnoremap <C-j> <C-n>
|
||||
cnoremap <C-k> <C-p>
|
||||
]])
|
||||
'';
|
||||
}
|
||||
46
plugins/common/options.nix
Normal file
46
plugins/common/options.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
wKeyList = mkOption {
|
||||
type = types.listOf types.attrs;
|
||||
};
|
||||
|
||||
myvim = {
|
||||
mkKey = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
};
|
||||
|
||||
icons = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
};
|
||||
|
||||
leader = mkOption {
|
||||
description = "The leader key for nvim.";
|
||||
type = types.str;
|
||||
default = " ";
|
||||
};
|
||||
|
||||
border = mkOption {
|
||||
description = "The border style for nvim.";
|
||||
type = types.enum [
|
||||
"single"
|
||||
"double"
|
||||
"rounded"
|
||||
"solid"
|
||||
"shadow"
|
||||
"curved"
|
||||
"bold"
|
||||
"none"
|
||||
];
|
||||
default = "rounded";
|
||||
};
|
||||
|
||||
transparent = mkEnableOption "transparent" // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
52
plugins/common/plugins.nix
Normal file
52
plugins/common/plugins.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
inherit (config.myvim.mkKey) mkKeymap;
|
||||
in
|
||||
{
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
stay-centered-nvim
|
||||
];
|
||||
|
||||
plugins = {
|
||||
comment = {
|
||||
enable = true;
|
||||
settings = {
|
||||
toggler.line = "<leader>/";
|
||||
opleader.line = "<leader>/";
|
||||
};
|
||||
};
|
||||
|
||||
flash = {
|
||||
enable = true;
|
||||
settings = {
|
||||
modes.char.enabled = false;
|
||||
};
|
||||
};
|
||||
|
||||
lz-n.enable = true;
|
||||
nvim-autopairs.enable = true;
|
||||
nvim-surround.enable = true;
|
||||
smart-splits.enable = true;
|
||||
trim.enable = true;
|
||||
visual-multi.enable = true;
|
||||
web-devicons.enable = true;
|
||||
|
||||
which-key = {
|
||||
enable = true;
|
||||
settings = {
|
||||
spec = config.wKeyList;
|
||||
preset = "helix";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
opts = {
|
||||
timeout = true;
|
||||
timeoutlen = 250;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
(mkKeymap "n" "<leader>vt" "<cmd>:lua require('flash').treesitter()<cr>" "Select Treesitter Node")
|
||||
(mkKeymap "n" "<leader>ut" ":TrimToggle<cr>" "Toggle Trim")
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue