commit 7c22850442a8b69775d45f1cf2c47141c8f694d4 Author: datsudo <76833632+datsudo@users.noreply.github.com> Date: Fri May 30 22:59:38 2025 +0800 stable gen diff --git a/bin/books b/bin/books new file mode 100755 index 0000000..a627188 --- /dev/null +++ b/bin/books @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +BOOKS="/ar1/Books" + +file_name="$(find "$BOOKS" -type f -printf "%f\n" | sed 's/\.[^.]*$//' | rofi -dmenu -i -p "Books:" -theme ~/.config/rofi/menu.rasi)" + +if [ ! -z "$file_name" ]; then + file_path="$(find "$BOOKS" -type f -name "$file_name.*")" + extension="${file_path#*.}" + if [ "$extension" == "epub" ]; then + ebook-viewer --detach "$file_path" >/dev/null 2>&1 + else + xdg-open "$file_path" >/dev/null 2>&1 + fi +fi diff --git a/bin/boomer b/bin/boomer new file mode 100755 index 0000000..833d12b Binary files /dev/null and b/bin/boomer differ diff --git a/bin/clipboard b/bin/clipboard new file mode 100755 index 0000000..001f098 --- /dev/null +++ b/bin/clipboard @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +rofi -modi "Clipboard:greenclip print" -show Clipboard -run-command '{cmd}' -theme ~/.config/rofi/menu.rasi diff --git a/bin/define b/bin/define new file mode 100755 index 0000000..47da32e --- /dev/null +++ b/bin/define @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +word="$(rofi -dmenu -i -p "Define:" -theme ~/.config/rofi/menu-no-list.rasi)" +TERMINAL="ghostty" + + +if [[ -n $word ]]; then + case "$TERMINAL" in + "kitty"|"ghostty") + $TERMINAL --title="Dictionary" -e ~/.local/bin/show_def "$word" + ;; + "wezterm") + $TERMINAL start --new-tab -e ~/.local/bin/show_def "$word" + ;; + "alacritty") + $TERMINAL --class "Dictionary" --hold \ + -e /bin/zsh -c "$HOME/.local/bin/show_def '$word'" + ;; + *) + exit 1 + ;; + esac +fi + diff --git a/bin/keyboard-toggle b/bin/keyboard-toggle new file mode 100755 index 0000000..3815a41 --- /dev/null +++ b/bin/keyboard-toggle @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +DEVICE_NAME="AT Translated Set 2 keyboard" +ID=$(xinput list --id-only "$DEVICE_NAME") +is_enabled=$(xinput --list-props "$ID" | awk -F'[\t:]+' '/Device Enabled/ {print $3}') + +if [[ $is_enabled == 0 ]]; then + xinput enable $ID + status="Enabled" +else + xinput disable $ID + status="Disabled" +fi + +notify-send "Internal Keyboard" "$status" -i "keyboard" diff --git a/bin/show_colors b/bin/show_colors new file mode 100755 index 0000000..bc63370 --- /dev/null +++ b/bin/show_colors @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +for b in $(seq 0 7) 9; do + echo + for f in $(seq 0 7) 9; do + printf " \033[0;1;3${f};4${b}m 3${f}\033[0;3${f};4${b}m 4${b} \033[0m " + done + echo +done +echo diff --git a/bin/show_def b/bin/show_def new file mode 100755 index 0000000..5059096 --- /dev/null +++ b/bin/show_def @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +function def() { + sdcv -n --utf8-output --color "$@" 2>&1 | \ + fold --width=$(tput cols) | \ + less --quit-if-one-screen -RX +} + +def $1 diff --git a/bin/stm b/bin/stm new file mode 100755 index 0000000..6f9b88c --- /dev/null +++ b/bin/stm @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +session_name="$1" +tmux has-session -t $session_name &> /dev/null + +if [ $? != 0 ]; then + case "$session_name" in + + webdev) + explorer="$COURSES/Angela Yu - The Complete 2022 Web Development Bootcamp" + webdev_dir="$DEVDIR/web/webproj" + + tmux new-session -s "webdev" -d -n "Explorer" -c "$explorer" "nnn" + tmux new-window -t "webdev" -d -n "Editor" -c "$webdev_dir" "$EDITOR" + tmux new-window -t "webdev" -d -n "Terminal" -c "$webdev_dir" + tmux split-window -h -t "webdev:Terminal" -c "$webdev_dir" + ;; + + media) + kvardir="/ar1/Kvar/Running Man" + moviesdir="/ar1/Movies" + tvseriesdir="/ar1/TV Series" + + tmux new-session -s "media" -d -n "Running Man" -c "$kvardir" "nnn" + tmux new-window -t "media" -d -n "Movies" -c "$moviesdir" "nnn" + tmux new-window -t "media" -d -n "TV Series" -c "$tvseriesdir" "nnn" + ;; + + *) + tmux new-session -s "$session_name" + ;; + esac +fi + +if [[ -z $session_name ]]; then + session_name="main" + tmux new-session -s "$session_name" +fi + +tmux attach -t "$session_name" diff --git a/bin/tmux-sessionizer b/bin/tmux-sessionizer new file mode 100755 index 0000000..a47780b --- /dev/null +++ b/bin/tmux-sessionizer @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +switch_to() { + if [[ -z $TMUX ]]; then + tmux attach-session -t $1 + else + tmux switch-client -t $1 + fi +} + +has_session() { + tmux list-sessions | grep -q "^$1:" +} + +hydrate() { + if [ -f $2/.tmux-sessionizer ]; then + tmux send-keys -t $1 "source $2/.tmux-sessionizer" c-M + elif [ -f $HOME/.tmux-sessionizer ]; then + tmux send-keys -t $1 "source $HOME/.tmux-sessionizer" c-M + fi +} + +if [[ $# -eq 1 ]]; then + selected=$1 +else + # If someone wants to make this extensible, i'll accept + # PR + selected=$(find ~/dev ~/dev/probe ~/dev/gitlab ~/Documents -mindepth 1 -maxdepth 1 -type d | fzf) +fi + +if [[ -z $selected ]]; then + exit 0 +fi + +selected_name=$(basename "$selected" | tr . _) +tmux_running=$(pgrep tmux) + +if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then + tmux new-session -s $selected_name -c $selected + hydrate $selected_name $selected + exit 0 +fi + +if ! has_session $selected_name; then + tmux new-session -ds $selected_name -c $selected + hydrate $selected_name $selected +fi + +switch_to $selected_name diff --git a/bin/touchpad-toggle-xinput b/bin/touchpad-toggle-xinput new file mode 100755 index 0000000..c0e7d62 --- /dev/null +++ b/bin/touchpad-toggle-xinput @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +TPAD_ID=$(xinput | awk '/Touchpad/ {print $6}' | awk -F = '{print $2}') +is_enabled=$(xinput list-props $TPAD_ID | awk '/Device Enabled/ {print $4}') + +if [[ $is_enabled == 0 ]]; then + xinput enable "$TPAD_ID" + status="Enabled" +else + xinput disable "$TPAD_ID" + status="Disabled" +fi + +notify-send "Touchpad" "$status" -i "touchpad" diff --git a/config/dracula.toml b/config/dracula.toml new file mode 100644 index 0000000..0a56c29 --- /dev/null +++ b/config/dracula.toml @@ -0,0 +1,76 @@ +# Dracula theme for Alacritty +# https://draculatheme.com/alacritty +# +# Color palette +# https://spec.draculatheme.com +# +# Instructions +# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd + +[colors.primary] + +background = "#282a36" +foreground = "#f8f8f2" +bright_foreground = "#ffffff" + +[colors.cursor] + +text = "#282a36" +cursor = "#f8f8f2" + +[colors.vi_mode_cursor] + +text = "CellBackground" +cursor = "CellForeground" + +[colors.selection] + +text = "CellForeground" +background = "#44475a" + +[colors.normal] + +black = "#21222c" +red = "#ff5555" +green = "#50fa7b" +yellow = "#f1fa8c" +blue = "#bd93f9" +magenta = "#ff79c6" +cyan = "#8be9fd" +white = "#f8f8f2" + +[colors.bright] + +black = "#6272a4" +red = "#ff6e6e" +green = "#69ff94" +yellow = "#ffffa5" +blue = "#d6acff" +magenta = "#ff92df" +cyan = "#a4ffff" +white = "#ffffff" + +[colors.search.matches] + +foreground = "#44475a" +background = "#50fa7b" + +[colors.search.focused_match] + +foreground = "#44475a" +background = "#ffb86c" + +[colors.footer_bar] + +background = "#282a36" +foreground = "#f8f8f2" + +[colors.hints.start] + +foreground = "#282a36" +background = "#f1fa8c" + +[colors.hints.end] + +foreground = "#f1fa8c" +background = "#282a36" diff --git a/config/ghostty-dracula b/config/ghostty-dracula new file mode 100644 index 0000000..02ace5c --- /dev/null +++ b/config/ghostty-dracula @@ -0,0 +1,22 @@ +palette = 0=#21222c +palette = 1=#ff5555 +palette = 2=#50fa7b +palette = 3=#f1fa8c +palette = 4=#bd93f9 +palette = 5=#ff79c6 +palette = 6=#8be9fd +palette = 7=#f8f8f2 +palette = 8=#6272a4 +palette = 9=#ff6e6e +palette = 10=#69ff94 +palette = 11=#ffffa5 +palette = 12=#d6acff +palette = 13=#ff92df +palette = 14=#a4ffff +palette = 15=#ffffff +background = #282a36 +foreground = #f8f8f2 +cursor-color = #f8f8f2 +cursor-text = #282a36 +selection-foreground = #f8f8f2 +selection-background = #44475a diff --git a/config/ideavimrc b/config/ideavimrc new file mode 100644 index 0000000..0f5eb66 --- /dev/null +++ b/config/ideavimrc @@ -0,0 +1,8 @@ +set clipboard^=unnamedplus,unnamed +set hlsearch +set ignorecase +set smartcase +set incsearch +set ideajoin +set scrolloff=8 +set sidescrolloff=8 diff --git a/config/mpd.conf b/config/mpd.conf new file mode 100644 index 0000000..4eaf80f --- /dev/null +++ b/config/mpd.conf @@ -0,0 +1,19 @@ +log_level "verbose" +auto_update "yes" +group "audio" + +audio_output { + type "pipewire" + name "Pipewire Pulse" +} + +audio_output { + type "fifo" + name "FIFO" + path "/tmp/mpd.fifo" + format "44100:16:2" +} + +follow_outside_symlinks "yes" +follow_inside_symlinks "yes" +filesystem_charset "UTF-8" diff --git a/config/nvim/after/ftplugin/astro.lua b/config/nvim/after/ftplugin/astro.lua new file mode 100644 index 0000000..3c844d9 --- /dev/null +++ b/config/nvim/after/ftplugin/astro.lua @@ -0,0 +1 @@ +vim.opt_local.tabstop = 2 diff --git a/config/nvim/after/ftplugin/html.lua b/config/nvim/after/ftplugin/html.lua new file mode 100644 index 0000000..3c844d9 --- /dev/null +++ b/config/nvim/after/ftplugin/html.lua @@ -0,0 +1 @@ +vim.opt_local.tabstop = 2 diff --git a/config/nvim/after/ftplugin/javascript.lua b/config/nvim/after/ftplugin/javascript.lua new file mode 100644 index 0000000..13efb08 --- /dev/null +++ b/config/nvim/after/ftplugin/javascript.lua @@ -0,0 +1,2 @@ +vim.opt_local.tabstop = 2 + diff --git a/config/nvim/after/ftplugin/javascriptreact.lua b/config/nvim/after/ftplugin/javascriptreact.lua new file mode 100644 index 0000000..3c844d9 --- /dev/null +++ b/config/nvim/after/ftplugin/javascriptreact.lua @@ -0,0 +1 @@ +vim.opt_local.tabstop = 2 diff --git a/config/nvim/after/ftplugin/json.lua b/config/nvim/after/ftplugin/json.lua new file mode 100644 index 0000000..2f1df5c --- /dev/null +++ b/config/nvim/after/ftplugin/json.lua @@ -0,0 +1,3 @@ +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.shiftwidth = 2 diff --git a/config/nvim/after/ftplugin/lua.lua b/config/nvim/after/ftplugin/lua.lua new file mode 100644 index 0000000..3c844d9 --- /dev/null +++ b/config/nvim/after/ftplugin/lua.lua @@ -0,0 +1 @@ +vim.opt_local.tabstop = 2 diff --git a/config/nvim/after/ftplugin/markdown.lua b/config/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..da15724 --- /dev/null +++ b/config/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,15 @@ +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.shiftwidth = 4 +vim.opt.wrap = true + +vim.opt.linebreak = true +vim.opt.signcolumn = 'no' +vim.opt.number = false +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.shiftwidth = 2 +vim.opt.fillchars = { eob = ' ', fold = ' ' } + +vim.o.list = true +vim.o.conceallevel = 2 diff --git a/config/nvim/after/ftplugin/nix.lua b/config/nvim/after/ftplugin/nix.lua new file mode 100644 index 0000000..2f1df5c --- /dev/null +++ b/config/nvim/after/ftplugin/nix.lua @@ -0,0 +1,3 @@ +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.shiftwidth = 2 diff --git a/config/nvim/after/ftplugin/oil.lua b/config/nvim/after/ftplugin/oil.lua new file mode 100644 index 0000000..e5396c2 --- /dev/null +++ b/config/nvim/after/ftplugin/oil.lua @@ -0,0 +1,2 @@ +vim.opt_local.number = false +vim.opt_local.relativenumber = false diff --git a/config/nvim/after/ftplugin/python.lua b/config/nvim/after/ftplugin/python.lua new file mode 100644 index 0000000..650db5c --- /dev/null +++ b/config/nvim/after/ftplugin/python.lua @@ -0,0 +1,3 @@ +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.shiftwidth = 4 diff --git a/config/nvim/after/ftplugin/toml.lua b/config/nvim/after/ftplugin/toml.lua new file mode 100644 index 0000000..2f1df5c --- /dev/null +++ b/config/nvim/after/ftplugin/toml.lua @@ -0,0 +1,3 @@ +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.shiftwidth = 2 diff --git a/config/nvim/after/ftplugin/typescript.lua b/config/nvim/after/ftplugin/typescript.lua new file mode 100644 index 0000000..3c844d9 --- /dev/null +++ b/config/nvim/after/ftplugin/typescript.lua @@ -0,0 +1 @@ +vim.opt_local.tabstop = 2 diff --git a/config/nvim/after/ftplugin/typescriptreact.lua b/config/nvim/after/ftplugin/typescriptreact.lua new file mode 100644 index 0000000..3c844d9 --- /dev/null +++ b/config/nvim/after/ftplugin/typescriptreact.lua @@ -0,0 +1 @@ +vim.opt_local.tabstop = 2 diff --git a/config/nvim/after/ftplugin/typst.lua b/config/nvim/after/ftplugin/typst.lua new file mode 100644 index 0000000..e53652a --- /dev/null +++ b/config/nvim/after/ftplugin/typst.lua @@ -0,0 +1,2 @@ +vim.opt_local.wrap = true +vim.opt_local.tabstop = 2 diff --git a/config/nvim/after/ftplugin/yaml.lua b/config/nvim/after/ftplugin/yaml.lua new file mode 100644 index 0000000..2f1df5c --- /dev/null +++ b/config/nvim/after/ftplugin/yaml.lua @@ -0,0 +1,3 @@ +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.shiftwidth = 2 diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..57dfa7a --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,7 @@ +vim.loader.enable() + +require 'config.lazy' +require 'config.options' +require 'config.keymaps' +require 'config.autocmds' +require 'config.lsp' diff --git a/config/nvim/lsp/astro.lua b/config/nvim/lsp/astro.lua new file mode 100644 index 0000000..9106456 --- /dev/null +++ b/config/nvim/lsp/astro.lua @@ -0,0 +1,9 @@ +return { + cmd = { 'astro-ls', '--stdio' }, + filetypes = { 'astro' }, + init_options = { + typescript = { + tsdk = 'node_modules/typescript/lib', + }, + }, +} diff --git a/config/nvim/lsp/basedpyright.lua b/config/nvim/lsp/basedpyright.lua new file mode 100644 index 0000000..e6ea9a3 --- /dev/null +++ b/config/nvim/lsp/basedpyright.lua @@ -0,0 +1,12 @@ +return { + cmd = { 'basedpyright-langserver', '--stdio' }, + filetypes = { 'python' }, + settings = { + basedpyright = { + analysis = { + typeCheckingMode = 'off', + reportUnusedVariable = false, + }, + }, + }, +} diff --git a/config/nvim/lsp/clangd.lua b/config/nvim/lsp/clangd.lua new file mode 100644 index 0000000..28c7c2c --- /dev/null +++ b/config/nvim/lsp/clangd.lua @@ -0,0 +1,4 @@ +return { + cmd = { 'clangd' }, + filetypes = { 'c', 'cpp' }, +} diff --git a/config/nvim/lsp/emmet_ls.lua b/config/nvim/lsp/emmet_ls.lua new file mode 100644 index 0000000..b198b2d --- /dev/null +++ b/config/nvim/lsp/emmet_ls.lua @@ -0,0 +1,13 @@ +return { + cmd = { 'emmet-language-server', '--stdio' }, + filetypes = { + 'typescript', + 'javascriptreact', + 'typescriptreact', + 'vue', + 'astro', + 'php', + 'html', + 'css', + }, +} diff --git a/config/nvim/lsp/luals.lua b/config/nvim/lsp/luals.lua new file mode 100644 index 0000000..642fae1 --- /dev/null +++ b/config/nvim/lsp/luals.lua @@ -0,0 +1,23 @@ +return { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + }, + }, + diagnostics = { + globals = { 'vim' }, + }, + telemetry = { + enable = false, + }, + }, + }, +} diff --git a/config/nvim/lsp/nixd.lua b/config/nvim/lsp/nixd.lua new file mode 100644 index 0000000..7fc6b44 --- /dev/null +++ b/config/nvim/lsp/nixd.lua @@ -0,0 +1,4 @@ +return { + cmd = { 'nixd' }, + filetypes = { 'nix' }, +} diff --git a/config/nvim/lsp/tailwindcss.lua b/config/nvim/lsp/tailwindcss.lua new file mode 100644 index 0000000..163b09a --- /dev/null +++ b/config/nvim/lsp/tailwindcss.lua @@ -0,0 +1,14 @@ +return { + cmd = { 'tailwindcss-language-server', '--stdio' }, + filetypes = { + 'typescript', + 'javascriptreact', + 'typescriptreact', + 'svelte', + 'vue', + 'astro', + 'php', + 'html', + 'css', + }, +} diff --git a/config/nvim/lsp/ts_ls.lua b/config/nvim/lsp/ts_ls.lua new file mode 100644 index 0000000..2f7c59e --- /dev/null +++ b/config/nvim/lsp/ts_ls.lua @@ -0,0 +1,4 @@ +return { + cmd = { 'typescript-language-server', '--stdio' }, + filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact' }, +} diff --git a/config/nvim/lua/config/autocmds.lua b/config/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..3b47d3a --- /dev/null +++ b/config/nvim/lua/config/autocmds.lua @@ -0,0 +1,24 @@ +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) + +vim.api.nvim_create_autocmd('TermOpen', { + group = vim.api.nvim_create_augroup('custom-term-open', { clear = true }), + callback = function() + vim.opt.number = false + vim.opt.relativenumber = false + end, +}) + +vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client then + client.server_capabilities.semanticTokensProvider = nil + end + end, +}) diff --git a/config/nvim/lua/config/keymaps.lua b/config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..4bac7cb --- /dev/null +++ b/config/nvim/lua/config/keymaps.lua @@ -0,0 +1,56 @@ +---@diagnostic disable: unused-local +local key = vim.keymap + +key.set('n', 'q', ':q', { desc = '[q]uit' }) +key.set('n', 'fs', ':w', { desc = '[f]ile [s]ave' }) +key.set('n', 'fr', ':e', { desc = '[f]ile [r]efresh' }) +key.set('n', 'fx', ':source %', { desc = '[f]ile e[x]ecute' }) + +key.set('v', 'er', ':lua', { desc = '[f]ile [s]ave' }) + +key.set('n', 'bx', ':source %', { desc = 'e[x]ecute buffer' }) +key.set('n', 'bx', ':source %', { desc = 'e[x]ecute buffer' }) +key.set('n', 'bd', ':bdelete', { desc = '[b]uffer [d]elete' }) +key.set('n', 'bp', ':bprevious', { desc = '[b]uffer [p]revious' }) +key.set('n', 'bn', ':bnext', { desc = '[b]uffer [n]ext' }) + +key.set('n', 'j', 'gj') +key.set('n', 'k', 'gk') + +key.set('v', '<', '', '>gv') + +key.set('n', 'n', 'nzzzv') +key.set('n', 'N', 'nzzzv') + +key.set('v', 'p', '"_dP') + +key.set({ 'i', 's' }, '', function() + if vim.snippet then + vim.snippet.stop() + end + return '' +end) + +key.set('n', 'ws', ':split', { desc = '[w]indow [s]plit horizontally' }) +key.set('n', 'wv', ':vsplit', { desc = '[w]indow split [v]ertically' }) +key.set('n', 'wh', '', { desc = 'move focus to left window' }) +key.set('n', 'wj', '', { desc = 'move focus to bottom window' }) +key.set('n', 'wk', '', { desc = 'move focus to top window' }) +key.set('n', 'wl', '', { desc = 'move focus to right window' }) +key.set('n', 'wc', 'c', { desc = '[w]indow [c]lose' }) +key.set('n', 'wo', 'o', { desc = '[w]indow make it [o]pen wide' }) + +key.set('n', '', ':cnext', { desc = 'quickfix next' }) +key.set('n', '', ':cprev', { desc = 'quickfix previous' }) + +key.set('t', '', '', { desc = 'easier terminal normal mode' }) + +local job_id = 0 +key.set('n', 'to', function() + vim.cmd.vnew() + vim.cmd.term() + vim.cmd.wincmd 'J' + vim.api.nvim_win_set_height(0, 13) + job_id = vim.bo.channel +end, { desc = '[t]erminal [o]pen' }) diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..2c3fc10 --- /dev/null +++ b/config/nvim/lua/config/lazy.lua @@ -0,0 +1,40 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, + { out, 'WarningMsg' }, + { '\nPress any key to exit...' }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Setup lazy.nvim +require('lazy').setup { + spec = { + { + 'tpope/vim-fugitive', + config = function() + vim.keymap.set('n', 'gd', ':0G', { desc = '[g]it [d]ashboard' }) + end, + }, + + { 'chrisbra/csv.vim', ft = 'csv' }, + { import = 'plugins' }, + }, + change_detection = { + notify = false, + }, +} diff --git a/config/nvim/lua/config/lsp.lua b/config/nvim/lua/config/lsp.lua new file mode 100644 index 0000000..49b43ca --- /dev/null +++ b/config/nvim/lua/config/lsp.lua @@ -0,0 +1,58 @@ +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspAttach', { clear = true }), + callback = function(args) + local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) + + local opts = { noremap = true, silent = true } + local k = vim.keymap + + k.set('n', 'gd', function() vim.lsp.buf.definition() end, { desc = '[g]oto [d]efinition' }) + k.set('n', 'lt', ':checkhealth vim.lsp', opts) + k.set('n', 'lr', vim.lsp.buf.rename, opts) + k.set('n', 'la', vim.lsp.buf.code_action, opts) + k.set('n', 'gr', vim.lsp.buf.references, opts) + k.set('n', '[d', function() vim.diagnostic.jump({ count = -1, float = true }) end, opts) + k.set('n', ']d', function() vim.diagnostic.jump({ count = 1, float = true }) end, opts) + + -- Auto-formatting (with Editorconfig) + if client:supports_method 'textDocument/willSaveWaitUntil' and client:supports_method 'textDocument/formatting' then + vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('UserLspAttach', { clear = false }), + buffer = args.buf, + callback = function() + vim.lsp.buf.format { bufnr = args.buf, id = client.id, timeout_ms = 1000 } + end, + }) + end + end, +}) +vim.o.completeopt = 'menuone,noinsert,popup,fuzzy,noselect' +vim.o.winborder = 'rounded' -- rounded borders in floating windows + +-- Diagnostics +vim.diagnostic.config { + severity_sort = true, + signs = true, + underline = true, + virtual_text = true, + -- virtual_lines = true, +} + +-- Configs +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +vim.lsp.config('*', { + capabilities = capabilities, +}) + +vim.lsp.enable({ + "astro", + "basedpyright", + "clangd", + "emmet_ls", + "luals", + "nixd", + "tailwindcss", + "ts_ls", +}) diff --git a/config/nvim/lua/config/options.lua b/config/nvim/lua/config/options.lua new file mode 100644 index 0000000..26b422d --- /dev/null +++ b/config/nvim/lua/config/options.lua @@ -0,0 +1,30 @@ +local set = vim.opt + +set.cole = 0 +set.tabstop = 4 +set.shiftwidth = 0 +set.wrap = false +set.number = true +set.softtabstop = -1 +set.smarttab = true +set.expandtab = false +set.ignorecase = true +set.smartcase = true +set.updatetime = 100 +set.redrawtime = 10000 +set.timeoutlen = 300 +set.hlsearch = true +set.clipboard = 'unnamedplus' +set.signcolumn = 'yes:1' +set.foldcolumn = '0' +set.list = true +set.undofile = true +set.cmdheight = 1 +set.fillchars = { eob = ' ', fold = ' ' } +set.listchars = { tab = '│ ', trail = '·', nbsp = '␣' } + +vim.o.foldenable = true +vim.o.foldlevel = 99 +vim.o.foldmethod = 'expr' +vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()' +vim.o.foldtext = '' diff --git a/config/nvim/lua/config/telescope/multigrep.lua b/config/nvim/lua/config/telescope/multigrep.lua new file mode 100644 index 0000000..320e864 --- /dev/null +++ b/config/nvim/lua/config/telescope/multigrep.lua @@ -0,0 +1,57 @@ +local pickers = require 'telescope.pickers' +local finders = require 'telescope.finders' +local make_entry = require 'telescope.make_entry' +local conf = require('telescope.config').values + +local M = {} + +local live_multigrep = function(opts) + opts = opts or {} + opts.cwd = opts.cwd or vim.uv.cwd() + + local finder = finders.new_async_job { + command_generator = function(prompt) + if not prompt or prompt == '' then + return nil + end + + local pieces = vim.split(prompt, ' ') + local args = { 'rg' } + if pieces[1] then + table.insert(args, '-e') + table.insert(args, pieces[1]) + end + + if pieces[2] then + table.insert(args, '-g') + table.insert(args, pieces[2]) + end + + return vim + .iter({ + args, + { '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' }, + }) + :flatten() + :totable() + end, + entry_maker = make_entry.gen_from_vimgrep(opts), + cwd = opts.cwd, + } + + pickers + .new(opts, { + debounce = 100, + prompt_title = 'Multi Grep', + finder = finder, + previewer = conf.grep_previewer(opts), + sorter = require('telescope.sorters').empty(), + }) + :find() +end + +M.setup = function() + return live_multigrep +end + +return M diff --git a/config/nvim/lua/plugins/autotag.lua b/config/nvim/lua/plugins/autotag.lua new file mode 100644 index 0000000..bcbd0eb --- /dev/null +++ b/config/nvim/lua/plugins/autotag.lua @@ -0,0 +1,7 @@ +return { + { + 'windwp/nvim-ts-autotag', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + opts = {}, + }, +} diff --git a/config/nvim/lua/plugins/blink.lua b/config/nvim/lua/plugins/blink.lua new file mode 100644 index 0000000..9258ddc --- /dev/null +++ b/config/nvim/lua/plugins/blink.lua @@ -0,0 +1,23 @@ +return { + 'saghen/blink.cmp', + dependencies = { 'rafamadriz/friendly-snippets' }, + build = 'cargo build --release', + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'enter' }, + appearance = { + nerd_font_variant = 'mono' + }, + completion = { documentation = { auto_show = true } }, + }, + opts_extend = { "sources.default" } +} diff --git a/config/nvim/lua/plugins/colorscheme.lua b/config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..71e58de --- /dev/null +++ b/config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,12 @@ +return { + { + 'Mofiqul/dracula.nvim', + lazy = false, + priority = 1000, + config = function() + require('dracula').setup {} + + vim.cmd.colorscheme 'dracula' + end, + }, +} diff --git a/config/nvim/lua/plugins/comment.lua b/config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..584d320 --- /dev/null +++ b/config/nvim/lua/plugins/comment.lua @@ -0,0 +1,17 @@ +return { + { + 'numToStr/Comment.nvim', + dependencies = { + 'JoosepAlviste/nvim-ts-context-commentstring', + }, + config = function() + require('ts_context_commentstring').setup { + enable_autocmd = false, + } + + require('Comment').setup { + pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(), + } + end, + }, +} diff --git a/config/nvim/lua/plugins/fzf.lua b/config/nvim/lua/plugins/fzf.lua new file mode 100644 index 0000000..0fc70d1 --- /dev/null +++ b/config/nvim/lua/plugins/fzf.lua @@ -0,0 +1,47 @@ +return { + 'ibhagwan/fzf-lua', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + local key = vim.keymap + local fzf = require('fzf-lua') + + fzf.setup { + 'telescope', + winopts = { + preview = { + layout = 'vertical', + vertical = 'down:60%' + }, + width = 0.95 + } + } + + local search_nvim_conf = function() + fzf.files { + cwd = vim.fn.stdpath 'config' + } + end + + key.set('n', '', fzf.buffers, { desc = 'search buffers' }) + + -- key.set('n', 'sf', fzf.files, { desc = '[s]earch [f]iles' }) + key.set('n', 'sl', fzf.blines, { desc = '[s]earch buffer [l]ines' }) + key.set('n', 'sh', fzf.helptags, { desc = '[s]earch [h]elp' }) + key.set('n', 'sk', fzf.keymaps, { desc = '[s]earch [k]eymaps' }) + key.set('n', 'sn', search_nvim_conf, { desc = '[s]earch [n]vim config files' }) + key.set('n', 'ss', fzf.builtin, { desc = '[s]earch [s]earchables' }) + + key.set('n', 'sf', fzf.files, { desc = '[s]earch [f]iles' }) + key.set('n', 'pf', fzf.files, { desc = '[p]roject [f]iles' }) + key.set('n', 'pg', fzf.live_grep_native, { desc = '[p]roject [g]rep' }) + + key.set('n', 'gc', fzf.git_commits, { desc = '[g]it [c]ommits' }) + key.set('n', 'gb', fzf.git_branches, { desc = '[g]it [b]ranches' }) + key.set('n', 'gt', fzf.git_status, { desc = '[g]it [s]tatus' }) + + key.set('n', 'ld', fzf.lsp_workspace_diagnostics, { desc = '[L]SP [d]iagnostics' }) + key.set('n', 'ls', fzf.lsp_document_symbols, { desc = '[L]SP [s]ymbols' }) + end +} diff --git a/config/nvim/lua/plugins/gitsigns.lua b/config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..5357f5a --- /dev/null +++ b/config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,15 @@ +return { + 'lewis6991/gitsigns.nvim', + config = function () + require('gitsigns').setup { + signs = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + } + end, +} diff --git a/config/nvim/lua/plugins/obsidian.lua b/config/nvim/lua/plugins/obsidian.lua new file mode 100644 index 0000000..df4cf92 --- /dev/null +++ b/config/nvim/lua/plugins/obsidian.lua @@ -0,0 +1,19 @@ +return { + 'obsidian-nvim/obsidian.nvim', + version = '*', + lazy = true, + event = { + 'BufReadPre ' .. vim.fn.expand '~' .. '/Documents/obsidian/*.md', + }, + dependencies = { + 'nvim-lua/plenary.nvim', + }, + opts = { + workspaces = { + { + name = 'personal', + path = '~/Documents/obsidian' + } + }, + }, +} diff --git a/config/nvim/lua/plugins/oil.lua b/config/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..8cba704 --- /dev/null +++ b/config/nvim/lua/plugins/oil.lua @@ -0,0 +1,16 @@ +return { + { + 'stevearc/oil.nvim', + config = function() + vim.keymap.set('n', 'fe', ':Oil', { desc = '[f]ile [e]xplorer' }) + vim.keymap.set('n', '-', ':Oil', { desc = 'file explorer' }) + require('oil').setup { + default_file_explorer = true, + delete_to_trash = true, + view_options = { + show_hidden = true, + }, + } + end, + }, +} diff --git a/config/nvim/lua/plugins/snacks.lua b/config/nvim/lua/plugins/snacks.lua new file mode 100644 index 0000000..7750319 --- /dev/null +++ b/config/nvim/lua/plugins/snacks.lua @@ -0,0 +1,13 @@ +return { + { + 'folke/snacks.nvim', + priority = 1000, + config = function() + require('snacks').setup { + quickfile = { + enable = true, + }, + } + end, + }, +} diff --git a/config/nvim/lua/plugins/treesitter.lua b/config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..4e77071 --- /dev/null +++ b/config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,38 @@ +---@diagnostic disable: missing-fields +return { + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = { + 'lua', + 'python', + 'c', + 'javascript', + 'typescript', + 'astro', + }, + auto_install = false, + -- ignore_install = {}, + highlight = { + enable = true, + ---@diagnostic disable-next-line: unused-local + disable = function(lang, buf) + local max_filesize = 100 * 1024 + ---@diagnostic disable-next-line: undefined-field + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + disable = { 'python', 'c' }, + }, + } + end, + }, +} diff --git a/config/nvim/plugin/floaterm.lua b/config/nvim/plugin/floaterm.lua new file mode 100644 index 0000000..86505ed --- /dev/null +++ b/config/nvim/plugin/floaterm.lua @@ -0,0 +1,51 @@ +local state = { + floating = { + buf = -1, + win = -1, + }, +} + +local function create_floating_window(opts) + opts = opts or {} + local width = opts.width or math.floor(vim.o.columns * 0.8) + local height = opts.height or math.floor(vim.o.lines * 0.8) + + local col = math.floor((vim.o.columns - width) / 2) + local row = math.floor((vim.o.lines - height) / 2) + + local buf = nil + if vim.api.nvim_buf_is_valid(opts.buf) then + buf = opts.buf + else + buf = vim.api.nvim_create_buf(false, true) + end + + local win_config = { + relative = 'editor', + width = width, + height = height, + col = col, + row = row, + style = 'minimal', + border = 'rounded', + } + + local win = vim.api.nvim_open_win(buf, true, win_config) + + return { buf = buf, win = win } +end + +local toggle_terminal = function() + if not vim.api.nvim_win_is_valid(state.floating.win) then + state.floating = create_floating_window { buf = state.floating.buf } + if vim.bo[state.floating.buf].buftype ~= 'terminal' then + vim.cmd.term() + end + else + vim.api.nvim_win_hide(state.floating.win) + end +end + +vim.api.nvim_create_user_command('Floaterm', toggle_terminal, {}) + +vim.keymap.set({ 'n', 't' }, '', toggle_terminal, { desc = '[t]oggle [t]erminal' }) diff --git a/config/p10k-config b/config/p10k-config new file mode 100644 index 0000000..6a9360a --- /dev/null +++ b/config/p10k-config @@ -0,0 +1,199 @@ +# Generated by Powerlevel10k configuration wizard on 2024-12-04 at 03:24 PST. +# Based on romkatv/powerlevel10k/config/p10k-pure.zsh, checksum 07533. +# Wizard options: nerdfont-v3 + powerline, large icons, pure, snazzy, 2 lines, sparse, +# transient_prompt, instant_prompt=quiet. +# Type `p10k configure` to generate another config. +# +# Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure). +# +# Differences from Pure: +# +# - Git: +# - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state. +# - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`). +# +# Apart from the differences listed above, the replication of Pure prompt is exact. This includes +# even the questionable parts. For example, just like in Pure, there is no indication of Git status +# being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt +# doesn't fit on one line, it wraps around with no attempt to shorten it. +# +# If you like the general style of Pure but not particularly attached to all its quirks, type +# `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking +# advantage of Powerlevel10k features that aren't present in Pure. + +# Temporarily change options. +'builtin' 'local' '-a' 'p10k_config_opts' +[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') +[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') +[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') +'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' + +() { + emulate -L zsh -o extended_glob + + # Unset all configuration options. + unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' + + # Zsh >= 5.1 is required. + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return + + # Prompt colors. + local grey='242' + local red='#FF5C57' + local yellow='#F3F99D' + local blue='#57C7FF' + local magenta='#FF6AC1' + local cyan='#9AEDFE' + local white='#F1F1F0' + + # Left prompt segments. + typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( + # =========================[ Line #1 ]========================= + context # user@host + dir # current directory + vcs # git status + command_execution_time # previous command duration + # =========================[ Line #2 ]========================= + newline # \n + virtualenv # python virtual environment + prompt_char # prompt symbol + ) + + # Right prompt segments. + typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( + # =========================[ Line #1 ]========================= + # command_execution_time # previous command duration + # virtualenv # python virtual environment + # context # user@host + # time # current time + # =========================[ Line #2 ]========================= + newline # \n + ) + + # Basic style options that define the overall prompt look. + typeset -g POWERLEVEL9K_BACKGROUND= # transparent background + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol + typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons + + # Add an empty line before each prompt except the first. This doesn't emulate the bug + # in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar. + typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true + + # Magenta prompt symbol if the last command succeeded. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta + # Red prompt symbol if the last command failed. + typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red + # Default prompt symbol. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' + # Prompt symbol in command vi mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' + # Prompt symbol in visual vi mode is the same as in command mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮' + # Prompt symbol in overwrite vi mode is the same as in command mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false + + # Grey Python Virtual Environment. + typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey + # Don't show Python version. + typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false + typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= + + # Blue current directory. + typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue + + # Context format when root: user@host. The first part white, the rest grey. + typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f" + # Context format when not root: user@host. The whole thing grey. + typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f" + # Don't show context unless root or in SSH. + typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION= + + # Show previous command duration only if it's >= 5s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5 + # Don't show fractional seconds. Thus, 7s rather than 7.3s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 + # Duration format: 1d 2h 3m 4s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' + # Yellow previous command duration. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow + + # Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones. + typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey + + # Disable async loading indicator to make directories that aren't Git repositories + # indistinguishable from large Git repositories without known state. + typeset -g POWERLEVEL9K_VCS_LOADING_TEXT= + + # Don't wait for Git status even for a millisecond, so that prompt always updates + # asynchronously when Git state changes. + typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0 + + # Cyan ahead/behind arrows. + typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan + # Don't show remote branch, current tag or stashes. + typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind) + # Don't show the branch icon. + typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= + # When in detached HEAD state, show @commit where branch normally goes. + typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@' + # Don't show staged, unstaged, untracked indicators. + typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON= + # Show '*' when there are staged, unstaged or untracked files. + typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*' + # Show '⇣' if local branch is behind remote. + typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣' + # Show '⇡' if local branch is ahead of remote. + typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡' + # Don't show the number of commits next to the ahead/behind arrows. + typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1 + # Remove space between '⇣' and '⇡' and all trailing spaces. + typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }' + + # Grey current time. + typeset -g POWERLEVEL9K_TIME_FOREGROUND=$grey + # Format for the current time: 09:51:02. See `man 3 strftime`. + typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' + # If set to true, time will update when you hit enter. This way prompts for the past + # commands will contain the start times of their commands rather than the end times of + # their preceding commands. + typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false + + # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt + # when accepting a command line. Supported values: + # + # - off: Don't change prompt when accepting a command line. + # - always: Trim down prompt when accepting a command line. + # - same-dir: Trim down prompt when accepting a command line unless this is the first command + # typed after changing current working directory. + typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always + + # Instant prompt mode. + # + # - off: Disable instant prompt. Choose this if you've tried instant prompt and found + # it incompatible with your zsh configuration files. + # - quiet: Enable instant prompt and don't print warnings when detecting console output + # during zsh initialization. Choose this if you've read and understood + # https://github.com/romkatv/powerlevel10k#instant-prompt. + # - verbose: Enable instant prompt and print a warning when detecting console output during + # zsh initialization. Choose this if you've never tried instant prompt, haven't + # seen the warning, or if you are unsure what this all means. + typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet + + # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. + # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload + # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you + # really need it. + typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true + + # If p10k is already loaded, reload configuration. + # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. + (( ! $+functions[p10k] )) || p10k reload +} + +# Tell `p10k configure` which file it should overwrite. +typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} + +(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} +'builtin' 'unset' 'p10k_config_opts' diff --git a/config/spacemacs b/config/spacemacs new file mode 100644 index 0000000..f57d23b --- /dev/null +++ b/config/spacemacs @@ -0,0 +1,542 @@ +;; -*- mode: emacs-lisp; lexical-binding: t -*- +;; This file is loaded by Spacemacs at startup. +;; It must be stored in your home directory. + +(defun dotspacemacs/layers () + "Layer configuration: +This function should only modify configuration layer settings." + (setq-default + dotspacemacs-distribution 'spacemacs + dotspacemacs-enable-lazy-installation 'unused + dotspacemacs-ask-for-lazy-installation t + + ;; List of additional paths where to look for configuration layers. + ;; Paths must have a trailing slash (i.e. "~/.mycontribs/") + dotspacemacs-configuration-layer-path '() + dotspacemacs-configuration-layers + '(yaml + html + shell-scripts + + ;; Spacemacs + spacemacs-project + spacemacs-defaults + spacemacs-org + spacemacs-evil + + ;; Fonts + emoji + unicode-fonts + + ;; editing + better-defaults + compleseus + auto-completion + multiple-cursors + prettier + + ;; tools + pdf + git + (shell :variables + shell-default-shell 'vterm + shell-default-term-shell "/home/dpv/.nix-profile/bin/zsh" + spacemacs-vterm-history-file-location "~/.local/share/zsh/zsh_history") + + ;; apps + hackernews + + ;; development + (lsp :variables + lsp-headerline-breadcrumb-enable nil) + emacs-lisp + c-c++ + lua + go + php + react + markdown + (python :variables python-backend 'lsp python-lsp-server 'pyright) + (javascript :variables + javascript-backend 'lsp) + (typescript :variables + typescript-backend 'lsp) + (docker :variables + docker-dockerfile-backend 'lsp) + + ;; Custom + dat-utils + dat-tabs + dat-notetaking + dat-emms) + + dotspacemacs-additional-packages '(doom-themes org-modern persistent-scratch autothemer) + + ;; A list of packages that cannot be updated. + dotspacemacs-frozen-packages '() + + ;; A list of packages that will not be installed and loaded. + dotspacemacs-excluded-packages + '(vi-tilde-fringe) + + ;; Defines the behaviour of Spacemacs when installing packages. + ;; Possible values are `used-only', `used-but-keep-unused' and `all'. + ;; `used-only' installs only explicitly used packages and deletes any unused + ;; packages as well as their unused dependencies. `used-but-keep-unused' + ;; installs only the used packages but won't delete unused ones. `all' + ;; installs *all* packages supported by Spacemacs and never uninstalls them. + ;; (default is `used-only') + dotspacemacs-install-packages 'used-only)) + +(defun dotspacemacs/init () + "Initialization: +This function is called at the very beginning of Spacemacs startup, +before layer configuration. +It should only modify the values of Spacemacs settings." + ;; This setq-default sexp is an exhaustive list of all the supported + ;; spacemacs settings. + (setq-default + ;; If non-nil then enable support for the portable dumper. You'll need to + ;; compile Emacs 27 from source following the instructions in file + ;; EXPERIMENTAL.org at to root of the git repository. + ;; + ;; WARNING: pdumper does not work with Native Compilation, so it's disabled + ;; regardless of the following setting when native compilation is in effect. + ;; + ;; (default nil) + dotspacemacs-enable-emacs-pdumper nil + + ;; Name of executable file pointing to emacs 27+. This executable must be + ;; in your PATH. + ;; (default "emacs") + dotspacemacs-emacs-pdumper-executable-file "emacs" + + ;; Name of the Spacemacs dump file. This is the file will be created by the + ;; portable dumper in the cache directory under dumps sub-directory. + ;; To load it when starting Emacs add the parameter `--dump-file' + ;; when invoking Emacs 27.1 executable on the command line, for instance: + ;; ./emacs --dump-file=$HOME/.emacs.d/.cache/dumps/spacemacs-27.1.pdmp + ;; (default (format "spacemacs-%s.pdmp" emacs-version)) + dotspacemacs-emacs-dumper-dump-file (format "spacemacs-%s.pdmp" emacs-version) + + ;; Maximum allowed time in seconds to contact an ELPA repository. + ;; (default 5) + dotspacemacs-elpa-timeout 5 + + ;; Set `gc-cons-threshold' and `gc-cons-percentage' when startup finishes. + ;; This is an advanced option and should not be changed unless you suspect + ;; performance issues due to garbage collection operations. + ;; (default '(100000000 0.1)) + dotspacemacs-gc-cons '(100000000 0.1) + + ;; Set `read-process-output-max' when startup finishes. + ;; This defines how much data is read from a foreign process. + ;; Setting this >= 1 MB should increase performance for lsp servers + ;; in emacs 27. + ;; (default (* 1024 1024)) + dotspacemacs-read-process-output-max (* 1024 1024) + + ;; If non-nil then Spacelpa repository is the primary source to install + ;; a locked version of packages. If nil then Spacemacs will install the + ;; latest version of packages from MELPA. Spacelpa is currently in + ;; experimental state please use only for testing purposes. + ;; (default nil) + dotspacemacs-use-spacelpa nil + + ;; If non-nil then verify the signature for downloaded Spacelpa archives. + ;; (default t) + dotspacemacs-verify-spacelpa-archives t + + ;; If non-nil then spacemacs will check for updates at startup + ;; when the current branch is not `develop'. Note that checking for + ;; new versions works via git commands, thus it calls GitHub services + ;; whenever you start Emacs. (default nil) + dotspacemacs-check-for-update nil + + ;; If non-nil, a form that evaluates to a package directory. For example, to + ;; use different package directories for different Emacs versions, set this + ;; to `emacs-version'. (default 'emacs-version) + dotspacemacs-elpa-subdirectory 'emacs-version + + ;; One of `vim', `emacs' or `hybrid'. + ;; `hybrid' is like `vim' except that `insert state' is replaced by the + ;; `hybrid state' with `emacs' key bindings. The value can also be a list + ;; with `:variables' keyword (similar to layers). Check the editing styles + ;; section of the documentation for details on available variables. + ;; (default 'vim) + dotspacemacs-editing-style 'vim + + ;; If non-nil show the version string in the Spacemacs buffer. It will + ;; appear as (spacemacs version)@(emacs version) + ;; (default t) + dotspacemacs-startup-buffer-show-version t + dotspacemacs-startup-banner 'official + dotspacemacs-startup-banner-scale 'auto + dotspacemacs-startup-lists '((recents . 5) + (projects . 7)) + dotspacemacs-startup-buffer-responsive t + dotspacemacs-show-startup-list-numbers t + dotspacemacs-startup-buffer-multi-digit-delay 0.4 + dotspacemacs-startup-buffer-show-icons nil + + ;; Default major mode for a new empty buffer. Possible values are mode + ;; names such as `text-mode'; and `nil' to use Fundamental mode. + ;; (default `text-mode') + dotspacemacs-new-empty-buffer-major-mode 'text-mode + + ;; Default major mode of the scratch buffer (default `text-mode') + dotspacemacs-scratch-mode 'text-mode + + ;; If non-nil, *scratch* buffer will be persistent. Things you write down in + ;; *scratch* buffer will be saved and restored automatically. + dotspacemacs-scratch-buffer-persistent nil + + ;; If non-nil, `kill-buffer' on *scratch* buffer + ;; will bury it instead of killing. + dotspacemacs-scratch-buffer-unkillable nil + + ;; Initial message in the scratch buffer, such as "Welcome to Spacemacs!" + ;; (default nil) + dotspacemacs-initial-scratch-message nil + + ;; List of themes, the first of the list is loaded when spacemacs starts. + ;; Press `SPC T n' to cycle to the next theme in the list (works great + ;; with 2 themes variants, one dark and one light). A theme from external + ;; package can be defined with `:package', or a theme can be defined with + ;; `:location' to download the theme package, refer the themes section in + ;; DOCUMENTATION.org for the full theme specifications. + dotspacemacs-themes '(doom-dracula + modus-operandi-deuteranopia) + + ;; Set the theme for the Spaceline. Supported themes are `spacemacs', + ;; `all-the-icons', `custom', `doom', `vim-powerline' and `vanilla'. The + ;; first three are spaceline themes. `doom' is the doom-emacs mode-line. + ;; `vanilla' is default Emacs mode-line. `custom' is a user defined themes, + ;; refer to the DOCUMENTATION.org for more info on how to create your own + ;; spaceline theme. Value can be a symbol or list with additional properties. + ;; (default '(spacemacs :separator wave :separator-scale 1.5)) + dotspacemacs-mode-line-theme 'doom + + ;; If non-nil the cursor color matches the state color in GUI Emacs. + ;; (default t) + dotspacemacs-colorize-cursor-according-to-state t + + ;; Default font or prioritized list of fonts. This setting has no effect when + ;; running Emacs in terminal. The font set here will be used for default and + ;; fixed-pitch faces. The `:size' can be specified as + ;; a non-negative integer (pixel size), or a floating-point (point size). + ;; Point size is recommended, because it's device independent. (default 10.0) + dotspacemacs-default-font '("Iosevka Nerd Font" + :size 15.0 + :weight medium) + + dotspacemacs-leader-key "SPC" + dotspacemacs-emacs-command-key "SPC" + dotspacemacs-ex-command-key ":" + dotspacemacs-emacs-leader-key "M-m" + dotspacemacs-major-mode-leader-key "," + dotspacemacs-major-mode-emacs-leader-key (if window-system "" "C-M-m") + + dotspacemacs-distinguish-gui-tab nil + dotspacemacs-default-layout-name "Default" + dotspacemacs-display-default-layout nil + dotspacemacs-auto-resume-layouts nil + dotspacemacs-auto-generate-layout-names nil + + dotspacemacs-large-file-size 1 + dotspacemacs-auto-save-file-location 'cache + dotspacemacs-max-rollback-slots 5 + dotspacemacs-enable-paste-transient-state nil + + dotspacemacs-which-key-delay 0.4 + + ;; Which-key frame position. Possible values are `right', `bottom' and + ;; `right-then-bottom'. right-then-bottom tries to display the frame to the + ;; right; if there is insufficient space it displays it at the bottom. + ;; It is also possible to use a posframe with the following cons cell + ;; `(posframe . position)' where position can be one of `center', + ;; `top-center', `bottom-center', `top-left-corner', `top-right-corner', + ;; `top-right-corner', `bottom-left-corner' or `bottom-right-corner' + ;; (default 'bottom) + dotspacemacs-which-key-position 'bottom + + ;; Control where `switch-to-buffer' displays the buffer. If nil, + ;; `switch-to-buffer' displays the buffer in the current window even if + ;; another same-purpose window is available. If non-nil, `switch-to-buffer' + ;; displays the buffer in a same-purpose window even if the buffer can be + ;; displayed in the current window. (default nil) + dotspacemacs-switch-to-buffer-prefers-purpose nil + + ;; Whether side windows (such as those created by treemacs or neotree) + ;; are kept or minimized by `spacemacs/toggle-maximize-window' (SPC w m). + ;; (default t) + dotspacemacs-maximize-window-keep-side-windows t + + ;; If nil, no load-hints enabled. If t, enable the `load-hints' which will + ;; put the most likely path on the top of `load-path' to reduce walking + ;; through the whole `load-path'. It's an experimental feature to speedup + ;; Spacemacs on Windows. Refer the FAQ.org "load-hints" session for details. + dotspacemacs-enable-load-hints nil + + ;; If t, enable the `package-quickstart' feature to avoid full package + ;; loading, otherwise no `package-quickstart' attemption (default nil). + ;; Refer the FAQ.org "package-quickstart" section for details. + dotspacemacs-enable-package-quickstart nil + dotspacemacs-loading-progress-bar nil + dotspacemacs-fullscreen-at-startup nil + dotspacemacs-fullscreen-use-non-native nil + dotspacemacs-maximized-at-startup t + + ;; If non-nil the frame is undecorated when Emacs starts up. Combine this + ;; variable with `dotspacemacs-maximized-at-startup' to obtain fullscreen + ;; without external boxes. Also disables the internal border. (default nil) + dotspacemacs-undecorated-at-startup nil + + ;; A value from the range (0..100), in increasing opacity, which describes + ;; the transparency level of a frame when it's active or selected. + ;; Transparency can be toggled through `toggle-transparency'. (default 90) + dotspacemacs-active-transparency 90 + + ;; A value from the range (0..100), in increasing opacity, which describes + ;; the transparency level of a frame when it's inactive or deselected. + ;; Transparency can be toggled through `toggle-transparency'. (default 90) + dotspacemacs-inactive-transparency 70 + + ;; A value from the range (0..100), in increasing opacity, which describes the + ;; transparency level of a frame background when it's active or selected. Transparency + ;; can be toggled through `toggle-background-transparency'. (default 90) + dotspacemacs-background-transparency 90 + + ;; If non-nil show the titles of transient states. (default t) + dotspacemacs-show-transient-state-title t + + ;; If non-nil show the color guide hint for transient state keys. (default t) + dotspacemacs-show-transient-state-color-guide t + + ;; If non-nil unicode symbols are displayed in the mode line. + ;; If you use Emacs as a daemon and wants unicode characters only in GUI set + ;; the value to quoted `display-graphic-p'. (default t) + dotspacemacs-mode-line-unicode-symbols t + dotspacemacs-smooth-scrolling t + dotspacemacs-scroll-bar-while-scrolling nil + + dotspacemacs-line-numbers '(:relative t :size-limit-kb 1000) + dotspacemacs-folding-method 'evil + dotspacemacs-smartparens-strict-mode nil + + ;; If non-nil smartparens-mode will be enabled in programming modes. + ;; (default t) + dotspacemacs-activate-smartparens-mode t + + ;; If non-nil pressing the closing parenthesis `)' key in insert mode passes + ;; over any automatically added closing parenthesis, bracket, quote, etc... + ;; This can be temporary disabled by pressing `C-q' before `)'. (default nil) + dotspacemacs-smart-closing-parenthesis nil + + ;; Select a scope to highlight delimiters. Possible values are `any', + ;; `current', `all' or `nil'. Default is `all' (highlight any scope and + ;; emphasis the current one). (default 'all) + dotspacemacs-highlight-delimiters 'all + + ;; If non-nil, start an Emacs server if one is not already running. + ;; (default nil) + dotspacemacs-enable-server nil + + ;; Set the emacs server socket location. + ;; If nil, uses whatever the Emacs default is, otherwise a directory path + ;; like \"~/.emacs.d/server\". It has no effect if + ;; `dotspacemacs-enable-server' is nil. + ;; (default nil) + dotspacemacs-server-socket-dir nil + + ;; If non-nil, advise quit functions to keep server open when quitting. + ;; (default nil) + dotspacemacs-persistent-server nil + + ;; List of search tool executable names. Spacemacs uses the first installed + ;; tool of the list. Supported tools are `rg', `ag', `pt', `ack' and `grep'. + ;; (default '("rg" "ag" "pt" "ack" "grep")) + dotspacemacs-search-tools '("rg" "ag" "pt" "ack" "grep") + + ;; The backend used for undo/redo functionality. Possible values are + ;; `undo-fu', `undo-redo' and `undo-tree' see also `evil-undo-system'. + ;; Note that saved undo history does not get transferred when changing + ;; your undo system. The default is currently `undo-fu' as `undo-tree' + ;; is not maintained anymore and `undo-redo' is very basic." + dotspacemacs-undo-system 'undo-fu + dotspacemacs-frame-title-format "%F - %a" + dotspacemacs-icon-title-format nil + dotspacemacs-show-trailing-whitespace t + dotspacemacs-whitespace-cleanup nil + dotspacemacs-use-clean-aindent-mode t + dotspacemacs-use-SPC-as-y nil + dotspacemacs-swap-number-row nil + dotspacemacs-zone-out-when-idle nil + dotspacemacs-pretty-docs nil + dotspacemacs-home-shorten-agenda-source nil + dotspacemacs-byte-compile nil)) + +(defun dotspacemacs/user-env () + (spacemacs/load-spacemacs-env)) + +(defun dotspacemacs/user-init () + ;; (add-to-list 'custom-theme-load-path "~/.emacs.d/private/themes/") + (setq-default git-magit-status-fullscreen t)) + +(defun dotspacemacs/user-load ()) + +(defun dotspacemacs/user-config () + ;; Custom functions + (setq-default indent-tabs-mode t) + (setq-default tab-width 4) + (defvaralias 'c-basic-offset 'tab-width) + + (setq initial-buffer-choice (lambda () (get-buffer "*scratch*"))) + + (tab-bar-mode -1) + + ;; Configure packages + (with-eval-after-load 'projectile + (setq projectile-project-search-path '("~/dev" "~/dev/gitlab") + projectile-require-project-root nil)) + + (with-eval-after-load 'doom-modeline + (setq doom-modeline-icon nil)) + + ;; Enable truncating lines + (add-hook 'hack-local-variables-hook #'spacemacs/toggle-truncate-lines-on) + + ;; More themes + (use-package doom-themes + :ensure t + :config + (setq doom-themes-enable-bold t + doom-themes-enable-italic t) + (doom-themes-org-config)) + + ;; Cleaning up Dired + (setf dired-kill-when-opening-new-dired-buffer t) + (add-hook 'dired-mode-hook #'dired-hide-details-mode) + + ;; Evil collection + (with-eval-after-load 'emms (evil-collection-emms-setup)) + (with-eval-after-load 'pdf-view (evil-collection-pdf-setup)) + (with-eval-after-load 'ibuffer (evil-collection-ibuffer-setup)) + + ;; Custom keybinds + (spacemacs/set-leader-keys "ks" 'nil) + (spacemacs/set-leader-keys "ks" 'bookmark-set) + (spacemacs/set-leader-keys "kv" 'bookmark-save) + (spacemacs/set-leader-keys "pp" (lambda () + (interactive) + (dat-tabs/create-project-tab) + (tab-bar-mode -1))) + (spacemacs/set-leader-keys "gd" 'magit-status) + (define-key evil-normal-state-map (kbd "C-`") 'spacemacs/shell-pop-vterm) + (spacemacs/set-leader-keys "l" nil) + (spacemacs/set-leader-keys "ld" 'consult-lsp-diagnostics)) + + +;; Do not write anything past this comment. This is where Emacs will +;; auto-generate custom variable definitions. +(defun dotspacemacs/emacs-custom-settings () + "Emacs custom settings. +This is an auto-generated function, do not modify its content directly, use +Emacs customize menu instead. +This function is called at the very end of Spacemacs initialization." + (custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(custom-safe-themes + '("bbb13492a15c3258f29c21d251da1e62f1abb8bbd492386a673dcfab474186af" default)) + '(ignored-local-variable-values '((origami-fold-style . triple-braces))) + '(package-selected-packages + '(ac-php-core ace-jump-helm-line ace-link add-node-modules-path + aggressive-indent all-the-icons auto-compile + auto-highlight-symbol auto-yasnippet bui catppuccin-theme + centaur-tabs centered-cursor-mode clean-aindent-mode closql + code-cells column-enforce-mode company company-c-headers + company-emoji company-php company-phpactor company-shell + company-web compleseus-spacemacs-help composer consult + consult-lsp consult-yasnippet counsel counsel-css + cpp-auto-include cython-mode dap-mode define-word devdocs + diminish dired-quick-sort disable-mouse disaster dotenv-mode + drag-stuff drupal-mode dumb-jump eat edit-indirect elisp-def + elisp-demos elisp-slime-nav emacsql embark embark-consult + emmet-mode emoji-cheat-sheet-plus emr esh-help + eshell-prompt-extras eshell-z eval-sexp-fu evil-anzu evil-args + evil-cleverparens evil-collection evil-easymotion evil-escape + evil-evilified-state evil-exchange evil-goggles + evil-iedit-state evil-indent-plus evil-lion evil-lisp-state + evil-matchit evil-mc evil-nerd-commenter evil-numbers + evil-surround evil-textobj-line evil-tutor evil-unimpaired + evil-visual-mark-mode evil-visualstar expand-region eyebrowse + fancy-battery fish-mode flycheck flycheck-bashate flycheck-elsa + flycheck-package flycheck-pos-tip font-utils forge geben + gendoxy ggtags gh-md ghub git-link git-messenger git-modes + git-timemachine gitignore-templates go-eldoc go-fill-struct + go-gen-test go-guru go-impl go-mode go-rename go-tag godoctor + golden-ratio google-c-style google-translate haml-mode helm + helm-ag helm-comint helm-core helm-css-scss helm-descbinds + helm-git-grep helm-ls-git helm-make helm-mode-manager helm-org + helm-projectile helm-purpose helm-swoop helm-themes helm-xref + hide-comnt highlight-indentation highlight-numbers + highlight-parentheses hl-todo holy-mode htmlize hungry-delete + hybrid-mode impatient-mode indent-guide info+ insert-shebang + inspector ivy js-doc js2-mode js2-refactor json-mode + json-navigator json-reformat json-snatcher link-hint + live-py-mode livid-mode llama load-env-vars lorem-ipsum + lsp-docker lsp-mode lsp-origami lsp-pyright lsp-treemacs lsp-ui + lua-mode macrostep magit magit-section marginalia markdown-mode + markdown-toc multi-line multi-term multi-vterm multiple-cursors + mwim nameless nerd-icons nodejs-repl npm-mode open-junk-file + orderless org-superstar origami overseer package-lint paradox + password-generator pcache pcre2el pdf-tools pdf-view-restore + persistent-scratch persistent-soft php-auto-yasnippets + php-extras php-mode php-runtime phpactor phpunit + pip-requirements pipenv pippel poetry popwin pos-tip powerline + prettier-js pug-mode py-isort pydoc pyenv-mode pylookup pytest + pythonic pyvenv quickrun rainbow-delimiters reformatter request + restart-emacs rjsx-mode sass-mode scss-mode shell-pop shfmt + simple-httpd skewer-mode slim-mode smeargle space-doc spaceline + spacemacs-purpose-popwin spacemacs-whitespace-cleanup + sphinx-doc string-edit-at-point string-inflection swiper + symbol-overlay symon tablist tagedit term-cursor terminal-here + toc-org transient treemacs-evil treemacs-icons-dired + treemacs-magit treemacs-persp treemacs-projectile treepy + typescript-mode ucs-utils undo-fu undo-fu-session unfill + unicode-fonts uuidgen vertico vi-tilde-fringe + volatile-highlights vterm vundo web-beautify + web-completion-data web-mode wfnames wgrep winum with-editor + writeroom-mode ws-butler xcscope yaml yasnippet + yasnippet-snippets)) + '(safe-local-variable-values + '((js2-basic-offset . 2) (web-mode-indent-style . 2) + (web-mode-block-padding . 2) (web-mode-script-padding . 2) + (web-mode-style-padding . 2) (typescript-backend . tide) + (typescript-backend . lsp) (javascript-backend . tide) + (javascript-backend . tern) (javascript-backend . lsp)))) + (custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ;; '(company-tooltip-selection ((t (:background "#ffffff" :foreground "#43242B" :weight bold)))) + ;; '(dired-directory ((t (:inherit bold :background "#1f1f28" :foreground "#4f97d7")))) + ;; '(font-lock-comment-face ((t (:foreground "#727169" :background "#1f1f28" :slant italic)))) + ;; '(minibuffer-prompt ((t (:inherit bold :background "#1f1f28" :foreground "#E6C384")))) + '(org-block ((t (:inherit shadow :extend t :background "#010F1D")))) + '(org-block-begin-line ((t (:inherit org-meta-line :extend t :background "#1f1f28" :foreground "#7FB4CA" :slant italic)))) + '(org-block-end-line ((t (:inherit org-meta-line :extend t :background "#1f1f28" :foreground "#FF5D62" :slant italic)))) + '(org-level-1 ((t (:inherit outline-1 :height 1.7)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.5)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.3)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.2)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.1)))) + '(org-level-6 ((t (:inherit outline-6 :height 1.1)))) + '(org-level-7 ((t (:inherit outline-7 :height 1.1)))) + '(org-level-8 ((t (:inherit outline-8 :height 1.1)))) + '(org-level-9 ((t (:inherit outline-9 :height 1.1))))) + ) diff --git a/config/zathurarc b/config/zathurarc new file mode 100644 index 0000000..832cb77 --- /dev/null +++ b/config/zathurarc @@ -0,0 +1,77 @@ +map i recolor +map h navigate previous +map l navigate next +map navigate previous +map navigate next +map J zoom out +map K zoom in + +set font "Iosudo Bold 10" + +set window-height 3000 +set window-width 3000 +set window-title-basename true +set window-title-page true + +set adjust-open "width" + +set selection-clipboard clipboard +set selection-notification false + +set statusbar-basename true + +set guioptions n + +set scroll-page-aware true + +set scroll-full-overlap 0.01 + +set scroll-step 100 + +####### COLOR SCHEME ####### +set notification-error-bg rgba(255,85,85,1) # Red +set notification-error-fg rgba(248,248,242,1) # Foreground +set notification-warning-bg rgba(255,184,108,1) # Orange +set notification-warning-fg rgba(68,71,90,1) # Selection +set notification-bg rgba(40,42,54,1) # Background +set notification-fg rgba(248,248,242,1) # Foreground + +set completion-bg rgba(40,42,54,1) # Background +set completion-fg rgba(98,114,164,1) # Comment +set completion-group-bg rgba(40,42,54,1) # Background +set completion-group-fg rgba(98,114,164,1) # Comment +set completion-highlight-bg rgba(68,71,90,1) # Selection +set completion-highlight-fg rgba(248,248,242,1) # Foreground + +set index-bg rgba(40,42,54,1) # Background +set index-fg rgba(248,248,242,1) # Foreground +set index-active-bg rgba(68,71,90,1) # Current Line +set index-active-fg rgba(248,248,242,1) # Foreground + +set inputbar-bg rgba(40,42,54,1) # Background +set inputbar-fg rgba(248,248,242,1) # Foreground +set statusbar-bg rgba(40,42,54,1) # Background +set statusbar-fg rgba(248,248,242,1) # Foreground + +set highlight-color rgba(255,184,108,0.5) # Orange +set highlight-active-color rgba(255,121,198,0.5) # Pink + +set default-bg rgba(40,42,54,1) # Background +set default-fg rgba(248,248,242,1) # Foreground + +set render-loading true +set render-loading-fg rgba(40,42,54,1) # Background +set render-loading-bg rgba(248,248,242,1) # Foreground + +# +# Recolor mode settings +# + +set recolor-lightcolor rgba(40,42,54,1) # Background +set recolor-darkcolor rgba(248,248,242,1) # Foreground + +# +# Startup options +# +set adjust-open width +# set recolor true diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2f973ae --- /dev/null +++ b/flake.lock @@ -0,0 +1,91 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747688838, + "narHash": "sha256-FZq4/3OtGV/cti9Vccsy2tGSUrxTO4hkDF9oeGRTen4=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "45c2985644b60ab64de2a2d93a4d132ecb87cf66", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "zen-browser", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747565775, + "narHash": "sha256-B6jmKHUEX1jxxcdoYHl7RVaeohtAVup8o3nuVkzkloA=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "97118a310eb8e13bc1b9b12d67267e55b7bee6c8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1747542820, + "narHash": "sha256-GaOZntlJ6gPPbbkTLjbd8BMWaDYafhuuYRNrxCGnPJw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "292fa7d4f6519c074f0a50394dbbe69859bb6043", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "zen-browser": "zen-browser" + } + }, + "zen-browser": { + "inputs": { + "home-manager": "home-manager_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747658502, + "narHash": "sha256-7SunK8XumGZz+ITBmOMVEHqrCFtP0hAyydftLkXqnw0=", + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "rev": "d4005e943d4276023fb81d598811c9ab04d141d0", + "type": "github" + }, + "original": { + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..41ddd95 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Dat's flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + zen-browser = { + url = "github:0xc000022070/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... } @ inputs: + { + nixosConfigurations = { + datNix = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + }; + modules = [ + ./system/configuration.nix + ]; + }; + }; + }; +} diff --git a/misc/camera.desktop b/misc/camera.desktop new file mode 100755 index 0000000..6566b94 --- /dev/null +++ b/misc/camera.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=MPV Camera +Icon=camera +Exec=mpv av://v4l2:/dev/video0 --profile=low-latency --untimed --no-osc --cache=no --profile=low-latency +Comment=Camera App Using MPV +Terminal=false +StartupWMClass=cheese diff --git a/misc/nsxiv.desktop b/misc/nsxiv.desktop new file mode 100644 index 0000000..01ae286 --- /dev/null +++ b/misc/nsxiv.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=nsxiv +GenericName=Image Viewer +Exec=nsxiv -ab %F +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;image/x-bmp;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-tga;image/x-xpixmap;image/webp;image/heic;image/svg+xml;application/postscript;image/jp2;image/jxl;image/avif;image/heif; +NoDisplay=true +Icon=nsxiv diff --git a/system/audio.nix b/system/audio.nix new file mode 100644 index 0000000..6d4f310 --- /dev/null +++ b/system/audio.nix @@ -0,0 +1,12 @@ +{ + services = { + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + pulseaudio.enable = false; + }; +} diff --git a/system/boot.nix b/system/boot.nix new file mode 100644 index 0000000..f8878f3 --- /dev/null +++ b/system/boot.nix @@ -0,0 +1,23 @@ +{ + boot = { + loader = { + systemd-boot.enable = false; + efi.canTouchEfiVariables = false; + efi.efiSysMountPoint = "/boot"; + grub = { + efiSupport = true; + efiInstallAsRemovable = true; + extraEntriesBeforeNixOS = false; + configurationLimit = 8; + device = "nodev"; + extraEntries = '' + menuentry "Windows 10" { + search --fs-uuid --no-floppy --set=root E00B-A178 + chainloader ($root)/EFI/Microsoft/Boot/bootmgfw.efi + } + ''; + }; + }; + supportedFilesystems = [ "ntfs" ]; + }; +} diff --git a/system/configuration.nix b/system/configuration.nix new file mode 100644 index 0000000..2ecebc2 --- /dev/null +++ b/system/configuration.nix @@ -0,0 +1,147 @@ +{ pkgs, inputs, options, ... }: + +{ + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./boot.nix + ./filesystems.nix + ./flatpak.nix + ./audio.nix + ./devtools.nix + ./fontconfig.nix + ./localisation.nix + inputs.home-manager.nixosModules.home-manager + ]; + + ### NETWORKING + networking = { + hostName = "dpv"; + networkmanager.enable = true; + timeServers = options.networking.timeServers.default ++ [ "time.google.com" ]; + }; + + ### SERVICES + services = { + xserver = { + enable = true; + + displayManager.lightdm.enable = true; + desktopManager.cinnamon.enable = true; + + xkb.layout = "us"; + xkb.variant = ""; + }; + + ntp.enable = true; + + ## Daemons + printing.enable = true; + openssh.enable = true; + + ### Clipboard + greenclip = { + enable = true; + package = pkgs.haskellPackages.greenclip; + }; + + envfs.enable = true; + gvfs.enable = true; + tumbler.enable = true; + }; + + xdg.portal = { + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + config.common.default = "gtk"; + }; + + ### HARDWARE + hardware = { + graphics = { + enable = true; + extraPackages = with pkgs; [ intel-media-driver ]; + }; + }; + + ### SECURITY + security.rtkit.enable = true; + + ### USERS + users = { + groups.libvirtd.members = [ "dpv" ]; + users.dpv = { + isNormalUser = true; + description = "dpv"; + extraGroups = [ "networkmanager" "wheel" "libvirtd" ]; + shell = pkgs.zsh; + packages = [ ]; + }; + }; + + ### PROGRAMS + programs = { + firefox.enable = false; + ssh.startAgent = true; + zsh.enable = true; + xfconf.enable = true; + thunar = { + enable = true; + plugins = [ + pkgs.xfce.thunar-archive-plugin + pkgs.xfce.thunar-volman + pkgs.xfce.thunar-media-tags-plugin + ]; + }; + }; + + flatpak.enable = true; + + ### UNFREE PACKAGES + nixpkgs.config.allowUnfree = true; + + ### PACKAGES TO INSTALL IN A SYSTEM + environment.systemPackages = with pkgs; [ + fastfetch btop htop wget fzf ripgrep + obsidian metasploit google-chrome home-manager + xclip sqlite lsd gpick nsxiv pulseaudio + mpc brightnessctl sdcv speedcrunch screenkey bitwarden-desktop + keepassxc rustup gcc gnumake clang-tools nodejs pnpm + imagemagick pandoc nixd dbeaver-bin gdu sl pavucontrol + ffmpeg ffmpegthumbnailer p7zip rar unrar zip unzip dig nix-du + nh graphviz libnotify + + inputs.zen-browser.packages.${pkgs.system}.default + ]; + + ### ENV + environment.variables = { + EDITOR = "nvim"; + }; + + ### DEV + devtools.postgres.enable = true; + devtools.virtualisation.enable = true; + devtools.docker.enable = true; + + ### HOME MANAGER + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + dpv = import ../user/home.nix; + }; + }; + + ### MORE NIX + nix = { + gc = { + automatic = true; + dates = "daily"; + options = "--delete-older-than 10d"; + }; + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + }; + }; + + system.stateVersion = "24.11"; +} diff --git a/system/devtools.nix b/system/devtools.nix new file mode 100644 index 0000000..22ca85d --- /dev/null +++ b/system/devtools.nix @@ -0,0 +1,69 @@ +{ config, pkgs, lib, ... }: + +let + inherit (lib) mkOption mkIf mkMerge types; + cfg = config.devtools; +in +{ + options.devtools = { + postgres.enable = mkOption { + default = false; + type = types.bool; + }; + virtualisation.enable = mkOption { + default = false; + type = types.bool; + }; + docker.enable = mkOption { + default = false; + type = types.bool; + }; + }; + + config = { + services.postgresql = { + enable = cfg.postgres.enable; + package = pkgs.postgresql_17; + ensureDatabases = [ "dpv" ]; + ensureUsers = [ + { + name = "dpv"; + ensureDBOwnership = true; + } + ]; + authentication = lib.mkForce '' + # Generated file; do not edit! + # TYPE DATABASE USER ADDRESS METHOD + local all all trust + host all all 127.0.0.1/32 trust + host all all ::1/128 trust + ''; + }; + + virtualisation = mkMerge [ + (mkIf cfg.virtualisation.enable { + libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + ovmf.enable = true; + ovmf.packages = [ pkgs.OVMFFull.fd ]; + }; + }; + spiceUSBRedirection.enable = true; + }) + + (mkIf cfg.docker.enable { + docker = { + enable = true; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; + }) + ]; + + programs.virt-manager.enable = cfg.virtualisation.enable; + }; +} diff --git a/system/filesystems.nix b/system/filesystems.nix new file mode 100644 index 0000000..5dd7d7a --- /dev/null +++ b/system/filesystems.nix @@ -0,0 +1,14 @@ +{ + fileSystems = { + "/ar1" = { + device = "/dev/disk/by-uuid/AEDEBC24DEBBE2AF"; + fsType = "ntfs-3g"; + options = [ "rw" "uid=1000" ]; + }; + "/win" = { + device = "/dev/disk/by-uuid/DA820CCE820CB155"; + fsType = "ntfs-3g"; + options = [ "rw" "uid=1000" ]; + }; + }; +} diff --git a/system/flatpak.nix b/system/flatpak.nix new file mode 100644 index 0000000..15fc933 --- /dev/null +++ b/system/flatpak.nix @@ -0,0 +1,26 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.flatpak; +in +{ + options.flatpak = { + enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + }; + + config = lib.mkIf cfg.enable { + services.flatpak.enable = true; + systemd.services = { + flatpak-repo = { + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.flatpak ]; + script = '' + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + ''; + }; + }; + }; +} diff --git a/system/fontconfig.nix b/system/fontconfig.nix new file mode 100644 index 0000000..458fd8c --- /dev/null +++ b/system/fontconfig.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +{ + fonts.packages = with pkgs; [ + inter + nerd-fonts.iosevka + nerd-fonts.symbols-only + ]; + fonts.fontconfig = { + defaultFonts = { + serif = [ "Liberation Serif" ]; + sansSerif = [ "Inter" "SF Pro Display" ]; + monospace = [ "Iosevka Nerd Font" ]; + }; + }; +} diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix new file mode 100644 index 0000000..844b9ae --- /dev/null +++ b/system/hardware-configuration.nix @@ -0,0 +1,40 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "nvme" "usbhid" "sd_mod" "rtsx_usb_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/740252ff-39d8-416e-8f04-73e837810417"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A717-5D98"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/33b020e2-7859-49d2-85e4-b0c8a778ab1d"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/system/localisation.nix b/system/localisation.nix new file mode 100644 index 0000000..efe8d94 --- /dev/null +++ b/system/localisation.nix @@ -0,0 +1,19 @@ +{ + time.timeZone = "Asia/Manila"; + time.hardwareClockInLocalTime = true; + + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; +} diff --git a/user/docs.nix b/user/docs.nix new file mode 100644 index 0000000..82b3f51 --- /dev/null +++ b/user/docs.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.docs; +in +{ + imports = [ ./subs/sioyek.nix ]; + + options.docs = { + zathura.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + sioyek.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + libreoffice.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + foliate.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + }; + + config = { + subs.sioyek.enable = cfg.sioyek.enable; + + programs.zathura = { + enable = cfg.zathura.enable; + extraConfig = builtins.readFile ../config/zathurarc; + }; + + programs.foliate = { + enable = cfg.foliate.enable; + }; + + home.packages = lib.mkIf cfg.libreoffice.enable [ + pkgs.libreoffice-fresh + ]; + }; +} diff --git a/user/editors.nix b/user/editors.nix new file mode 100644 index 0000000..97db205 --- /dev/null +++ b/user/editors.nix @@ -0,0 +1,40 @@ +{ config, lib, ... }: + +let + inherit (lib) mkOption types; + + cfg = config.editors; +in +{ + imports = [ + ./subs/zed.nix + ./subs/neovim.nix + ./subs/emacs.nix + ]; + + options.editors = { + emacs.enable = mkOption { + default = false; + type = types.bool; + }; + neovim.enable = mkOption { + default = false; + type = types.bool; + }; + zed.enable = mkOption { + default = false; + type = types.bool; + }; + vscode.enable = mkOption { + default = false; + type = types.bool; + }; + }; + + config = { + subs.zed.enable = cfg.zed.enable; + subs.neovim.enable = cfg.neovim.enable; + subs.emacs.enable = cfg.emacs.enable; + programs.vscode.enable = cfg.vscode.enable; + }; +} diff --git a/user/home.nix b/user/home.nix new file mode 100644 index 0000000..0938bc7 --- /dev/null +++ b/user/home.nix @@ -0,0 +1,102 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + ./shells.nix + ./music.nix + ./theming.nix + ./terminals.nix + ./termtools.nix + ./editors.nix + ./docs.nix + ./utils.nix + ./subs/mpv.nix + ./subs/git.nix + ]; + + nixpkgs.config.allowUnfree = true; + + home = { + username = "dpv"; + homeDirectory = "/home/dpv"; + stateVersion = "24.11"; + }; + + home.packages = with pkgs; [ + qbittorrent yt-dlp typst obs-studio krita + jetbrains.idea-community astro-language-server + basedpyright emmet-language-server lua-language-server + tailwindcss-language-server typescript-language-server + ripcord abaddon netcat-gnu nmap nerd-fonts.jetbrains-mono + nerd-fonts.fira-code + ]; + + home.file = { + ".ideavimrc".source = ../config/ideavimrc; + ".local/bin/books".source = ../bin/books; + ".local/bin/clipboard".source = ../bin/clipboard; + ".local/bin/define".source = ../bin/define; + ".local/bin/keyboard-toggle".source = ../bin/keyboard-toggle; + ".local/bin/show_colors".source = ../bin/show_colors; + ".local/bin/show_def".source = ../bin/show_def; + ".local/bin/stm".source = ../bin/stm; + ".local/bin/tmux-sessionizer".source = ../bin/tmux-sessionizer; + ".local/bin/touchpad-toggle-xinput".source = ../bin/touchpad-toggle-xinput; + ".local/share/applications/camera.desktop".source = ../misc/camera.desktop; + ".local/share/applications/nsxiv.desktop".source = ../misc/nsxiv.desktop; + }; + + home.activation.createDirs = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + mkdir -p "${config.home.homeDirectory}/dev/gitlab" + mkdir -p "${config.home.homeDirectory}/Documents/org" + mkdir -p "${config.home.homeDirectory}/.local/src" + ''; + + ### SESSION ENV + home.sessionPath = [ + "$HOME/.local/bin" + ]; + + home.sessionVariables = { + "GTK_THEME" = "Adwaita:dark"; + }; + + ### DOCK + theming.dock.enable = true; + theming.dock.autostart = true; + + music = { + enable = true; + directory = "/ar1/Music"; + ncmpcpp.enable = true; + rmpc.enable = true; + }; + + editors = { + neovim.enable = true; + emacs.enable = true; + vscode.enable = true; + zed.enable = true; + }; + + terminals.ghostty.enable = true; + terminals.alacritty.enable = true; + + shells.fish.enable = false; + + termtools.tmux.enable = true; + termtools.zoxide.enable = true; + + docs.zathura.enable = true; + docs.sioyek.enable = true; + docs.libreoffice.enable = true; + docs.foliate.enable = true; + + utils.rofi.enable = true; + utils.sxhkd.enable = true; + utils.flameshot.enable = true; + + programs.vesktop.enable = true; + + programs.home-manager.enable = true; +} diff --git a/user/music.nix b/user/music.nix new file mode 100644 index 0000000..1c9668f --- /dev/null +++ b/user/music.nix @@ -0,0 +1,101 @@ +{ config, lib, ... }: + +let + inherit (lib) mkIf mkOption types; + + cfg = config.music; +in +{ + options.music = { + enable = mkOption { + default = false; + type = types.bool; + description = ''Enables MPD server''; + }; + directory = mkOption { + default = "~/Music"; + type = types.str; + description = ''Path to your music directory''; + }; + ncmpcpp.enable = mkOption { + default = false; + type = types.bool; + description = ''Enables NCMPCPP (MPD Client)''; + }; + rmpc.enable = mkOption { + default = false; + type = types.bool; + description = '' + Enables RMPC (Rusty Music Player Client) (another MPD Client) + ''; + }; + }; + + config = { + services.mpd = { + enable = cfg.enable; + musicDirectory = cfg.directory; + extraConfig = builtins.readFile ../config/mpd.conf; + }; + + programs = mkIf cfg.enable { + ncmpcpp = { + enable = cfg.ncmpcpp.enable; + bindings = [ + { key = "k"; command = "scroll_up"; } + { key = "j"; command = "scroll_down"; } + { key = "l"; command = "next_column"; } + { key = "l"; command = "slave_screen"; } + { key = "h"; command = "previous_column"; } + { key = "h"; command = "master_screen"; } + { key = "G"; command = "move_end"; } + { key = "g"; command = "move_home"; } + { key = "alt-l"; command = "show_lyrics"; } + ]; + settings = { + ncmpcpp_directory = "~/.config/ncmpcpp"; + system_encoding = "utf-8"; + visualizer_output_name = "my_fifo"; + visualizer_type = "ellipse"; + visualizer_in_stereo = "yes"; + visualizer_look = "▀▋"; + visualizer_color = "blue, cyan, green, yellow, magenta, red, black"; + playlist_display_mode = "columns"; + media_library_primary_tag = "album_artist"; + media_library_hide_album_dates = true; + playlist_shorten_total_times = "yes"; + playlist_editor_display_mode = "columns"; + lyrics_fetchers = "genius, internet"; + browser_display_mode = "columns"; + search_engine_display_mode = "columns"; + autocenter_mode = "yes"; + mouse_support = "yes"; + centered_cursor = "yes"; + follow_now_playing_lyrics = "yes"; + display_bitrate = "no"; + external_editor = "vim"; + progressbar_elapsed_color = "white"; + progressbar_color = "black"; + user_interface = "alternative"; + header_visibility = "no"; + statusbar_visibility = "yes"; + titles_visibility = "yes"; + progressbar_look = "━━"; + statusbar_color = "white"; + enable_window_title = "yes"; + now_playing_prefix = "$b$1"; + now_playing_suffix = "$8$/b"; + song_list_format = "$1 $2%A$8 - $8%t $R $3%l "; + song_status_format = "$b$7♫ $2%a $8- $3%b $8- $8%t "; + song_window_title_format = " {%A} - {%t}"; + song_columns_list_format = "(23)[white]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}"; + startup_slave_screen = "playlist"; + startup_slave_screen_focus = "yes"; + locked_screen_width_part = "50"; + }; + }; + + rmpc.enable = cfg.rmpc.enable; + }; + }; +} diff --git a/user/shells.nix b/user/shells.nix new file mode 100644 index 0000000..3996a44 --- /dev/null +++ b/user/shells.nix @@ -0,0 +1,81 @@ +{ config, pkgs, lib, ... }: + +let + inherit (lib) mkIf mkOption mkMerge types; + + cfg = config.shells; + aliases = { + "ls" = "lsd --color=never"; + "ll" = "lsd -la --color=never"; + "llt" = "lsd --tree --color=never"; + "cp" = "cp --verbose"; + "rm" = "rm --verbose"; + "mv" = "mv --verbose"; + "mkdir" = "mkdir --verbose"; + "v" = "nvim"; + "music" = "ncmpcpp"; + "tls" = "tmux ls"; + "tkl" = "tmux kill-session -t"; + "tch" = "tmux attach"; + "ytmusic" = "yt-dlp -f 'ba' -x --audio-format mp3 -o '%(id)s.%(ext)s'"; + "ytvid" = "yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'"; + }; + +in +{ + options.shells = { + fish.enable = mkOption { + default = false; + type = types.bool; + description = ''Enables FISH''; + }; + + zsh.enable = mkOption { + default = true; + type = types.bool; + description = ''Enables ZSH''; + }; + }; + + config = { + programs.fish = { + enable = cfg.fish.enable; + shellAliases = aliases; + plugins = [ + { name = "hydro"; src = pkgs.fishPlugins.hydro.src; } + ]; + functions = { + __fish_command_not_found_handler = { + body = "__fish_default_command_not_found_handler $argv[1]"; + onEvent = "fish_command_not_found"; + }; + + su = "command su --shell=/usr/bin/fish $argv"; + }; + }; + + programs.zsh = { + enable = cfg.zsh.enable; + enableCompletion = true; + defaultKeymap = "emacs"; + shellAliases = aliases; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + history.path = "${config.xdg.dataHome}/zsh/zsh_history"; + initContent = '' + [ -f ~/.p10k.zsh ]; source ~/.p10k.zsh + ''; + plugins = [ + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + ]; + }; + + home.file.".p10k.zsh" = mkIf cfg.zsh.enable { + source = ../config/p10k-config; + }; + }; +} diff --git a/user/subs/alacritty.nix b/user/subs/alacritty.nix new file mode 100644 index 0000000..4281339 --- /dev/null +++ b/user/subs/alacritty.nix @@ -0,0 +1,52 @@ +{ config, lib, ... }: + +let + cfg = config.subs.alacritty; +in +{ + options.subs.alacritty.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + + config = lib.mkIf cfg.enable { + programs.alacritty = { + enable = true; + settings = { + general.live_config_reload = true; + general.import = [ + "~/.config/alacritty/themes/dracula.toml" + ]; + colors.draw_bold_text_with_bright_colors = true; + font = { + size = 15; + normal = { + family = "Iosevka Nerd Font"; + style = "Medium"; + }; + italic = { + style = "Medium Italic"; + }; + bold = { + style = "ExtraBold"; + }; + bold_italic = { + style = "ExtraBold Italic"; + }; + }; + scrolling = { + history = 100000; + multiplier = 3; + }; + window = { + decorations = "full"; + dynamic_padding = false; + dynamic_title = true; + startup_mode = "Maximized"; + padding.x = 0; + padding.y = 0; + }; + }; + }; + }; +} diff --git a/user/subs/emacs.nix b/user/subs/emacs.nix new file mode 100644 index 0000000..7914e68 --- /dev/null +++ b/user/subs/emacs.nix @@ -0,0 +1,25 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.subs.emacs; +in +{ + options.subs.emacs.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + + config = lib.mkIf cfg.enable { + programs.emacs.enable = true; + services.emacs = { + enable = true; + package = pkgs.emacs; + client.enable = true; + client.arguments = [ "-ca" ]; + startWithUserSession = "graphical"; + }; + home.file = { + ".spacemacs".source = ../../config/spacemacs; + }; + }; +} diff --git a/user/subs/ghostty.nix b/user/subs/ghostty.nix new file mode 100644 index 0000000..be3e2ce --- /dev/null +++ b/user/subs/ghostty.nix @@ -0,0 +1,47 @@ +{ config, lib, ... }: + +let + cfg = config.subs.ghostty; +in +{ + options.subs.ghostty.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + + config = lib.mkIf cfg.enable { + programs.ghostty = { + enable = true; + enableZshIntegration = true; + settings = { + font-family = "Iosevka Nerd Font"; + font-size = 14; + theme = "ghostty-dracula"; + clipboard-read = "allow"; + clipboard-write = "allow"; + window-padding-x = 0; + window-padding-y = 0; + window-theme = "system"; + window-decoration = true; + window-padding-balance = true; + window-new-tab-position = "end"; + gtk-single-instance = true; + gtk-titlebar = true; + gtk-titlebar-hide-when-maximized = true; + gtk-adwaita = false; + gtk-wide-tabs = false; + confirm-close-surface = false; + keybind = [ + "ctrl+shift+h=goto_split:left" + "ctrl+shift+j=goto_split:down" + "ctrl+shift+k=goto_split:up" + "ctrl+shift+l=goto_split:right" + "ctrl+alt+h=new_split:left" + "ctrl+alt+j=new_split:down" + "ctrl+alt+k=new_split:up" + "ctrl+alt+l=new_split:right" + ]; + }; + }; + }; +} diff --git a/user/subs/git.nix b/user/subs/git.nix new file mode 100644 index 0000000..b04051f --- /dev/null +++ b/user/subs/git.nix @@ -0,0 +1,42 @@ +{ + programs.git = { + enable = true; + userName = "datsudo"; + userEmail = "76833632+datsudo@users.noreply.github.com"; + includes = [ + { + condition = "gitdir:~/dev/gitlab/"; + contents = { + user = { + name = "datsudo"; + email = "11058167-Datsudo@users.noreply.gitlab.com"; + }; + }; + } + ]; + extraConfig = { + init.defaultBranch = "main"; + column.ui = "auto"; + branch.sort = "-committerdate"; + tag.sort = "version:refname"; + user.signingkey = "~/.ssh/id_ed25519.pub"; + diff = { + algorithm = "histogram"; + colorMoved = "plain"; + mnemonicPrefix = true; + renames = true; + }; + push.autoSetupRemote = true; + fetch = { + prune = true; + pruneTags = true; + all = true; + }; + gpg = { + format = "ssh"; + }; + help.autocorrect = "prompt"; + commit.verbose = true; + }; + }; +} diff --git a/user/subs/mpv.nix b/user/subs/mpv.nix new file mode 100644 index 0000000..ca9424b --- /dev/null +++ b/user/subs/mpv.nix @@ -0,0 +1,16 @@ +{ + programs.mpv = { + enable = true; + bindings = { + "ALT+k" = "add sub-scale +0.1"; + "ALT+j" = "add sub-scale -0.1"; + }; + config = { + "sub-scale" = "0.60"; + "interpolation" = true; + "tscale" = "oversample"; + "sub-auto" = "fuzzy"; + "force-window" = "yes"; + }; + }; +} diff --git a/user/subs/neovim.nix b/user/subs/neovim.nix new file mode 100644 index 0000000..bd0f958 --- /dev/null +++ b/user/subs/neovim.nix @@ -0,0 +1,29 @@ +{ config, lib, ... }: + +let + cfg = config.subs.neovim; +in +{ + options.subs.neovim.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + + config = lib.mkIf cfg.enable { + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + }; + + home.file = { + ".config/nvim/init.lua".source = ../../config/nvim/init.lua; + ".config/nvim/after" = { source = ../../config/nvim/after; recursive = true; }; + ".config/nvim/lsp" = { source = ../../config/nvim/lsp; recursive = true; }; + ".config/nvim/lua" = { source = ../../config/nvim/lua; recursive = true; }; + ".config/nvim/plugin" = { source = ../../config/nvim/plugin; recursive = true; }; + }; + }; +} diff --git a/user/subs/sioyek.nix b/user/subs/sioyek.nix new file mode 100644 index 0000000..f3163aa --- /dev/null +++ b/user/subs/sioyek.nix @@ -0,0 +1,44 @@ +{ config, lib, ... }: + +let + cfg = config.subs.sioyek; +in +{ + options.subs.sioyek.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + + config = lib.mkIf cfg.enable { + programs.sioyek = { + enable = true; + bindings = { + "add_highlight" = ""; + "overview_definition" = ""; + "toggle_dark_mode" = ""; + "fit_to_page_width" = ""; + "quit" = ""; + "next_page" = "l"; + "previous_page" = "h"; + "toggle_custom_color" = "i"; + "fit_to_page_width_ratio" = "="; + "close_window" = "q"; + }; + config = { + "ui_font" = "Inter"; + "font_size" = "15"; + "status_bar_font_size" = "10"; + "fit_to_page_width_ratio" = "1.0"; + "should_launch_new_window" = "1"; + "show_document_name_in_statusbar" = "1"; + "super_fast_search" = "1"; + "collapsed_toc" = "1"; + "sort_bookmarks_by_location" = "1"; + "create_table_of_contents_if_not_exists" = "0"; + "dark_mode_background_color" = "0.114 0.125 0.129"; + "custom_background_color" = "0.114 0.125 0.129"; + "startup_commands" = "fit_to_page_width_ratio,toggle_custom_color"; + }; + }; + }; +} diff --git a/user/subs/sxhkd.nix b/user/subs/sxhkd.nix new file mode 100644 index 0000000..a4c0283 --- /dev/null +++ b/user/subs/sxhkd.nix @@ -0,0 +1,56 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.subs.sxhkd; +in +{ + options.subs.sxhkd.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + + config = lib.mkIf cfg.enable { + services.sxhkd = { + enable = true; + keybindings = { + "super + Return" = "alacritty"; + "super + b" = "zen-beta"; + "super + f" = "thunar"; + "super + m" = "emacsclient -ca ''"; + "super + t" = "flatpak run eu.betterbird.Betterbird"; + "super + c" = "speedcrunch"; + "super + ctrl + 1" = "/home/dpv/.local/bin/books"; + "XF86MonBrightness{Up,Down}" = "brightnessctl {-q set 3%+,--min-val=2 -q set 3%-}"; + "super + ctrl + {equal,minus}" = "brightnessctl {-q set 3%+,--min-val=2 -q set 3%-}"; + "XF86PowerOff" = "~/.config/rofi/scripts/powermenu.sh"; + "XF86Audio{Raise,Lower}Volume" = "pactl set-sink-volume @DEFAULT_SINK@ {+5%,-5%}"; + "XF86Audio{Mic,_}Mute" = "pactl {set-source-mute @DEFAULT_SOURCE@,set-sink-mute @DEFAULT_SINK@} toggle"; + "XF86Audio{Prev,Next}" = "mpc -q {prev,next}"; + "XF86Audio{Stop,Play}" = "mpc {stop,toggle}"; + "super + ctrl + {comma,period,slash}" = "mpc {-q prev,-q next,toggle}"; + "alt + space" = "/home/dpv/.config/rofi/scripts/launcher.sh"; + "super + shift + d" = "/home/dpv/.local/bin/define"; + "super + ctrl + shift + 7" = "/home/dpv/.local/bin/keyboard-toggle"; + "super + ctrl + shift + 6" = "/home/dpv/.local/bin/touchpad-toggle-xinput"; + "super + shift + F8" = "setxkbmap -option 'caps:escape' && notify-send 'Caps' 'Remapped to Esc'"; + "super + z" = "rofi -modi 'Clipboard:greenclip print' -show Clipboard -run-command '{cmd}' -theme ~/.config/rofi/menu.rasi"; + "super + ctrl + shift + k" = "screenkey"; + "ctrl + Print" = "flameshot gui"; + "super + shift + p" = "flameshot gui"; + "Print" = "flameshot full"; + "ctrl + alt + n" = "/home/dpv/.config/rofi/scripts/powermenu.sh"; + }; + }; + + systemd.user.services.sxhkd-daemon = { + Unit = { Description = "SXHKD Daemon."; }; + Install = { + WantedBy = [ "graphical-session.target" "default.target" ]; + }; + Service = { + ExecStart = "${pkgs.sxhkd}/bin/sxhkd -m 1"; + Restart = "always"; + }; + }; + }; +} diff --git a/user/subs/tmux.nix b/user/subs/tmux.nix new file mode 100644 index 0000000..a580a2a --- /dev/null +++ b/user/subs/tmux.nix @@ -0,0 +1,64 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.subs.tmux; +in +{ + options.subs.tmux = { + enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + }; + + config = lib.mkIf cfg.enable { + programs.tmux = { + enable = true; + package = pkgs.tmux; + baseIndex = 1; + mouse = true; + prefix = "C-Space"; + terminal = "alacritty"; + plugins = with pkgs.tmuxPlugins; [ + { + plugin = yank; + extraConfig = '' + 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 + ''; + } + { + plugin = tmux-fzf; + extraConfig = '' + TMUX_FZF_LAUNCH_KEY="z" + TMUX_FZF_PREVIEW=0 + TMUX_FZF_ORDER="session|window|pane|command|keybinding" + ''; + } + { + plugin = dracula; + extraConfig = '' + set -g @dracula-plugins "cwd ssh-session" + set -g @dracula-show-left-icon "#S" + set -g @dracula-show-powerline false + set -g @dracula-border-contrast true + ''; + } + ]; + extraConfig = '' + set -sg escape-time 10 + set -g focus-events on + set -sa terminal-features ",alacritty:RGB" + set -g status-position top + set -g status-left-length 50 + set -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 + bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer" + ''; + }; + }; +} diff --git a/user/subs/zed.nix b/user/subs/zed.nix new file mode 100644 index 0000000..6578548 --- /dev/null +++ b/user/subs/zed.nix @@ -0,0 +1,132 @@ +{ config, lib, ... }: + +let + cfg = config.subs.zed; +in +{ + options = { + subs.zed.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + }; + + config = lib.mkIf cfg.enable { + programs.zed-editor = { + enable = true; + extensions = [ + "kanagawa-themes" "modus-themes" "material-icon-theme" + "toml" "php" "dockerfile" "vue" "sql" "svelte" "scss" "lua" + "astro" "graphql" "ini" "emmet" + ]; + + userKeymaps = [ + { + context = "Workspace"; + bindings = { + "alt-`" = "workspace::ToggleLeftDock"; + "alt-~" = "workspace::ToggleRightDock"; + "ctrl-`" = "workspace::ToggleBottomDock"; + "alt-h" = "workspace::ActivatePaneLeft"; + "alt-j" = "workspace::ActivatePaneDown"; + "alt-k" = "workspace::ActivatePaneUp"; + "alt-l" = "workspace::ActivatePaneRight"; + }; + } + { + context = "Editor"; + bindings = { + "ctrl-w" = "pane::CloseActiveItem"; + }; + } + { + context = "VimControl && !menu"; + bindings = { + "ctrl-w" = "pane::CloseActiveItem"; + }; + } + { + context = "Editor || Pane"; + bindings = { + "ctrl-alt-h" = "pane::SplitLeft"; + "ctrl-alt-j" = "pane::SplitDown"; + "ctrl-alt-k" = "pane::SplitUp"; + "ctrl-alt-l" = "pane::SplitRight"; + }; + } + ]; + + userSettings = { + vim_mode = true; + base_keymap = "VSCode"; + diagnostics = { + include_warnings = false; + inline.enabled = true; + }; + tab_size = 4; + hard_tabs = true; + git.inline_blame.enabled = false; + ui_font_family = "Inter"; + ui_font_size = 16; + buffer_font_family = "Iosevka Nerd Font"; + buffer_font_fallbacks = [ "Symbols Nerd Font" "Noto Color Emoji" ]; + buffer_font_weight = 500; + buffer_font_size = 18; + buffer_line_height.custom = 1.3; + terminal = { + font_family = "Iosevka Nerd Font"; + font_weight = 500; + font_size = 16; + font_fallbacks = [ "Symbols Nerd Font" "Noto Color Emoji" ]; + working_directory = "current_project_directory"; + toolbar.breadcrumbs = false; + env = { + "ZED" = "1"; + }; + }; + icon_theme = "Material Icon Theme"; + theme = { + mode = "dark"; + light = "Modus Operandi Deuteranopia"; + dark = "Kanagawa"; + }; + toolbar.quick_actions = false; + tab_bar.show = false; + scrollbar = { + show = "never"; + git_diff = false; + }; + gutter = { + code_actions = true; + runnables = true; + folds = false; + line_numbers = true; + }; + inlay_hints = { + enabled = true; + show_type_hints = true; + }; + telemetry = { + diagnostics = false; + metrics = false; + }; + languages = { + CSS.tab_size = 2; + HTML.tab_size = 2; + Astro.tab_size = 2; + JavaScript.tab_size = 2; + TypeScript.tab_size = 2; + TSX.tab_size = 2; + JSON.hard_tabs = false; + JSON.tab_size = 2; + YAML.hard_tabs = false; + YAML.tab_size = 2; + JSONC.hard_tabs = false; + JSONC.tab_size = 2; + TOML.tab_size = 2; + Python.hard_tabs = false; + }; + }; + }; + }; +} diff --git a/user/terminals.nix b/user/terminals.nix new file mode 100644 index 0000000..4d8bd29 --- /dev/null +++ b/user/terminals.nix @@ -0,0 +1,33 @@ +{ config, lib, ... }: + +let + inherit (lib) mkIf mkOption types; + cfg = config.terminals; +in +{ + imports = [ + ./subs/ghostty.nix + ./subs/alacritty.nix + ]; + + options.terminals = { + ghostty.enable = mkOption { + default = false; + type = types.bool; + }; + alacritty.enable = mkOption { + default = false; + type = types.bool; + }; + }; + + config = { + subs.ghostty.enable = cfg.ghostty.enable; + subs.alacritty.enable = cfg.alacritty.enable; + + home.file = { + ".config/alacritty/themes/dracula.toml".source = mkIf cfg.alacritty.enable ../config/dracula.toml; + ".config/ghostty/themes/ghostty-dracula".source = mkIf cfg.ghostty.enable ../config/ghostty-dracula; + }; + }; +} diff --git a/user/termtools.nix b/user/termtools.nix new file mode 100644 index 0000000..fdefffb --- /dev/null +++ b/user/termtools.nix @@ -0,0 +1,28 @@ +{ config, lib, ... }: + +let + inherit (lib) mkOption types; + cfg = config.termtools; +in +{ + imports = [ ./subs/tmux.nix ]; + options.termtools = { + tmux.enable = mkOption { + default = false; + type = types.bool; + }; + zoxide.enable = mkOption { + default = false; + type = types.bool; + }; + }; + + config = { + subs.tmux.enable = cfg.tmux.enable; + programs.zoxide = { + enable = cfg.zoxide.enable; + enableZshIntegration = true; + options = [ "--cmd cd" ]; + }; + }; +} diff --git a/user/theming.nix b/user/theming.nix new file mode 100644 index 0000000..bad9bc9 --- /dev/null +++ b/user/theming.nix @@ -0,0 +1,63 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.theming.dock; +in +{ + options.theming.dock = { + enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + autostart = lib.mkOption { + default = false; + type = lib.types.bool; + }; + }; + + config = { + home.pointerCursor = { + x11.enable = true; + name = "Bibata-Modern-Classic"; + package = pkgs.bibata-cursors; + gtk.enable = true; + size = 20; + }; + + gtk = { + enable = true; + cursorTheme = { + name = "Bibata-Modern-Classic"; + package = pkgs.bibata-cursors; + size = 20; + }; + iconTheme = { + name = "Tela-dark"; + package = pkgs.tela-icon-theme; + }; + gtk3 = { + extraConfig.gtk-application-prefer-dark-theme = true; + }; + gtk4 = { + extraConfig.gtk-application-prefer-dark-theme = true; + }; + }; + + qt = { + enable = true; + platformTheme.name = "gtk"; + style.name = "adwaita-dark"; + }; + + home.packages = lib.mkIf cfg.enable [ + pkgs.plank pkgs.libwnck pkgs.bamf + ]; + + xdg.autostart = lib.mkIf cfg.autostart { + enable = true; + entries = [ + "${pkgs.plank}/share/applications/plank.desktop" + ]; + }; + }; +} diff --git a/user/utils.nix b/user/utils.nix new file mode 100644 index 0000000..3ecc2fa --- /dev/null +++ b/user/utils.nix @@ -0,0 +1,41 @@ +{ config, lib, ... }: + +let + cfg = config.utils; +in +{ + imports = [ ./subs/sxhkd.nix ]; + + options.utils = { + rofi.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + sxhkd.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + flameshot.enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + }; + + config = { + programs.rofi.enable = cfg.rofi.enable; + + subs.sxhkd.enable = cfg.sxhkd.enable; + + services.flameshot = { + enable = cfg.flameshot.enable; + settings = { + General = { + savePathFixed = false; + saveAfterCopy = true; + showStartupLaunchMessage = false; + useJpgForClipboard = true; + }; + }; + }; + }; +}