diff options
author | Freya Murphy <freya@freyacat.org> | 2025-06-23 22:33:44 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-06-23 22:33:44 -0400 |
commit | 328c741b1aac74020412e99e0dca7c728dbc92fa (patch) | |
tree | 461f4ebcd3252d542749a34668defd62de356c73 /home | |
parent | removed unused packages (diff) | |
download | dotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.tar.gz dotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.tar.bz2 dotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.zip |
refactor
Diffstat (limited to 'home')
-rw-r--r-- | home/default.nix | 120 | ||||
-rw-r--r-- | home/git.nix | 19 | ||||
-rw-r--r-- | home/gpg.nix | 31 | ||||
-rw-r--r-- | home/neovim/config.nix | 94 | ||||
-rw-r--r-- | home/neovim/default.nix | 74 | ||||
-rw-r--r-- | home/neovim/init.lua | 359 | ||||
-rw-r--r-- | home/ssh/config | 12 | ||||
-rw-r--r-- | home/ssh/default.nix | 13 | ||||
-rw-r--r-- | home/starship.nix | 49 | ||||
-rw-r--r-- | home/tmux/default.nix | 16 | ||||
-rw-r--r-- | home/tmux/tmux.conf | 105 | ||||
-rwxr-xr-x | home/tmux/tmux_window | 7 | ||||
-rw-r--r-- | home/zsh/default.nix | 17 | ||||
-rw-r--r-- | home/zsh/zprofile | 11 | ||||
-rw-r--r-- | home/zsh/zshrc | 73 |
15 files changed, 929 insertions, 71 deletions
diff --git a/home/default.nix b/home/default.nix index 8561236..4cdc894 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,11 +1,22 @@ { + lib, config, pkgs, inputs, ... -}: { +}: let + inherit (lib) optionals; + system = pkgs.stdenv.hostPlatform.system; +in { imports = [ inputs.home-manager.nixosModules.home-manager + ./neovim + ./ssh + ./tmux + ./zsh + ./git.nix + ./gpg.nix + ./starship.nix ]; home-manager.users.${config.user} = { @@ -15,76 +26,43 @@ news.display = "silent"; fonts.fontconfig.enable = true; - home.packages = with pkgs; [ - # nix - home-manager - # c / c++ - clang-tools - gcc - gdb - gnumake - nasm - pkg-config - # rust - rustc - rustfmt - rust-analyzer - cargo - clippy - # zig - zig - zls - # java/kotlin - gradle - jdk - jdt-language-server - kotlin - kotlin-language-server - maven - # gtk - adwaita-icon-theme - orchis-theme - # media - ffmpeg - libaacs - libavif - libbluray - libjxl - # wayland - cage - grimblast - wl-clipboard - wl-clip-persist - wl-mirror - # gaming - prismlauncher - # social - discord - element-desktop - gajim - # programs - blueman - brightnessctl - easyeffects - fd - filezilla - gimp - imagemagick - imv - jq - libnotify - mpv - pavucontrol - pfetch-rs - rsync - sassc - sl - starship - thunderbird-latest - vlc - yt-dlp - zathura - ]; + home.packages = + (with pkgs; [ + # nix + home-manager + # programs + fd + imagemagick + jq + pfetch-rs + rsync + sassc + sl + starship + yt-dlp + ]) + ++ [ + inputs.talc.packages.${system}.talc + ] + ++ (with pkgs; + optionals config.desktop.enable [ + # social + discord + element-desktop + gajim + thunderbird-latest + # programs + blueman + brightnessctl + easyeffects + filezilla + gimp + imv + mpv + pavucontrol + vlc + zathura + ]); xdg.configFile = { "aacs/keydb.cfg" = { diff --git a/home/git.nix b/home/git.nix new file mode 100644 index 0000000..5c6a73a --- /dev/null +++ b/home/git.nix @@ -0,0 +1,19 @@ +{config, ...}: { + home-manager.users.${config.user} = { + programs.git = { + enable = true; + userName = config.fullName; + userEmail = config.email; + + signing = { + format = "openpgp"; + key = "D9AF0A4209B7C2DE11A884BFACBC553660D9993D"; + signByDefault = true; + }; + + extraConfig = { + init.defaultBranch = "main"; + }; + }; + }; +} diff --git a/home/gpg.nix b/home/gpg.nix new file mode 100644 index 0000000..a2deed2 --- /dev/null +++ b/home/gpg.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + pkgs, + ... +}: let + keysDir = ../files/keys; + keys = lib.attrsets.mapAttrsToList (name: type: "${keysDir}/${name}") (builtins.readDir keysDir); + gpgKeys = builtins.filter (path: lib.strings.hasSuffix "asc" path) keys; +in { + home-manager.users.${config.user} = { + # install keys into gpg keyring + programs.gpg = { + enable = true; + publicKeys = + map (path: { + source = path; + trust = 5; + }) + gpgKeys; + }; + + # global gpg agent + services.gpg-agent = { + enable = true; + enableExtraSocket = true; + enableSshSupport = true; + pinentry.package = pkgs.pinentry-curses; + }; + }; +} diff --git a/home/neovim/config.nix b/home/neovim/config.nix new file mode 100644 index 0000000..ae10243 --- /dev/null +++ b/home/neovim/config.nix @@ -0,0 +1,94 @@ +{ + config, + inputs, +}: +inputs.self.lib.lua.fmt { + # Width of tabs in the editor + tabwidth = 4; + # If tabs should be expanded to spaces + expandtab = false; + keys = { + # NeoVIM leader key + leader = " "; + # Keybind to remove active hilighted content + noh = "<leader>h"; + menus = { + # Open file browser + browser = "<leader>e"; + # Show active buffers + buffers = "<leader>fb"; + # Show LSP errors + error = "<leader>t"; + # Find files in working directory + find = "<leader>ff"; + # Grep files in working directory + grep = "<leader>fg"; + # Search help menu + help = "<leader>fh"; + # Voew undo tree + undo = "<leader>u"; + }; + lsp = { + # Open LSP hover menu on a value + hover = "K"; + # Perform an LSP action on a value + action = "<leader>la"; + # View all references of a value + references = "<leader>lr"; + # Rename current and all references of a value + rename = "<leader>ln"; + }; + cmp = { + # Select previous value in completion engine + prev = "<C-p>"; + # Select next value in completion engine + next = "<C-n>"; + # Confirm current value in completion engine + confirm = "<CR>"; + # Auto complete using completion engine + complete = "<C-space>"; + }; + }; + # list of lsp servers to load + lsps = { + clangd = {}; + jdtls = {}; + kotlin_language_server = {}; + phpactor = {}; + rust_analyzer = {}; + ts_ls = {}; + zls = {}; + }; + highlight = { + # max file size in KiB to attempt to parse + max_size = 1024; + }; + # colorscheme + theme = { + colors = { + base00 = "#${config.theme.colors.bg}"; + base01 = "#${config.theme.colors.surface.bg}"; + base02 = "#${config.theme.colors.surface.bg}"; + base03 = "#${config.theme.colors.bright.white}"; + base04 = "#${config.theme.colors.bright.black}"; + base05 = "#${config.theme.colors.fg}"; + base06 = "#${config.theme.colors.bright.white}"; + base07 = "#${config.theme.colors.hover.bg}"; + base08 = "#${config.theme.colors.bright.red}"; + base09 = "#${config.theme.colors.bright.yellow}"; + base0A = "#${config.theme.colors.bright.yellow}"; + base0B = "#${config.theme.colors.bright.green}"; + base0C = "#${config.theme.colors.bright.cyan}"; + base0D = "#${config.theme.colors.bright.blue}"; + base0E = "#${config.theme.colors.bright.magenta}"; + base0F = "#${config.theme.colors.normal.yellow}"; + }; + transparent = true; + }; + # max column width + col = { + # show a bar at `width` characters + show = true; + width = 80; + }; +} diff --git a/home/neovim/default.nix b/home/neovim/default.nix new file mode 100644 index 0000000..c1ed000 --- /dev/null +++ b/home/neovim/default.nix @@ -0,0 +1,74 @@ +{ + inputs, + config, + lib, + pkgs, + ... +}: let + lua_cfg = import ./config.nix {inherit config inputs;}; + lua = builtins.readFile ./init.lua; +in { + environment.variables.EDITOR = "nvim"; + + home-manager.users.${config.user} = { + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + + extraLuaConfig = '' + local config = ${lua_cfg} + + ${lua} + ''; + + plugins = with pkgs.vimPlugins; [ + # Dependencies + vim-devicons + nvim-web-devicons + plenary-nvim + # Colorscheme + base16-nvim + # Mode line + lualine-nvim + # Buffer line + bufferline-nvim + # File browser + nvim-tree-lua + # Undo tree + undotree + # Trouble (error menu) + trouble-nvim + # Telescope (buffers/find/grep/help) + telescope-nvim + # Snippets + vim-vsnip + vim-vsnip-integ + friendly-snippets + # Completion + cmp-buffer + cmp-nvim-lsp + cmp-vsnip + nvim-cmp + # Sourround delimiters + nvim-surround + # Comment functions + nerdcommenter + # Treesitter + nvim-treesitter.withAllGrammars + # Syntax hilighting + vim-illuminate + # Todo comments + todo-comments-nvim + # Lsp server + nvim-lspconfig + # Notifications + fidget-nvim + # Auto indentation + indent-o-matic + # 80 column width + virt-column-nvim + ]; + }; + }; +} diff --git a/home/neovim/init.lua b/home/neovim/init.lua new file mode 100644 index 0000000..2be7fee --- /dev/null +++ b/home/neovim/init.lua @@ -0,0 +1,359 @@ +--[[ + + NeoVIM Configuration + Copyright (c) Freya Murphy 2025 + +]]-- + +--[[ LIB ]]-- + +local function bind(key, action, opts) + opts = opts or {} + vim.keymap.set('n', key, action, opts) +end + +local function join(left, right) + if not left then return right end + if not right then return left end + for k,v in pairs(right) do + local lv, rv = left[k], right[k] + if type(rv) == "table" then + left[k] = join(lv, rv) + else + left[k] = rv + end + end + return left +end + +--[[ VIM ]]-- + +vim.opt.tabstop = config.tabwidth +vim.opt.softtabstop = config.tabwidth +vim.opt.shiftwidth = config.tabwidth +vim.opt.expandtab = config.expandtab +vim.opt.mouse = "a" +vim.opt.clipboard = "unnamedplus" +vim.opt.hlsearch = true +vim.opt.autoindent = true +vim.opt.ttyfast = true +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.rnu = true +vim.opt.swapfile = false +vim.opt.fillchars = { eob = " "} + + +--[[ BUF ]]-- + +-- remove trailing whitespace on save +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = { "*" }, + command = [[%s/\s\+$//e]], +}) + +--[[ KEYBINDS ]]-- + +-- leader +vim.g.mapleader = config.keys.leader +vim.g.maplocalleader = config.keys.leader +vim.keymap.set("", '<leader>', '<Nop>', { noremap = true, silent = true }) + +-- lsp +bind(config.keys.noh, vim.cmd.noh) +vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + local opts = {buffer = event.buf} + bind(config.keys.lsp.hover, function() vim.lsp.buf.hover() end, opts) + bind(config.keys.lsp.action, function() vim.lsp.buf.code_action() end, opts) + bind(config.keys.lsp.references, function() vim.lsp.buf.references() end, opts) + bind(config.keys.lsp.rename, function() vim.lsp.buf.rename() end, opts) + end +}) + +--[[ COLORSCHEME ]]-- + +vim.opt.termguicolors = true +if config.theme.transparent then + vim.g.base16_transparent_background = 1 +end + +local colorscheme = require('base16-colorscheme') +colorscheme.setup({ + base00 = config.theme.colors.base00, + base01 = config.theme.colors.base01, + base02 = config.theme.colors.base02, + base03 = config.theme.colors.base03, + base04 = config.theme.colors.base04, + base05 = config.theme.colors.base05, + base06 = config.theme.colors.base06, + base07 = config.theme.colors.base07, + base08 = config.theme.colors.base08, + base09 = config.theme.colors.base09, + base0A = config.theme.colors.base0A, + base0B = config.theme.colors.base0B, + base0C = config.theme.colors.base0C, + base0D = config.theme.colors.base0D, + base0E = config.theme.colors.base0E, + base0F = config.theme.colors.base0F, +}) + +-- make transparent background +if config.theme.transparent then + local colors = { + -- Text + "Normal", "NormalNC", "NormalFloat", + -- Line Numbers + "LineNr", "EndOfBuffer", "SignColumn", + -- Floating + "FloatBorder", + -- Mode/Buffer Lines + "TabLine", "TabLineFill", "StatusLine", + } + for _,color in pairs(colors) do + vim.api.nvim_set_hl(0, color, { bg = "none" }) + end +end +-- identifiers should not be colored +vim.api.nvim_set_hl(0, "Identifier", { fg = config.theme.colors.base05 }) +vim.api.nvim_set_hl(0, "TSVariable", { fg = config.theme.colors.base05 }) +-- macro should be colored as a keyword +vim.api.nvim_set_hl(0, "TSFuncMacro", { fg = config.theme.colors.base0E }) +-- comments are too dark +vim.api.nvim_set_hl(0, "Comment", { fg = config.theme.colors.base07 }) +vim.api.nvim_set_hl(0, "@comment", { link = "Comment" }) + +--[[ MODE LINE ]]-- + +local lualine_theme = require('lualine.themes.base16') +if config.theme.transparent then + lualine_theme.normal.c = { fg = config.theme.colors.base05, bg = "none" } +end + +require('lualine').setup { + options = { + theme = lualine_theme, + icons_enabled = true, + globalstatus = true, + }, +} + +--[[ BUFFER LINE ]]-- + +require('bufferline').setup {} + +--[[ FILE BROWSER ]]-- + +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +require('nvim-tree').setup { + sort = { + sorter = "case_sensitive", + }, + view = { + centralize_selection = true, + signcolumn = "yes", + float = { + enable = true, + quit_on_focus_loss = true, + open_win_config = { + relative = "editor", + border = "rounded", + width = 80, + height = 30, + row = 1, + col = 1, + }, + } + }, + renderer = { + group_empty = true, + }, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + restrict_above_cwd = false, + }, + expand_all = { + max_folder_discovery = 300, + exclude = {}, + }, + file_popup = { + open_win_config = { + col = 1, + row = 1, + relative = "cursor", + border = "shadow", + style = "minimal", + }, + }, + open_file = { + quit_on_open = true, + window_picker = { + enable = false, + picker = "default", + chars = "abcdefghijklmnopqrstuvwxyz1234567890", + exclude = { + filetype = { "notify", "lazy", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + }, + }, + remove_file = { + close_window = true, + }, + }, + filters = { + dotfiles = false, + }, + tab = { + sync = { + open = false, + close = false, + ignore = {}, + }, + }, + git = { + enable = false, + }, + update_cwd = true, + respect_buf_cwd = true, + update_focused_file = { + enable = true, + update_cwd = true + }, +} + +bind(config.keys.menus.browser, vim.cmd.NvimTreeToggle) + +--[[ UNDO TREE ]]-- + +bind(config.keys.menus.undo, vim.cmd.UndotreeToggle) + +--[[ ERROR MENU ]]-- + +bind(config.keys.menus.error, function() require('trouble').toggle() end) + +--[[ TELESCOPE ]]-- + +local telescope = require('telescope.builtin') +bind(config.keys.menus.buffers, telescope.buffers) +bind(config.keys.menus.find, telescope.find_files) +bind(config.keys.menus.grep, telescope.live_grep) +bind(config.keys.menus.help, telescope.help_tags) +if config.theme.transparent then + vim.api.nvim_set_hl(0, 'TelescopeNormal', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopeBorder', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopeResultsTitle', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopePromptTitle', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopePreviewTitle', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopePromptNormal', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopePromptBorder', { bg = "none" }) +end + +--[[ COMPLETION ]]-- + +local cmp = require('cmp') +local cmp_select = {behavior = cmp.SelectBehavior.select} +local cmp_mappings = cmp.mapping.preset.insert({ + [config.keys.cmp.prev] = cmp.mapping.select_prev_item(cmp_select), + [config.keys.cmp.next] = cmp.mapping.select_next_item(cmp_select), + [config.keys.cmp.confirm] = cmp.mapping.confirm({ select = true }), + [config.keys.cmp.complete] = cmp.mapping.complete(), +}) + +cmp_mappings['<Tab>'] = nil +cmp_mappings['<S-Tab>'] = nil + +cmp.setup { + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + sources = cmp.config.sources { + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + { name = 'buffer' }, + }, + mapping = cmp_mappings, +} + +--[[ Surround Delimiters ]]-- + +require('nvim-surround').setup {} + +--[[ SYNTAX HIGHLIGHTING ]]-- + +require('nvim-treesitter.configs').setup { + highlight = { + enable = true, + disable = function(lang, buf) + local max_filesize = config.highlight.max_size * 1024 + 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 = true, + }, +} + +require('illuminate').configure { + providers = { + 'lsp', + 'treesitter', + 'regex', + }, +} + +--[[ TODO COMMENTS ]]-- + +require('todo-comments').setup() + +--[[ LSP SERVER ]]-- + +local lspconfig = require('lspconfig') +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +for lsp,config in pairs(config.lsps) do + local config = join(capabilities, config) + lspconfig[lsp].setup { + capabilities = config, + } +end + +vim.diagnostic.config({ + virtual_lines = true, +}) + +--[[ NOTIFICATIONS ]]-- + +require('fidget').setup { + notification = { + window = { + winblend = 0, + }, + }, +} + +--[[ AUTO INDENTATION ]]-- + +require('indent-o-matic').setup { + max_lines = 2048, + standard_widths = { 2, 4, 8 }, + skip_multiline = true, +} + +--[[ 80 COLUMN WIDTH ]]-- + +if config.col.show then + require('virt-column').setup { + enabled = true, + virtcolumn = tostring(config.col.width), + } +end diff --git a/home/ssh/config b/home/ssh/config new file mode 100644 index 0000000..5ae97b6 --- /dev/null +++ b/home/ssh/config @@ -0,0 +1,12 @@ +Match Host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye" + +Host *.in.freya.cat cid.freya.cat alivemc.net + User root + +Host *.cs.rit.edu + User tam2214 + +Host * + HostkeyAlgorithms +ssh-rsa + PubkeyAcceptedKeyTypes +ssh-rsa + KexAlgorithms -sntrup761x25519-sha512@openssh.com diff --git a/home/ssh/default.nix b/home/ssh/default.nix new file mode 100644 index 0000000..b34e23f --- /dev/null +++ b/home/ssh/default.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: { + # ssh config + home-manager.users.${config.user} = { + programs.ssh = { + enable = true; + extraConfig = lib.fileContents ./config; + }; + }; +} diff --git a/home/starship.nix b/home/starship.nix new file mode 100644 index 0000000..74fd28a --- /dev/null +++ b/home/starship.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + ... +}: { + home-manager.users.${config.user} = { + programs.starship = { + enable = true; + + settings = { + format = lib.concatStrings [ + "╭─ " + "$username" + "$hostname" + "$git_branch" + "$directory" + "$line_break" + "╰─ " + ]; + + username = { + style_user = "bold cyan"; + style_root = "bold red"; + format = "[$user]($style) "; + disabled = false; + show_always = true; + }; + + hostname = { + ssh_only = false; + format = "on [$hostname](bold blue) "; + disabled = false; + }; + + directory = { + format = "[$path]($style)[$read_only]($read_only_style) "; + truncation_length = -1; + truncate_to_repo = false; + truncation_symbol = "…/"; + }; + + git_branch = { + style = "bold purple"; + format = "at [$symbol$branch(:$remote_branch)]($style) "; + }; + }; + }; + }; +} diff --git a/home/tmux/default.nix b/home/tmux/default.nix new file mode 100644 index 0000000..c7ce7db --- /dev/null +++ b/home/tmux/default.nix @@ -0,0 +1,16 @@ +{ + config, + pkgs, + ... +}: { + home-manager.users.${config.user} = { + home.packages = [ + pkgs.tmux + ]; + + home.file = { + ".tmux.conf".source = ./tmux.conf; + ".local/bin/tmux_window".source = ./tmux_window; + }; + }; +} diff --git a/home/tmux/tmux.conf b/home/tmux/tmux.conf new file mode 100644 index 0000000..31ac742 --- /dev/null +++ b/home/tmux/tmux.conf @@ -0,0 +1,105 @@ + +# change prefix +set -g prefix C-a +unbind C-b +bind C-a send-prefix + +# split windows like vim +# vim's definition of a horizontal/vertical split is reversed from tmux's +bind s split-window -v +bind v split-window -h + +# split panes using | and - +bind - split-window -v +bind | split-window -h +unbind '"' +unbind % + +# reload config file +bind r source-file ~/.tmux.conf + +# large history +set -g history-limit 10000 + +# start windows and panes at 1, not 0 +set -g base-index 1 +setw -g pane-base-index 1 + +# switch term +bind 1 run-shell "tmux_window 1" +bind 2 run-shell "tmux_window 2" +bind 3 run-shell "tmux_window 3" +bind 4 run-shell "tmux_window 4" +bind 5 run-shell "tmux_window 5" +bind 6 run-shell "tmux_window 6" +bind 7 run-shell "tmux_window 7" +bind 8 run-shell "tmux_window 8" +bind 9 run-shell "tmux_window 9" +bind 0 run-shell "tmux_window 10" +bind S choose-tree + +# terminal style +set -g default-terminal "tmux-256color" +set -g terminal-overrides "*:colors=256" +set -a terminal-features "xterm-kitty:RGB" + +# focus events +set -g focus-events on + +# move around panes with hjkl, as one would in vim after pressing ctrl-w +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +# enable mouse control +set -g mouse on + +# don't rename windows automatically +set-option -g allow-rename off + +# don't do anything when a 'bell' rings +set -g visual-activity off +set -g visual-bell off +set -g visual-silence off +setw -g monitor-activity off +set -g bell-action none + +# clock mode +setw -g clock-mode-colour yellow + +# copy mode +setw -g mode-style 'fg=black bg=red bold' +setw -g mode-keys vi + +# panes +set -g pane-border-style 'fg=red' +set -g pane-active-border-style 'fg=yellow' + +# statusbar +set -g status-position bottom +set -g status-justify left +set -g status-style 'fg=blue' +set -g status-interval 1 + +set -g status-left '' +set -g status-left-length 10 + +set -g status-right-style 'fg=black bg=blue' +set -g status-right '%Y-%m-%d %H:%M:%S ' +set -g status-right-length 50 + +setw -g window-status-current-style 'fg=black bg=blue' +setw -g window-status-current-format ' #I #W #F ' + +setw -g window-status-style 'fg=blue bg=black' +setw -g window-status-format ' #I #[fg=white]#W #[fg=blue]#F ' + +setw -g window-status-bell-style 'fg=blue bg=red bold' + +# messages +set -g message-style 'fg=yellow bg=red bold' + +# bind : to command-prompt like vim +# this is the default in tmux already +bind : command-prompt diff --git a/home/tmux/tmux_window b/home/tmux/tmux_window new file mode 100755 index 0000000..1cdacf0 --- /dev/null +++ b/home/tmux/tmux_window @@ -0,0 +1,7 @@ +#!/bin/sh + +if tmux list-windows | grep -q "^$1:"; then + tmux select-window -t "$1" +else + tmux new-window -t "$1" +fi diff --git a/home/zsh/default.nix b/home/zsh/default.nix new file mode 100644 index 0000000..ce1820e --- /dev/null +++ b/home/zsh/default.nix @@ -0,0 +1,17 @@ +{config, ...}: { + programs.zsh = { + enable = true; + enableCompletion = true; + enableGlobalCompInit = false; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + histSize = 10000; + }; + + home-manager.users.${config.user} = { + home.file = { + ".zshrc".source = ./zshrc; + ".zprofile".source = ./zprofile; + }; + }; +} diff --git a/home/zsh/zprofile b/home/zsh/zprofile new file mode 100644 index 0000000..4815b36 --- /dev/null +++ b/home/zsh/zprofile @@ -0,0 +1,11 @@ +# dont attempt to launch a graphical +# env in tmux +if [ -n "$TMUX" ]; then + return +fi + +# only launch hyprland on tty 1 +if [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then + export XDG_CURRENT_DESKTOP=Hyprland + exec dbus-run-session Hyprland +fi diff --git a/home/zsh/zshrc b/home/zsh/zshrc new file mode 100644 index 0000000..b1c61a2 --- /dev/null +++ b/home/zsh/zshrc @@ -0,0 +1,73 @@ +# zsh initalization file + +# export 'SHELL' to child processes +export SHELL + +if [[ $- != *i* ]] +then + # We are being invoked from a non-interactive shell. If this + # is an SSH session (as in "ssh host command"), source + # /etc/profile so we get PATH and other essential variables. + [[ -n "$SSH_CLIENT" ]] && source /etc/profile + + # Don't do anything else. + return +fi + +# update PATH +PATH=$PATH:$HOME/.local/bin +PATH=$PATH:$HOME/.cargo/bin + +# vim mode >:) +# no ryan i am not copying you +set -o vi +set show-mode-in-prompt on + +# Set shell prompt using starship +if command -v "starship" > /dev/null; then + eval "$(starship init zsh)" +else + export PS1="$$USER: " +fi + +# aliases +alias rf="rm -fr" # remove le french hon hon hon +alias ls="ls --color=auto" +alias ip="ip --color=auto" +alias grep="grep --color=auto" +alias diff="diff --color=auto" +alias vim="nvim" +alias ssh='TERM=xterm-256color ssh' # xterm-kitty bad + +# nix rebuild +alias rs="sudo nixos-rebuild switch --flake ~/.config/nix#$(hostname)" +alias rh="home-manager switch --flake ~/.config/nix#$(hostname)" + +# manpages +export LESS_TERMCAP_md=$'\e[1;36m' +export LESS_TERMCAP_me=$'\e[0m' +export LESS_TERMCAP_se=$'\e[0m' +export LESS_TERMCAP_so=$'\e[1;92m' +export LESS_TERMCAP_ue=$'\e[0m' +export LESS_TERMCAP_us=$'\e[1;35m' +export GROFF_NO_SGR=1 + +# compinit +autoload compinit && compinit + +# keybinds +bindkey "\e[1;5D" backward-word +bindkey "\e[1;5C" forward-word +bindkey "\e[3;5~" kill-word +bindkey "\C-_" backward-kill-word +bindkey "\e[3~" delete-char +bindkey "\e[H" beginning-of-line +bindkey "\e[F" end-of-line +bindkey "\e\d" undo + +# gpg +export GPG_TTY=$(tty) +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + +# ricing +pfetch |