i got tired of b&w
This commit is contained in:
parent
43a9d4a0f7
commit
0a5e457ae0
55 changed files with 401 additions and 2713 deletions
|
|
@ -4,3 +4,12 @@ vim.o.undofile = true
|
||||||
vim.o.undodir = vim.fn.expand("~/.local/state/nvim/undo")
|
vim.o.undodir = vim.fn.expand("~/.local/state/nvim/undo")
|
||||||
vim.diagnostic.config({ signs = false })
|
vim.diagnostic.config({ signs = false })
|
||||||
vim.print("loaded extra config.lua file ;)")
|
vim.print("loaded extra config.lua file ;)")
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
callback = function(args)
|
||||||
|
local bt = vim.bo[args.buf].buftype
|
||||||
|
if bt == "prompt" then
|
||||||
|
vim.b[args.buf].minicompletion_disable = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,74 +1,37 @@
|
||||||
{ pkgs, inputs, ... }:
|
{inputs, ...}: {
|
||||||
|
imports = [inputs.nixvim.homeModules.nixvim];
|
||||||
# my most preciated config, well documented if you want to use it.
|
|
||||||
# inspired by https://github.com/xhuyz/nixvim
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [ inputs.nixvim.homeModules.nixvim ];
|
|
||||||
|
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
# plugins
|
# plugins
|
||||||
# ./plugins/aerial.nix
|
./plugins/basics.nix
|
||||||
./plugins/autopairs.nix
|
./plugins/completion.nix
|
||||||
./plugins/blink.nix
|
./plugins/extra.nix
|
||||||
./plugins/dashboard.nix
|
./plugins/files.nix
|
||||||
./plugins/hlchunk.nix
|
./plugins/git.nix
|
||||||
./plugins/lualine.nix
|
./plugins/icons.nix
|
||||||
./plugins/neo-tree.nix
|
./plugins/notify.nix
|
||||||
./plugins/snacks.nix
|
./plugins/pairs.nix
|
||||||
./plugins/toggleterm.nix
|
./plugins/statusline.nix
|
||||||
|
./plugins/starter.nix
|
||||||
|
./plugins/snippets.nix
|
||||||
|
./plugins/which-key.nix
|
||||||
|
./plugins/conform.nix
|
||||||
./plugins/treesitter.nix
|
./plugins/treesitter.nix
|
||||||
./plugins/treesj.nix
|
|
||||||
./plugins/web-devicons.nix
|
# lsp
|
||||||
./plugins/yanky.nix
|
./lsp/default.nix
|
||||||
|
|
||||||
|
# keymaps
|
||||||
|
./keymaps.nix
|
||||||
|
|
||||||
# theme
|
# theme
|
||||||
./theme.nix
|
./theme.nix
|
||||||
|
|
||||||
# lsp
|
# options
|
||||||
./lsp/fidget.nix
|
./options.nix
|
||||||
./lsp/lsp.nix
|
|
||||||
./lsp/roslyn.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
globals.mapleader = " ";
|
|
||||||
|
|
||||||
opts = {
|
|
||||||
number = true;
|
|
||||||
relativenumber = false;
|
|
||||||
colorcolumn = "0";
|
|
||||||
shiftwidth = 2;
|
|
||||||
tabstop = 2;
|
|
||||||
wrap = false;
|
|
||||||
swapfile = false; # undotree
|
|
||||||
backup = false; # undotree
|
|
||||||
undofile = true;
|
|
||||||
hlsearch = false;
|
|
||||||
incsearch = true;
|
|
||||||
termguicolors = true;
|
|
||||||
scrolloff = 8;
|
|
||||||
signcolumn = "no";
|
|
||||||
updatetime = 50;
|
|
||||||
foldlevelstart = 99;
|
|
||||||
};
|
|
||||||
|
|
||||||
clipboard = {
|
|
||||||
register = "unnamedplus";
|
|
||||||
};
|
|
||||||
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
# formatters
|
|
||||||
stylua
|
|
||||||
nixfmt-rfc-style
|
|
||||||
|
|
||||||
# linters
|
|
||||||
golangci-lint
|
|
||||||
shellcheck
|
|
||||||
];
|
|
||||||
|
|
||||||
extraConfigLua = builtins.readFile ./config.lua;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
57
home/modules/ide/nvim/keymaps.nix
Normal file
57
home/modules/ide/nvim/keymaps.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<Leader>e";
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({
|
||||||
|
toggle = true,
|
||||||
|
dir = vim.fn.getcwd()
|
||||||
|
})
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>ff";
|
||||||
|
mode = ["n"];
|
||||||
|
action = "<cmd>lua Snacks.picker.files()<CR>";
|
||||||
|
options.desc = "find files";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>gr";
|
||||||
|
mode = ["n"];
|
||||||
|
action = "<cmd>lua Snacks.picker.grep()<CR>";
|
||||||
|
options.desc = "find grep";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>gl";
|
||||||
|
mode = ["n"];
|
||||||
|
action = "<cmd>lua Snacks.picker.git_log()<CR>";
|
||||||
|
options.desc = "git log";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>gs";
|
||||||
|
mode = ["n"];
|
||||||
|
action = "<cmd>lua Snacks.picker.git_status()<CR>";
|
||||||
|
options.desc = "git status";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>uC";
|
||||||
|
mode = ["n"];
|
||||||
|
action = "<cmd>lua Snacks.picker.colorschemes()<CR>";
|
||||||
|
options.desc = "colorschemes";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>:";
|
||||||
|
mode = ["n"];
|
||||||
|
action = "<cmd>lua Snacks.picker.command_history()<CR>";
|
||||||
|
options.desc = "command history";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-h>";
|
||||||
|
mode = ["n"];
|
||||||
|
action = "<cmd>Neotree source=filesystem focus<CR>";
|
||||||
|
options.desc = "switch focus";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
imports = [
|
||||||
...
|
./nixd.nix
|
||||||
}:
|
./go.nix
|
||||||
{
|
];
|
||||||
imports = [ ./langs/default.nix ];
|
|
||||||
plugins = {
|
plugins = {
|
||||||
lsp = {
|
lsp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -62,17 +61,5 @@
|
||||||
};
|
};
|
||||||
lsp-lines.enable = true;
|
lsp-lines.enable = true;
|
||||||
lsp-format.enable = true;
|
lsp-format.enable = true;
|
||||||
helm.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
|
||||||
roslyn-nvim
|
|
||||||
];
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
roslyn-ls
|
|
||||||
nixfmt-rfc-style
|
|
||||||
svelte-language-server
|
|
||||||
typescript-language-server
|
|
||||||
typescript
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
plugins.fidget = {
|
|
||||||
enable = true;
|
|
||||||
settings.progress = {
|
|
||||||
suppress_on_insert = true;
|
|
||||||
ignore_done_already = true;
|
|
||||||
poll_rate = 1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
10
home/modules/ide/nvim/lsp/go.nix
Normal file
10
home/modules/ide/nvim/lsp/go.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
plugins.lsp.servers.gopls = {
|
||||||
|
enable = true;
|
||||||
|
filetypes = [
|
||||||
|
"go"
|
||||||
|
"mod"
|
||||||
|
"sum"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
{
|
|
||||||
plugins = {
|
|
||||||
lsp.servers = {
|
|
||||||
clangd.enable = true;
|
|
||||||
cmake.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
conform-nvim.settings = {
|
|
||||||
formatters_by_ft = {
|
|
||||||
c = [ "clang_format" ];
|
|
||||||
cpp = [ "clang_format" ];
|
|
||||||
cmake = [ "cmake-format" ];
|
|
||||||
};
|
|
||||||
formatters.cmake-format.command = lib.getExe pkgs.cmake-format;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
imports =
|
|
||||||
with builtins;
|
|
||||||
map (fn: ./${fn}) (filter (fn: fn != "default.nix") (attrNames (readDir ./.)));
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
{
|
|
||||||
plugins = {
|
|
||||||
lsp.servers = {
|
|
||||||
gopls = {
|
|
||||||
enable = true;
|
|
||||||
filetypes = [
|
|
||||||
"go"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
conform-nvim.settings = {
|
|
||||||
formatters_by_ft = {
|
|
||||||
go = [ "gofmt" ];
|
|
||||||
};
|
|
||||||
formatters = {
|
|
||||||
gofmt = {
|
|
||||||
command = lib.getExe pkgs.go + " fmt";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
plugins = {
|
|
||||||
lsp.servers.lua_ls.enable = true;
|
|
||||||
conform-nvim.settings = {
|
|
||||||
formatters_by_ft.lua = [ "stylua" ];
|
|
||||||
formatters.stylua = {
|
|
||||||
# if a command is string then it will execute the system's stylua binary
|
|
||||||
command = "stylua";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
plugins = {
|
|
||||||
lsp.servers = {
|
|
||||||
nixd = {
|
|
||||||
enable = true;
|
|
||||||
cmd = [ "nixd" ];
|
|
||||||
rootMarkers = [
|
|
||||||
"require('lspconfig.util').root_pattern('.nixd.json', 'flake.nix', '.git')"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
plugins = {
|
|
||||||
lsp.servers.vue_ls.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
7
home/modules/ide/nvim/lsp/nixd.nix
Normal file
7
home/modules/ide/nvim/lsp/nixd.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
plugins.lsp = {
|
||||||
|
servers = {
|
||||||
|
nixd.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
{
|
|
||||||
lsp.servers.roslyn_ls = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
config = {
|
|
||||||
cmd = [
|
|
||||||
"${lib.getExe' pkgs.roslyn-ls "Microsoft.CodeAnalysis.LanguageServer"}"
|
|
||||||
"--logLevel"
|
|
||||||
"Information"
|
|
||||||
"--extensionLogDirectory"
|
|
||||||
"fs.joinpath(uv.os_tmpdir() \"roslyn_ls/logs\")"
|
|
||||||
"--stdio"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
33
home/modules/ide/nvim/options.nix
Normal file
33
home/modules/ide/nvim/options.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
{ pkgs, ... }: {
|
||||||
|
opts = {
|
||||||
|
number = true;
|
||||||
|
relativenumber = false;
|
||||||
|
colorcolumn = "0";
|
||||||
|
shiftwidth = 2;
|
||||||
|
tabstop = 2;
|
||||||
|
wrap = false;
|
||||||
|
swapfile = false; # undotree
|
||||||
|
backup = false; # undotree
|
||||||
|
undofile = true;
|
||||||
|
hlsearch = false;
|
||||||
|
incsearch = true;
|
||||||
|
termguicolors = true;
|
||||||
|
scrolloff = 8;
|
||||||
|
signcolumn = "no";
|
||||||
|
updatetime = 50;
|
||||||
|
foldlevelstart = 99;
|
||||||
|
};
|
||||||
|
|
||||||
|
clipboard = {
|
||||||
|
register = "unnamedplus";
|
||||||
|
};
|
||||||
|
|
||||||
|
globals.mapleader = " ";
|
||||||
|
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
stylua
|
||||||
|
nixfmt-rfc-style
|
||||||
|
];
|
||||||
|
|
||||||
|
extraConfigLua = builtins.readFile ./config.lua;
|
||||||
|
}
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
{
|
|
||||||
plugins.aerial = {
|
|
||||||
enable = true;
|
|
||||||
autoLoad = true;
|
|
||||||
settings = {
|
|
||||||
attach_mode = "global";
|
|
||||||
backends = [
|
|
||||||
"treesitter"
|
|
||||||
"lsp"
|
|
||||||
"markdown"
|
|
||||||
"man"
|
|
||||||
];
|
|
||||||
disable_max_lines = 5000;
|
|
||||||
highlight_on_hover = true;
|
|
||||||
ignore = {
|
|
||||||
filetypes = [
|
|
||||||
"gomod"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
keymaps = {
|
|
||||||
"<2-LeftMouse>" = "actions.jump";
|
|
||||||
"<C-j>" = "actions.down_and_scroll";
|
|
||||||
"<C-k>" = "actions.up_and_scroll";
|
|
||||||
"<C-s>" = "actions.jump_split";
|
|
||||||
"<C-v>" = "actions.jump_vsplit";
|
|
||||||
"<CR>" = "actions.jump";
|
|
||||||
"?" = "actions.show_help";
|
|
||||||
H = "actions.tree_close_recursive";
|
|
||||||
L = "actions.tree_open_recursive";
|
|
||||||
O = "actions.tree_toggle_recursive";
|
|
||||||
"[[" = "actions.prev_up";
|
|
||||||
"]]" = "actions.next_up";
|
|
||||||
"g?" = "actions.show_help";
|
|
||||||
h = "actions.tree_close";
|
|
||||||
l = "actions.tree_open";
|
|
||||||
o = "actions.tree_toggle";
|
|
||||||
p = "actions.scroll";
|
|
||||||
q = "actions.close";
|
|
||||||
zA = "actions.tree_toggle_recursive";
|
|
||||||
zC = "actions.tree_close_recursive";
|
|
||||||
zM = "actions.tree_close_all";
|
|
||||||
zO = "actions.tree_open_recursive";
|
|
||||||
zR = "actions.tree_open_all";
|
|
||||||
zX = "actions.tree_sync_folds";
|
|
||||||
za = "actions.tree_toggle";
|
|
||||||
zc = "actions.tree_close";
|
|
||||||
zm = "actions.tree_decrease_fold_level";
|
|
||||||
zo = "actions.tree_open";
|
|
||||||
zr = "actions.tree_increase_fold_level";
|
|
||||||
zx = "actions.tree_sync_folds";
|
|
||||||
"{" = "actions.prev";
|
|
||||||
"}" = "actions.next";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
key = "<leader>o";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>AerialToggle<CR>";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
plugins.nvim-autopairs = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
disable_filetype = [
|
|
||||||
"TelescopePrompt"
|
|
||||||
"vim"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
23
home/modules/ide/nvim/plugins/basics.nix
Normal file
23
home/modules/ide/nvim/plugins/basics.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
plugins.mini-basics = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
autocommands = {
|
||||||
|
basic = true;
|
||||||
|
relnum_in_visual_mode = false;
|
||||||
|
};
|
||||||
|
mappings = {
|
||||||
|
basic = true;
|
||||||
|
move_with_alt = false;
|
||||||
|
option_toggle_prefix = "\\";
|
||||||
|
windows = false;
|
||||||
|
};
|
||||||
|
options = {
|
||||||
|
basic = true;
|
||||||
|
extra_ui = false;
|
||||||
|
win_borders = "auto";
|
||||||
|
};
|
||||||
|
silent = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
{
|
|
||||||
plugins = {
|
|
||||||
blink-cmp = {
|
|
||||||
enable = true;
|
|
||||||
setupLspCapabilities = true;
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
keymap.preset = "super-tab";
|
|
||||||
signature.enabled = true;
|
|
||||||
|
|
||||||
sources = {
|
|
||||||
default = [
|
|
||||||
"lsp"
|
|
||||||
"buffer"
|
|
||||||
"path"
|
|
||||||
"snippets"
|
|
||||||
];
|
|
||||||
|
|
||||||
providers = {
|
|
||||||
lsp.score_offset = 4;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
appearance = {
|
|
||||||
nerd_font_variant = "mono";
|
|
||||||
kind_icons = {
|
|
||||||
Text = "";
|
|
||||||
Method = "";
|
|
||||||
Function = "";
|
|
||||||
Constructor = "";
|
|
||||||
Field = "";
|
|
||||||
Variable = "";
|
|
||||||
Property = "";
|
|
||||||
Class = "";
|
|
||||||
Interface = "";
|
|
||||||
Struct = "";
|
|
||||||
Module = "";
|
|
||||||
Unit = "";
|
|
||||||
Value = "";
|
|
||||||
Enum = "";
|
|
||||||
EnumMember = "";
|
|
||||||
Keyword = "";
|
|
||||||
Constant = "";
|
|
||||||
Snippet = "";
|
|
||||||
Color = "";
|
|
||||||
File = "";
|
|
||||||
Reference = "";
|
|
||||||
Folder = "";
|
|
||||||
Event = "";
|
|
||||||
Operator = "";
|
|
||||||
TypeParameter = "";
|
|
||||||
Error = "";
|
|
||||||
Warning = "";
|
|
||||||
Information = "";
|
|
||||||
Hint = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
completion = {
|
|
||||||
menu = {
|
|
||||||
border = "none";
|
|
||||||
draw = {
|
|
||||||
gap = 1;
|
|
||||||
treesitter = [ "lsp" ];
|
|
||||||
columns = [
|
|
||||||
{ __unkeyed-1 = "label"; }
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "kind_icon";
|
|
||||||
__unkeyed-2 = "kind";
|
|
||||||
gap = 1;
|
|
||||||
}
|
|
||||||
{ __unkeyed-1 = "source_name"; }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
trigger.show_in_snippet = false;
|
|
||||||
|
|
||||||
documentation = {
|
|
||||||
auto_show = true;
|
|
||||||
window.border = "single";
|
|
||||||
};
|
|
||||||
|
|
||||||
accept.auto_brackets.enabled = false;
|
|
||||||
|
|
||||||
performance = {
|
|
||||||
debounce_ms = 80;
|
|
||||||
throttle_ms = 50;
|
|
||||||
max_view_entries = 20;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
38
home/modules/ide/nvim/plugins/completion.nix
Normal file
38
home/modules/ide/nvim/plugins/completion.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
plugins.mini-completion = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
delay = {
|
||||||
|
completion = 100;
|
||||||
|
info = 100;
|
||||||
|
signature = 50;
|
||||||
|
};
|
||||||
|
fallback_action = "<C-n>";
|
||||||
|
lsp_completion = {
|
||||||
|
auto_setup = true;
|
||||||
|
process_items = lib.nixvim.mkRaw "nil";
|
||||||
|
snippet_insert = lib.nixvim.mkRaw "nil";
|
||||||
|
source_func = "completefunc";
|
||||||
|
};
|
||||||
|
mappings = {
|
||||||
|
force_fallback = "<A-Space>";
|
||||||
|
force_twostep = "<C-Space>";
|
||||||
|
scroll_down = "<C-f>";
|
||||||
|
scroll_up = "<C-b>";
|
||||||
|
};
|
||||||
|
window = {
|
||||||
|
info = {
|
||||||
|
border = lib.nixvim.mkRaw "nil";
|
||||||
|
height = 25;
|
||||||
|
width = 80;
|
||||||
|
};
|
||||||
|
signature = {
|
||||||
|
border = lib.nixvim.mkRaw "nil";
|
||||||
|
height = 25;
|
||||||
|
width = 80;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
23
home/modules/ide/nvim/plugins/conform.nix
Normal file
23
home/modules/ide/nvim/plugins/conform.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
plugins.conform-nvim = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
format_on_save = {
|
||||||
|
lsp_fallback = true;
|
||||||
|
timeout_ms = 500;
|
||||||
|
};
|
||||||
|
|
||||||
|
formatters_by_ft = {
|
||||||
|
nix = ["alejandra"];
|
||||||
|
go = ["goimports"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
alejandra
|
||||||
|
go
|
||||||
|
gopls
|
||||||
|
gotools
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
{
|
|
||||||
plugins.dashboard = {
|
|
||||||
enable = true;
|
|
||||||
autoLoad = true;
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
theme = "doom";
|
|
||||||
|
|
||||||
config = {
|
|
||||||
header = [
|
|
||||||
""
|
|
||||||
""
|
|
||||||
""
|
|
||||||
""
|
|
||||||
""
|
|
||||||
""
|
|
||||||
""
|
|
||||||
""
|
|
||||||
""
|
|
||||||
" ⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀ "
|
|
||||||
" ⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷ "
|
|
||||||
" ⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿ "
|
|
||||||
" ⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿ "
|
|
||||||
" ⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿ "
|
|
||||||
" ⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿ "
|
|
||||||
" ⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟ "
|
|
||||||
" ⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣ "
|
|
||||||
" ⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾ "
|
|
||||||
" ⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿ "
|
|
||||||
" ⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿ "
|
|
||||||
" ⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿ "
|
|
||||||
" ⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿ "
|
|
||||||
" ⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋ ⣾⡌⢠⣿⡿⠃ "
|
|
||||||
" ⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉ "
|
|
||||||
""
|
|
||||||
""
|
|
||||||
""
|
|
||||||
];
|
|
||||||
|
|
||||||
center = [
|
|
||||||
{
|
|
||||||
icon = " ";
|
|
||||||
desc = "find files";
|
|
||||||
action = "lua Snacks.picker.files()";
|
|
||||||
key = "f";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
icon = " ";
|
|
||||||
desc = "projects";
|
|
||||||
action = "lua Snacks.picker.projects()";
|
|
||||||
key = "p";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
icon = " ";
|
|
||||||
desc = "grep";
|
|
||||||
action = "lua Snacks.picker.grep()";
|
|
||||||
key = "s";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
icon = " ";
|
|
||||||
desc = "todos";
|
|
||||||
action = "lua Snacks.picker.todo_comments()";
|
|
||||||
key = "t";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
icon = " ";
|
|
||||||
desc = "ragequit";
|
|
||||||
action = "qa";
|
|
||||||
key = "x";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
footer = [ "~elisiei" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
extraConfigLua = ''
|
|
||||||
vim.api.nvim_create_autocmd("User", {
|
|
||||||
pattern = "DashboardReady",
|
|
||||||
callback = function()
|
|
||||||
vim.b.miniindentscope_disable = true
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
5
home/modules/ide/nvim/plugins/extra.nix
Normal file
5
home/modules/ide/nvim/plugins/extra.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
plugins.mini-extra = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
55
home/modules/ide/nvim/plugins/files.nix
Normal file
55
home/modules/ide/nvim/plugins/files.nix
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
plugins.snacks = {
|
||||||
|
enable = true;
|
||||||
|
autoLoad = true;
|
||||||
|
};
|
||||||
|
plugins.neo-tree = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
default_component_configs = {
|
||||||
|
indent = {
|
||||||
|
with_expanders = true;
|
||||||
|
expander_collapsed = "";
|
||||||
|
expander_expanded = "";
|
||||||
|
expander_highlight = "NeoTreeExpander";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
sources = [
|
||||||
|
"filesystem"
|
||||||
|
"buffers"
|
||||||
|
"git_status"
|
||||||
|
];
|
||||||
|
enable_diagnostics = true;
|
||||||
|
enable_git_status = true;
|
||||||
|
enable_modified_markers = true;
|
||||||
|
enable_refresh_on_write = true;
|
||||||
|
open_files_in_last_window = true;
|
||||||
|
open_files_do_not_replace_types = [
|
||||||
|
"terminal"
|
||||||
|
"Trouble"
|
||||||
|
"trouble"
|
||||||
|
"qf"
|
||||||
|
"Outline"
|
||||||
|
];
|
||||||
|
filesystem = {
|
||||||
|
bind_to_cwd = false;
|
||||||
|
follow_current_file = {
|
||||||
|
enabled = true;
|
||||||
|
};
|
||||||
|
use_libuv_file_watcher = true;
|
||||||
|
};
|
||||||
|
event_handlers = {
|
||||||
|
file_moved = ''
|
||||||
|
function(data)
|
||||||
|
require("snacks.rename").on_rename_file(data.source, data.destination)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
file_renamed = ''
|
||||||
|
function(data)
|
||||||
|
require("snacks.rename").on_rename_file(data.source, data.destination)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
13
home/modules/ide/nvim/plugins/git.nix
Normal file
13
home/modules/ide/nvim/plugins/git.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
plugins.mini-git = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
command = {
|
||||||
|
split = "horizontal";
|
||||||
|
};
|
||||||
|
job = {
|
||||||
|
timeout = 20000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
{
|
|
||||||
plugins.hlchunk = {
|
|
||||||
enable = true;
|
|
||||||
autoLoad = true;
|
|
||||||
settings = {
|
|
||||||
blank = {
|
|
||||||
enable = false;
|
|
||||||
};
|
|
||||||
chunk = {
|
|
||||||
chars = {
|
|
||||||
horizontal_line = "─";
|
|
||||||
left_bottom = "╰";
|
|
||||||
left_top = "╭";
|
|
||||||
right_arrow = "─";
|
|
||||||
vertical_line = "│";
|
|
||||||
};
|
|
||||||
enable = true;
|
|
||||||
exclude_filetypes = {
|
|
||||||
lazyterm = true;
|
|
||||||
neo-tree = true;
|
|
||||||
};
|
|
||||||
style = {
|
|
||||||
fg = "#91bef0";
|
|
||||||
};
|
|
||||||
use_treesitter = true;
|
|
||||||
};
|
|
||||||
indent = {
|
|
||||||
chars = [
|
|
||||||
"│"
|
|
||||||
];
|
|
||||||
exclude_filetypes = {
|
|
||||||
lazyterm = true;
|
|
||||||
neo-tree = true;
|
|
||||||
};
|
|
||||||
style = {
|
|
||||||
fg = "#45475a";
|
|
||||||
};
|
|
||||||
use_treesitter = false;
|
|
||||||
};
|
|
||||||
line_num = {
|
|
||||||
style = "#91bef0";
|
|
||||||
use_treesitter = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
5
home/modules/ide/nvim/plugins/icons.nix
Normal file
5
home/modules/ide/nvim/plugins/icons.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
plugins.mini-icons = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
5
home/modules/ide/nvim/plugins/keymap.nix
Normal file
5
home/modules/ide/nvim/plugins/keymap.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
plugins.mini-keymap = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
{
|
|
||||||
plugins.lualine = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
options = {
|
|
||||||
globalstatus = true;
|
|
||||||
extensions = [
|
|
||||||
"fzf"
|
|
||||||
"neo-tree"
|
|
||||||
];
|
|
||||||
disabledFiletypes = {
|
|
||||||
statusline = [
|
|
||||||
"startup"
|
|
||||||
"alpha"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
theme = "lackluster";
|
|
||||||
};
|
|
||||||
sections = {
|
|
||||||
lualine_a = [
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "mode";
|
|
||||||
icon = "";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lualine_b = [
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "branch";
|
|
||||||
icon = "";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "diff";
|
|
||||||
symbols = {
|
|
||||||
added = " ";
|
|
||||||
modified = " ";
|
|
||||||
removed = " ";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lualine_c = [
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "diagnostics";
|
|
||||||
sources = [ "nvim_lsp" ];
|
|
||||||
symbols = {
|
|
||||||
error = " ";
|
|
||||||
warn = " ";
|
|
||||||
info = " ";
|
|
||||||
hint = " ";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "navic";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lualine_x = [
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "filetype";
|
|
||||||
icon_only = true;
|
|
||||||
separator = "";
|
|
||||||
padding = {
|
|
||||||
left = 1;
|
|
||||||
right = 0;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "filename";
|
|
||||||
path = 1;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1.__raw = ''
|
|
||||||
function()
|
|
||||||
local icon = " "
|
|
||||||
local status = require("copilot.api").status.data
|
|
||||||
return icon .. (status.message or " ")
|
|
||||||
end,
|
|
||||||
|
|
||||||
cond = function()
|
|
||||||
local ok, clients = pcall(vim.lsp.get_clients, { name = "copilot", bufnr = 0 })
|
|
||||||
return ok and #clients > 0
|
|
||||||
end,
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lualine_y = [
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "progress";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lualine_z = [
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "location";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,139 +0,0 @@
|
||||||
{
|
|
||||||
plugins.neo-tree = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
sources = [
|
|
||||||
"filesystem"
|
|
||||||
"buffers"
|
|
||||||
"git_status"
|
|
||||||
];
|
|
||||||
enable_diagnostics = true;
|
|
||||||
enable_git_status = true;
|
|
||||||
enable_modified_markers = true;
|
|
||||||
enable_refresh_on_write = true;
|
|
||||||
open_files_in_last_window = true;
|
|
||||||
open_files_do_not_replace_types = [
|
|
||||||
"terminal"
|
|
||||||
"Trouble"
|
|
||||||
"trouble"
|
|
||||||
"qf"
|
|
||||||
"Outline"
|
|
||||||
];
|
|
||||||
filesystem = {
|
|
||||||
bind_to_cwd = false;
|
|
||||||
follow_current_file = {
|
|
||||||
enabled = true;
|
|
||||||
};
|
|
||||||
use_libuv_file_watcher = true;
|
|
||||||
};
|
|
||||||
window.mappings = {
|
|
||||||
"l" = "open";
|
|
||||||
"h" = "close_node";
|
|
||||||
"<space>" = "none";
|
|
||||||
"Y" = {
|
|
||||||
__raw = ''
|
|
||||||
function(state)
|
|
||||||
local node = state.tree:get_node()
|
|
||||||
local path = node:get_id()
|
|
||||||
vim.fn.setreg("+", path, "c")
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
desc = "Copy Path to Clipboard";
|
|
||||||
};
|
|
||||||
"O" = {
|
|
||||||
__raw = ''
|
|
||||||
function(state)
|
|
||||||
vim.ui.open(state.tree:get_node().path)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
desc = "Open with System Application";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
default_component_configs = {
|
|
||||||
indent = {
|
|
||||||
with_expanders = true;
|
|
||||||
expander_collapsed = "";
|
|
||||||
expander_expanded = "";
|
|
||||||
expander_highlight = "NeoTreeExpander";
|
|
||||||
};
|
|
||||||
|
|
||||||
git_status.symbols = {
|
|
||||||
unstaged = "";
|
|
||||||
staged = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
icon = {
|
|
||||||
folder_closed = "";
|
|
||||||
folder_open = "";
|
|
||||||
folder_empty = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
event_handlers = {
|
|
||||||
file_moved = ''
|
|
||||||
function(data)
|
|
||||||
require("snacks.rename").on_rename_file(data.source, data.destination)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
file_renamed = ''
|
|
||||||
function(data)
|
|
||||||
require("snacks.rename").on_rename_file(data.source, data.destination)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
key = "<leader>fe";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("neo-tree.command").execute({
|
|
||||||
toggle = true,
|
|
||||||
dir = vim.fn.getcwd()
|
|
||||||
})
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
options.desc = "Explorer NeoTree (cwd)";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>e";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<leader>fe";
|
|
||||||
options.remap = true;
|
|
||||||
options.desc = "Explorer NeoTree (cwd)";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>ge";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("neo-tree.command").execute({
|
|
||||||
source = "git_status",
|
|
||||||
toggle = true
|
|
||||||
})
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
options.desc = "Git Explorer";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>be";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action.__raw = ''
|
|
||||||
function()
|
|
||||||
require("neo-tree.command").execute({
|
|
||||||
source = "buffers",
|
|
||||||
toggle = true
|
|
||||||
})
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
options.desc = "Buffer Explorer";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<C-h>";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>Neotree source=filesystem focus<CR>";
|
|
||||||
options.desc = "switch focus";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
5
home/modules/ide/nvim/plugins/notify.nix
Normal file
5
home/modules/ide/nvim/plugins/notify.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
plugins.mini-notify = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
12
home/modules/ide/nvim/plugins/pairs.nix
Normal file
12
home/modules/ide/nvim/plugins/pairs.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
plugins.mini-pairs = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
modes = {
|
||||||
|
command = true;
|
||||||
|
insert = true;
|
||||||
|
terminal = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
{
|
|
||||||
plugins.snacks = {
|
|
||||||
enable = true;
|
|
||||||
autoLoad = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
key = "<leader>ff";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>lua Snacks.picker.files()<CR>";
|
|
||||||
options.desc = "Find files";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>fb";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>lua Snacks.picker.buffers()<CR>";
|
|
||||||
options.desc = "Find buffers";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>gl";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>lua Snacks.picker.git_log()<CR>";
|
|
||||||
options.desc = "Git log";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>gs";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>lua Snacks.picker.git_status()<CR>";
|
|
||||||
options.desc = "Git status";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>uC";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>lua Snacks.picker.colorschemes()<CR>";
|
|
||||||
options.desc = "Colorschemes";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>:";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>lua Snacks.picker.command_history()<CR>";
|
|
||||||
options.desc = "Command history";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
5
home/modules/ide/nvim/plugins/snippets.nix
Normal file
5
home/modules/ide/nvim/plugins/snippets.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
plugins.mini-snippets = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
26
home/modules/ide/nvim/plugins/starter.nix
Normal file
26
home/modules/ide/nvim/plugins/starter.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
plugins.mini-starter = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
autoopen = true;
|
||||||
|
evaluate_single = true;
|
||||||
|
header = ''
|
||||||
|
⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀
|
||||||
|
⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷
|
||||||
|
⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿
|
||||||
|
⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿
|
||||||
|
⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿
|
||||||
|
⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿
|
||||||
|
⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟
|
||||||
|
⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣
|
||||||
|
⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾
|
||||||
|
⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿
|
||||||
|
⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿
|
||||||
|
⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿
|
||||||
|
⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿
|
||||||
|
⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋ ⣾⡌⢠⣿⡿⠃
|
||||||
|
⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
8
home/modules/ide/nvim/plugins/statusline.nix
Normal file
8
home/modules/ide/nvim/plugins/statusline.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
plugins.mini-statusline = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
use_icons = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
plugins.toggleterm = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
direction = "float";
|
|
||||||
float_opts = {
|
|
||||||
border = "curved";
|
|
||||||
height = 30;
|
|
||||||
width = 130;
|
|
||||||
};
|
|
||||||
open_mapping = "[[<c-t>]]";
|
|
||||||
autochdir = true;
|
|
||||||
auto_scroll = true;
|
|
||||||
close_on_exit = true;
|
|
||||||
insert_mappings = true;
|
|
||||||
shell = "fish";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
key = "<C-t>";
|
|
||||||
mode = [
|
|
||||||
"n"
|
|
||||||
"t"
|
|
||||||
];
|
|
||||||
action = "<cmd>ToggleTerm<CR>";
|
|
||||||
options = {
|
|
||||||
silent = true;
|
|
||||||
noremap = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +1,29 @@
|
||||||
{ pkgs, ... }:
|
{pkgs, ...}: {
|
||||||
{
|
plugins.treesitter = {
|
||||||
plugins = {
|
enable = true;
|
||||||
treesitter = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
indent = {
|
indent = {
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
highlight = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nixvimInjections = true;
|
|
||||||
grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars;
|
|
||||||
};
|
|
||||||
|
|
||||||
treesitter-context = {
|
|
||||||
enable = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
treesitter-textobjects = {
|
|
||||||
enable = true;
|
|
||||||
settings.select = {
|
|
||||||
enable = true;
|
enable = true;
|
||||||
lookahead = true;
|
|
||||||
};
|
};
|
||||||
|
highlight = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nixvimInjections = true;
|
||||||
|
grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars;
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter-context = {
|
||||||
|
enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter-textobjects = {
|
||||||
|
enable = true;
|
||||||
|
settings.select = {
|
||||||
|
enable = true;
|
||||||
|
lookahead = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
plugins.treesj = {
|
|
||||||
enable = true;
|
|
||||||
autoLoad = true;
|
|
||||||
};
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
key = "<leader>m";
|
|
||||||
mode = [
|
|
||||||
"n"
|
|
||||||
];
|
|
||||||
action = "<cmd>TSJToggle<CR>";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>s";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>TSJSplit<CR>";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>j";
|
|
||||||
mode = [ "n" ];
|
|
||||||
action = "<cmd>TSJJoin<CR>";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
plugins.web-devicons = {
|
|
||||||
enable = true;
|
|
||||||
autoLoad = true;
|
|
||||||
settings = {
|
|
||||||
color_icons = true;
|
|
||||||
strict = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
programs.micro = {
|
plugins.which-key = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1,139 +0,0 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
{
|
|
||||||
plugins = {
|
|
||||||
sqlite-lua.enable = true;
|
|
||||||
|
|
||||||
yanky = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
lazyLoad = {
|
|
||||||
settings = {
|
|
||||||
keys = lib.mkIf config.plugins.lz-n.enable [
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>fy";
|
|
||||||
__unkeyed-2 = "<cmd>Telescope yank_history<cr>";
|
|
||||||
desc = "Paste from yanky history";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "y";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyYank)";
|
|
||||||
mode = [
|
|
||||||
"n"
|
|
||||||
"x"
|
|
||||||
];
|
|
||||||
desc = "Yank text";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "p";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutAfter)";
|
|
||||||
mode = [
|
|
||||||
"n"
|
|
||||||
"x"
|
|
||||||
];
|
|
||||||
desc = "Put yanked text after cursor";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "P";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutBefore)";
|
|
||||||
mode = [
|
|
||||||
"n"
|
|
||||||
"x"
|
|
||||||
];
|
|
||||||
desc = "Put yanked text before cursor";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "gp";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyGPutAfter)";
|
|
||||||
mode = [
|
|
||||||
"n"
|
|
||||||
"x"
|
|
||||||
];
|
|
||||||
desc = "Put yanked text after selection";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "gP";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyGPutBefore)";
|
|
||||||
mode = [
|
|
||||||
"n"
|
|
||||||
"x"
|
|
||||||
];
|
|
||||||
desc = "Put yanked text before selection";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<c-p>";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPreviousEntry)";
|
|
||||||
desc = "Select previous entry through yank history";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<c-n>";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyNextEntry)";
|
|
||||||
desc = "Select next entry through yank history";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "]p";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutIndentAfterLinewise)";
|
|
||||||
desc = "Put indented after cursor (linewise)";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "[p";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutIndentBeforeLinewise)";
|
|
||||||
desc = "Put indented before cursor (linewise)";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "]P";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutIndentAfterLinewise)";
|
|
||||||
desc = "Put indented after cursor (linewise)";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "[P";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutIndentBeforeLinewise)";
|
|
||||||
desc = "Put indented before cursor (linewise)";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = ">p";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutIndentAfterShiftRight)";
|
|
||||||
desc = "Put and indent right";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<p";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutIndentAfterShiftLeft)";
|
|
||||||
desc = "Put and indent left";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = ">P";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutIndentBeforeShiftRight)";
|
|
||||||
desc = "Put before and indent right";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<P";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutIndentBeforeShiftLeft)";
|
|
||||||
desc = "Put before and indent left";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "=p";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutAfterFilter)";
|
|
||||||
desc = "Put after applying a filter";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "=P";
|
|
||||||
__unkeyed-2 = "<Plug>(YankyPutBeforeFilter)";
|
|
||||||
desc = "Put before applying a filter";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
ring = {
|
|
||||||
history_length = 100;
|
|
||||||
storage = "sqlite";
|
|
||||||
storage_path.__raw = "vim.fn.stdpath('data') .. '/databases/yanky.db'";
|
|
||||||
sync_with_numbered_registers = true;
|
|
||||||
cancel_event = "update";
|
|
||||||
ignore_registers = [ "_" ];
|
|
||||||
update_register_on_cycle = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -2,6 +2,11 @@
|
||||||
colorschemes = {
|
colorschemes = {
|
||||||
tokyonight = {
|
tokyonight = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
transparent = true;
|
||||||
|
style = "night";
|
||||||
|
mini_completion = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
enable = false;
|
enable = false;
|
||||||
enableCompletion = false;
|
enableCompletion = false;
|
||||||
bashrcExtra = ''
|
bashrcExtra = ''
|
||||||
export PATH="$PATH:$HOME/bin"
|
export PATH="$PATH:$HOME/bin"
|
||||||
alias cls=clear
|
alias cls=clear
|
||||||
alias nv=nvim
|
alias nv=nvim
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ fish_config prompt choose minimalist
|
||||||
direnv hook fish | source
|
direnv hook fish | source
|
||||||
|
|
||||||
# set theme
|
# set theme
|
||||||
source ~/.config/fish/themes/bw.fish
|
source ~/.config/fish/themes/tokyonight_night.fish
|
||||||
|
|
||||||
# set aliases
|
# set aliases
|
||||||
source ~/.config/fish/aliases/git.fish
|
source ~/.config/fish/aliases/git.fish
|
||||||
|
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
||||||
use std repeat
|
|
||||||
|
|
||||||
$env.EDITOR = "nvim"
|
|
||||||
|
|
||||||
const config_path = $nu.default-config-dir | path join "config";
|
|
||||||
const aliases_path = $config_path | path join "aliases";
|
|
||||||
const completions_path = $config_path | path join "completions";
|
|
||||||
const hooks_path = $config_path | path join "hooks";
|
|
||||||
const scripts_path = $config_path | path join "scripts";
|
|
||||||
const themes_path = $config_path | path join "themes";
|
|
||||||
|
|
||||||
# register aliases
|
|
||||||
source ($aliases_path | path join "git.nu");
|
|
||||||
|
|
||||||
# register completions
|
|
||||||
source ($completions_path | path join "git.nu");
|
|
||||||
source ($completions_path | path join "make.nu");
|
|
||||||
|
|
||||||
# register hooks
|
|
||||||
source ($hooks_path | path join "did_you_mean.nu")
|
|
||||||
|
|
||||||
# register scripts
|
|
||||||
source ($scripts_path | path join "nufetch.nu")
|
|
||||||
|
|
||||||
# register themes
|
|
||||||
source ($themes_path | path join "tokyo-night.nu")
|
|
||||||
|
|
||||||
$env.PATH = ($env.PATH |
|
|
||||||
append /home/elisiei/bin |
|
|
||||||
append /home/elisiei/go/bin
|
|
||||||
)
|
|
||||||
|
|
||||||
$env.COLORTERM = "truecolor"
|
|
||||||
|
|
||||||
$env.config = {
|
|
||||||
buffer_editor: "nvim"
|
|
||||||
edit_mode: "vi"
|
|
||||||
show_banner: false
|
|
||||||
}
|
|
||||||
|
|
||||||
def create_left_prompt [] {
|
|
||||||
# path
|
|
||||||
let folder_name = (
|
|
||||||
$env.PWD
|
|
||||||
| str replace $env.HOME "~"
|
|
||||||
| split row "/"
|
|
||||||
| each {|it| $it }
|
|
||||||
| str join "/"
|
|
||||||
| $in
|
|
||||||
)
|
|
||||||
|
|
||||||
let folder = $"($folder_name)"
|
|
||||||
let folder_colored = (
|
|
||||||
$folder | ansi gradient --fgstart '0xA0B6A0' --fgend '0x6C94DC'
|
|
||||||
)
|
|
||||||
|
|
||||||
let path_segment = $"(ansi bo)($folder_colored)(ansi reset)"
|
|
||||||
|
|
||||||
# git
|
|
||||||
let git_segment = (
|
|
||||||
if (do -i { git rev-parse --is-inside-work-tree } | complete | get exit_code) == 0 {
|
|
||||||
let branch = (do -i { git branch --show-current } | complete | get stdout | str trim)
|
|
||||||
let changes = (do -i { git status --porcelain } | complete | get stdout | str trim)
|
|
||||||
let status = if ($changes | is-empty) { "" } else { $" (ansi bo)(ansi '#FF6E7F')[!]" }
|
|
||||||
$"(ansi i)on(ansi reset) (ansi bo)(ansi '#FBDBB6') ($branch)(ansi reset)($status)(ansi reset)"
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
# nix shell
|
|
||||||
let nix_segment = (
|
|
||||||
if ($env | columns | any {|c| $c == "IN_NIX_SHELL" }) and ($env.IN_NIX_SHELL | default "" | str trim | is-not-empty) {
|
|
||||||
$"(ansi i)via(ansi reset) (ansi bo)(ansi '#A4CCB1')nix(ansi reset)"
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
# all
|
|
||||||
[$path_segment $git_segment $nix_segment]
|
|
||||||
| where {|x| not ($x | is-empty) }
|
|
||||||
| str join " "
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$env.PROMPT_COMMAND = { || create_left_prompt }
|
|
||||||
$env.PROMPT_COMMAND_RIGHT = { || }
|
|
||||||
|
|
||||||
$env.PROMPT_INDICATOR_VI_INSERT = { || ": " }
|
|
||||||
$env.PROMPT_INDICATOR_VI_NORMAL = { || "! " }
|
|
||||||
|
|
||||||
$env.PROMPT_MULTILINE_INDICATOR = { || "::: " }
|
|
||||||
|
|
||||||
$env.PROMPT_INDICATOR = { ||
|
|
||||||
let last_exit_code = $env.LAST_EXIT_CODE
|
|
||||||
let indicator = if ($last_exit_code == 0) {
|
|
||||||
$"(ansi cyan)❯(ansi reset)"
|
|
||||||
} else {
|
|
||||||
$"(ansi red)❯(ansi reset)"
|
|
||||||
}
|
|
||||||
$"\n($indicator) "
|
|
||||||
}
|
|
||||||
|
|
@ -1,246 +0,0 @@
|
||||||
# returns the name of the current branch
|
|
||||||
export def git_current_branch [] {
|
|
||||||
^git rev-parse --abbrev-ref HEAD
|
|
||||||
}
|
|
||||||
|
|
||||||
export def git_main_branch [] {
|
|
||||||
git remote show origin
|
|
||||||
| lines
|
|
||||||
| str trim
|
|
||||||
| find --regex 'HEAD .*?[:: ].+'
|
|
||||||
| first
|
|
||||||
| ansi strip
|
|
||||||
| str replace --regex 'HEAD .*?[:: ]\s*(.+)' '$1'
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Aliases
|
|
||||||
# (sorted alphabetically)
|
|
||||||
#
|
|
||||||
|
|
||||||
export alias ga = git add
|
|
||||||
export alias gaa = git add --all
|
|
||||||
export alias gapa = git add --patch
|
|
||||||
export alias gau = git add --update
|
|
||||||
export alias gav = git add --verbose
|
|
||||||
export alias gap = git apply
|
|
||||||
export alias gapt = git apply --3way
|
|
||||||
|
|
||||||
export alias gb = git branch
|
|
||||||
export alias gba = git branch --all
|
|
||||||
export alias gbd = git branch --delete
|
|
||||||
export alias gbD = git branch --delete --force
|
|
||||||
export alias gbl = git blame -b -w
|
|
||||||
export alias gbm = git branch --move
|
|
||||||
export alias gbmc = git branch --move (git_current_branch)
|
|
||||||
export alias gbnm = git branch --no-merged
|
|
||||||
export alias gbr = git branch --remote
|
|
||||||
export alias gbs = git bisect
|
|
||||||
export alias gbsb = git bisect bad
|
|
||||||
export alias gbsg = git bisect good
|
|
||||||
export alias gbsn = git bisect new
|
|
||||||
export alias gbso = git bisect old
|
|
||||||
export alias gbsr = git bisect reset
|
|
||||||
export alias gbss = git bisect start
|
|
||||||
|
|
||||||
export alias gc = git commit --verbose
|
|
||||||
export alias gc! = git commit --verbose --amend
|
|
||||||
export alias gcn = git commit --verbose --no-edit
|
|
||||||
export alias gcn! = git commit --verbose --no-edit --amend
|
|
||||||
export alias gca = git commit --verbose --all
|
|
||||||
export alias gca! = git commit --verbose --all --amend
|
|
||||||
export alias gcan! = git commit --verbose --all --no-edit --amend
|
|
||||||
export alias gcans! = git commit --verbose --all --signoff --no-edit --amend
|
|
||||||
export def gcam [message: string] {
|
|
||||||
git commit --all --message $message
|
|
||||||
}
|
|
||||||
export def gcsm [message: string] {
|
|
||||||
git commit --all --signoff $message
|
|
||||||
}
|
|
||||||
export alias gcas = git commit --all --signoff
|
|
||||||
export def gcasm [message: string] {
|
|
||||||
git commit --all --signoff --message $message
|
|
||||||
}
|
|
||||||
export alias gcb = git checkout -b
|
|
||||||
export alias gcd = git checkout develop
|
|
||||||
export alias gcf = git config --list
|
|
||||||
export alias gcl = git clone --recurse-submodules
|
|
||||||
export alias gclean = git clean --interactive -d
|
|
||||||
export def gpristine [] {
|
|
||||||
git reset --hard
|
|
||||||
git clean -d --force -x
|
|
||||||
}
|
|
||||||
export alias gcm = git checkout (git_main_branch)
|
|
||||||
export def gcmsg [message: string] {
|
|
||||||
git commit --message $message
|
|
||||||
}
|
|
||||||
export alias gco = git checkout
|
|
||||||
export alias gcor = git checkout --recurse-submodules
|
|
||||||
export alias gcount = git shortlog --summary --numbered
|
|
||||||
export alias gcp = git cherry-pick
|
|
||||||
export alias gcpa = git cherry-pick --abort
|
|
||||||
export alias gcpc = git cherry-pick --continue
|
|
||||||
export alias gcs = git commit --gpg-sign
|
|
||||||
export alias gcss = git commit --gpg-sign --signoff
|
|
||||||
export def gcssm [message: string] {
|
|
||||||
git commit --gpg-sign --signoff --message $message
|
|
||||||
}
|
|
||||||
export alias gd = git diff
|
|
||||||
export alias gdca = git diff --cached
|
|
||||||
export alias gdcw = git diff --cached --word-diff
|
|
||||||
export alias gdct = git describe --tags (git rev-list --tags --max-count=1)
|
|
||||||
export alias gds = git diff --staged
|
|
||||||
export alias gdt = git diff-tree --no-commit-id --name-only -r
|
|
||||||
export alias gdup = git diff @{upstream}
|
|
||||||
export alias gdw = git diff --word-diff
|
|
||||||
|
|
||||||
export alias gf = git fetch
|
|
||||||
export alias gfa = git fetch --all --prune
|
|
||||||
export alias gfo = git fetch origin
|
|
||||||
|
|
||||||
export alias gg = git gui citool
|
|
||||||
export alias gga = git gui citool --amend
|
|
||||||
|
|
||||||
export alias ghh = git help
|
|
||||||
|
|
||||||
export alias gignore = git update-index --assume-unchanged
|
|
||||||
|
|
||||||
export alias gl = git log
|
|
||||||
export alias glg = git log --stat
|
|
||||||
export alias glgp = git log --stat --patch
|
|
||||||
export alias glgg = git log --graph
|
|
||||||
export alias glgga = git log --graph --decorate --all
|
|
||||||
export alias glgm = git log --graph --max-count=10
|
|
||||||
export alias glo = git log --oneline --decorate
|
|
||||||
export alias glod = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ad(char rp) %C(char lp)bold blue(char rp)<%an>%Creset'
|
|
||||||
export alias glods = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ad(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --date=short
|
|
||||||
export alias glog = git log --oneline --decorate --graph
|
|
||||||
export alias gloga = git log --oneline --decorate --graph --all
|
|
||||||
export alias glol = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset'
|
|
||||||
export alias glola = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --all
|
|
||||||
export alias glols = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --stat
|
|
||||||
|
|
||||||
export alias gm = git merge
|
|
||||||
export alias gmtl = git mergetool --no-prompt
|
|
||||||
export alias gmtlvim = git mergetool --no-prompt --tool=vimdiff
|
|
||||||
export alias gma = git merge --abort
|
|
||||||
export def gmom [] {
|
|
||||||
let main = (git_main_branch)
|
|
||||||
git merge $"origin/($main)"
|
|
||||||
}
|
|
||||||
|
|
||||||
export alias gp = git push
|
|
||||||
export alias gpd = git push --dry-run
|
|
||||||
export alias gpf = git push --force-with-lease
|
|
||||||
export alias gpf! = git push --force
|
|
||||||
export alias gpl = git pull
|
|
||||||
export def gpoat [] {
|
|
||||||
git push origin --all; git push origin --tags
|
|
||||||
}
|
|
||||||
export alias gpod = git push origin --delete
|
|
||||||
export alias gpodc = git push origin --delete (git_current_branch)
|
|
||||||
def "nu-complete git pull rebase" [] {
|
|
||||||
["false","true","merges","interactive"]
|
|
||||||
}
|
|
||||||
export def gpr [rebase_type: string@"nu-complete git pull rebase"] {
|
|
||||||
git pull --rebase $rebase_type
|
|
||||||
}
|
|
||||||
export alias gpu = git push upstream
|
|
||||||
export alias gpv = git push --verbose
|
|
||||||
|
|
||||||
export alias gr = git remote
|
|
||||||
export alias gpra = git pull --rebase --autostash
|
|
||||||
export alias gprav = git pull --rebase --autostash --verbose
|
|
||||||
export alias gprv = git pull --rebase --verbose
|
|
||||||
export alias gpsup = git push --set-upstream origin (git_current_branch)
|
|
||||||
export alias gra = git remote add
|
|
||||||
export alias grb = git rebase
|
|
||||||
export alias grba = git rebase --abort
|
|
||||||
export alias grbc = git rebase --continue
|
|
||||||
export alias grbd = git rebase develop
|
|
||||||
export alias grbi = git rebase --interactive
|
|
||||||
export alias grbm = git rebase (git_main_branch)
|
|
||||||
export alias grbo = git rebase --onto
|
|
||||||
export alias grbs = git rebase --skip
|
|
||||||
export alias grev = git revert
|
|
||||||
export alias grh = git reset
|
|
||||||
export alias grhh = git reset --hard
|
|
||||||
export alias groh = git reset $"origin/(git_current_branch)" --hard
|
|
||||||
export alias grm = git rm
|
|
||||||
export alias grmc = git rm --cached
|
|
||||||
export def grmv [remote: string, new_name: string] {
|
|
||||||
git remote rename $remote $new_name
|
|
||||||
}
|
|
||||||
export def grrm [remote: string] {
|
|
||||||
git remote remove $remote
|
|
||||||
}
|
|
||||||
export alias grs = git restore
|
|
||||||
export def grset [remote: string, url: string] {
|
|
||||||
git remote set-url $remote $url
|
|
||||||
}
|
|
||||||
export alias grss = git restore --source
|
|
||||||
export alias grst = git restore --staged
|
|
||||||
export alias grt = cd (git rev-parse --show-toplevel or echo .)
|
|
||||||
export alias gru = git reset --
|
|
||||||
export alias grup = git remote update
|
|
||||||
export alias grv = git remote --verbose
|
|
||||||
|
|
||||||
export alias gsb = git status --short --branch
|
|
||||||
export alias gsd = git svn dcommit
|
|
||||||
export alias gsh = git show
|
|
||||||
export alias gshs = git show -s
|
|
||||||
export alias gsi = git submodule init
|
|
||||||
export alias gsps = git show --pretty=short --show-signature
|
|
||||||
export alias gsr = git svn rebase
|
|
||||||
export alias gss = git status --short
|
|
||||||
export alias gst = git status
|
|
||||||
|
|
||||||
export alias gsta = git stash push
|
|
||||||
export alias gstaa = git stash apply
|
|
||||||
export alias gstc = git stash clear
|
|
||||||
export alias gstd = git stash drop
|
|
||||||
export alias gstl = git stash list
|
|
||||||
export alias gstp = git stash pop
|
|
||||||
export alias gsts = git stash show --text
|
|
||||||
export alias gstu = gsta --include-untracked
|
|
||||||
export alias gstall = git stash --all
|
|
||||||
export alias gsu = git submodule update
|
|
||||||
export alias gsw = git switch
|
|
||||||
export alias gswc = git switch --create
|
|
||||||
|
|
||||||
export alias gts = git tag --sign
|
|
||||||
export def gtv [] {
|
|
||||||
git tag | lines | sort
|
|
||||||
}
|
|
||||||
export alias glum = git pull upstream (git_main_branch)
|
|
||||||
|
|
||||||
export alias gunignore = git update-index --no-assume-unchanged
|
|
||||||
export def gup [rebase_type: string@"nu-complete git pull rebase"] {
|
|
||||||
git pull --rebase $rebase_type
|
|
||||||
}
|
|
||||||
export alias gupv = git pull --rebase --verbose
|
|
||||||
export alias gupa = git pull --rebase --autostash
|
|
||||||
export alias gupav = git pull --rebase --autostash --verbose
|
|
||||||
|
|
||||||
export alias gwch = git whatchanged -p --abbrev-commit --pretty=medium
|
|
||||||
|
|
||||||
export alias gwt = git worktree
|
|
||||||
export def gwta [path: path, branch?: string] {
|
|
||||||
if $branch != null {
|
|
||||||
git worktree add $path $branch
|
|
||||||
} else {
|
|
||||||
git worktree add $path
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export alias gwtls = git worktree list
|
|
||||||
export alias gwtmv = git worktree move
|
|
||||||
export def gwtm [worktree: string] {
|
|
||||||
git worktree remove $worktree
|
|
||||||
}
|
|
||||||
|
|
||||||
export alias gam = git am
|
|
||||||
export alias gamc = git am --continue
|
|
||||||
export alias gams = git am --skip
|
|
||||||
export alias gama = git am --abort
|
|
||||||
export alias gamscp = git am --show-current-patch
|
|
||||||
|
|
||||||
|
|
@ -1,985 +0,0 @@
|
||||||
# nu-version: 0.102.0
|
|
||||||
|
|
||||||
module git-completion-utils {
|
|
||||||
export const GIT_SKIPABLE_FLAGS = ['-v', '--version', '-h', '--help', '-p', '--paginate', '-P', '--no-pager', '--no-replace-objects', '--bare']
|
|
||||||
|
|
||||||
# Helper function to append token if non-empty
|
|
||||||
def append-non-empty [token: string]: list<string> -> list<string> {
|
|
||||||
if ($token | is-empty) { $in } else { $in | append $token }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Split a string to list of args, taking quotes into account.
|
|
||||||
# Code is copied and modified from https://github.com/nushell/nushell/issues/14582#issuecomment-2542596272
|
|
||||||
export def args-split []: string -> list<string> {
|
|
||||||
# Define our states
|
|
||||||
const STATE_NORMAL = 0
|
|
||||||
const STATE_IN_SINGLE_QUOTE = 1
|
|
||||||
const STATE_IN_DOUBLE_QUOTE = 2
|
|
||||||
const STATE_ESCAPE = 3
|
|
||||||
const WHITESPACES = [" " "\t" "\n" "\r"]
|
|
||||||
|
|
||||||
# Initialize variables
|
|
||||||
mut state = $STATE_NORMAL
|
|
||||||
mut current_token = ""
|
|
||||||
mut result: list<string> = []
|
|
||||||
mut prev_state = $STATE_NORMAL
|
|
||||||
|
|
||||||
# Process each character
|
|
||||||
for char in ($in | split chars) {
|
|
||||||
if $state == $STATE_ESCAPE {
|
|
||||||
# Handle escaped character
|
|
||||||
$current_token = $current_token + $char
|
|
||||||
$state = $prev_state
|
|
||||||
} else if $char == '\' {
|
|
||||||
# Enter escape state
|
|
||||||
$prev_state = $state
|
|
||||||
$state = $STATE_ESCAPE
|
|
||||||
} else if $state == $STATE_NORMAL {
|
|
||||||
if $char == "'" {
|
|
||||||
$state = $STATE_IN_SINGLE_QUOTE
|
|
||||||
} else if $char == '"' {
|
|
||||||
$state = $STATE_IN_DOUBLE_QUOTE
|
|
||||||
} else if ($char in $WHITESPACES) {
|
|
||||||
# Whitespace in normal state means token boundary
|
|
||||||
$result = $result | append-non-empty $current_token
|
|
||||||
$current_token = ""
|
|
||||||
} else {
|
|
||||||
$current_token = $current_token + $char
|
|
||||||
}
|
|
||||||
} else if $state == $STATE_IN_SINGLE_QUOTE {
|
|
||||||
if $char == "'" {
|
|
||||||
$state = $STATE_NORMAL
|
|
||||||
} else {
|
|
||||||
$current_token = $current_token + $char
|
|
||||||
}
|
|
||||||
} else if $state == $STATE_IN_DOUBLE_QUOTE {
|
|
||||||
if $char == '"' {
|
|
||||||
$state = $STATE_NORMAL
|
|
||||||
} else {
|
|
||||||
$current_token = $current_token + $char
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# Handle the last token
|
|
||||||
$result = $result | append-non-empty $current_token
|
|
||||||
# Return the result
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get changed files which can be restored by `git checkout --`
|
|
||||||
export def get-changed-files []: nothing -> list<string> {
|
|
||||||
^git status -uno --porcelain=2 | lines
|
|
||||||
| where $it =~ '^1 [.MD]{2}'
|
|
||||||
| each { split row ' ' -n 9 | last }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get files which can be retrieved from a branch/commit by `git checkout <tree-ish>`
|
|
||||||
export def get-checkoutable-files []: nothing -> list<string> {
|
|
||||||
# Relevant statuses are .M", "MM", "MD", ".D", "UU"
|
|
||||||
^git status -uno --porcelain=2 | lines
|
|
||||||
| where $it =~ '^1 ([.MD]{2}|UU)'
|
|
||||||
| each { split row ' ' -n 9 | last }
|
|
||||||
}
|
|
||||||
|
|
||||||
export def get-all-git-local-refs []: nothing -> list<record<ref: string, obj: string, upstream: string, subject: string>> {
|
|
||||||
^git for-each-ref --format '%(refname:lstrip=2)%09%(objectname:short)%09%(upstream:remotename)%(upstream:track)%09%(contents:subject)' refs/heads | lines | parse "{ref}\t{obj}\t{upstream}\t{subject}"
|
|
||||||
}
|
|
||||||
|
|
||||||
export def get-all-git-remote-refs []: nothing -> list<record<ref: string, obj: string, subject: string>> {
|
|
||||||
^git for-each-ref --format '%(refname:lstrip=2)%09%(objectname:short)%09%(contents:subject)' refs/remotes | lines | parse "{ref}\t{obj}\t{subject}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get local branches, remote branches which can be passed to `git merge`
|
|
||||||
export def get-mergable-sources []: nothing -> list<record<value: string, description: string>> {
|
|
||||||
let local = get-all-git-local-refs | each {|x| {value: $x.ref description: $'Branch, Local, ($x.obj) ($x.subject), (if ($x.upstream | is-not-empty) { $x.upstream } else { "no upstream" } )'} } | insert style 'light_blue'
|
|
||||||
let remote = get-all-git-remote-refs | each {|x| {value: $x.ref description: $'Branch, Remote, ($x.obj) ($x.subject)'} } | insert style 'blue_italic'
|
|
||||||
$local | append $remote
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git available upstream" [] {
|
|
||||||
^git branch --no-color -a | lines | each { |line| $line | str replace '* ' "" | str trim }
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git remotes" [] {
|
|
||||||
^git remote | lines | each { |line| $line | str trim }
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git log" [] {
|
|
||||||
^git log --pretty=%h | lines | each { |line| $line | str trim }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Yield all existing commits in descending chronological order.
|
|
||||||
def "nu-complete git commits all" [] {
|
|
||||||
^git rev-list --all --remotes --pretty=oneline | lines | parse "{value} {description}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Yield commits of current branch only. This is useful for e.g. cut points in
|
|
||||||
# `git rebase`.
|
|
||||||
def "nu-complete git commits current branch" [] {
|
|
||||||
^git log --pretty="%h %s" | lines | parse "{value} {description}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Yield local branches like `main`, `feature/typo_fix`
|
|
||||||
def "nu-complete git local branches" [] {
|
|
||||||
^git branch --no-color | lines | each { |line| $line | str replace '* ' "" | str replace '+ ' "" | str trim }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Yield remote branches like `origin/main`, `upstream/feature-a`
|
|
||||||
def "nu-complete git remote branches with prefix" [] {
|
|
||||||
^git branch --no-color -r | lines | parse -r '^\*?(\s*|\s*\S* -> )(?P<branch>\S*$)' | get branch | uniq
|
|
||||||
}
|
|
||||||
|
|
||||||
# Yield local and remote branch names which can be passed to `git merge`
|
|
||||||
def "nu-complete git mergable sources" [] {
|
|
||||||
use git-completion-utils *
|
|
||||||
let branches = get-mergable-sources
|
|
||||||
{
|
|
||||||
options: {
|
|
||||||
case_sensitive: false,
|
|
||||||
completion_algorithm: prefix,
|
|
||||||
sort: false,
|
|
||||||
},
|
|
||||||
completions: $branches
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git switch" [] {
|
|
||||||
use git-completion-utils *
|
|
||||||
let branches = get-mergable-sources
|
|
||||||
{
|
|
||||||
options: {
|
|
||||||
case_sensitive: false,
|
|
||||||
completion_algorithm: prefix,
|
|
||||||
sort: false,
|
|
||||||
},
|
|
||||||
completions: $branches
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git checkout" [context: string, position?:int] {
|
|
||||||
use git-completion-utils *
|
|
||||||
let preceding = $context | str substring ..$position
|
|
||||||
# See what user typed before, like 'git checkout a-branch a-path'.
|
|
||||||
# We exclude some flags from previous tokens, to detect if a branch name has been used as the first argument.
|
|
||||||
# FIXME: This method is still naive, though.
|
|
||||||
let prev_tokens = $preceding | str trim | args-split | where ($it not-in $GIT_SKIPABLE_FLAGS)
|
|
||||||
# In these scenarios, we suggest only file paths, not branch:
|
|
||||||
# - After '--'
|
|
||||||
# - First arg is a branch
|
|
||||||
# If before '--' is just 'git checkout' (or its alias), we suggest "dirty" files only (user is about to reset file).
|
|
||||||
if $prev_tokens.2? == '--' {
|
|
||||||
return (get-changed-files)
|
|
||||||
}
|
|
||||||
if '--' in $prev_tokens {
|
|
||||||
return (get-checkoutable-files)
|
|
||||||
}
|
|
||||||
# Already typed first argument.
|
|
||||||
if ($prev_tokens | length) > 2 and $preceding ends-with ' ' {
|
|
||||||
return (get-checkoutable-files)
|
|
||||||
}
|
|
||||||
# The first argument can be local branches, remote branches, files and commits
|
|
||||||
# Get local and remote branches
|
|
||||||
let branches = get-mergable-sources
|
|
||||||
let files = (get-checkoutable-files) | wrap value | insert description 'File' | insert style green
|
|
||||||
let commits = ^git rev-list -n 400 --remotes --oneline | lines | split column -n 2 ' ' value description | upsert description {|x| $'Commit, ($x.value) ($x.description)' } | insert style 'light_cyan_dimmed'
|
|
||||||
{
|
|
||||||
options: {
|
|
||||||
case_sensitive: false,
|
|
||||||
completion_algorithm: prefix,
|
|
||||||
sort: false,
|
|
||||||
},
|
|
||||||
completions: [...$branches, ...$files, ...$commits]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Arguments to `git rebase --onto <arg1> <arg2>`
|
|
||||||
def "nu-complete git rebase" [] {
|
|
||||||
(nu-complete git local branches)
|
|
||||||
| parse "{value}"
|
|
||||||
| insert description "local branch"
|
|
||||||
| append (nu-complete git remote branches with prefix
|
|
||||||
| parse "{value}"
|
|
||||||
| insert description "remote branch")
|
|
||||||
| append (nu-complete git commits all)
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git stash-list" [] {
|
|
||||||
git stash list | lines | parse "{value}: {description}"
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git tags" [] {
|
|
||||||
^git tag --no-color | lines
|
|
||||||
}
|
|
||||||
|
|
||||||
# See `man git-status` under "Short Format"
|
|
||||||
# This is incomplete, but should cover the most common cases.
|
|
||||||
const short_status_descriptions = {
|
|
||||||
".D": "Deleted"
|
|
||||||
".M": "Modified"
|
|
||||||
"!" : "Ignored"
|
|
||||||
"?" : "Untracked"
|
|
||||||
"AU": "Staged, not merged"
|
|
||||||
"MD": "Some modifications staged, file deleted in work tree"
|
|
||||||
"MM": "Some modifications staged, some modifications untracked"
|
|
||||||
"R.": "Renamed"
|
|
||||||
"UU": "Both modified (in merge conflict)"
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git files" [] {
|
|
||||||
let relevant_statuses = ["?",".M", "MM", "MD", ".D", "UU"]
|
|
||||||
^git status -uall --porcelain=2
|
|
||||||
| lines
|
|
||||||
| each { |$it|
|
|
||||||
if $it starts-with "1 " {
|
|
||||||
$it | parse --regex "1 (?P<short_status>\\S+) (?:\\S+\\s?){6} (?P<value>\\S+)"
|
|
||||||
} else if $it starts-with "2 " {
|
|
||||||
$it | parse --regex "2 (?P<short_status>\\S+) (?:\\S+\\s?){6} (?P<value>\\S+)"
|
|
||||||
} else if $it starts-with "u " {
|
|
||||||
$it | parse --regex "u (?P<short_status>\\S+) (?:\\S+\\s?){8} (?P<value>\\S+)"
|
|
||||||
} else if $it starts-with "? " {
|
|
||||||
$it | parse --regex "(?P<short_status>.{1}) (?P<value>.+)"
|
|
||||||
} else {
|
|
||||||
{ short_status: 'unknown', value: $it }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
| flatten
|
|
||||||
| where $it.short_status in $relevant_statuses
|
|
||||||
| insert "description" { |e| $short_status_descriptions | get $e.short_status}
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git built-in-refs" [] {
|
|
||||||
[HEAD FETCH_HEAD ORIG_HEAD]
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git refs" [] {
|
|
||||||
nu-complete git local branches
|
|
||||||
| parse "{value}"
|
|
||||||
| insert description Branch
|
|
||||||
| append (nu-complete git tags | parse "{value}" | insert description Tag)
|
|
||||||
| append (nu-complete git built-in-refs)
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git files-or-refs" [] {
|
|
||||||
nu-complete git local branches
|
|
||||||
| parse "{value}"
|
|
||||||
| insert description Branch
|
|
||||||
| append (nu-complete git files | where description == "Modified" | select value)
|
|
||||||
| append (nu-complete git tags | parse "{value}" | insert description Tag)
|
|
||||||
| append (nu-complete git built-in-refs)
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git subcommands" [] {
|
|
||||||
^git help -a | lines | where $it starts-with " " | parse -r '\s*(?P<value>[^ ]+) \s*(?P<description>\w.*)'
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git add" [] {
|
|
||||||
nu-complete git files
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git pull rebase" [] {
|
|
||||||
["false","true","merges","interactive"]
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git merge strategies" [] {
|
|
||||||
['ort', 'octopus']
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete git merge strategy options" [] {
|
|
||||||
['ours', 'theirs']
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Check out git branches and files
|
|
||||||
export extern "git checkout" [
|
|
||||||
...targets: string@"nu-complete git checkout" # name of the branch or files to checkout
|
|
||||||
--conflict: string # conflict style (merge or diff3)
|
|
||||||
--detach(-d) # detach HEAD at named commit
|
|
||||||
--force(-f) # force checkout (throw away local modifications)
|
|
||||||
--guess # second guess 'git checkout <no-such-branch>' (default)
|
|
||||||
--ignore-other-worktrees # do not check if another worktree is holding the given ref
|
|
||||||
--ignore-skip-worktree-bits # do not limit pathspecs to sparse entries only
|
|
||||||
--merge(-m) # perform a 3-way merge with the new branch
|
|
||||||
--orphan: string # new unparented branch
|
|
||||||
--ours(-2) # checkout our version for unmerged files
|
|
||||||
--overlay # use overlay mode (default)
|
|
||||||
--overwrite-ignore # update ignored files (default)
|
|
||||||
--patch(-p) # select hunks interactively
|
|
||||||
--pathspec-from-file: string # read pathspec from file
|
|
||||||
--progress # force progress reporting
|
|
||||||
--quiet(-q) # suppress progress reporting
|
|
||||||
--recurse-submodules # control recursive updating of submodules
|
|
||||||
--theirs(-3) # checkout their version for unmerged files
|
|
||||||
--track(-t) # set upstream info for new branch
|
|
||||||
-b # create and checkout a new branch
|
|
||||||
-B: string # create/reset and checkout a branch
|
|
||||||
-l # create reflog for new branch
|
|
||||||
]
|
|
||||||
|
|
||||||
export extern "git reset" [
|
|
||||||
...targets: string@"nu-complete git checkout" # name of commit, branch, or files to reset to
|
|
||||||
--hard # reset HEAD, index and working tree
|
|
||||||
--keep # reset HEAD but keep local changes
|
|
||||||
--merge # reset HEAD, index and working tree
|
|
||||||
--mixed # reset HEAD and index
|
|
||||||
--patch(-p) # select hunks interactively
|
|
||||||
--quiet(-q) # be quiet, only report errors
|
|
||||||
--soft # reset only HEAD
|
|
||||||
--pathspec-from-file: string # read pathspec from file
|
|
||||||
--pathspec-file-nul # with --pathspec-from-file, pathspec elements are separated with NUL character
|
|
||||||
--no-refresh # skip refreshing the index after reset
|
|
||||||
--recurse-submodules: string # control recursive updating of submodules
|
|
||||||
--no-recurse-submodules # don't recurse into submodules
|
|
||||||
]
|
|
||||||
|
|
||||||
# Download objects and refs from another repository
|
|
||||||
export extern "git fetch" [
|
|
||||||
repository?: string@"nu-complete git remotes" # name of the branch to fetch
|
|
||||||
--all # Fetch all remotes
|
|
||||||
--append(-a) # Append ref names and object names to .git/FETCH_HEAD
|
|
||||||
--atomic # Use an atomic transaction to update local refs.
|
|
||||||
--depth: int # Limit fetching to n commits from the tip
|
|
||||||
--deepen: int # Limit fetching to n commits from the current shallow boundary
|
|
||||||
--shallow-since: string # Deepen or shorten the history by date
|
|
||||||
--shallow-exclude: string # Deepen or shorten the history by branch/tag
|
|
||||||
--unshallow # Fetch all available history
|
|
||||||
--update-shallow # Update .git/shallow to accept new refs
|
|
||||||
--negotiation-tip: string # Specify which commit/glob to report while fetching
|
|
||||||
--negotiate-only # Do not fetch, only print common ancestors
|
|
||||||
--dry-run # Show what would be done
|
|
||||||
--write-fetch-head # Write fetched refs in FETCH_HEAD (default)
|
|
||||||
--no-write-fetch-head # Do not write FETCH_HEAD
|
|
||||||
--force(-f) # Always update the local branch
|
|
||||||
--keep(-k) # Keep downloaded pack
|
|
||||||
--multiple # Allow several arguments to be specified
|
|
||||||
--auto-maintenance # Run 'git maintenance run --auto' at the end (default)
|
|
||||||
--no-auto-maintenance # Don't run 'git maintenance' at the end
|
|
||||||
--auto-gc # Run 'git maintenance run --auto' at the end (default)
|
|
||||||
--no-auto-gc # Don't run 'git maintenance' at the end
|
|
||||||
--write-commit-graph # Write a commit-graph after fetching
|
|
||||||
--no-write-commit-graph # Don't write a commit-graph after fetching
|
|
||||||
--prefetch # Place all refs into the refs/prefetch/ namespace
|
|
||||||
--prune(-p) # Remove obsolete remote-tracking references
|
|
||||||
--prune-tags(-P) # Remove any local tags that do not exist on the remote
|
|
||||||
--no-tags(-n) # Disable automatic tag following
|
|
||||||
--refmap: string # Use this refspec to map the refs to remote-tracking branches
|
|
||||||
--tags(-t) # Fetch all tags
|
|
||||||
--recurse-submodules: string # Fetch new commits of populated submodules (yes/on-demand/no)
|
|
||||||
--jobs(-j): int # Number of parallel children
|
|
||||||
--no-recurse-submodules # Disable recursive fetching of submodules
|
|
||||||
--set-upstream # Add upstream (tracking) reference
|
|
||||||
--submodule-prefix: string # Prepend to paths printed in informative messages
|
|
||||||
--upload-pack: string # Non-default path for remote command
|
|
||||||
--quiet(-q) # Silence internally used git commands
|
|
||||||
--verbose(-v) # Be verbose
|
|
||||||
--progress # Report progress on stderr
|
|
||||||
--server-option(-o): string # Pass options for the server to handle
|
|
||||||
--show-forced-updates # Check if a branch is force-updated
|
|
||||||
--no-show-forced-updates # Don't check if a branch is force-updated
|
|
||||||
-4 # Use IPv4 addresses, ignore IPv6 addresses
|
|
||||||
-6 # Use IPv6 addresses, ignore IPv4 addresses
|
|
||||||
]
|
|
||||||
|
|
||||||
# Push changes
|
|
||||||
export extern "git push" [
|
|
||||||
remote?: string@"nu-complete git remotes", # the name of the remote
|
|
||||||
...refs: string@"nu-complete git local branches" # the branch / refspec
|
|
||||||
--all # push all refs
|
|
||||||
--atomic # request atomic transaction on remote side
|
|
||||||
--delete(-d) # delete refs
|
|
||||||
--dry-run(-n) # dry run
|
|
||||||
--exec: string # receive pack program
|
|
||||||
--follow-tags # push missing but relevant tags
|
|
||||||
--force-with-lease # require old value of ref to be at this value
|
|
||||||
--force(-f) # force updates
|
|
||||||
--ipv4(-4) # use IPv4 addresses only
|
|
||||||
--ipv6(-6) # use IPv6 addresses only
|
|
||||||
--mirror # mirror all refs
|
|
||||||
--no-verify # bypass pre-push hook
|
|
||||||
--porcelain # machine-readable output
|
|
||||||
--progress # force progress reporting
|
|
||||||
--prune # prune locally removed refs
|
|
||||||
--push-option(-o): string # option to transmit
|
|
||||||
--quiet(-q) # be more quiet
|
|
||||||
--receive-pack: string # receive pack program
|
|
||||||
--recurse-submodules: string # control recursive pushing of submodules
|
|
||||||
--repo: string # repository
|
|
||||||
--set-upstream(-u) # set upstream for git pull/status
|
|
||||||
--signed: string # GPG sign the push
|
|
||||||
--tags # push tags (can't be used with --all or --mirror)
|
|
||||||
--thin # use thin pack
|
|
||||||
--verbose(-v) # be more verbose
|
|
||||||
]
|
|
||||||
|
|
||||||
# Pull changes
|
|
||||||
export extern "git pull" [
|
|
||||||
remote?: string@"nu-complete git remotes", # the name of the remote
|
|
||||||
...refs: string@"nu-complete git local branches", # the branch / refspec
|
|
||||||
--rebase(-r): string@"nu-complete git pull rebase", # rebase current branch on top of upstream after fetching
|
|
||||||
--quiet(-q) # suppress output during transfer and merge
|
|
||||||
--verbose(-v) # be more verbose
|
|
||||||
--commit # perform the merge and commit the result
|
|
||||||
--no-commit # perform the merge but do not commit the result
|
|
||||||
--edit(-e) # edit the merge commit message
|
|
||||||
--no-edit # use the auto-generated merge commit message
|
|
||||||
--cleanup: string # specify how to clean up the merge commit message
|
|
||||||
--ff # fast-forward if possible
|
|
||||||
--no-ff # create a merge commit in all cases
|
|
||||||
--gpg-sign(-S) # GPG-sign the resulting merge commit
|
|
||||||
--no-gpg-sign # do not GPG-sign the resulting merge commit
|
|
||||||
--log: int # include log messages from merged commits
|
|
||||||
--no-log # do not include log messages from merged commits
|
|
||||||
--signoff # add Signed-off-by trailer
|
|
||||||
--no-signoff # do not add Signed-off-by trailer
|
|
||||||
--stat(-n) # show a diffstat at the end of the merge
|
|
||||||
--no-stat # do not show a diffstat at the end of the merge
|
|
||||||
--squash # produce working tree and index state as if a merge happened
|
|
||||||
--no-squash # perform the merge and commit the result
|
|
||||||
--verify # run pre-merge and commit-msg hooks
|
|
||||||
--no-verify # do not run pre-merge and commit-msg hooks
|
|
||||||
--strategy(-s): string # use the given merge strategy
|
|
||||||
--strategy-option(-X): string # pass merge strategy-specific option
|
|
||||||
--verify-signatures # verify the tip commit of the side branch being merged
|
|
||||||
--no-verify-signatures # do not verify the tip commit of the side branch being merged
|
|
||||||
--summary # show a summary of the merge
|
|
||||||
--no-summary # do not show a summary of the merge
|
|
||||||
--autostash # create a temporary stash entry before the operation
|
|
||||||
--no-autostash # do not create a temporary stash entry before the operation
|
|
||||||
--allow-unrelated-histories # allow merging histories without a common ancestor
|
|
||||||
--no-rebase # do not rebase the current branch on top of the upstream branch
|
|
||||||
--all # fetch all remotes
|
|
||||||
--append(-a) # append fetched refs to existing contents of FETCH_HEAD
|
|
||||||
--atomic # use an atomic transaction to update local refs
|
|
||||||
--depth: int # limit fetching to the specified number of commits
|
|
||||||
--deepen: int # deepen the history by the specified number of commits
|
|
||||||
--shallow-since: string # deepen or shorten the history since a specified date
|
|
||||||
--shallow-exclude: string # exclude commits reachable from a specified branch or tag
|
|
||||||
--unshallow # convert a shallow repository to a complete one
|
|
||||||
--update-shallow # update .git/shallow with new refs
|
|
||||||
--tags(-t) # fetch all tags from the remote
|
|
||||||
--jobs(-j): int # number of parallel children for fetching
|
|
||||||
--set-upstream # add upstream (tracking) reference
|
|
||||||
--upload-pack: string # specify non-default path for upload-pack on the remote
|
|
||||||
--progress # force progress status even if stderr is not a terminal
|
|
||||||
--server-option(-o): string # transmit the given string to the server
|
|
||||||
]
|
|
||||||
|
|
||||||
# Switch between branches and commits
|
|
||||||
export extern "git switch" [
|
|
||||||
switch?: string@"nu-complete git switch" # name of branch to switch to
|
|
||||||
--create(-c) # create a new branch
|
|
||||||
--detach(-d): string@"nu-complete git log" # switch to a commit in a detached state
|
|
||||||
--force-create(-C): string # forces creation of new branch, if it exists then the existing branch will be reset to starting point
|
|
||||||
--force(-f) # alias for --discard-changes
|
|
||||||
--guess # if there is no local branch which matches then name but there is a remote one then this is checked out
|
|
||||||
--ignore-other-worktrees # switch even if the ref is held by another worktree
|
|
||||||
--merge(-m) # attempts to merge changes when switching branches if there are local changes
|
|
||||||
--no-guess # do not attempt to match remote branch names
|
|
||||||
--no-progress # do not report progress
|
|
||||||
--no-recurse-submodules # do not update the contents of sub-modules
|
|
||||||
--no-track # do not set "upstream" configuration
|
|
||||||
--orphan: string # create a new orphaned branch
|
|
||||||
--progress # report progress status
|
|
||||||
--quiet(-q) # suppress feedback messages
|
|
||||||
--recurse-submodules # update the contents of sub-modules
|
|
||||||
--track(-t) # set "upstream" configuration
|
|
||||||
]
|
|
||||||
|
|
||||||
# Apply the change introduced by an existing commit
|
|
||||||
export extern "git cherry-pick" [
|
|
||||||
commit?: string@"nu-complete git commits all" # The commit ID to be cherry-picked
|
|
||||||
--edit(-e) # Edit the commit message prior to committing
|
|
||||||
--no-commit(-n) # Apply changes without making any commit
|
|
||||||
--signoff(-s) # Add Signed-off-by line to the commit message
|
|
||||||
--ff # Fast-forward if possible
|
|
||||||
--continue # Continue the operation in progress
|
|
||||||
--abort # Cancel the operation
|
|
||||||
--skip # Skip the current commit and continue with the rest of the sequence
|
|
||||||
]
|
|
||||||
|
|
||||||
# Rebase the current branch
|
|
||||||
export extern "git rebase" [
|
|
||||||
branch?: string@"nu-complete git rebase" # name of the branch to rebase onto
|
|
||||||
upstream?: string@"nu-complete git rebase" # upstream branch to compare against
|
|
||||||
--continue # restart rebasing process after editing/resolving a conflict
|
|
||||||
--abort # abort rebase and reset HEAD to original branch
|
|
||||||
--quit # abort rebase but do not reset HEAD
|
|
||||||
--interactive(-i) # rebase interactively with list of commits in editor
|
|
||||||
--onto?: string@"nu-complete git rebase" # starting point at which to create the new commits
|
|
||||||
--root # start rebase from root commit
|
|
||||||
]
|
|
||||||
|
|
||||||
# Merge from a branch
|
|
||||||
export extern "git merge" [
|
|
||||||
# For now, to make it simple, we only complete branches (not commits) and support single-parent case.
|
|
||||||
branch?: string@"nu-complete git mergable sources" # The source branch
|
|
||||||
--edit(-e) # Edit the commit message prior to committing
|
|
||||||
--no-edit # Do not edit commit message
|
|
||||||
--no-commit(-n) # Apply changes without making any commit
|
|
||||||
--signoff # Add Signed-off-by line to the commit message
|
|
||||||
--ff # Fast-forward if possible
|
|
||||||
--continue # Continue after resolving a conflict
|
|
||||||
--abort # Abort resolving conflict and go back to original state
|
|
||||||
--quit # Forget about the current merge in progress
|
|
||||||
--strategy(-s): string@"nu-complete git merge strategies" # Merge strategy
|
|
||||||
-X: string@"nu-complete git merge strategy options" # Option for merge strategy
|
|
||||||
--verbose(-v)
|
|
||||||
--help
|
|
||||||
]
|
|
||||||
|
|
||||||
# List or change branches
|
|
||||||
export extern "git branch" [
|
|
||||||
branch?: string@"nu-complete git local branches" # name of branch to operate on
|
|
||||||
--abbrev # use short commit hash prefixes
|
|
||||||
--edit-description # open editor to edit branch description
|
|
||||||
--merged # list reachable branches
|
|
||||||
--no-merged # list unreachable branches
|
|
||||||
--set-upstream-to: string@"nu-complete git available upstream" # set upstream for branch
|
|
||||||
--unset-upstream # remote upstream for branch
|
|
||||||
--all # list both remote and local branches
|
|
||||||
--copy # copy branch together with config and reflog
|
|
||||||
--format # specify format for listing branches
|
|
||||||
--move # rename branch
|
|
||||||
--points-at # list branches that point at an object
|
|
||||||
--show-current # print the name of the current branch
|
|
||||||
--verbose # show commit and upstream for each branch
|
|
||||||
--color # use color in output
|
|
||||||
--quiet # suppress messages except errors
|
|
||||||
--delete(-d) # delete branch
|
|
||||||
--list # list branches
|
|
||||||
--contains: string@"nu-complete git commits all" # show only branches that contain the specified commit
|
|
||||||
--no-contains # show only branches that don't contain specified commit
|
|
||||||
--track(-t) # when creating a branch, set upstream
|
|
||||||
]
|
|
||||||
|
|
||||||
# List all variables set in config file, along with their values.
|
|
||||||
export extern "git config list" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Emits the value of the specified key.
|
|
||||||
export extern "git config get" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Set value for one or more config options.
|
|
||||||
export extern "git config set" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Unset value for one or more config options.
|
|
||||||
export extern "git config unset" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Rename the given section to a new name.
|
|
||||||
export extern "git config rename-section" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Remove the given section from the configuration file.
|
|
||||||
export extern "git config remove-section" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Opens an editor to modify the specified config file
|
|
||||||
export extern "git config edit" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# List or change tracked repositories
|
|
||||||
export extern "git remote" [
|
|
||||||
--verbose(-v) # Show URL for remotes
|
|
||||||
]
|
|
||||||
|
|
||||||
# Add a new tracked repository
|
|
||||||
export extern "git remote add" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Rename a tracked repository
|
|
||||||
export extern "git remote rename" [
|
|
||||||
remote: string@"nu-complete git remotes" # remote to rename
|
|
||||||
new_name: string # new name for remote
|
|
||||||
]
|
|
||||||
|
|
||||||
# Remove a tracked repository
|
|
||||||
export extern "git remote remove" [
|
|
||||||
remote: string@"nu-complete git remotes" # remote to remove
|
|
||||||
]
|
|
||||||
|
|
||||||
# Get the URL for a tracked repository
|
|
||||||
export extern "git remote get-url" [
|
|
||||||
remote: string@"nu-complete git remotes" # remote to get URL for
|
|
||||||
]
|
|
||||||
|
|
||||||
# Set the URL for a tracked repository
|
|
||||||
export extern "git remote set-url" [
|
|
||||||
remote: string@"nu-complete git remotes" # remote to set URL for
|
|
||||||
url: string # new URL for remote
|
|
||||||
]
|
|
||||||
|
|
||||||
# Show changes between commits, working tree etc
|
|
||||||
export extern "git diff" [
|
|
||||||
rev1_or_file?: string@"nu-complete git files-or-refs"
|
|
||||||
rev2?: string@"nu-complete git refs"
|
|
||||||
--cached # show staged changes
|
|
||||||
--name-only # only show names of changed files
|
|
||||||
--name-status # show changed files and kind of change
|
|
||||||
--no-color # disable color output
|
|
||||||
]
|
|
||||||
|
|
||||||
# Commit changes
|
|
||||||
export extern "git commit" [
|
|
||||||
--all(-a) # automatically stage all modified and deleted files
|
|
||||||
--amend # amend the previous commit rather than adding a new one
|
|
||||||
--message(-m): string # specify the commit message rather than opening an editor
|
|
||||||
--reuse-message(-C): string # reuse the message from a previous commit
|
|
||||||
--reedit-message(-c): string # reuse and edit message from a commit
|
|
||||||
--fixup: string # create a fixup/amend commit
|
|
||||||
--squash: string # squash commit for autosquash rebase
|
|
||||||
--reset-author # reset author information
|
|
||||||
--short # short-format output for dry-run
|
|
||||||
--branch # show branch info in short-format
|
|
||||||
--porcelain # porcelain-ready format for dry-run
|
|
||||||
--long # long-format output for dry-run
|
|
||||||
--null(-z) # use NUL instead of LF in output
|
|
||||||
--file(-F): string # read commit message from file
|
|
||||||
--author: string # override commit author
|
|
||||||
--date: string # override author date
|
|
||||||
--template(-t): string # use commit message template file
|
|
||||||
--signoff(-s) # add Signed-off-by trailer
|
|
||||||
--no-signoff # do not add Signed-off-by trailer
|
|
||||||
--trailer: string # add trailer to commit message
|
|
||||||
--no-verify(-n) # bypass pre-commit and commit-msg hooks
|
|
||||||
--verify # do not bypass pre-commit and commit-msg hooks
|
|
||||||
--allow-empty # allow commit with no changes
|
|
||||||
--allow-empty-message # allow commit with empty message
|
|
||||||
--cleanup: string # cleanup commit message
|
|
||||||
--edit(-e) # edit commit message
|
|
||||||
--no-edit # do not edit commit message
|
|
||||||
--include(-i) # include given paths in commit
|
|
||||||
--only(-o) # commit only specified paths
|
|
||||||
--pathspec-from-file: string # read pathspec from file
|
|
||||||
--pathspec-file-nul # use NUL character for pathspec file
|
|
||||||
--untracked-files(-u): string # show untracked files
|
|
||||||
--verbose(-v) # show diff in commit message template
|
|
||||||
--quiet(-q) # suppress commit summary
|
|
||||||
--dry-run # show paths to be committed without committing
|
|
||||||
--status # include git-status output in commit message
|
|
||||||
--no-status # do not include git-status output
|
|
||||||
--gpg-sign(-S) # GPG-sign commit
|
|
||||||
--no-gpg-sign # do not GPG-sign commit
|
|
||||||
...pathspec: string # commit files matching pathspec
|
|
||||||
]
|
|
||||||
|
|
||||||
# List commits
|
|
||||||
export extern "git log" [
|
|
||||||
# Ideally we'd allow completion of revisions here, but that would make completion of filenames not work.
|
|
||||||
-U # show diffs
|
|
||||||
--follow # show history beyond renames (single file only)
|
|
||||||
--grep: string # show log entries matching supplied regular expression
|
|
||||||
]
|
|
||||||
|
|
||||||
# Show or change the reflog
|
|
||||||
export extern "git reflog" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Stage files
|
|
||||||
export extern "git add" [
|
|
||||||
...file: string@"nu-complete git add" # file to add
|
|
||||||
--all(-A) # add all files
|
|
||||||
--dry-run(-n) # don't actually add the file(s), just show if they exist and/or will be ignored
|
|
||||||
--edit(-e) # open the diff vs. the index in an editor and let the user edit it
|
|
||||||
--force(-f) # allow adding otherwise ignored files
|
|
||||||
--interactive(-i) # add modified contents in the working tree interactively to the index
|
|
||||||
--patch(-p) # interactively choose hunks to stage
|
|
||||||
--verbose(-v) # be verbose
|
|
||||||
]
|
|
||||||
|
|
||||||
# Delete file from the working tree and the index
|
|
||||||
export extern "git rm" [
|
|
||||||
-r # recursive
|
|
||||||
--force(-f) # override the up-to-date check
|
|
||||||
--dry-run(-n) # Don't actually remove any file(s)
|
|
||||||
--cached # unstage and remove paths only from the index
|
|
||||||
]
|
|
||||||
|
|
||||||
# Show the working tree status
|
|
||||||
export extern "git status" [
|
|
||||||
--verbose(-v) # be verbose
|
|
||||||
--short(-s) # show status concisely
|
|
||||||
--branch(-b) # show branch information
|
|
||||||
--show-stash # show stash information
|
|
||||||
]
|
|
||||||
|
|
||||||
# Stash changes for later
|
|
||||||
export extern "git stash push" [
|
|
||||||
--patch(-p) # interactively choose hunks to stash
|
|
||||||
]
|
|
||||||
|
|
||||||
# Unstash previously stashed changes
|
|
||||||
export extern "git stash pop" [
|
|
||||||
stash?: string@"nu-complete git stash-list" # stash to pop
|
|
||||||
--index(-i) # try to reinstate not only the working tree's changes, but also the index's ones
|
|
||||||
]
|
|
||||||
|
|
||||||
# List stashed changes
|
|
||||||
export extern "git stash list" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Show a stashed change
|
|
||||||
export extern "git stash show" [
|
|
||||||
stash?: string@"nu-complete git stash-list"
|
|
||||||
-U # show diff
|
|
||||||
]
|
|
||||||
|
|
||||||
# Drop a stashed change
|
|
||||||
export extern "git stash drop" [
|
|
||||||
stash?: string@"nu-complete git stash-list"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Create a new git repository
|
|
||||||
export extern "git init" [
|
|
||||||
--initial-branch(-b): string # initial branch name
|
|
||||||
]
|
|
||||||
|
|
||||||
# List or manipulate tags
|
|
||||||
export extern "git tag" [
|
|
||||||
--delete(-d): string@"nu-complete git tags" # delete a tag
|
|
||||||
]
|
|
||||||
|
|
||||||
# Prune all unreachable objects
|
|
||||||
export extern "git prune" [
|
|
||||||
--dry-run(-n) # dry run
|
|
||||||
--expire: string # expire objects older than
|
|
||||||
--progress # show progress
|
|
||||||
--verbose(-v) # report all removed objects
|
|
||||||
]
|
|
||||||
|
|
||||||
# Start a binary search to find the commit that introduced a bug
|
|
||||||
export extern "git bisect start" [
|
|
||||||
bad?: string # a commit that has the bug
|
|
||||||
good?: string # a commit that doesn't have the bug
|
|
||||||
]
|
|
||||||
|
|
||||||
# Mark the current (or specified) revision as bad
|
|
||||||
export extern "git bisect bad" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Mark the current (or specified) revision as good
|
|
||||||
export extern "git bisect good" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Skip the current (or specified) revision
|
|
||||||
export extern "git bisect skip" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# End bisection
|
|
||||||
export extern "git bisect reset" [
|
|
||||||
]
|
|
||||||
|
|
||||||
# Show help for a git subcommand
|
|
||||||
export extern "git help" [
|
|
||||||
command?: string@"nu-complete git subcommands" # subcommand to show help for
|
|
||||||
]
|
|
||||||
|
|
||||||
# git worktree
|
|
||||||
export extern "git worktree" [
|
|
||||||
--help(-h) # display the help message for this command
|
|
||||||
...args
|
|
||||||
]
|
|
||||||
|
|
||||||
# create a new working tree
|
|
||||||
export extern "git worktree add" [
|
|
||||||
path: path # directory to clone the branch
|
|
||||||
branch: string@"nu-complete git available upstream" # Branch to clone
|
|
||||||
--help(-h) # display the help message for this command
|
|
||||||
--force(-f) # checkout <branch> even if already checked out in other worktree
|
|
||||||
-b # create a new branch
|
|
||||||
-B # create or reset a branch
|
|
||||||
--detach(-d) # detach HEAD at named commit
|
|
||||||
--checkout # populate the new working tree
|
|
||||||
--lock # keep the new working tree locked
|
|
||||||
--reason # reason for locking
|
|
||||||
--quiet(-q) # suppress progress reporting
|
|
||||||
--track # set up tracking mode (see git-branch(1))
|
|
||||||
--guess-remote # try to match the new branch name with a remote-tracking branch
|
|
||||||
...args
|
|
||||||
]
|
|
||||||
|
|
||||||
# list details of each worktree
|
|
||||||
export extern "git worktree list" [
|
|
||||||
--help(-h) # display the help message for this command
|
|
||||||
--porcelain # machine-readable output
|
|
||||||
--verbose(-v) # show extended annotations and reasons, if available
|
|
||||||
--expire # add 'prunable' annotation to worktrees older than <time>
|
|
||||||
-z # terminate records with a NUL character
|
|
||||||
...args
|
|
||||||
]
|
|
||||||
|
|
||||||
def "nu-complete worktree list" [] {
|
|
||||||
^git worktree list | to text | parse --regex '(?P<value>\S+)\s+(?P<commit>\w+)\s+(?P<description>\S.*)'
|
|
||||||
}
|
|
||||||
|
|
||||||
# prevent a working tree from being pruned
|
|
||||||
export extern "git worktree lock" [
|
|
||||||
worktree: string@"nu-complete worktree list"
|
|
||||||
--reason: string # reason because the tree is locked
|
|
||||||
--help(-h) # display the help message for this command
|
|
||||||
--reason # reason for locking
|
|
||||||
...args
|
|
||||||
]
|
|
||||||
|
|
||||||
# move a working tree to a new location
|
|
||||||
export extern "git worktree move" [
|
|
||||||
--help(-h) # display the help message for this command
|
|
||||||
--force(-f) # force move even if worktree is dirty or locked
|
|
||||||
...args
|
|
||||||
]
|
|
||||||
|
|
||||||
# prune working tree information
|
|
||||||
export extern "git worktree prune" [
|
|
||||||
--help(-h) # display the help message for this command
|
|
||||||
--dry-run(-n) # do not remove, show only
|
|
||||||
--verbose(-v) # report pruned working trees
|
|
||||||
--expire # expire working trees older than <time>
|
|
||||||
...args
|
|
||||||
]
|
|
||||||
|
|
||||||
# remove a working tree
|
|
||||||
export extern "git worktree remove" [
|
|
||||||
worktree: string@"nu-complete worktree list"
|
|
||||||
--help(-h) # display the help message for this command
|
|
||||||
--force(-f) # force removal even if worktree is dirty or locked
|
|
||||||
]
|
|
||||||
|
|
||||||
# allow working tree to be pruned, moved or deleted
|
|
||||||
export extern "git worktree unlock" [
|
|
||||||
worktree: string@"nu-complete worktree list"
|
|
||||||
...args
|
|
||||||
]
|
|
||||||
|
|
||||||
# clones a repo
|
|
||||||
export extern "git clone" [
|
|
||||||
--help(-h) # display the help message for this command
|
|
||||||
--local(-l) # cloning from the local machine
|
|
||||||
--no-local # use the git transport mechanism even if cloning from a local path
|
|
||||||
--no-hardlinks # force git to copy files when cloning from the local machine
|
|
||||||
--shared(-s) # setup .git/objects/info/alternates to share objects with the source local repo
|
|
||||||
--reference: string # setup .git/objects/info/alternates to share objects with the =<reference> local repo
|
|
||||||
--reference-if-able: string # same as --reference, but skips empty folders
|
|
||||||
--dissociate # borrow objects from the referenced repo (--reference)
|
|
||||||
--quiet(-q) # suppress progress reporting
|
|
||||||
--verbose(-v) # be verbose
|
|
||||||
--progress # report progress unless --quiet
|
|
||||||
--server-option: string # transmit the =<option> to the server
|
|
||||||
--no-checkout(-n) # no checkout of HEAD
|
|
||||||
--reject-shallow # reject shallow repository as source
|
|
||||||
--no-reject-shallow # do not reject shallow repository as source
|
|
||||||
--bare # make a bare git repo
|
|
||||||
--sparse # initialize the sparse-checkout file
|
|
||||||
--filter: string # partial clone using the given =<filter-spec>
|
|
||||||
--mirror # mirror the source repo
|
|
||||||
--origin(-o): string # use <name> as the name for the remote origin
|
|
||||||
--branch(-b): string # point HEAD to <name> branch
|
|
||||||
--upload-pack(-u): string # use <upload-pack> as the path in the other end when using ssh
|
|
||||||
--template: string # use <template-dir> as the templates directory
|
|
||||||
--config(-c): string # set a <key>=<value> config variable
|
|
||||||
--depth: int # shallow clone <depth> commits
|
|
||||||
--shallow-since: string # shallow clone commits newer than =<date>
|
|
||||||
--shallow-exclude: string # do not clone commits reachable from <revision> (branch or tag)
|
|
||||||
--single-branch # clone commit history from a single branch
|
|
||||||
--no-single-Branch # do not clone only one branch
|
|
||||||
--no-tags # do not clone any tags
|
|
||||||
--recurse-submodules # clone the submodules. Also accepts paths
|
|
||||||
--shallow-submodules # shallow clone submodules with depth 1
|
|
||||||
--no-shallow-submodules # do not shallow clone submodules
|
|
||||||
--remote-submodules # submodules are updating using their remote tracking branch
|
|
||||||
--no-remote-submodules # do not track submodules remote
|
|
||||||
--separate-git-dir: string # place the clone at =<git dir> and link it here
|
|
||||||
--jobs(-j): int # number of simultaneous submodules fetch
|
|
||||||
...args
|
|
||||||
]
|
|
||||||
|
|
||||||
# Restores files in working tree or index to previous versions
|
|
||||||
export extern "git restore" [
|
|
||||||
--help(-h) # Display the help message for this command
|
|
||||||
--source(-s) # Restore the working tree files with the content from the given tree
|
|
||||||
--patch(-p) # Interactively choose hunks to restore
|
|
||||||
--worktree(-W) # Restore working tree (default if neither --worktree or --staged is used)
|
|
||||||
--staged(-S) # Restore index
|
|
||||||
--quiet(-q) # Quiet, suppress feedback messages
|
|
||||||
--progress # Force progress reporting
|
|
||||||
--no-progress # Suppress progress reporting
|
|
||||||
--ours # Restore from index using our version for unmerged files
|
|
||||||
--theirs # Restore from index using their version for unmerged files
|
|
||||||
--merge(-m) # Restore from index and recreate the conflicted merge in unmerged files
|
|
||||||
--conflict: string # Like --merge but changes the conflict presentation with =<style>
|
|
||||||
--ignore-unmerged # Restore from index and ignore unmerged entries (unmerged files are left as is)
|
|
||||||
--ignore-skip-worktree-bits # Ignore sparse checkout patterns and unconditionally restores any files in <pathspec>
|
|
||||||
--recurse-submodules # Restore the contents of sub-modules in working tree
|
|
||||||
--no-recurse-submodules # Do not restore the contents of sub-modules in working tree (default)
|
|
||||||
--overlay # Do not remove files that don't exist when restoring from tree with --source
|
|
||||||
--no-overlay # Remove files that don't exist when restoring from tree with --source (default)
|
|
||||||
--pathspec-from-file: string # Read pathspec from file
|
|
||||||
--pathspec-file-nul # Separate pathspec elements with NUL character when reading from file
|
|
||||||
...pathspecs: string@"nu-complete git files" # Target pathspecs to restore
|
|
||||||
]
|
|
||||||
|
|
||||||
# Print lines matching a pattern
|
|
||||||
export extern "git grep" [
|
|
||||||
--help(-h) # Display the help message for this command
|
|
||||||
--cached # Search blobs registered in the index file instead of worktree
|
|
||||||
--untracked # Include untracked files in search
|
|
||||||
--no-index # Similar to `grep -r`, but with additional benefits, such as using pathspec patterns to limit paths; Cannot be used together with --cached or --untracked
|
|
||||||
--no-exclude-standard # Include ignored files in search (only useful with --untracked)
|
|
||||||
--exclude-standard # No not include ignored files in search (only useful with --no-index)
|
|
||||||
--recurse-submodules # Recursively search in each submodule that is active and checked out
|
|
||||||
--text(-a) # Process binary files as if they were text
|
|
||||||
--textconv # Honor textconv filter settings
|
|
||||||
--no-textconv # Do not honor textconv filter settings (default)
|
|
||||||
--ignore-case(-i) # Ignore case differences between patterns and files
|
|
||||||
-I # Don’t match the pattern in binary files
|
|
||||||
--max-depth: int # Max <depth> to descend down directories for each pathspec. A value of -1 means no limit.
|
|
||||||
--recursive(-r) # Same as --max-depth=-1
|
|
||||||
--no-recursive # Same as --max-depth=0
|
|
||||||
--word-regexp(-w) # Match the pattern only at word boundary
|
|
||||||
--invert-match(-v) # Select non-matching lines
|
|
||||||
-H # Suppress filename in output of matched lines
|
|
||||||
--full-name # Force relative path to filename from top directory
|
|
||||||
--extended-regexp(-E) # Use POSIX extended regexp for patterns
|
|
||||||
--basic-regexp(-G) # Use POSIX basic regexp for patterns (default)
|
|
||||||
--perl-regexp(-P) # Use Perl-compatible regular expressions for patterns
|
|
||||||
--line-number(-n) # Prefix the line number to matching lines
|
|
||||||
--column # Prefix the 1-indexed byte-offset of the first match from the start of the matching line
|
|
||||||
--files-with-matches(-l) # Print filenames of files that contains matches
|
|
||||||
--name-only # Same as --files-with-matches
|
|
||||||
--files-without-match(-L) # Print filenames of files that do not contain matches
|
|
||||||
--null(-z) # Use \0 as the delimiter for pathnames in the output, and print them verbatim
|
|
||||||
--only-matching(-o) # Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line
|
|
||||||
--count(-c) # Instead of showing every matched line, show the number of lines that match
|
|
||||||
--no-color # Same as --color=never
|
|
||||||
--break # Print an empty line between matches from different files.
|
|
||||||
--heading # Show the filename above the matches in that file instead of at the start of each shown line.
|
|
||||||
--show-function(-p) # Show the preceding line that contains the function name of the match, unless the matching line is a function name itself.
|
|
||||||
--context(-C): int # Show <num> leading and trailing lines, and place a line containing -- between contiguous groups of matches.
|
|
||||||
--after-context(-A): int # Show <num> trailing lines, and place a line containing -- between contiguous groups of matches.
|
|
||||||
--before-context(-B): int # Show <num> leading lines, and place a line containing -- between contiguous groups of matches.
|
|
||||||
--function-context(-W) # Show the surrounding text from the previous line containing a function name up to the one before the next function name
|
|
||||||
--max-count(-m): int # Limit the amount of matches per file. When using the -v or --invert-match option, the search stops after the specified number of non-matches.
|
|
||||||
--threads: int # Number of grep worker threads to use. Use --help for more information on grep threads.
|
|
||||||
-f: string # Read patterns from <file>, one per line.
|
|
||||||
-e: string # Next parameter is the pattern. Multiple patterns are combined by --or.
|
|
||||||
--and # Search for lines that match multiple patterns.
|
|
||||||
--or # Search for lines that match at least one of multiple patterns. --or is implied between patterns without --and or --not.
|
|
||||||
--not # Search for lines that does not match pattern.
|
|
||||||
--all-match # When giving multiple pattern expressions combined with --or, this flag is specified to limit the match to files that have lines to match all of them.
|
|
||||||
--quiet(-q) # Do not output matched lines; instead, exit with status 0 when there is a match and with non-zero status when there isn’t.
|
|
||||||
...pathspecs: string # Target pathspecs to limit the scope of the search.
|
|
||||||
]
|
|
||||||
|
|
||||||
export extern "git" [
|
|
||||||
command?: string@"nu-complete git subcommands" # Subcommands
|
|
||||||
--version(-v) # Prints the Git suite version that the git program came from
|
|
||||||
--help(-h) # Prints the synopsis and a list of the most commonly used commands
|
|
||||||
--html-path # Print the path, without trailing slash, where Git’s HTML documentation is installed and exit
|
|
||||||
--man-path # Print the manpath (see man(1)) for the man pages for this version of Git and exit
|
|
||||||
--info-path # Print the path where the Info files documenting this version of Git are installed and exit
|
|
||||||
--paginate(-p) # Pipe all output into less (or if set, $env.PAGER) if standard output is a terminal
|
|
||||||
--no-pager(-P) # Do not pipe Git output into a pager
|
|
||||||
--no-replace-objects # Do not use replacement refs to replace Git objects
|
|
||||||
--bare # Treat the repository as a bare repository
|
|
||||||
]
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
def "nu-complete make" [] {
|
|
||||||
ls
|
|
||||||
| find --ignore-case makefile
|
|
||||||
| open $in.0.name
|
|
||||||
| lines
|
|
||||||
| find --regex '^[\w\.-]+\s*:'
|
|
||||||
| where ($it | str starts-with '.') == false
|
|
||||||
| split column ':' target
|
|
||||||
| get target
|
|
||||||
| str trim
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete make jobs" [] {
|
|
||||||
seq 1 (sys cpu | length)
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete make files" [] {
|
|
||||||
ls **/* | where type == file | get name
|
|
||||||
}
|
|
||||||
|
|
||||||
def "nu-complete make dirs" [] {
|
|
||||||
ls **/* | where type == dir | get name
|
|
||||||
}
|
|
||||||
|
|
||||||
export extern "make" [
|
|
||||||
command?: string@"nu-complete make"
|
|
||||||
--always-make(-B) # Unconditionally make all targets.
|
|
||||||
--directory(-C): string@"nu-complete make dirs" # Change to DIRECTORY before doing anything.
|
|
||||||
--debug(-d) # Print various types of debugging information.
|
|
||||||
--environment-overrides(-e) # Environment variables override makefiles.
|
|
||||||
--eval(-E): string # Evaluate STRING as a makefile statement.
|
|
||||||
--file(-f) # Read FILE as a makefile.
|
|
||||||
--help(-h) # Print this message and exit.
|
|
||||||
--ignore-errors(-i) # Ignore errors from recipes.
|
|
||||||
--include-dir(-I): string@"nu-complete make dirs" # Search DIRECTORY for included makefiles.
|
|
||||||
--jobs(-j): int@"nu-complete make jobs" # Allow N jobs at once; infinite jobs with no arg.
|
|
||||||
--keep-going(-k) # Keep going when some targets can't be made.
|
|
||||||
--load-average(-l): int@"nu-complete make jobs" # Don't start multiple jobs unless load is below N.
|
|
||||||
--check-symlink-times(-L) # Use the latest mtime between symlinks and target.
|
|
||||||
--just-print(-n) # Don't actually run any recipe; just print them.
|
|
||||||
--dry-run
|
|
||||||
--recon
|
|
||||||
--assume-old: string@"nu-complete make files" # Consider FILE to be very old and don't remake it.
|
|
||||||
--old-file(-o): string@"nu-complete make files"
|
|
||||||
--output-sync(-O) # Synchronize output of parallel jobs by TYPE.
|
|
||||||
--print-data-base(-p) # Print make's internal database.
|
|
||||||
--question(-q) # Run no recipe; exit status says if up to date.
|
|
||||||
--no-builtin-rules(-r) # Disable the built-in implicit rules.
|
|
||||||
--no-builtin-variables(-R) # Disable the built-in variable settings.
|
|
||||||
--silent(-s) # Don't echo recipes.
|
|
||||||
--quiet
|
|
||||||
--no-silent # Echo recipes (disable --silent mode).
|
|
||||||
--stop(-S) # Turns off -k.
|
|
||||||
--no-keep-going
|
|
||||||
--touch(-t) # Touch targets instead of remaking them.
|
|
||||||
--trace # Print tracing information.
|
|
||||||
--version(-v) # Print the version number of make and exit.
|
|
||||||
--print-directory(-w) # Print the current directory.
|
|
||||||
--no-print-directory # Turn off -w, even if it was turned on implicitly.
|
|
||||||
--what-if(-W): string@"nu-complete make files" # Consider FILE to be infinitely new.
|
|
||||||
--new-file: string@"nu-complete make files"
|
|
||||||
--assume-new: string@"nu-complete make files"
|
|
||||||
--warn-undefined-variables # Warn when an undefined variable is referenced.
|
|
||||||
]
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
# example:
|
|
||||||
# ```nu
|
|
||||||
# > got
|
|
||||||
# Error: nu::shell::external_command
|
|
||||||
#
|
|
||||||
# × External command failed
|
|
||||||
# ╭─[entry #1:1:1]
|
|
||||||
# 1 │ got
|
|
||||||
# · ─┬─
|
|
||||||
# · ╰── did you mean 'get'?
|
|
||||||
# ╰────
|
|
||||||
# help: No such file or directory (os error 2)
|
|
||||||
#
|
|
||||||
# did you mean?
|
|
||||||
# dot
|
|
||||||
# git
|
|
||||||
# go
|
|
||||||
# ```
|
|
||||||
{|cmd|
|
|
||||||
let commands_in_path = (
|
|
||||||
$env.PATH | each {|directory|
|
|
||||||
if ($directory | path exists) {
|
|
||||||
ls $directory | get name | path parse | update parent "" | path join
|
|
||||||
}
|
|
||||||
}
|
|
||||||
| flatten
|
|
||||||
| wrap cmd
|
|
||||||
)
|
|
||||||
|
|
||||||
let closest_commands = (
|
|
||||||
$commands_in_path
|
|
||||||
| insert distance {|it|
|
|
||||||
$it.cmd | str distance $cmd
|
|
||||||
}
|
|
||||||
| uniq
|
|
||||||
| sort-by distance
|
|
||||||
| get cmd
|
|
||||||
| first 3
|
|
||||||
)
|
|
||||||
|
|
||||||
let pretty_commands = (
|
|
||||||
$closest_commands | each {|cmd|
|
|
||||||
$" (ansi {fg: "default" attr: "di"})($cmd)(ansi reset)"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
$"\ndid you mean?\n($pretty_commands | str join "\n")"
|
|
||||||
}
|
|
||||||
|
|
@ -1,120 +0,0 @@
|
||||||
let pri = ansi --escape '38;2;82;119;195m'
|
|
||||||
let sec = ansi --escape '38;2;127;183;255m'
|
|
||||||
let pri_bg = ansi --escape '48;2;82;119;195m'
|
|
||||||
let sec_bg = ansi --escape '48;2;127;183;255m'
|
|
||||||
let reset = ansi reset
|
|
||||||
|
|
||||||
let arts = [
|
|
||||||
{
|
|
||||||
name: "NixOS",
|
|
||||||
art: $"
|
|
||||||
██ ███ ██
|
|
||||||
███ ██████
|
|
||||||
███ ██████
|
|
||||||
████████████████
|
|
||||||
█████████████████ ██
|
|
||||||
███ ██████
|
|
||||||
███ █████
|
|
||||||
█████████ ████████
|
|
||||||
████████ █████████
|
|
||||||
█████ ███
|
|
||||||
██████ ███
|
|
||||||
██ █████████████████
|
|
||||||
████████████████
|
|
||||||
██████ ███
|
|
||||||
██████ ███
|
|
||||||
██ ███ ██
|
|
||||||
"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
def get_art [--fake: string] {
|
|
||||||
if ($fake | is-not-empty) {
|
|
||||||
return ($arts | where name == $fake | first | get art)
|
|
||||||
}
|
|
||||||
|
|
||||||
let host = sys host
|
|
||||||
let target = $arts | where name == $host.name | first
|
|
||||||
if ($target | is-empty) {
|
|
||||||
return ""
|
|
||||||
} else {
|
|
||||||
let ar = $target | get art
|
|
||||||
return ($ar | ansi gradient --fgstart '0x47CBFF' --fgend '0x4797FF')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_pc_model [] {
|
|
||||||
if ($nu.os-info.name == "windows") {
|
|
||||||
let info = wmic computersystem get model /format:csv | from csv | first
|
|
||||||
return $info.Model
|
|
||||||
} else if ($nu.os-info.name == "linux") {
|
|
||||||
return (cat /sys/class/dmi/id/product_name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_shell [] {
|
|
||||||
$env.SHELL | path split | last
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_local_ip [] {
|
|
||||||
ip -j route | from json | default gateway ""| default metric "" | first | get prefsrc
|
|
||||||
}
|
|
||||||
|
|
||||||
def calculate_packages [] {
|
|
||||||
# TODO
|
|
||||||
let nix_packages = ls /run/current-system/sw/bin | length
|
|
||||||
return {
|
|
||||||
nix: $nix_packages,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def print_dots [] {
|
|
||||||
let colors = {
|
|
||||||
blue: "34m",
|
|
||||||
cyan: "36m",
|
|
||||||
green: "32m",
|
|
||||||
yellow: "33m",
|
|
||||||
red: "31m",
|
|
||||||
magenta: "35m",
|
|
||||||
}
|
|
||||||
let dots = $colors | values | each {|k| $'(ansi --escape $k) '}
|
|
||||||
|
|
||||||
return $"($dots | str join ' ') (ansi --escape '0m')"
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_gpus [] {
|
|
||||||
lspci | where description =~ "VGA" | each {|x| $'($x.description)'}
|
|
||||||
}
|
|
||||||
|
|
||||||
def nufetch [ --fake: string -l ] {
|
|
||||||
if ($l) {
|
|
||||||
return $arts
|
|
||||||
}
|
|
||||||
|
|
||||||
let art = get_art --fake $fake
|
|
||||||
|
|
||||||
let hostinfo = sys host
|
|
||||||
let pkgs = calculate_packages | transpose name count | each {|x| $"($x.name) - ($x.count)"} | str join ", "
|
|
||||||
let cpus = sys cpu | get brand | uniq
|
|
||||||
let disks = sys disks | each {$"(ansi yellow)Диск \(($in.mount)\)(ansi white): ($in.total) / ($in.free) \(((((($in.total - $in.free) / $in.total) * 100) | math floor))%\)"}
|
|
||||||
|
|
||||||
let information = [
|
|
||||||
$"(ansi blue)(whoami)(ansi white)@(ansi blue)($hostinfo.hostname)(ansi white)",
|
|
||||||
"-------------------------------------",
|
|
||||||
$"(ansi yellow)ОC(ansi white): ($hostinfo.long_os_version) ($hostinfo.kernel_version)",
|
|
||||||
$"(ansi yellow)Модель(ansi white): (get_pc_model)",
|
|
||||||
$"(ansi yellow)Ядро(ansi white): ($hostinfo.long_os_version)",
|
|
||||||
$"(ansi yellow)Время(ansi white): ($hostinfo.uptime)",
|
|
||||||
$"(ansi yellow)Oболочка(ansi white): (get_shell)",
|
|
||||||
$"(ansi yellow)Пакеты(ansi white): ($pkgs)",
|
|
||||||
$"(ansi yellow)Процессоры(ansi white): ($cpus | str join ', ')",
|
|
||||||
$"(ansi yellow)Память(ansi white): ((sys mem | $'($in.total) / (ansi red)($in.used)(ansi white) / (ansi green)($in.free)(ansi white)'))",
|
|
||||||
...$disks,
|
|
||||||
$"(ansi yellow)Локальный IP(ansi white): (get_local_ip)",
|
|
||||||
$"(ansi yellow)Цвета(ansi white): (print_dots)",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
print ([[Арт, Информация]; [$art ($information | str join "\n")]] | table -i false)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,133 +0,0 @@
|
||||||
# TokyoNight Storm for Nushell
|
|
||||||
|
|
||||||
# Retrieve the theme settings
|
|
||||||
export def main [] {
|
|
||||||
return {
|
|
||||||
binary: '#bb9af7'
|
|
||||||
block: '#7aa2f7'
|
|
||||||
cell-path: '#a9b1d6'
|
|
||||||
closure: '#7dcfff'
|
|
||||||
custom: '#c0caf5'
|
|
||||||
duration: '#e0af68'
|
|
||||||
float: '#f7768e'
|
|
||||||
glob: '#c0caf5'
|
|
||||||
int: '#bb9af7'
|
|
||||||
list: '#7dcfff'
|
|
||||||
nothing: '#f7768e'
|
|
||||||
range: '#e0af68'
|
|
||||||
record: '#7dcfff'
|
|
||||||
string: '#9ece6a'
|
|
||||||
|
|
||||||
bool: {|| if $in { '#7dcfff' } else { '#e0af68' } }
|
|
||||||
|
|
||||||
datetime: {|| (date now) - $in |
|
|
||||||
if $in < 1hr {
|
|
||||||
{ fg: '#f7768e' attr: 'b' }
|
|
||||||
} else if $in < 6hr {
|
|
||||||
'#f7768e'
|
|
||||||
} else if $in < 1day {
|
|
||||||
'#e0af68'
|
|
||||||
} else if $in < 3day {
|
|
||||||
'#9ece6a'
|
|
||||||
} else if $in < 1wk {
|
|
||||||
{ fg: '#9ece6a' attr: 'b' }
|
|
||||||
} else if $in < 6wk {
|
|
||||||
'#7dcfff'
|
|
||||||
} else if $in < 52wk {
|
|
||||||
'#7aa2f7'
|
|
||||||
} else { 'dark_gray' }
|
|
||||||
}
|
|
||||||
|
|
||||||
filesize: {|e|
|
|
||||||
if $e == 0b {
|
|
||||||
'#a9b1d6'
|
|
||||||
} else if $e < 1mb {
|
|
||||||
'#7dcfff'
|
|
||||||
} else {{ fg: '#7aa2f7' }}
|
|
||||||
}
|
|
||||||
|
|
||||||
shape_and: { fg: '#bb9af7' attr: 'b' }
|
|
||||||
shape_binary: { fg: '#bb9af7' attr: 'b' }
|
|
||||||
shape_block: { fg: '#7aa2f7' attr: 'b' }
|
|
||||||
shape_bool: '#7dcfff'
|
|
||||||
shape_closure: { fg: '#7dcfff' attr: 'b' }
|
|
||||||
shape_custom: '#9ece6a'
|
|
||||||
shape_datetime: { fg: '#7dcfff' attr: 'b' }
|
|
||||||
shape_directory: '#7dcfff'
|
|
||||||
shape_external: '#7dcfff'
|
|
||||||
shape_external_resolved: '#7dcfff'
|
|
||||||
shape_externalarg: { fg: '#9ece6a' attr: 'b' }
|
|
||||||
shape_filepath: '#7dcfff'
|
|
||||||
shape_flag: { fg: '#7aa2f7' attr: 'b' }
|
|
||||||
shape_float: { fg: '#f7768e' attr: 'b' }
|
|
||||||
shape_garbage: { fg: '#FFFFFF' bg: '#FF0000' attr: 'b' }
|
|
||||||
shape_glob_interpolation: { fg: '#7dcfff' attr: 'b' }
|
|
||||||
shape_globpattern: { fg: '#7dcfff' attr: 'b' }
|
|
||||||
shape_int: { fg: '#bb9af7' attr: 'b' }
|
|
||||||
shape_internalcall: { fg: '#7dcfff' attr: 'b' }
|
|
||||||
shape_keyword: { fg: '#bb9af7' attr: 'b' }
|
|
||||||
shape_list: { fg: '#7dcfff' attr: 'b' }
|
|
||||||
shape_literal: '#7aa2f7'
|
|
||||||
shape_match_pattern: '#9ece6a'
|
|
||||||
shape_matching_brackets: { attr: 'u' }
|
|
||||||
shape_nothing: '#f7768e'
|
|
||||||
shape_operator: '#e0af68'
|
|
||||||
shape_or: { fg: '#bb9af7' attr: 'b' }
|
|
||||||
shape_pipe: { fg: '#bb9af7' attr: 'b' }
|
|
||||||
shape_range: { fg: '#e0af68' attr: 'b' }
|
|
||||||
shape_raw_string: { fg: '#c0caf5' attr: 'b' }
|
|
||||||
shape_record: { fg: '#7dcfff' attr: 'b' }
|
|
||||||
shape_redirection: { fg: '#bb9af7' attr: 'b' }
|
|
||||||
shape_signature: { fg: '#9ece6a' attr: 'b' }
|
|
||||||
shape_string: '#9ece6a'
|
|
||||||
shape_string_interpolation: { fg: '#7dcfff' attr: 'b' }
|
|
||||||
shape_table: { fg: '#7aa2f7' attr: 'b' }
|
|
||||||
shape_vardecl: { fg: '#7aa2f7' attr: 'u' }
|
|
||||||
shape_variable: '#bb9af7'
|
|
||||||
|
|
||||||
# Base foot.ini colors
|
|
||||||
foreground: '#c0caf5'
|
|
||||||
background: '#1a1b26'
|
|
||||||
cursor: '#c0caf5'
|
|
||||||
empty: '#7aa2f7'
|
|
||||||
header: { fg: '#9ece6a' attr: 'b' }
|
|
||||||
hints: '#414868'
|
|
||||||
leading_trailing_space_bg: { attr: 'n' }
|
|
||||||
row_index: { fg: '#9ece6a' attr: 'b' }
|
|
||||||
search_result: { fg: '#f7768e' bg: '#a9b1d6' }
|
|
||||||
separator: '#a9b1d6'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update the Nushell configuration
|
|
||||||
export def --env "set color_config" [] {
|
|
||||||
$env.config.color_config = (main)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update terminal colors
|
|
||||||
export def "update terminal" [] {
|
|
||||||
let theme = (main)
|
|
||||||
|
|
||||||
# Set terminal colors
|
|
||||||
let osc_screen_foreground_color = '10;'
|
|
||||||
let osc_screen_background_color = '11;'
|
|
||||||
let osc_cursor_color = '12;'
|
|
||||||
|
|
||||||
$"
|
|
||||||
(ansi -o $osc_screen_foreground_color)($theme.foreground)(char bel)
|
|
||||||
(ansi -o $osc_screen_background_color)($theme.background)(char bel)
|
|
||||||
(ansi -o $osc_cursor_color)($theme.cursor)(char bel)
|
|
||||||
"
|
|
||||||
| str replace --all "\n" ''
|
|
||||||
| print -n $"($in)\r"
|
|
||||||
}
|
|
||||||
|
|
||||||
export module activate {
|
|
||||||
export-env {
|
|
||||||
set color_config
|
|
||||||
update terminal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Activate the theme when sourced
|
|
||||||
use activate
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
home.file.".config/nushell/config".source = ./config;
|
|
||||||
programs.nushell = {
|
|
||||||
enable = false;
|
|
||||||
configFile.source = ./config.nu;
|
|
||||||
shellAliases = {
|
|
||||||
cls = "clear";
|
|
||||||
nv = "nvim";
|
|
||||||
ls = "lse";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
shell = "fish";
|
shell = "fish";
|
||||||
pad = "0x0center";
|
pad = "0x0center";
|
||||||
font = "Maple Mono NF:size=12";
|
font = "Maple Mono NF:size=12";
|
||||||
include = "${config.xdg.configHome}/foot/themes/bw.ini";
|
include = "${config.xdg.configHome}/foot/themes/tokyonight.ini";
|
||||||
};
|
};
|
||||||
scrollback = {
|
scrollback = {
|
||||||
lines = 100000;
|
lines = 100000;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ background=1a1b26
|
||||||
selection-foreground=c0caf5
|
selection-foreground=c0caf5
|
||||||
selection-background=283457
|
selection-background=283457
|
||||||
urls=73daca
|
urls=73daca
|
||||||
cursor=c0caf5 283457
|
cursor=1a1b26 e0af68
|
||||||
|
|
||||||
regular0=15161e
|
regular0=15161e
|
||||||
regular1=f7768e
|
regular1=f7768e
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue