big refactor
This commit is contained in:
commit
76d68230f6
81 changed files with 3065 additions and 0 deletions
14
modules/programs/nixvim/_nixvim.nix
Normal file
14
modules/programs/nixvim/_nixvim.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ pkgs, config, ... }:
|
||||
{
|
||||
programs.nixvim.imports = [
|
||||
./default.nix
|
||||
./extra-packages.nix
|
||||
|
||||
./keymaps/_keymaps.nix
|
||||
|
||||
./plugins/_plugins.nix
|
||||
./plugins/_extraPlugins.nix
|
||||
|
||||
./lua/_lua.nix
|
||||
];
|
||||
}
|
||||
20
modules/programs/nixvim/default.nix
Normal file
20
modules/programs/nixvim/default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ ... }:
|
||||
{
|
||||
enable = true;
|
||||
vimdiffAlias = true;
|
||||
colorschemes.catppuccin.enable = true;
|
||||
|
||||
opts = {
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
softtabstop = 2;
|
||||
smartindent = true;
|
||||
expandtab = true;
|
||||
|
||||
clipboard = "unnamedplus";
|
||||
};
|
||||
}
|
||||
|
||||
6
modules/programs/nixvim/extra-packages.nix
Normal file
6
modules/programs/nixvim/extra-packages.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
extraPackages = with pkgs; [
|
||||
nodePackages.prettier
|
||||
];
|
||||
}
|
||||
26
modules/programs/nixvim/keymaps/_default.nix
Normal file
26
modules/programs/nixvim/keymaps/_default.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[
|
||||
{
|
||||
mode = "i";
|
||||
key = "<A-h>";
|
||||
action = "<Left>";
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = "i";
|
||||
key = "<A-j>";
|
||||
action = "<Down>";
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = "i";
|
||||
key = "<A-k>";
|
||||
action = "<Up>";
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = "i";
|
||||
key = "<A-l>";
|
||||
action = "<Right>";
|
||||
options.silent = true;
|
||||
}
|
||||
]
|
||||
11
modules/programs/nixvim/keymaps/_keymaps.nix
Normal file
11
modules/programs/nixvim/keymaps/_keymaps.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
{
|
||||
globals.mapleader = " ";
|
||||
keymaps =
|
||||
[ ]
|
||||
++ (import ./_default.nix)
|
||||
++ (import ./barbar.nix)
|
||||
++ (import ./toggleterm.nix)
|
||||
++ (import ./nvim-tree-toggle.nix);
|
||||
}
|
||||
|
||||
39
modules/programs/nixvim/keymaps/barbar.nix
Normal file
39
modules/programs/nixvim/keymaps/barbar.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
[
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A-,>";
|
||||
action = "<cmd>BufferPrevious<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A-.>";
|
||||
action = "<cmd>BufferNext<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A-<>";
|
||||
action = "<cmd>BufferMovePrevious<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A->>";
|
||||
action = "<cmd>BufferMoveNext<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A-c>";
|
||||
action = "<Cmd>BufferClose<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
]
|
||||
++ (builtins.genList (i: {
|
||||
mode = "n";
|
||||
key = "<A-${toString (i + 1)}>";
|
||||
action = "<cmd>BufferGoto ${toString (i + 1)}<CR>";
|
||||
options.silent = true;
|
||||
}) 9)
|
||||
|
||||
8
modules/programs/nixvim/keymaps/nvim-tree-toggle.nix
Normal file
8
modules/programs/nixvim/keymaps/nvim-tree-toggle.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-b>";
|
||||
action = "<cmd>NvimTreeToggle<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
]
|
||||
63
modules/programs/nixvim/keymaps/toggleterm.nix
Normal file
63
modules/programs/nixvim/keymaps/toggleterm.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
[
|
||||
{
|
||||
mode = "t";
|
||||
key = "<esc>";
|
||||
action = "<C-\\><C-n>";
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "jk";
|
||||
action = "<C-\\><C-n>";
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "<C-w>";
|
||||
action = "<C-\\><C-n><C-w>";
|
||||
}
|
||||
|
||||
{
|
||||
mode = "t";
|
||||
key = "<C-l>";
|
||||
action = "<Cmd>wincmd l<CR>";
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "<C-k>";
|
||||
action = "<Cmd>wincmd k<CR>";
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "<C-j>";
|
||||
action = "<Cmd>wincmd j<CR>";
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "<C-h>";
|
||||
action = "<Cmd>wincmd h<CR>";
|
||||
}
|
||||
]
|
||||
++ builtins.concatLists (
|
||||
builtins.genList (i: [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>th${toString (i + 1)}";
|
||||
action = ":${toString (i + 1)}ToggleTerm direction=horizontal<CR>";
|
||||
options.silent = true;
|
||||
options.noremap = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tv${toString (i + 1)}";
|
||||
action = ":${toString (i + 1)}ToggleTerm direction=vertical<CR>";
|
||||
options.silent = true;
|
||||
options.noremap = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tf${toString (i + 1)}";
|
||||
action = ":${toString (i + 1)}ToggleTerm direction=float<CR>";
|
||||
options.silent = true;
|
||||
options.noremap = true;
|
||||
}
|
||||
]) 9
|
||||
)
|
||||
4
modules/programs/nixvim/lua/_lua.nix
Normal file
4
modules/programs/nixvim/lua/_lua.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{ ... }:
|
||||
{
|
||||
|
||||
}
|
||||
15
modules/programs/nixvim/plugins/_extraPlugins.nix
Normal file
15
modules/programs/nixvim/plugins/_extraPlugins.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
EXTRA_PLUGINS = [
|
||||
./extras/neocord.nix
|
||||
./extras/mini-icons.nix
|
||||
];
|
||||
|
||||
LUA = [
|
||||
./lua/neocord.lua
|
||||
];
|
||||
in
|
||||
{
|
||||
extraPlugins = map (path: import path { plugins = pkgs.vimPlugins; }) EXTRA_PLUGINS;
|
||||
extraConfigLua = builtins.concatStringsSep "\n" (map builtins.readFile LUA);
|
||||
}
|
||||
33
modules/programs/nixvim/plugins/_plugins.nix
Normal file
33
modules/programs/nixvim/plugins/_plugins.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ ... }@inputs:
|
||||
{
|
||||
plugins = {
|
||||
nvim-tree = import ./nvimtree.nix inputs;
|
||||
lsp = import ./lsp.nix inputs;
|
||||
lspkind = import ./lspkind.nix inputs;
|
||||
conform-nvim = import ./conform-nvim.nix inputs;
|
||||
which-key = import ./which-key.nix inputs;
|
||||
lint = import ./lint.nix inputs;
|
||||
|
||||
cmp = import ./cmp.nix inputs;
|
||||
cmp-nvim-lsp.enable = true;
|
||||
cmp-buffer.enable = true;
|
||||
cmp-path.enable = true;
|
||||
cmp_luasnip.enable = true;
|
||||
|
||||
web-devicons.enable = true;
|
||||
lz-n.enable = true;
|
||||
treesitter.enable = true;
|
||||
lualine.enable = true;
|
||||
neoscroll.enable = true;
|
||||
image.enable = true;
|
||||
nvim-autopairs.enable = true;
|
||||
bufferline.enable = true;
|
||||
luasnip.enable = true;
|
||||
friendly-snippets.enable = true;
|
||||
indent-blankline.enable = true;
|
||||
barbar.enable = true;
|
||||
toggleterm.enable = true;
|
||||
auto-save.enable = true;
|
||||
visual-multi.enable = true;
|
||||
};
|
||||
}
|
||||
25
modules/programs/nixvim/plugins/cmp.nix
Normal file
25
modules/programs/nixvim/plugins/cmp.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ ... }: {
|
||||
enable = true;
|
||||
autoEnableSources = true;
|
||||
|
||||
settings = {
|
||||
sources = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "path"; }
|
||||
{ name = "luasnip"; }
|
||||
{ name = "buffer"; }
|
||||
];
|
||||
|
||||
mapping = {
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-e>" = "cmp.mapping.abort()";
|
||||
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
||||
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
|
||||
};
|
||||
|
||||
formatting.fields = [ "kind" "abbr" "menu" ];
|
||||
};
|
||||
}
|
||||
20
modules/programs/nixvim/plugins/conform-nvim.nix
Normal file
20
modules/programs/nixvim/plugins/conform-nvim.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ ... }:
|
||||
{
|
||||
enable = true;
|
||||
settings = {
|
||||
formatters_by_ft = {
|
||||
javascript = [ "prettier" ];
|
||||
typescript = [ "prettier" ];
|
||||
json = [ "prettier" ];
|
||||
css = [ "prettier" ];
|
||||
html = [ "prettier" ];
|
||||
nix = [ "nixfmt" ];
|
||||
php = [ "php_cs_fixer" ];
|
||||
};
|
||||
|
||||
format_on_save = {
|
||||
timeout_ms = 500;
|
||||
lsp_fallback = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
4
modules/programs/nixvim/plugins/extras/mini-icons.nix
Normal file
4
modules/programs/nixvim/plugins/extras/mini-icons.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{ plugins, ... }:
|
||||
{
|
||||
plugin = plugins.mini-icons;
|
||||
}
|
||||
4
modules/programs/nixvim/plugins/extras/neocord.nix
Normal file
4
modules/programs/nixvim/plugins/extras/neocord.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{ plugins, ... }:
|
||||
{
|
||||
plugin = plugins.neocord;
|
||||
}
|
||||
6
modules/programs/nixvim/plugins/lint.nix
Normal file
6
modules/programs/nixvim/plugins/lint.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
enable = true;
|
||||
lintersByFt = {
|
||||
};
|
||||
}
|
||||
12
modules/programs/nixvim/plugins/lsp.nix
Normal file
12
modules/programs/nixvim/plugins/lsp.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ ... }:
|
||||
{
|
||||
enable = true;
|
||||
servers = {
|
||||
phpactor.enable = true;
|
||||
nil_ls.enable = true;
|
||||
pyright.enable = true;
|
||||
ts_ls.enable = true;
|
||||
html.enable = true;
|
||||
cssls.enable = true;
|
||||
};
|
||||
}
|
||||
4
modules/programs/nixvim/plugins/lspkind.nix
Normal file
4
modules/programs/nixvim/plugins/lspkind.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{ ... }: {
|
||||
enable = true;
|
||||
cmp.enable = true;
|
||||
}
|
||||
24
modules/programs/nixvim/plugins/lua/neocord.lua
Normal file
24
modules/programs/nixvim/plugins/lua/neocord.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
require("neocord").setup({
|
||||
-- General options
|
||||
logo= "auto", -- "auto" or url
|
||||
logo_tooltip= nil,-- nil or string
|
||||
main_image= "language", -- "language" or "logo"
|
||||
client_id = "1157438221865717891",-- Use your own Discord application client id (not recommended)
|
||||
log_level = nil,-- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
|
||||
debounce_timeout= 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
|
||||
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
|
||||
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
|
||||
show_time = true, -- Show the timer
|
||||
global_timer= false,-- if set true, timer won't update when any event are triggered
|
||||
buttons = nil,-- A list of buttons (objects with label and url attributes) or a function returning such list.
|
||||
|
||||
-- Rich Presence text options
|
||||
editing_text= "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
|
||||
file_explorer_text= "Browsing %s",-- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
|
||||
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
|
||||
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
|
||||
reading_text= "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
|
||||
workspace_text= "Working on %s",-- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
|
||||
line_number_text= "Line %s out of %s",-- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
|
||||
terminal_text = "Using Terminal", -- Format string rendered when in terminal mode.
|
||||
})
|
||||
5
modules/programs/nixvim/plugins/nvimtree.nix
Normal file
5
modules/programs/nixvim/plugins/nvimtree.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ ... }: {
|
||||
enable = true;
|
||||
openOnSetupFile = true;
|
||||
settings.auto_reload_on_write = true;
|
||||
}
|
||||
7
modules/programs/nixvim/plugins/which-key.nix
Normal file
7
modules/programs/nixvim/plugins/which-key.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ ... }:
|
||||
{
|
||||
enable = true;
|
||||
settings = {
|
||||
preset = "modern";
|
||||
};
|
||||
}
|
||||
Reference in a new issue