initial commit
This commit is contained in:
commit
35fb1473db
20 changed files with 836 additions and 0 deletions
5
config/bufferline.nix
Normal file
5
config/bufferline.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
plugins.bufferline = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
18
config/comment.nix
Normal file
18
config/comment.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
plugins.comment = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<C-_>";
|
||||
action = "gcc";
|
||||
}
|
||||
{
|
||||
mode = [ "v" ];
|
||||
key = "<C-_>";
|
||||
action = "gc";
|
||||
}
|
||||
];
|
||||
}
|
29
config/core.nix
Normal file
29
config/core.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
config = {
|
||||
# Color scheme.
|
||||
colorschemes.catppuccin = {
|
||||
enable = true;
|
||||
settings.flavour = "mocha";
|
||||
};
|
||||
|
||||
# Options.
|
||||
opts = {
|
||||
# Indent settings.
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
expandtab = true;
|
||||
# Line number.
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
signcolumn = "yes";
|
||||
# Search case sensitivity.
|
||||
ic = true;
|
||||
};
|
||||
|
||||
# Clipboard.
|
||||
clipboard = {
|
||||
register = "unnamedplus";
|
||||
providers.xclip.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
18
config/default.nix
Normal file
18
config/default.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
# Import all your configuration modules here
|
||||
imports = [
|
||||
./bufferline.nix
|
||||
./comment.nix
|
||||
./core.nix
|
||||
./gitsign.nix
|
||||
./indent-blankline.nix
|
||||
./keybindings.nix
|
||||
./lsp
|
||||
./rainbow-delimiters.nix
|
||||
./telescope.nix
|
||||
./toggleterm.nix
|
||||
./treesitter.nix
|
||||
./neo-tree.nix
|
||||
./which-key.nix
|
||||
];
|
||||
}
|
69
config/gitsign.nix
Normal file
69
config/gitsign.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{ helpers, ... }:
|
||||
|
||||
{
|
||||
plugins.gitsigns = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
# Navigate through hunks
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "]c";
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal({']c', bang = true})
|
||||
else
|
||||
require("gitsigns").nav_hunk('next')
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "[c";
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal({'[c', bang = true})
|
||||
else
|
||||
require("gitsigns").nav_hunk('prev')
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
mode = [ "v" ];
|
||||
key = "<leader>hs";
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "Stage Hunk";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<leader>hu";
|
||||
action = helpers.mkRaw ''
|
||||
require("gitsigns").undo_stage_hunk
|
||||
'';
|
||||
options = {
|
||||
desc = "Undo Stage Hunk";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<leader>hp";
|
||||
action = helpers.mkRaw ''
|
||||
require("gitsigns").preview_hunk
|
||||
'';
|
||||
options = {
|
||||
desc = "Preview Hunk";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
7
config/indent-blankline.nix
Normal file
7
config/indent-blankline.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
plugins.indent-blankline = {
|
||||
enable = true;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
}
|
96
config/keybindings.nix
Normal file
96
config/keybindings.nix
Normal file
|
@ -0,0 +1,96 @@
|
|||
{ helpers, ... }:
|
||||
{
|
||||
keymaps = [
|
||||
# Window movement.
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<c-h>";
|
||||
action = "<c-w>h";
|
||||
options = {
|
||||
remap = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<c-h>";
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
local cur_win = vim.api.nvim_get_current_win()
|
||||
vim.cmd('wincmd h')
|
||||
if cur_win == vim.api.nvim_get_current_win() then
|
||||
require('neo-tree.command').execute({ toggle = true })
|
||||
end
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
remap = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<c-j>";
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
local cur_win = vim.api.nvim_get_current_win()
|
||||
vim.cmd('wincmd j')
|
||||
if cur_win == vim.api.nvim_get_current_win() then
|
||||
vim.cmd('ToggleTerm')
|
||||
end
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
remap = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<c-k>";
|
||||
action = "<c-w>k";
|
||||
options = {
|
||||
remap = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<c-l>";
|
||||
action = "<c-w>l";
|
||||
options = {
|
||||
remap = true;
|
||||
};
|
||||
}
|
||||
|
||||
# Use ESC to exit terminal mode
|
||||
{
|
||||
mode = [ "t" ];
|
||||
key = "<Esc>";
|
||||
action = "<C-\\><C-n>";
|
||||
}
|
||||
|
||||
# Buffer movement
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<s-h>";
|
||||
action = "<cmd>bprevious<cr>";
|
||||
options = {
|
||||
desc = "Previous Buffer";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<s-l>";
|
||||
action = "<cmd>bnext<cr>";
|
||||
options = {
|
||||
desc = "Next Buffer";
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = [ "n" "i" ];
|
||||
key = "<S-Tab>";
|
||||
action = "<cmd>tabprevious<cr>";
|
||||
options = {
|
||||
desc = "Previous Tab";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
6
config/lsp/default.nix
Normal file
6
config/lsp/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./lsp.nix
|
||||
./lsp-format.nix
|
||||
];
|
||||
}
|
5
config/lsp/lsp-format.nix
Normal file
5
config/lsp/lsp-format.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
plugins.lsp-format = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
75
config/lsp/lsp.nix
Normal file
75
config/lsp/lsp.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
cmake = {
|
||||
enable = true;
|
||||
};
|
||||
clangd = {
|
||||
enable = true;
|
||||
};
|
||||
pyright = {
|
||||
enable = true;
|
||||
};
|
||||
nixd = {
|
||||
enable = true;
|
||||
};
|
||||
metals = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
keymaps = {
|
||||
silent = true;
|
||||
lspBuf = {
|
||||
gd = {
|
||||
action = "definition";
|
||||
desc = "Goto Definition";
|
||||
};
|
||||
gA = {
|
||||
action = "references";
|
||||
desc = "Goto References";
|
||||
};
|
||||
gD = {
|
||||
action = "declaration";
|
||||
desc = "Goto Declaration";
|
||||
};
|
||||
gI = {
|
||||
action = "implementation";
|
||||
desc = "Goto Implementation";
|
||||
};
|
||||
gT = {
|
||||
action = "type_definition";
|
||||
desc = "Type Definition";
|
||||
};
|
||||
K = {
|
||||
action = "hover";
|
||||
desc = "Hover";
|
||||
};
|
||||
"<leader>cw" = {
|
||||
action = "workspace_symbol";
|
||||
desc = "Workspace Symbol";
|
||||
};
|
||||
"<f2>" = {
|
||||
action = "rename";
|
||||
desc = "Rename";
|
||||
};
|
||||
};
|
||||
diagnostic = {
|
||||
"<leader>cd" = {
|
||||
action = "open_float";
|
||||
desc = "Line Diagnostics";
|
||||
};
|
||||
"[d" = {
|
||||
action = "goto_next";
|
||||
desc = "Next Diagnostic";
|
||||
};
|
||||
"]d" = {
|
||||
action = "goto_prev";
|
||||
desc = "Previous Diagnostic";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
45
config/neo-tree.nix
Normal file
45
config/neo-tree.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ helpers, ... }:
|
||||
|
||||
{
|
||||
plugins.neo-tree = {
|
||||
enable = true;
|
||||
window.mappings."h".__raw = ''
|
||||
function(state)
|
||||
local node = state.tree:get_node()
|
||||
if node.type == "directory" and node:is_expanded() then
|
||||
require("neo-tree.sources.filesystem").toggle_directory(state, node)
|
||||
else
|
||||
require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
|
||||
end
|
||||
end
|
||||
'';
|
||||
window.mappings."l".__raw = ''
|
||||
function(state)
|
||||
local node = state.tree:get_node()
|
||||
if node.type == "directory" then
|
||||
if not node:is_expanded() then
|
||||
require("neo-tree.sources.filesystem").toggle_directory(state, node)
|
||||
elseif node:has_children() then
|
||||
require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
window.mappings."s" = "";
|
||||
window.mappings."<space>" = "";
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<leader>e";
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true })
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "Toggle Neo-Tree";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
23
config/rainbow-delimiters.nix
Normal file
23
config/rainbow-delimiters.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
plugins.rainbow-delimiters = {
|
||||
enable = true;
|
||||
highlight = [
|
||||
"RainbowRed"
|
||||
"RainbowYellow"
|
||||
"RainbowBlue"
|
||||
"RainbowOrange"
|
||||
"RainbowGreen"
|
||||
"RainbowViolet"
|
||||
"RainbowCyan"
|
||||
];
|
||||
};
|
||||
highlight = {
|
||||
RainbowRed = { fg = "#E06C75"; };
|
||||
RainbowYellow = { fg = "#E5C07B"; };
|
||||
RainbowBlue = { fg = "#61AFEF"; };
|
||||
RainbowOrange = { fg = "#D19A66"; };
|
||||
RainbowGreen = { fg = "#98C379"; };
|
||||
RainbowViolet = { fg = "#C678DD"; };
|
||||
RainbowCyan = { fg = "#56B6C2"; };
|
||||
};
|
||||
}
|
21
config/telescope.nix
Normal file
21
config/telescope.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ helpers, ... }:
|
||||
|
||||
{
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
mode = [ "n" "i" ];
|
||||
key = "<C-p>";
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
require("telescope.builtin").find_files()
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "Find files with telescope";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
17
config/toggleterm.nix
Normal file
17
config/toggleterm.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
plugins.toggleterm = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
|
||||
{
|
||||
mode = [ "n" ];
|
||||
key = "<leader>tt";
|
||||
action = "<cmd>ToggleTerm<cr>";
|
||||
options = {
|
||||
desc = "Toggle terminal";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
5
config/treesitter.nix
Normal file
5
config/treesitter.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
5
config/which-key.nix
Normal file
5
config/which-key.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
plugins.which-key = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue