feat: better modules aragement.
This commit is contained in:
parent
de11ee0676
commit
6e967a751f
49 changed files with 27 additions and 19 deletions
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env zsh
|
||||
# Open a script in path with vim quicly
|
||||
vish () {
|
||||
nvim $(which $1)
|
||||
}
|
||||
|
||||
# Create a directory and change into it
|
||||
md () {
|
||||
mkdir -p "$@" && cd "$@"
|
||||
}
|
||||
|
||||
# Move a file and create a link in it's place
|
||||
mvln () {
|
||||
from=$(readlink -f $1)
|
||||
to="$2"
|
||||
[ ! -d "$(dirname $to)" ] && mkdir -p "$(dirname $to)"
|
||||
mv $from $to
|
||||
ln -s $to $from
|
||||
}
|
||||
|
||||
# nnn
|
||||
n () {
|
||||
# Block nesting of nnn in subshells
|
||||
[ "${NNNLVL:-0}" -eq 0 ] || {
|
||||
echo "nnn is already running"
|
||||
return
|
||||
}
|
||||
|
||||
# Tempfile location
|
||||
NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
||||
|
||||
nnn "$@"
|
||||
|
||||
[ ! -f "$NNN_TMPFILE" ] || {
|
||||
. "$NNN_TMPFILE"
|
||||
rm -f "$NNN_TMPFILE" > /dev/null
|
||||
}
|
||||
}
|
||||
|
||||
# upfast
|
||||
upfast () {
|
||||
curl -F "file=@$(readlink -f $1)" "https://upfast.cronyakatsuki.xyz/"
|
||||
}
|
13
modules/cross-platform/home-manager/default.nix
Normal file
13
modules/cross-platform/home-manager/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{lib, ...}: {
|
||||
imports = [
|
||||
./neovim.nix
|
||||
./shell.nix
|
||||
./tmux.nix
|
||||
./zsh.nix
|
||||
];
|
||||
|
||||
crony.neovim.enable = lib.mkDefault true;
|
||||
crony.shell.enable = lib.mkDefault true;
|
||||
crony.tmux.enable = lib.mkDefault true;
|
||||
crony.zsh.enable = lib.mkDefault true;
|
||||
}
|
286
modules/cross-platform/home-manager/neovim.nix
Normal file
286
modules/cross-platform/home-manager/neovim.nix
Normal file
|
@ -0,0 +1,286 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
markdown-table-mode = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "markdown-table-mode";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Kicamon";
|
||||
repo = "markdown-table-mode.nvim";
|
||||
rev = "fe207ea7cef615ccaf2c0f1257c58ffa0a50a9f5";
|
||||
hash = "sha256-JGc5L+7/eSBww1HaMl0AVcIwEJF/RFqoVRpR3DnP6+E=";
|
||||
};
|
||||
};
|
||||
in {
|
||||
options = {
|
||||
crony.neovim.enable = lib.mkEnableOption "Enable neovim and apply a good config.";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.crony.neovim.enable {
|
||||
# Disable stylix for nvf, I wan't to use a properly implemented theme sorry.
|
||||
stylix.targets.nvf.enable = false;
|
||||
|
||||
# Setup neovim
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
settings = {
|
||||
vim = {
|
||||
# Enable the aliases, I love them
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
# Changing some basic settings
|
||||
options = {
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
expandtab = true;
|
||||
softtabstop = 2;
|
||||
updatetime = 50;
|
||||
scrolloff = 5;
|
||||
signcolumn = "no";
|
||||
ignorecase = true;
|
||||
smartcase = true;
|
||||
colorcolumn = "80";
|
||||
laststatus = 3;
|
||||
};
|
||||
|
||||
# Enable the undo file
|
||||
undoFile = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
binds = {
|
||||
# Setup whichkey
|
||||
whichKey.enable = true;
|
||||
};
|
||||
|
||||
# Enable lsp
|
||||
lsp = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Autocompletion
|
||||
autocomplete.nvim-cmp = {
|
||||
enable = true;
|
||||
mappings = {
|
||||
close = "<C-h>";
|
||||
complete = null;
|
||||
confirm = "<C-l>";
|
||||
next = "<C-j>";
|
||||
previous = "<C-k>";
|
||||
};
|
||||
};
|
||||
|
||||
# Setup lsp's and languages
|
||||
languages = {
|
||||
enableLSP = true;
|
||||
enableTreesitter = true;
|
||||
enableFormat = true;
|
||||
|
||||
lua = {
|
||||
enable = true;
|
||||
lsp.lazydev.enable = true;
|
||||
};
|
||||
python = {
|
||||
enable = true;
|
||||
format.type = "black-and-isort";
|
||||
};
|
||||
css.enable = true;
|
||||
ts.enable = true;
|
||||
nix = {
|
||||
enable = true;
|
||||
lsp = {
|
||||
server = "nixd";
|
||||
options = {
|
||||
nixos = {
|
||||
expr = ''(builtins.getFlake "/home/crony/Repos/nixos").nixosConfigurations.CONFIGNAME.options'';
|
||||
};
|
||||
home_manager = {
|
||||
expr = ''(builtins.getFlake "/home/crony/Repos/nixos").homeConfigurations.CONFIGNAME.options'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
bash.enable = true;
|
||||
go = {
|
||||
enable = true;
|
||||
format.type = "gofumpt";
|
||||
};
|
||||
markdown = {
|
||||
enable = true;
|
||||
extensions.render-markdown-nvim.enable = true;
|
||||
};
|
||||
html.enable = true;
|
||||
};
|
||||
|
||||
# Enable mini modules ( mini is amazing )
|
||||
mini = {
|
||||
# Text editing
|
||||
ai.enable = true;
|
||||
comment.enable = true;
|
||||
operators.enable = true;
|
||||
pairs.enable = true;
|
||||
surround.enable = true;
|
||||
basics = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
mappings = {
|
||||
windows = true;
|
||||
move_with_alt = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
bracketed.enable = true;
|
||||
bufremove.enable = true;
|
||||
diff.enable = true;
|
||||
files.enable = true;
|
||||
git.enable = true;
|
||||
sessions.enable = true;
|
||||
visits.enable = true;
|
||||
hipatterns = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
highlighters = {
|
||||
fixme = lib.generators.mkLuaInline "{ pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' }";
|
||||
hack = lib.generators.mkLuaInline "{ pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' }";
|
||||
todo = lib.generators.mkLuaInline "{ pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' }";
|
||||
note = lib.generators.mkLuaInline "{ pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' }";
|
||||
hex_color = lib.generators.mkLuaInline "require('mini.hipatterns').gen_highlighter.hex_color()";
|
||||
};
|
||||
};
|
||||
};
|
||||
icons.enable = true;
|
||||
indentscope.enable = true;
|
||||
notify.enable = true;
|
||||
starter.enable = true;
|
||||
statusline.enable = true;
|
||||
move.enable = true;
|
||||
splitjoin.enable = true;
|
||||
};
|
||||
|
||||
# Use telescope
|
||||
telescope = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true;
|
||||
override_generic_sorter = true;
|
||||
override_file_sorter = true;
|
||||
case_mode = "smart_case";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Theme
|
||||
theme = {
|
||||
enable = true;
|
||||
name = "gruvbox";
|
||||
style = "dark";
|
||||
};
|
||||
|
||||
# Keymaps
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>e";
|
||||
mode = ["n"];
|
||||
action = ":lua MiniFiles.open()<CR>";
|
||||
silent = true;
|
||||
desc = "Open Mini.Files and manage the filesystem.";
|
||||
}
|
||||
{
|
||||
key = "<C-d>";
|
||||
mode = ["n"];
|
||||
action = "<C-d>zz";
|
||||
silent = true;
|
||||
}
|
||||
{
|
||||
key = "<C-u>";
|
||||
mode = ["n"];
|
||||
action = "<C-u>zz";
|
||||
silent = true;
|
||||
}
|
||||
{
|
||||
key = "<C-f>";
|
||||
mode = ["n"];
|
||||
action = "<C-f>zz";
|
||||
silent = true;
|
||||
}
|
||||
{
|
||||
key = "<C-b>";
|
||||
mode = ["n"];
|
||||
action = "<C-b>zz";
|
||||
silent = true;
|
||||
}
|
||||
];
|
||||
|
||||
extraLuaFiles = [./nvim/autocommands.lua];
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; {
|
||||
oil = {
|
||||
package = oil-nvim;
|
||||
setup = ''
|
||||
require("oil").setup()
|
||||
|
||||
vim.keymap.set("n", "<leader>N", ":Oil<CR>")
|
||||
vim.keymap.set("n", "<leader>n", ':lua require("oil").toggle_float()<CR>')
|
||||
'';
|
||||
};
|
||||
harpoon = {
|
||||
package = harpoon2;
|
||||
setup = ''
|
||||
local harpoon = require("harpoon")
|
||||
|
||||
-- REQUIRED
|
||||
harpoon:setup()
|
||||
-- REQUIRED
|
||||
|
||||
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
|
||||
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
|
||||
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
|
||||
vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end)
|
||||
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end)
|
||||
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)
|
||||
'';
|
||||
};
|
||||
friendly-snippets = {
|
||||
package = friendly-snippets;
|
||||
};
|
||||
telescope-fzf-native = {
|
||||
package = telescope-fzf-native-nvim;
|
||||
setup = ''
|
||||
require('telescope').load_extension('fzf')
|
||||
'';
|
||||
};
|
||||
telescope-ui-select = {
|
||||
package = telescope-ui-select-nvim;
|
||||
setup = ''
|
||||
require('telescope').load_extension('fzf')
|
||||
'';
|
||||
};
|
||||
markdown-table-mode-nvim = {
|
||||
package = markdown-table-mode;
|
||||
setup = ''
|
||||
require('markdown-table-mode').setup()
|
||||
'';
|
||||
};
|
||||
snacks-nvim = {
|
||||
package = snacks-nvim;
|
||||
setup = ''
|
||||
require('snacks').setup({
|
||||
bigfile = {enabled = true},
|
||||
quickfile = {enabled = true},
|
||||
})
|
||||
'';
|
||||
};
|
||||
helpview-nvim.package = helpview-nvim;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
25
modules/cross-platform/home-manager/nvim/autocommands.lua
Normal file
25
modules/cross-platform/home-manager/nvim/autocommands.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local function augroup(name)
|
||||
return vim.api.nvim_create_augroup("crony_" .. name, { clear = true })
|
||||
end
|
||||
|
||||
-- [[ Auto create parent directory if it doesn't exist ]]
|
||||
autocmd({ "BufWritePre" }, {
|
||||
group = augroup("auto_create_dir"),
|
||||
callback = function(event)
|
||||
if event.match:match("^%w%w+://") then
|
||||
return
|
||||
end
|
||||
local file = vim.loop.fs_realpath(event.match) or event.match
|
||||
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
|
||||
end,
|
||||
})
|
||||
|
||||
-- [[ Settings for default neovim terminal ]]
|
||||
autocmd({ "TermOpen" }, {
|
||||
group = augroup("term_open"),
|
||||
callback = function()
|
||||
vim.opt.number = false
|
||||
vim.opt.relativenumber = false
|
||||
end
|
||||
})
|
118
modules/cross-platform/home-manager/shell.nix
Normal file
118
modules/cross-platform/home-manager/shell.nix
Normal file
|
@ -0,0 +1,118 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
# Module that bundles all my shell related software that make up my shell experience
|
||||
options = {
|
||||
crony.shell.enable = lib.mkEnableOption "Enable my bundled shell software that make up my shell experience";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.crony.shell.enable {
|
||||
home.packages = with pkgs; [
|
||||
alejandra
|
||||
age
|
||||
nix-output-monitor
|
||||
nvd
|
||||
nurl
|
||||
entr
|
||||
ffmpeg
|
||||
imagemagick
|
||||
glow
|
||||
buku
|
||||
unzip
|
||||
p7zip
|
||||
aria2
|
||||
commitizen
|
||||
license-go
|
||||
termsonic
|
||||
inputs.iamb.packages.x86_64-linux.default
|
||||
toot
|
||||
];
|
||||
|
||||
# Enable nix-index
|
||||
programs.nix-index = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
# Enable comma
|
||||
programs.nix-index-database.comma.enable = true;
|
||||
|
||||
# Enable git
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Crony Akatsuki";
|
||||
userEmail = "crony@cronyakatsuki.xyz";
|
||||
};
|
||||
|
||||
# Install fzf
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
defaultCommand = "fd --type f";
|
||||
};
|
||||
|
||||
# Install starship
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
settings = {
|
||||
add_newline = false;
|
||||
};
|
||||
};
|
||||
|
||||
# Install zoxide
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
# Install eza
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
git = true;
|
||||
icons = "always";
|
||||
};
|
||||
|
||||
# Install direnv
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
# Install the fuck
|
||||
programs.thefuck = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
# Install tealdeer
|
||||
programs.tealdeer.enable = true;
|
||||
|
||||
# Install bat
|
||||
programs.bat.enable = true;
|
||||
|
||||
# Install jq
|
||||
programs.jq.enable = true;
|
||||
|
||||
# Install fd
|
||||
programs.fd = {
|
||||
enable = true;
|
||||
hidden = true;
|
||||
ignores = ["~/Documents/Share" ".git"];
|
||||
};
|
||||
|
||||
# Install rg
|
||||
programs.ripgrep = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Install btop
|
||||
programs.btop.enable = true;
|
||||
};
|
||||
}
|
90
modules/cross-platform/home-manager/tmux.nix
Normal file
90
modules/cross-platform/home-manager/tmux.nix
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
crony.tmux.enable = lib.mkEnableOption "Enable tmux and customize it";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.crony.tmux.enable {
|
||||
# Enable custom tmux bar settings
|
||||
home.sessionVariables = {
|
||||
TINTED_TMUX_OPTION_STATUSBAR = 1;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
sesh
|
||||
];
|
||||
|
||||
# Setup tmux
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
escapeTime = 0;
|
||||
keyMode = "vi";
|
||||
prefix = "C-Space";
|
||||
|
||||
extraConfig = ''
|
||||
# start window and panes indexing at 1
|
||||
set -g base-index 1
|
||||
set -g pane-base-index 1
|
||||
set-window-option -g pane-base-index 1
|
||||
set-option -g renumber-windows on
|
||||
|
||||
# SPEED
|
||||
set-option -g status-interval 1
|
||||
|
||||
# set vi-mode
|
||||
set-window-option -g mode-keys vi
|
||||
# keybindings
|
||||
bind-key -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
|
||||
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
|
||||
|
||||
bind "'" split-window -v -c "#{pane_current_path}"
|
||||
bind '\' split-window -h -c "#{pane_current_path}"
|
||||
|
||||
# Vim keybindings for pane movement
|
||||
setw -g mode-keys vi
|
||||
bind-key h select-pane -L
|
||||
bind-key j select-pane -D
|
||||
bind-key k select-pane -U
|
||||
bind-key l select-pane -R
|
||||
|
||||
# Skip kill pane %Number% (y/n) prompt
|
||||
bind-key x kill-pane
|
||||
|
||||
# Don't exit from tmux when closing a session
|
||||
set -g detach-on-destroy off
|
||||
|
||||
# Bar to top
|
||||
set-option -g status-position top
|
||||
|
||||
# Sesh section
|
||||
bind-key "T" run-shell "sesh connect \"$(
|
||||
sesh list --icons | fzf-tmux -p 80%,70% \
|
||||
--no-sort --ansi --border-label ' sesh ' --prompt '⚡ ' \
|
||||
--header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \
|
||||
--bind 'tab:down,btab:up' \
|
||||
--bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list --icons)' \
|
||||
--bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t --icons)' \
|
||||
--bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --icons)' \
|
||||
--bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z --icons)' \
|
||||
--bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \
|
||||
--bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list --icons)' \
|
||||
--preview-window 'right:55%' \
|
||||
--preview 'sesh preview {}'
|
||||
)\""
|
||||
|
||||
bind -N "last-session (via sesh) " L run-shell "sesh last"
|
||||
'';
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
sensible
|
||||
yank
|
||||
fzf-tmux-url
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
77
modules/cross-platform/home-manager/zsh.nix
Normal file
77
modules/cross-platform/home-manager/zsh.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
crony.zsh.enable = lib.mkEnableOption "Enable zsh and customize it.";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.crony.zsh.enable {
|
||||
# Setup zsh
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
autosuggestion.enable = true;
|
||||
historySubstringSearch.enable = true;
|
||||
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
shellAliases = {
|
||||
# General aliases
|
||||
grep = "grep --color=auto";
|
||||
cp = "cp -iv";
|
||||
rm = "rm -iv";
|
||||
mkd = "mkdir -pv";
|
||||
less = "less -R";
|
||||
df = "df -h -x devtmpfs -x tmpfs -x usbfs -x loop";
|
||||
free = "free -mht";
|
||||
# nnn on crack
|
||||
nnn = ''LC_COLLATE="C" nnn -xeaiH'';
|
||||
# Buku powerup
|
||||
b = "buku -p";
|
||||
# fzf shenanigans
|
||||
vif = ''nvim $(fzf --preview="bat --color=always {}")'';
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
${pkgs.nerdfetch}/bin/nerdfetch
|
||||
# VI Mode escape timeout fix
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# Substring search settings
|
||||
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold"
|
||||
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=black,bold'
|
||||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
|
||||
[[ -f "$HOME/.config/zsh/functions.zsh" ]] && source "$HOME/.config/zsh/functions.zsh"
|
||||
'';
|
||||
|
||||
initExtraFirst = ''
|
||||
# Tmux autostart
|
||||
if [ -x "$(command -v tmux)" ] && [ -n "$DISPLAY" ] && [ -z "$TMUX" ]; then
|
||||
exec tmux new-session -A -s default >/dev/null 2>&1
|
||||
fi
|
||||
'';
|
||||
|
||||
antidote = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
"zap-zsh/supercharge"
|
||||
"zap-zsh/completions"
|
||||
"zap-zsh/vim"
|
||||
"chivalryq/git-alias"
|
||||
"zdharma-continuum/fast-syntax-highlighting"
|
||||
"zsh-users/zsh-history-substring-search"
|
||||
"MichaelAquilina/zsh-you-should-use"
|
||||
];
|
||||
};
|
||||
};
|
||||
# Link my functions file to ~/.config/zsh/functions.zsh
|
||||
home.file = {
|
||||
".config/zsh/functions.zsh".source = ./configs/zsh-functions.zsh;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue