Migrate to Snowfall (#1)
Reviewed-on: #1 Co-authored-by: Evan Reichard <evan@reichard.io> Co-committed-by: Evan Reichard <evan@reichard.io>
This commit was merged in pull request #1.
This commit is contained in:
18
modules/home/programs/terminal/aws/default.nix
Executable file
18
modules/home/programs/terminal/aws/default.nix
Executable file
@@ -0,0 +1,18 @@
|
||||
{ lib, pkgs, config, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.${namespace}.programs.terminal.aws;
|
||||
in
|
||||
{
|
||||
options.${namespace}.programs.terminal.aws = {
|
||||
enable = lib.mkEnableOption "AWS";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
cw
|
||||
awscli2
|
||||
ssm-session-manager-plugin
|
||||
];
|
||||
};
|
||||
}
|
||||
218
modules/home/programs/terminal/btop/config/btop.conf
Executable file
218
modules/home/programs/terminal/btop/config/btop.conf
Executable file
@@ -0,0 +1,218 @@
|
||||
#? Config file for btop v. 1.4.0
|
||||
|
||||
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
|
||||
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
|
||||
color_theme = "catppuccin_mocha"
|
||||
|
||||
#* If the theme set background should be shown, set to False if you want terminal background transparency.
|
||||
theme_background = True
|
||||
|
||||
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
|
||||
truecolor = True
|
||||
|
||||
#* Set to true to force tty mode regardless if a real tty has been detected or not.
|
||||
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
|
||||
force_tty = False
|
||||
|
||||
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
|
||||
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
|
||||
#* Use whitespace " " as separator between different presets.
|
||||
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
|
||||
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
|
||||
|
||||
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
|
||||
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
|
||||
vim_keys = False
|
||||
|
||||
#* Rounded corners on boxes, is ignored if TTY mode is ON.
|
||||
rounded_corners = True
|
||||
|
||||
#* Default symbols to use for graph creation, "braille", "block" or "tty".
|
||||
#* "braille" offers the highest resolution but might not be included in all fonts.
|
||||
#* "block" has half the resolution of braille but uses more common characters.
|
||||
#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY.
|
||||
#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view.
|
||||
graph_symbol = "braille"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_cpu = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_mem = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_net = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_proc = "default"
|
||||
|
||||
#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace.
|
||||
shown_boxes = "cpu mem net proc"
|
||||
|
||||
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
|
||||
update_ms = 2000
|
||||
|
||||
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
||||
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
||||
proc_sorting = "cpu lazy"
|
||||
|
||||
#* Reverse sorting order, True or False.
|
||||
proc_reversed = False
|
||||
|
||||
#* Show processes as a tree.
|
||||
proc_tree = False
|
||||
|
||||
#* Use the cpu graph colors in the process list.
|
||||
proc_colors = True
|
||||
|
||||
#* Use a darkening gradient in the process list.
|
||||
proc_gradient = True
|
||||
|
||||
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
|
||||
proc_per_core = False
|
||||
|
||||
#* Show process memory as bytes instead of percent.
|
||||
proc_mem_bytes = True
|
||||
|
||||
#* Show cpu graph for each process.
|
||||
proc_cpu_graphs = True
|
||||
|
||||
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
|
||||
proc_info_smaps = False
|
||||
|
||||
#* Show proc box on left side of screen instead of right.
|
||||
proc_left = False
|
||||
|
||||
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
|
||||
proc_filter_kernel = False
|
||||
|
||||
#* In tree-view, always accumulate child process resources in the parent process.
|
||||
proc_aggregate = False
|
||||
|
||||
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
|
||||
#* Select from a list of detected attributes from the options menu.
|
||||
cpu_graph_upper = "Auto"
|
||||
|
||||
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
|
||||
#* Select from a list of detected attributes from the options menu.
|
||||
cpu_graph_lower = "Auto"
|
||||
|
||||
#* Toggles if the lower CPU graph should be inverted.
|
||||
cpu_invert_lower = True
|
||||
|
||||
#* Set to True to completely disable the lower CPU graph.
|
||||
cpu_single_graph = False
|
||||
|
||||
#* Show cpu box at bottom of screen instead of top.
|
||||
cpu_bottom = False
|
||||
|
||||
#* Shows the system uptime in the CPU box.
|
||||
show_uptime = True
|
||||
|
||||
#* Show cpu temperature.
|
||||
check_temp = True
|
||||
|
||||
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
|
||||
cpu_sensor = "Auto"
|
||||
|
||||
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
|
||||
show_coretemp = True
|
||||
|
||||
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
|
||||
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
|
||||
#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries.
|
||||
#* Example: "4:0 5:1 6:3"
|
||||
cpu_core_map = ""
|
||||
|
||||
#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine".
|
||||
temp_scale = "celsius"
|
||||
|
||||
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
|
||||
base_10_sizes = False
|
||||
|
||||
#* Show CPU frequency.
|
||||
show_cpu_freq = True
|
||||
|
||||
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
|
||||
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
|
||||
clock_format = "%X"
|
||||
|
||||
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
|
||||
background_update = True
|
||||
|
||||
#* Custom cpu model name, empty string to disable.
|
||||
custom_cpu_name = ""
|
||||
|
||||
#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ".
|
||||
#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user".
|
||||
disks_filter = ""
|
||||
|
||||
#* Show graphs instead of meters for memory values.
|
||||
mem_graphs = True
|
||||
|
||||
#* Show mem box below net box instead of above.
|
||||
mem_below_net = False
|
||||
|
||||
#* Count ZFS ARC in cached and available memory.
|
||||
zfs_arc_cached = True
|
||||
|
||||
#* If swap memory should be shown in memory box.
|
||||
show_swap = True
|
||||
|
||||
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
|
||||
swap_disk = True
|
||||
|
||||
#* If mem box should be split to also show disks info.
|
||||
show_disks = True
|
||||
|
||||
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
|
||||
only_physical = True
|
||||
|
||||
#* Read disks list from /etc/fstab. This also disables only_physical.
|
||||
use_fstab = True
|
||||
|
||||
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
|
||||
zfs_hide_datasets = False
|
||||
|
||||
#* Set to true to show available disk space for privileged users.
|
||||
disk_free_priv = False
|
||||
|
||||
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
|
||||
show_io_stat = True
|
||||
|
||||
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
|
||||
io_mode = False
|
||||
|
||||
#* Set to True to show combined read/write io graphs in io mode.
|
||||
io_graph_combined = False
|
||||
|
||||
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
|
||||
#* Example: "/mnt/media:100 /:20 /boot:1".
|
||||
io_graph_speeds = ""
|
||||
|
||||
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
|
||||
net_download = 100
|
||||
|
||||
net_upload = 100
|
||||
|
||||
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
|
||||
net_auto = True
|
||||
|
||||
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
|
||||
net_sync = True
|
||||
|
||||
#* Starts with the Network Interface specified here.
|
||||
net_iface = ""
|
||||
|
||||
#* Show battery stats in top right if battery is present.
|
||||
show_battery = True
|
||||
|
||||
#* Which battery to use if multiple are present. "Auto" for auto detection.
|
||||
selected_battery = "Auto"
|
||||
|
||||
#* Show power stats of battery next to charge indicator.
|
||||
show_battery_watts = True
|
||||
|
||||
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
|
||||
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
|
||||
log_level = "WARNING"
|
||||
83
modules/home/programs/terminal/btop/config/catppuccin_mocha.theme
Executable file
83
modules/home/programs/terminal/btop/config/catppuccin_mocha.theme
Executable file
@@ -0,0 +1,83 @@
|
||||
# Main background, empty for terminal default, need to be empty if you want transparent background
|
||||
theme[main_bg]="#1E1E2E"
|
||||
|
||||
# Main text color
|
||||
theme[main_fg]="#CDD6F4"
|
||||
|
||||
# Title color for boxes
|
||||
theme[title]="#CDD6F4"
|
||||
|
||||
# Highlight color for keyboard shortcuts
|
||||
theme[hi_fg]="#89B4FA"
|
||||
|
||||
# Background color of selected item in processes box
|
||||
theme[selected_bg]="#45475A"
|
||||
|
||||
# Foreground color of selected item in processes box
|
||||
theme[selected_fg]="#89B4FA"
|
||||
|
||||
# Color of inactive/disabled text
|
||||
theme[inactive_fg]="#7F849C"
|
||||
|
||||
# Color of text appearing on top of graphs, i.e uptime and current network graph scaling
|
||||
theme[graph_text]="#F5E0DC"
|
||||
|
||||
# Background color of the percentage meters
|
||||
theme[meter_bg]="#45475A"
|
||||
|
||||
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
|
||||
theme[proc_misc]="#F5E0DC"
|
||||
|
||||
# CPU, Memory, Network, Proc box outline colors
|
||||
theme[cpu_box]="#cba6f7" #Mauve
|
||||
theme[mem_box]="#a6e3a1" #Green
|
||||
theme[net_box]="#eba0ac" #Maroon
|
||||
theme[proc_box]="#89b4fa" #Blue
|
||||
|
||||
# Box divider line and small boxes line color
|
||||
theme[div_line]="#6C7086"
|
||||
|
||||
# Temperature graph color (Green -> Yellow -> Red)
|
||||
theme[temp_start]="#a6e3a1"
|
||||
theme[temp_mid]="#f9e2af"
|
||||
theme[temp_end]="#f38ba8"
|
||||
|
||||
# CPU graph colors (Teal -> Lavender)
|
||||
theme[cpu_start]="#94e2d5"
|
||||
theme[cpu_mid]="#74c7ec"
|
||||
theme[cpu_end]="#b4befe"
|
||||
|
||||
# Mem/Disk free meter (Mauve -> Lavender -> Blue)
|
||||
theme[free_start]="#cba6f7"
|
||||
theme[free_mid]="#b4befe"
|
||||
theme[free_end]="#89b4fa"
|
||||
|
||||
# Mem/Disk cached meter (Sapphire -> Lavender)
|
||||
theme[cached_start]="#74c7ec"
|
||||
theme[cached_mid]="#89b4fa"
|
||||
theme[cached_end]="#b4befe"
|
||||
|
||||
# Mem/Disk available meter (Peach -> Red)
|
||||
theme[available_start]="#fab387"
|
||||
theme[available_mid]="#eba0ac"
|
||||
theme[available_end]="#f38ba8"
|
||||
|
||||
# Mem/Disk used meter (Green -> Sky)
|
||||
theme[used_start]="#a6e3a1"
|
||||
theme[used_mid]="#94e2d5"
|
||||
theme[used_end]="#89dceb"
|
||||
|
||||
# Download graph colors (Peach -> Red)
|
||||
theme[download_start]="#fab387"
|
||||
theme[download_mid]="#eba0ac"
|
||||
theme[download_end]="#f38ba8"
|
||||
|
||||
# Upload graph colors (Green -> Sky)
|
||||
theme[upload_start]="#a6e3a1"
|
||||
theme[upload_mid]="#94e2d5"
|
||||
theme[upload_end]="#89dceb"
|
||||
|
||||
# Process box color gradient for threads, mem and cpu usage (Sapphire -> Mauve)
|
||||
theme[process_start]="#74C7EC"
|
||||
theme[process_mid]="#89DCEB"
|
||||
theme[process_end]="#cba6f7"
|
||||
19
modules/home/programs/terminal/btop/default.nix
Executable file
19
modules/home/programs/terminal/btop/default.nix
Executable file
@@ -0,0 +1,19 @@
|
||||
{ lib, config, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.${namespace}.programs.terminal.btop;
|
||||
in
|
||||
{
|
||||
options.${namespace}.programs.terminal.btop = {
|
||||
enable = lib.mkEnableOption "btop";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.btop.enable = true;
|
||||
|
||||
home.file.".config/btop/btop.conf".text =
|
||||
builtins.readFile ./config/btop.conf;
|
||||
home.file.".config/btop/themes/catppuccin_mocha.theme".text =
|
||||
builtins.readFile ./config/catppuccin_mocha.theme;
|
||||
};
|
||||
}
|
||||
17
modules/home/programs/terminal/direnv/default.nix
Executable file
17
modules/home/programs/terminal/direnv/default.nix
Executable file
@@ -0,0 +1,17 @@
|
||||
{ lib, config, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.${namespace}.programs.terminal.direnv;
|
||||
in
|
||||
{
|
||||
options.${namespace}.programs.terminal.direnv = {
|
||||
enable = lib.mkEnableOption "direnv";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
3
modules/home/programs/terminal/git/config/.gitignore
vendored
Executable file
3
modules/home/programs/terminal/git/config/.gitignore
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
_scratch
|
||||
.direnv
|
||||
.envrc
|
||||
5
modules/home/programs/terminal/git/config/personal
Executable file
5
modules/home/programs/terminal/git/config/personal
Executable file
@@ -0,0 +1,5 @@
|
||||
[core]
|
||||
sshCommand = "ssh -i ~/Keys/personal"
|
||||
|
||||
[user]
|
||||
email = evan@reichard.io
|
||||
5
modules/home/programs/terminal/git/config/work
Executable file
5
modules/home/programs/terminal/git/config/work
Executable file
@@ -0,0 +1,5 @@
|
||||
[core]
|
||||
sshCommand = "ssh -i ~/Keys/work"
|
||||
|
||||
[user]
|
||||
email = evan@prophetsecurity.ai
|
||||
98
modules/home/programs/terminal/git/default.nix
Executable file
98
modules/home/programs/terminal/git/default.nix
Executable file
@@ -0,0 +1,98 @@
|
||||
{ pkgs, lib, config, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.${namespace}.programs.terminal.git;
|
||||
in
|
||||
{
|
||||
options.${namespace}.programs.terminal.git = {
|
||||
enable = lib.mkEnableOption "Git";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Evan Reichard";
|
||||
aliases = {
|
||||
lg = "log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all -n 15";
|
||||
};
|
||||
includes = [
|
||||
{
|
||||
path = "~/.config/git/work";
|
||||
condition = "gitdir:~/Development/git/work/";
|
||||
}
|
||||
{
|
||||
path = "~/.config/git/personal";
|
||||
condition = "gitdir:~/Development/git/personal/";
|
||||
}
|
||||
];
|
||||
extraConfig = {
|
||||
user = {
|
||||
email = "evan@reichard.io";
|
||||
};
|
||||
core = {
|
||||
autocrlf = "input";
|
||||
safecrlf = "true";
|
||||
excludesFile = "~/.config/git/.gitignore";
|
||||
};
|
||||
column = {
|
||||
ui = "auto";
|
||||
};
|
||||
fetch = {
|
||||
prune = true;
|
||||
pruneTags = true;
|
||||
all = true;
|
||||
};
|
||||
help = {
|
||||
autocorrect = true;
|
||||
};
|
||||
diff = {
|
||||
algorithm = "histogram";
|
||||
colorMoved = "plain";
|
||||
mnemonicPrefix = true;
|
||||
renames = true;
|
||||
};
|
||||
rebase = {
|
||||
autoSquash = true;
|
||||
autoStash = true;
|
||||
updateRefs = true;
|
||||
};
|
||||
rerere = {
|
||||
enabled = true;
|
||||
autoupdate = true;
|
||||
};
|
||||
commit = {
|
||||
verbose = true;
|
||||
};
|
||||
branch = {
|
||||
sort = "-committerdate";
|
||||
};
|
||||
merge = {
|
||||
conflictstyle = "zdiff3";
|
||||
};
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_protocol = "ssh";
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
gitAndTools.gh
|
||||
pre-commit
|
||||
];
|
||||
|
||||
# Copy Configuration
|
||||
xdg.configFile = {
|
||||
git = {
|
||||
source = ./config;
|
||||
recursive = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
19
modules/home/programs/terminal/k9s/default.nix
Executable file
19
modules/home/programs/terminal/k9s/default.nix
Executable file
@@ -0,0 +1,19 @@
|
||||
{ lib, pkgs, config, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.${namespace}.programs.terminal.k9s;
|
||||
in
|
||||
{
|
||||
options.${namespace}.programs.terminal.k9s = {
|
||||
enable = lib.mkEnableOption "k9s";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.k9s.enable = true;
|
||||
|
||||
home.packages = with pkgs; [
|
||||
kubectl
|
||||
kubernetes-helm
|
||||
];
|
||||
};
|
||||
}
|
||||
3
modules/home/programs/terminal/nvim/config/lua/.luarc.json
Executable file
3
modules/home/programs/terminal/nvim/config/lua/.luarc.json
Executable file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"diagnostics.globals": ["vim"]
|
||||
}
|
||||
8
modules/home/programs/terminal/nvim/config/lua/aerial-config.lua
Executable file
8
modules/home/programs/terminal/nvim/config/lua/aerial-config.lua
Executable file
@@ -0,0 +1,8 @@
|
||||
require('aerial').setup({
|
||||
on_attach = function(bufnr)
|
||||
vim.keymap.set('n', '{', '<cmd>AerialPrev<CR>', {buffer = bufnr})
|
||||
vim.keymap.set('n', '}', '<cmd>AerialNext<CR>', {buffer = bufnr})
|
||||
end
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>a', '<cmd>AerialToggle!<CR>')
|
||||
1
modules/home/programs/terminal/nvim/config/lua/autopairs-config.lua
Executable file
1
modules/home/programs/terminal/nvim/config/lua/autopairs-config.lua
Executable file
@@ -0,0 +1 @@
|
||||
require("nvim-autopairs").setup()
|
||||
69
modules/home/programs/terminal/nvim/config/lua/base.lua
Executable file
69
modules/home/programs/terminal/nvim/config/lua/base.lua
Executable file
@@ -0,0 +1,69 @@
|
||||
-- Set Theme
|
||||
-- vim.g.nord_borders = true
|
||||
-- vim.g.nord_contrast = true
|
||||
-- vim.cmd('colorscheme nord')
|
||||
-- vim.cmd('colorscheme melange')
|
||||
vim.cmd("colorscheme catppuccin-mocha")
|
||||
|
||||
-- Set Leader
|
||||
vim.keymap.set("n", "<Space>", "<Nop>", { silent = true })
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Set Timeout
|
||||
vim.opt.timeoutlen = 250
|
||||
|
||||
-- Disable NetRW
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Set Term Colors
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
-- Synchronize with system clipboard
|
||||
vim.opt.clipboard = "unnamed"
|
||||
|
||||
-- Always show the signcolumn
|
||||
vim.opt.signcolumn = "yes"
|
||||
|
||||
-- Set nowrap, line numbers, hightlight search
|
||||
vim.opt.wrap = false
|
||||
vim.opt.nu = true
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.shiftwidth = 2
|
||||
|
||||
-- Set fold settings
|
||||
vim.opt.foldmethod = "indent"
|
||||
vim.opt.foldnestmax = 10
|
||||
vim.opt.foldlevel = 2
|
||||
|
||||
-- Diagnostics Mappings
|
||||
local diagnostics_active = true
|
||||
local toggle_diagnostics = function()
|
||||
diagnostics_active = not diagnostics_active
|
||||
if diagnostics_active then
|
||||
vim.diagnostic.enable()
|
||||
else
|
||||
vim.diagnostic.disable()
|
||||
end
|
||||
end
|
||||
|
||||
local diagnostics_loclist_active = false
|
||||
local toggle_diagnostics_loclist = function()
|
||||
diagnostics_loclist_active = not diagnostics_loclist_active
|
||||
if diagnostics_loclist_active then
|
||||
vim.diagnostic.setloclist()
|
||||
else
|
||||
vim.cmd("lclose")
|
||||
end
|
||||
end
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set("n", "<leader>qt", toggle_diagnostics, opts)
|
||||
vim.keymap.set("n", "<leader>qN", function()
|
||||
vim.diagnostic.goto_prev({ float = false })
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>qn", function()
|
||||
vim.diagnostic.goto_next({ float = false })
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>qq", toggle_diagnostics_loclist, opts)
|
||||
vim.keymap.set("n", "<leader>qe", vim.diagnostic.open_float, opts)
|
||||
71
modules/home/programs/terminal/nvim/config/lua/cmp-config.lua
Executable file
71
modules/home/programs/terminal/nvim/config/lua/cmp-config.lua
Executable file
@@ -0,0 +1,71 @@
|
||||
local cmp = require('cmp')
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
-- Check Tab Completion
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and
|
||||
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col,
|
||||
col)
|
||||
:match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args) require'luasnip'.lsp_expand(args.body) end
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
|
||||
-- Tab Completion
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"}),
|
||||
|
||||
-- Reverse Tab Completion
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"}),
|
||||
|
||||
-- Misc Mappings
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({select = true})
|
||||
|
||||
}),
|
||||
|
||||
-- Default Sources
|
||||
sources = cmp.config.sources({
|
||||
{name = 'nvim_lsp'}, {name = 'luasnip'}, {name = 'path'},
|
||||
{name = 'buffer'}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
-- Completion - `/` and `?`
|
||||
cmp.setup.cmdline({'/', '?'}, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {{name = 'buffer'}}
|
||||
})
|
||||
|
||||
-- Completion = `:`
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({{name = 'path'}, {name = 'cmdline'}})
|
||||
})
|
||||
|
||||
-- Autopairs
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
1
modules/home/programs/terminal/nvim/config/lua/comment-config.lua
Executable file
1
modules/home/programs/terminal/nvim/config/lua/comment-config.lua
Executable file
@@ -0,0 +1 @@
|
||||
require('Comment').setup()
|
||||
70
modules/home/programs/terminal/nvim/config/lua/dap-config.lua
Executable file
70
modules/home/programs/terminal/nvim/config/lua/dap-config.lua
Executable file
@@ -0,0 +1,70 @@
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
local dapgo = require("dap-go")
|
||||
|
||||
dapui.setup({
|
||||
controls = {
|
||||
element = "repl",
|
||||
enabled = true,
|
||||
icons = {
|
||||
disconnect = "",
|
||||
pause = "",
|
||||
play = "",
|
||||
run_last = "",
|
||||
step_back = "",
|
||||
step_into = "",
|
||||
step_out = "",
|
||||
step_over = "",
|
||||
terminate = ""
|
||||
}
|
||||
},
|
||||
element_mappings = {},
|
||||
expand_lines = false,
|
||||
floating = {border = "single", mappings = {close = {"q", "<Esc>"}}},
|
||||
force_buffers = true,
|
||||
icons = {collapsed = "", current_frame = "", expanded = ""},
|
||||
layouts = {
|
||||
{
|
||||
elements = {{id = "repl", size = 0.5}, {id = "scopes", size = 0.5}},
|
||||
position = "bottom",
|
||||
size = 10
|
||||
}, {
|
||||
elements = {
|
||||
{id = "breakpoints", size = 0.5}, {id = "stacks", size = 0.5}
|
||||
},
|
||||
position = "left",
|
||||
size = 40
|
||||
}
|
||||
},
|
||||
mappings = {
|
||||
edit = "e",
|
||||
expand = {"<CR>", "<2-LeftMouse>"},
|
||||
open = "o",
|
||||
remove = "d",
|
||||
repl = "r",
|
||||
toggle = "t"
|
||||
},
|
||||
render = {indent = 1, max_value_lines = 100}
|
||||
})
|
||||
dapgo.setup()
|
||||
|
||||
-- Auto Open UI
|
||||
dap.listeners.before.attach.dapui_config = function() dapui.open() end
|
||||
dap.listeners.before.launch.dapui_config = function() dapui.open() end
|
||||
|
||||
-- Continue Hotkey ("c")
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "dap-repl",
|
||||
callback = function()
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'c',
|
||||
"<cmd>lua require'dap'.continue()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
end
|
||||
})
|
||||
|
||||
-- Leader Keys
|
||||
local opts = {noremap = true, silent = true}
|
||||
vim.keymap.set('n', '<leader>db', dap.toggle_breakpoint, opts)
|
||||
vim.keymap.set('n', '<leader>du', dapui.toggle, opts)
|
||||
vim.keymap.set('n', '<leader>dc', dap.continue, opts)
|
||||
vim.keymap.set('n', '<leader>dt', dapgo.debug_test, opts)
|
||||
6
modules/home/programs/terminal/nvim/config/lua/diffview-config.lua
Executable file
6
modules/home/programs/terminal/nvim/config/lua/diffview-config.lua
Executable file
@@ -0,0 +1,6 @@
|
||||
vim.keymap.set('n', '<leader>go', '<cmd>DiffviewOpen<CR>')
|
||||
vim.keymap.set('n', '<leader>gO', '<cmd>DiffviewOpen origin/main...HEAD<CR>')
|
||||
vim.keymap.set('n', '<leader>gh', '<cmd>DiffviewFileHistory<CR>')
|
||||
vim.keymap.set('n', '<leader>gH',
|
||||
'<cmd>DiffviewFileHistory --range=origin..HEAD<CR>')
|
||||
vim.keymap.set('n', '<leader>gc', '<cmd>DiffviewClose<CR>')
|
||||
41
modules/home/programs/terminal/nvim/config/lua/git-ref.lua
Executable file
41
modules/home/programs/terminal/nvim/config/lua/git-ref.lua
Executable file
@@ -0,0 +1,41 @@
|
||||
function get_git_info()
|
||||
local abs_path = vim.fn.expand("%:p")
|
||||
local git_root = vim.fn.systemlist(
|
||||
"git -C " .. vim.fn.escape(vim.fn.fnamemodify(abs_path, ":h"), " ") .. " rev-parse --show-toplevel"
|
||||
)[1]
|
||||
|
||||
if vim.v.shell_error ~= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local git_repo = vim.fn.system("git remote get-url origin"):match("([^/:]+/[^/.]+)%.?[^/]*$"):gsub("\n", "")
|
||||
local git_branch = vim.fn.system("git rev-parse --abbrev-ref HEAD"):gsub("\n", "")
|
||||
|
||||
return {
|
||||
file = vim.fn.fnamemodify(abs_path, ":s?" .. git_root .. "/??"),
|
||||
branch = git_branch,
|
||||
repo = git_repo,
|
||||
}
|
||||
end
|
||||
|
||||
vim.keymap.set("v", "<Leader>gy", function()
|
||||
local git_info = get_git_info()
|
||||
if git_info == nil then
|
||||
vim.notify("Failed to get git info", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
local start_line = vim.fn.line("v")
|
||||
local end_line = vim.fn.line(".")
|
||||
|
||||
local message = string.format(
|
||||
"https://github.com/%s/blob/%s/%s#L%d-L%d",
|
||||
git_info.repo,
|
||||
git_info.branch,
|
||||
git_info.file,
|
||||
start_line,
|
||||
end_line
|
||||
)
|
||||
vim.fn.setreg("+", message)
|
||||
vim.notify("Copied:\n\t" .. message, vim.log.levels.INFO)
|
||||
end, { noremap = true, silent = true, desc = "Copy GitHub Link" })
|
||||
16
modules/home/programs/terminal/nvim/config/lua/git-signs.lua
Executable file
16
modules/home/programs/terminal/nvim/config/lua/git-signs.lua
Executable file
@@ -0,0 +1,16 @@
|
||||
require('gitsigns').setup {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require('gitsigns')
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
map('n', '<leader>gb', gitsigns.toggle_current_line_blame)
|
||||
map('n', '<leader>gB', function()
|
||||
gitsigns.blame_line {full = true}
|
||||
end)
|
||||
end
|
||||
}
|
||||
23
modules/home/programs/terminal/nvim/config/lua/init.lua
Executable file
23
modules/home/programs/terminal/nvim/config/lua/init.lua
Executable file
@@ -0,0 +1,23 @@
|
||||
require("base")
|
||||
require("aerial-config")
|
||||
require("autopairs-config")
|
||||
require("cmp-config")
|
||||
require("comment-config")
|
||||
require("dap-config")
|
||||
require("diffview-config")
|
||||
require("git-ref")
|
||||
require("git-signs")
|
||||
require("llm")
|
||||
require("leap-config")
|
||||
require("lsp-config")
|
||||
require("lsp-lines-config")
|
||||
require("lualine-config")
|
||||
require("neotree-config")
|
||||
require("noice-config")
|
||||
require("numb-config")
|
||||
require("silicon-config")
|
||||
require("telescope-config")
|
||||
require("toggleterm-config")
|
||||
require("ts-config")
|
||||
require("which-key-config")
|
||||
require("weird-chars")
|
||||
1
modules/home/programs/terminal/nvim/config/lua/leap-config.lua
Executable file
1
modules/home/programs/terminal/nvim/config/lua/leap-config.lua
Executable file
@@ -0,0 +1 @@
|
||||
require('leap').add_default_mappings()
|
||||
20
modules/home/programs/terminal/nvim/config/lua/llm.lua
Executable file
20
modules/home/programs/terminal/nvim/config/lua/llm.lua
Executable file
@@ -0,0 +1,20 @@
|
||||
-- Configure LLama LLM
|
||||
vim.g.llama_config = {
|
||||
endpoint = "http://10.0.50.120:8080/infill",
|
||||
api_key = "",
|
||||
n_prefix = 256,
|
||||
n_suffix = 64,
|
||||
n_predict = 256,
|
||||
t_max_prompt_ms = 500,
|
||||
t_max_predict_ms = 500,
|
||||
show_info = 2,
|
||||
auto_fim = true,
|
||||
max_line_suffix = 8,
|
||||
max_cache_keys = 256,
|
||||
ring_n_chunks = 8,
|
||||
ring_chunk_size = 32,
|
||||
ring_scope = 512,
|
||||
ring_update_ms = 1000,
|
||||
}
|
||||
|
||||
-- require("gen").setup({ model = "codegemma" })
|
||||
238
modules/home/programs/terminal/nvim/config/lua/lsp-config.lua
Executable file
238
modules/home/programs/terminal/nvim/config/lua/lsp-config.lua
Executable file
@@ -0,0 +1,238 @@
|
||||
------------------------------------------------------
|
||||
------------------- Custom Settings ------------------
|
||||
------------------------------------------------------
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "go",
|
||||
callback = function()
|
||||
vim.bo.textwidth = 120
|
||||
end,
|
||||
})
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
templ = "templ",
|
||||
},
|
||||
})
|
||||
|
||||
------------------------------------------------------
|
||||
-------------------- Built-in LSP --------------------
|
||||
------------------------------------------------------
|
||||
local nix_vars = require("nix-vars")
|
||||
local nvim_lsp = require("lspconfig")
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false, timeout_ms = 2000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set("n", "<leader>lD", vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set("n", "<leader>ld", vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set("n", "<leader>li", vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set("n", "<leader>ln", vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set("n", "<leader>lr", vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set("n", "<leader>lt", vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set("n", "<leader>lf", function()
|
||||
vim.lsp.buf.format({ async = true, timeout_ms = 2000 })
|
||||
end, bufopts)
|
||||
end
|
||||
|
||||
local on_attach_no_formatting = function(client, bufnr)
|
||||
-- Disable Formatting
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
client.server_capabilities.documentRangeFormattingProvider = false
|
||||
on_attach(client, bufnr)
|
||||
end
|
||||
|
||||
local organize_go_imports = function()
|
||||
local encoding = vim.lsp.util._get_offset_encoding()
|
||||
local params = vim.lsp.util.make_range_params(nil, encoding)
|
||||
params.context = { only = { "source.organizeImports" } }
|
||||
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
|
||||
for _, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, encoding)
|
||||
else
|
||||
vim.lsp.buf.execute_command(r.command)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Define LSP Flags & Capabilities
|
||||
local lsp_flags = { debounce_text_changes = 150 }
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- Python LSP Configuration
|
||||
nvim_lsp.pyright.setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- HTML LSP Configuration
|
||||
nvim_lsp.html.setup({
|
||||
on_attach = on_attach_no_formatting,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio" },
|
||||
})
|
||||
|
||||
-- JSON LSP Configuration
|
||||
nvim_lsp.jsonls.setup({
|
||||
on_attach = on_attach_no_formatting,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio" },
|
||||
})
|
||||
|
||||
-- CSS LSP Configuration
|
||||
nvim_lsp.cssls.setup({
|
||||
on_attach = on_attach_no_formatting,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio" },
|
||||
})
|
||||
|
||||
-- Typescript / Javascript LSP Configuration
|
||||
nvim_lsp.ts_ls.setup({
|
||||
on_attach = on_attach_no_formatting,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.tsls, "--stdio" },
|
||||
})
|
||||
|
||||
-- Svelte LSP Configuration
|
||||
nvim_lsp.svelte.setup({
|
||||
on_attach = on_attach_no_formatting,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.sveltels, "--stdio" },
|
||||
})
|
||||
|
||||
-- Lua LSP Configuration
|
||||
nvim_lsp.lua_ls.setup({
|
||||
on_attach = on_attach_no_formatting,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.luals },
|
||||
})
|
||||
|
||||
-- Templ LSP Configuration
|
||||
nvim_lsp.templ.setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- Nix LSP Configuration
|
||||
nvim_lsp.nil_ls.setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- Go LSP Configuration
|
||||
nvim_lsp.gopls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = organize_go_imports,
|
||||
})
|
||||
end,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.gopls },
|
||||
settings = {
|
||||
gopls = {
|
||||
buildFlags = { "-tags=e2e" },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Go LSP Linting
|
||||
nvim_lsp.golangci_lint_ls.setup({
|
||||
on_attach = on_attach_no_formatting,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.golintls },
|
||||
init_options = {
|
||||
command = {
|
||||
"golangci-lint",
|
||||
"run",
|
||||
"--output.json.path",
|
||||
"stdout",
|
||||
"--show-stats=false",
|
||||
"--issues-exit-code=1",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
------------------------------------------------------
|
||||
--------------------- Null-LS LSP --------------------
|
||||
------------------------------------------------------
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local eslintFiles = {
|
||||
".eslintrc",
|
||||
".eslintrc.js",
|
||||
".eslintrc.cjs",
|
||||
".eslintrc.yaml",
|
||||
".eslintrc.yml",
|
||||
".eslintrc.json",
|
||||
"eslint.config.js",
|
||||
"eslint.config.mjs",
|
||||
"eslint.config.cjs",
|
||||
"eslint.config.ts",
|
||||
"eslint.config.mts",
|
||||
"eslint.config.cts",
|
||||
}
|
||||
|
||||
has_eslint_in_parents = function(fname)
|
||||
root_file = nvim_lsp.util.insert_package_json(eslintFiles, "eslintConfig", fname)
|
||||
return nvim_lsp.util.root_pattern(unpack(root_file))(fname)
|
||||
end
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
-- Prettier Formatting
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.prettier.with({ filetypes = { "template" } }),
|
||||
require("none-ls.diagnostics.eslint_d").with({
|
||||
condition = function(utils)
|
||||
return has_eslint_in_parents(vim.fn.getcwd())
|
||||
end,
|
||||
}),
|
||||
null_ls.builtins.completion.spell,
|
||||
null_ls.builtins.formatting.nixpkgs_fmt,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.diagnostics.sqlfluff,
|
||||
null_ls.builtins.formatting.sqlfluff,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false, timeout_ms = 2000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
2
modules/home/programs/terminal/nvim/config/lua/lsp-lines-config.lua
Executable file
2
modules/home/programs/terminal/nvim/config/lua/lsp-lines-config.lua
Executable file
@@ -0,0 +1,2 @@
|
||||
require("lsp_lines").setup()
|
||||
vim.diagnostic.config({virtual_text = false})
|
||||
49
modules/home/programs/terminal/nvim/config/lua/lualine-config.lua
Executable file
49
modules/home/programs/terminal/nvim/config/lua/lualine-config.lua
Executable file
@@ -0,0 +1,49 @@
|
||||
-- Cached variable
|
||||
local cached_pr_status = ""
|
||||
|
||||
-- Read process output
|
||||
local function read_output(err, data)
|
||||
if err then return end
|
||||
if not data then return end
|
||||
cached_pr_status = data
|
||||
end
|
||||
|
||||
-- Spawn process
|
||||
local function execute_command()
|
||||
local stdout = vim.loop.new_pipe(false)
|
||||
|
||||
local spawn_opts = {
|
||||
detached = true,
|
||||
stdio = {nil, stdout, nil},
|
||||
args = {"-c", "gh pr checks | awk -F'\t' '{ print $2 }'"}
|
||||
}
|
||||
|
||||
vim.loop.spawn("bash", spawn_opts,
|
||||
function() stdout:read_start(read_output) end)
|
||||
end
|
||||
|
||||
-- Spawn & schedule process
|
||||
execute_command()
|
||||
vim.fn.timer_start(300000, execute_command)
|
||||
|
||||
-- Return status from cache
|
||||
function pr_status()
|
||||
--
|
||||
--
|
||||
--
|
||||
-- PENDING COLOR - #d29922
|
||||
-- PASS COLOR - #3fb950
|
||||
-- FAIL COLOR - #f85149
|
||||
return cached_pr_status:gsub("\n", ""):gsub("fail", " "):gsub("pass",
|
||||
" ")
|
||||
:gsub("pending", " "):gsub("skipping", " "):sub(1, -2)
|
||||
end
|
||||
|
||||
require('lualine').setup({
|
||||
options = {
|
||||
theme = "gruvbox_dark"
|
||||
-- theme = "nord"
|
||||
-- theme = "OceanicNext",
|
||||
},
|
||||
sections = {lualine_c = {{pr_status}}}
|
||||
})
|
||||
2
modules/home/programs/terminal/nvim/config/lua/neotree-config.lua
Executable file
2
modules/home/programs/terminal/nvim/config/lua/neotree-config.lua
Executable file
@@ -0,0 +1,2 @@
|
||||
require("neo-tree").setup({ window = { mappings = { ["<space>"] = "none" } } })
|
||||
vim.keymap.set("n", "<leader>t", ":Neotree toggle<CR>", { silent = true })
|
||||
26
modules/home/programs/terminal/nvim/config/lua/noice-config.lua
Executable file
26
modules/home/programs/terminal/nvim/config/lua/noice-config.lua
Executable file
@@ -0,0 +1,26 @@
|
||||
-- Noice Doc Scrolling
|
||||
vim.keymap.set("n", "<c-f>", function()
|
||||
if not require("noice.lsp").scroll(4) then return "<c-f>" end
|
||||
end, {silent = true, expr = true})
|
||||
|
||||
vim.keymap.set("n", "<c-b>", function()
|
||||
if not require("noice.lsp").scroll(-4) then return "<c-b>" end
|
||||
end, {silent = true, expr = true})
|
||||
|
||||
-- Noice Setup
|
||||
require("noice").setup({
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = false
|
||||
},
|
||||
signature = {enabled = false}
|
||||
},
|
||||
presets = {
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false -- add a border to hover docs and signature help
|
||||
}
|
||||
})
|
||||
1
modules/home/programs/terminal/nvim/config/lua/numb-config.lua
Executable file
1
modules/home/programs/terminal/nvim/config/lua/numb-config.lua
Executable file
@@ -0,0 +1 @@
|
||||
require('numb').setup()
|
||||
10
modules/home/programs/terminal/nvim/config/lua/silicon-config.lua
Executable file
10
modules/home/programs/terminal/nvim/config/lua/silicon-config.lua
Executable file
@@ -0,0 +1,10 @@
|
||||
local silicon = require('silicon')
|
||||
silicon.setup({})
|
||||
|
||||
vim.keymap.set('v', '<Leader>ss', function() silicon.visualise_api({}) end)
|
||||
vim.keymap.set('v', '<Leader>sb',
|
||||
function() silicon.visualise_api({show_buf = true}) end)
|
||||
vim.keymap.set('n', '<Leader>sv',
|
||||
function() silicon.visualise_api({visible = true}) end)
|
||||
vim.keymap.set('n', '<Leader>sb',
|
||||
function() silicon.visualise_api({show_buf = true}) end)
|
||||
20
modules/home/programs/terminal/nvim/config/lua/telescope-config.lua
Executable file
20
modules/home/programs/terminal/nvim/config/lua/telescope-config.lua
Executable file
@@ -0,0 +1,20 @@
|
||||
require('telescope').setup {
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require('telescope').load_extension('fzf')
|
||||
require("telescope").load_extension("ui-select")
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
||||
vim.keymap.set('n', '<leader>fj', builtin.jumplist, {})
|
||||
20
modules/home/programs/terminal/nvim/config/lua/toggleterm-config.lua
Executable file
20
modules/home/programs/terminal/nvim/config/lua/toggleterm-config.lua
Executable file
@@ -0,0 +1,20 @@
|
||||
require("toggleterm").setup({open_mapping = [[<c-\>]]})
|
||||
|
||||
-- Get PR status on terminal load
|
||||
-- require("toggleterm").setup({
|
||||
-- open_mapping = [[<c-\>]],
|
||||
-- on_create = function(term)
|
||||
-- vim.cmd("startinsert")
|
||||
-- term:send("gh pr checks")
|
||||
-- end
|
||||
-- })
|
||||
|
||||
-- Duplicate C-w & Esc Behavior
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = {buffer = 0}
|
||||
vim.opt.signcolumn = "no"
|
||||
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
|
||||
end
|
||||
|
||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||
3
modules/home/programs/terminal/nvim/config/lua/ts-config.lua
Executable file
3
modules/home/programs/terminal/nvim/config/lua/ts-config.lua
Executable file
@@ -0,0 +1,3 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {enable = true, additional_vim_regex_highlighting = false}
|
||||
}
|
||||
66
modules/home/programs/terminal/nvim/config/lua/weird-chars.lua
Executable file
66
modules/home/programs/terminal/nvim/config/lua/weird-chars.lua
Executable file
@@ -0,0 +1,66 @@
|
||||
local ns = vim.api.nvim_create_namespace("weird-chars")
|
||||
|
||||
local weird_chars = {
|
||||
["–"] = "en dash found, consider using regular hyphen (-)",
|
||||
["—"] = "em dash found, consider using regular hyphen (-)",
|
||||
["“"] = 'left double quote found, consider using straight quote (")',
|
||||
["”"] = 'right double quote found, consider using straight quote (")',
|
||||
["‘"] = "left single quote found, consider using straight quote (')",
|
||||
["’"] = "right single quote found, consider using straight quote (')",
|
||||
["•"] = "bullet found, consider using regular asterisk (*)",
|
||||
["·"] = "middle dot found",
|
||||
[" "] = "full-width space found, consider using regular space",
|
||||
}
|
||||
|
||||
local function check_weird_chars()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
local diagnostics = {}
|
||||
|
||||
for linenr, line in ipairs(lines) do
|
||||
local i = 1
|
||||
while i <= #line do
|
||||
local b = line:byte(i)
|
||||
local char
|
||||
|
||||
-- Check for UTF-8 multi-byte sequences
|
||||
if b >= 0xE2 and b <= 0xEF then
|
||||
-- Likely a 3-byte UTF-8 sequence
|
||||
char = line:sub(i, i + 2)
|
||||
i = i + 3
|
||||
elseif b >= 0xC2 and b <= 0xDF then
|
||||
-- Likely a 2-byte UTF-8 sequence
|
||||
char = line:sub(i, i + 1)
|
||||
i = i + 2
|
||||
else
|
||||
-- Single byte character
|
||||
char = line:sub(i, i)
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
if weird_chars[char] then
|
||||
table.insert(diagnostics, {
|
||||
bufnr = bufnr,
|
||||
lnum = linenr - 1,
|
||||
col = i - #char - 1,
|
||||
message = weird_chars[char],
|
||||
severity = vim.diagnostic.severity.WARN,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.diagnostic.set(ns, bufnr, diagnostics)
|
||||
end
|
||||
|
||||
-- Create autocommand group
|
||||
local group = vim.api.nvim_create_augroup("WeirdChars", { clear = true })
|
||||
|
||||
-- Set up autocommands
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "TextChanged", "InsertLeave" }, {
|
||||
group = group,
|
||||
callback = check_weird_chars,
|
||||
})
|
||||
|
||||
-- Create commands for manual checking
|
||||
vim.api.nvim_create_user_command("CheckWeirdChars", check_weird_chars, {})
|
||||
47
modules/home/programs/terminal/nvim/config/lua/which-key-config.lua
Executable file
47
modules/home/programs/terminal/nvim/config/lua/which-key-config.lua
Executable file
@@ -0,0 +1,47 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup({})
|
||||
|
||||
wk.add({
|
||||
{ "<C-k>", desc = "Signature Help" },
|
||||
{ "<leader>a", desc = "Aerial" },
|
||||
{ "<leader>d", group = "Debug" },
|
||||
{ "<leader>db", desc = "Toggle Breakpoint" },
|
||||
{ "<leader>dc", desc = "Continue" },
|
||||
{ "<leader>dt", desc = "Run Test" },
|
||||
{ "<leader>du", desc = "Toggle UI" },
|
||||
{ "<leader>f", group = "Find - Telescope" },
|
||||
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Find Buffer" },
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find File" },
|
||||
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live Grep" },
|
||||
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help Tags" },
|
||||
{ "<leader>fj", "<cmd>Telescope jumplist<cr>", desc = "Jump List" },
|
||||
{ "<leader>g", group = "DiffView" },
|
||||
{ "<leader>gB", desc = "Git Blame Full" },
|
||||
{ "<leader>gH", "<cmd>DiffviewFileHistory --range=origin..HEAD<cr>", desc = "Diff History - Main" },
|
||||
{ "<leader>gO", "<cmd>DiffviewOpen origin/main...HEAD<cr>", desc = "Open Diff - Main" },
|
||||
{ "<leader>gb", desc = "Git Blame Line" },
|
||||
{ "<leader>gc", "<cmd>DiffviewClose<cr>", desc = "Close Diff" },
|
||||
{ "<leader>gh", "<cmd>DiffviewFileHistory<cr>", desc = "Diff History" },
|
||||
{ "<leader>go", "<cmd>DiffviewOpen<cr>", desc = "Open Diff - Current" },
|
||||
{ "<leader>l", group = "LSP" },
|
||||
{ "<leader>lD", desc = "Declaration" },
|
||||
{ "<leader>ld", desc = "Definition" },
|
||||
{ "<leader>lf", desc = "Format" },
|
||||
{ "<leader>li", desc = "Implementation" },
|
||||
{ "<leader>ln", desc = "Rename" },
|
||||
{ "<leader>lr", desc = "References" },
|
||||
{ "<leader>lt", desc = "Type Definition" },
|
||||
{ "<leader>q", group = "Diagnostics" },
|
||||
{ "<leader>qN", desc = "Previous Diagnostic" },
|
||||
{ "<leader>qe", desc = "Open Diagnostic Float" },
|
||||
{ "<leader>qn", desc = "Next Diagnostic" },
|
||||
{ "<leader>qq", desc = "Toggle Diagnostic List" },
|
||||
{ "<leader>qt", desc = "Toggle Inline Diagnostics" },
|
||||
{ "<leader>sv", desc = "Visual Screenshot" },
|
||||
{ "<leader>t", desc = "NeoTree" },
|
||||
{ "K", desc = "Definition Hover" },
|
||||
{ "<leader>ss", desc = "Selected Screenshot", mode = "v" },
|
||||
{ "<leader>s", group = "Screenshot", mode = { "n", "v" } },
|
||||
{ "<leader>sb", desc = "Buffer Screenshot", mode = { "n", "v" } },
|
||||
})
|
||||
204
modules/home/programs/terminal/nvim/default.nix
Executable file
204
modules/home/programs/terminal/nvim/default.nix
Executable file
@@ -0,0 +1,204 @@
|
||||
{ pkgs, lib, config, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.${namespace}.programs.terminal.nvim;
|
||||
in
|
||||
{
|
||||
options.${namespace}.programs.terminal.nvim = {
|
||||
enable = lib.mkEnableOption "NeoVim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
withNodeJs = true;
|
||||
withPython3 = true;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# ------------------
|
||||
# --- Completion ---
|
||||
# ------------------
|
||||
cmp-buffer # Buffer Word Completion
|
||||
cmp-cmdline # Command Line Completion
|
||||
cmp-nvim-lsp # Main LSP
|
||||
cmp-path # Path Completion
|
||||
cmp_luasnip # Snippets Completion
|
||||
friendly-snippets # Snippets
|
||||
lsp_lines-nvim # Inline Diagnostics
|
||||
luasnip # Snippets
|
||||
nvim-cmp # Completions
|
||||
nvim-lspconfig # LSP Config
|
||||
|
||||
# -------------------
|
||||
# ----- Helpers -----
|
||||
# -------------------
|
||||
aerial-nvim # Code Outline
|
||||
comment-nvim # Code Comments
|
||||
diffview-nvim # Diff View
|
||||
gitsigns-nvim # Git Blame
|
||||
leap-nvim # Quick Movement
|
||||
markdown-preview-nvim # Markdown Preview
|
||||
neo-tree-nvim # File Explorer
|
||||
none-ls-nvim # Formatters
|
||||
numb-nvim # Peek / Jump to Lines
|
||||
nvim-autopairs # Automatically Close Pairs (),[],{}
|
||||
telescope-fzf-native-nvim # Faster Telescope
|
||||
telescope-nvim # Fuzzy Finder
|
||||
telescope-ui-select-nvim # UI
|
||||
toggleterm-nvim # Terminal Helper
|
||||
vim-nix # Nix Helpers
|
||||
which-key-nvim # Shortcut Helper
|
||||
|
||||
# ------------------
|
||||
# --- Theme / UI ---
|
||||
# ------------------
|
||||
lualine-nvim # Bottom Line
|
||||
noice-nvim # UI Tweaks
|
||||
# nord-nvim # Theme
|
||||
# melange-nvim # Theme
|
||||
catppuccin-nvim # Theme
|
||||
nvim-notify # Noice Dependency
|
||||
nvim-web-devicons # Dev Icons
|
||||
|
||||
# ------------------
|
||||
# --- Treesitter ---
|
||||
# ------------------
|
||||
nvim-treesitter-context
|
||||
nvim-treesitter.withAllGrammars
|
||||
|
||||
# -------------------
|
||||
# ------- DAP -------
|
||||
# -------------------
|
||||
nvim-dap
|
||||
nvim-dap-go
|
||||
nvim-dap-ui
|
||||
|
||||
# --------------------
|
||||
# -- NONE-LS EXTRAS --
|
||||
# --------------------
|
||||
(
|
||||
pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "none-ls-extras.nvim";
|
||||
version = "2024-06-11";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "nvimtools";
|
||||
repo = "none-ls-extras.nvim";
|
||||
rev = "336e84b9e43c0effb735b08798ffac382920053b";
|
||||
sha256 = "sha256-UtU4oWSRTKdEoMz3w8Pk95sROuo3LEwxSDAm169wxwk=";
|
||||
};
|
||||
meta.homepage = "https://github.com/nvimtools/none-ls-extras.nvim/";
|
||||
}
|
||||
)
|
||||
|
||||
# -------------------
|
||||
# ----- Silicon -----
|
||||
# -------------------
|
||||
(
|
||||
pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "silicon.lua";
|
||||
version = "2022-12-03";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "mhanberg";
|
||||
repo = "silicon.lua";
|
||||
rev = "5ca462bee0a39b058786bc7fbeb5d16ea49f3a23";
|
||||
sha256 = "0vlp645d5mmii513v72jca931miyrhkvhwb9bfzhix1199zx7vi2";
|
||||
};
|
||||
meta.homepage = "https://github.com/mhanberg/silicon.lua/";
|
||||
}
|
||||
)
|
||||
|
||||
# -------------------
|
||||
# ------- LLM -------
|
||||
# -------------------
|
||||
(
|
||||
pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "llm.nvim";
|
||||
version = "2024-05-25";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "David-Kunz";
|
||||
repo = "gen.nvim";
|
||||
rev = "bd19cf584b5b82123de977b44105e855e61e5f39";
|
||||
sha256 = "sha256-0AEB6im8Jz5foYzmL6KEGSAYo48g1bkFpjlCSWT6JeE=";
|
||||
};
|
||||
meta.homepage = "https://github.com/David-Kunz/gen.nvim/";
|
||||
}
|
||||
)
|
||||
|
||||
# -------------------
|
||||
# ---- LLAMA.VIM ----
|
||||
# -------------------
|
||||
(
|
||||
pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "llama.vim";
|
||||
version = "2025-01-23";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "ggml-org";
|
||||
repo = "llama.vim";
|
||||
rev = "143fe910b8d47a054ed464c38d8b7c17d5354468";
|
||||
sha256 = "sha256-PW0HKzhSxcZiWzpDOuy98rl/X0o2nE7tMjZjwwh0qLE=";
|
||||
};
|
||||
meta.homepage = "https://github.com/ggml-org/llama.vim/";
|
||||
}
|
||||
)
|
||||
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
# Telescope Dependencies
|
||||
fd
|
||||
ripgrep
|
||||
tree-sitter
|
||||
|
||||
# LSP Dependencies
|
||||
go
|
||||
golangci-lint
|
||||
golangci-lint-langserver
|
||||
gopls
|
||||
lua-language-server
|
||||
nil
|
||||
nodePackages.eslint
|
||||
nodePackages.svelte-language-server
|
||||
nodePackages.typescript
|
||||
nodePackages.typescript-language-server
|
||||
nodePackages.vscode-langservers-extracted
|
||||
pyright
|
||||
eslint_d
|
||||
|
||||
# Formatters
|
||||
luaformatter
|
||||
nixpkgs-fmt
|
||||
nodePackages.prettier
|
||||
sqlfluff
|
||||
stylua
|
||||
|
||||
# Silicon
|
||||
silicon
|
||||
];
|
||||
|
||||
extraConfig = ":luafile ~/.config/nvim/lua/init.lua";
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
# Copy Configuration
|
||||
nvim = {
|
||||
source = ./config;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
# Generate Nix Vars
|
||||
"nvim/lua/nix-vars.lua".text = ''
|
||||
local nix_vars = {
|
||||
gopls = "${pkgs.gopls}/bin/gopls",
|
||||
luals = "${pkgs.lua-language-server}/bin/lua-language-server",
|
||||
sveltels = "${pkgs.nodePackages.svelte-language-server}/bin/svelteserver",
|
||||
tsls = "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server",
|
||||
golintls = "${pkgs.golangci-lint-langserver}/bin/golangci-lint-langserver",
|
||||
vscls = "${pkgs.nodePackages.vscode-langservers-extracted}",
|
||||
}
|
||||
return nix_vars
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user