commit ad3f3f0c8fd88d20a257cf3f8b0a75c08d0574c4 Author: tony Date: Mon Sep 1 23:30:05 2025 -0700 First commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..577b0a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hardware-configuration.nix diff --git a/config/alacritty/alacritty.toml b/config/alacritty/alacritty.toml new file mode 100644 index 0000000..b7c5654 --- /dev/null +++ b/config/alacritty/alacritty.toml @@ -0,0 +1,33 @@ +[window] +opacity=0.9 +[window.padding] +y = 6 +x = 6 + +[font] +normal = { family = "JetBrainsMono Nerd Font Propo", style = "Regular" } +size = 18 + +[colors.bright] +black = "#444b6a" +blue = "#7da6ff" +cyan = "#0db9d7" +green = "#b9f27c" +magenta = "#bb9af7" +red = "#ff7a93" +white = "#acb0d0" +yellow = "#ff9e64" + +[colors.normal] +black = "#32344a" +blue = "#7aa2f7" +cyan = "#449dab" +green = "#9ece6a" +magenta = "#ad8ee6" +red = "#f7768e" +white = "#787c99" +yellow = "#e0af68" + +[colors.primary] +background = "#1a1b26" +foreground = "#a9b1d6" diff --git a/config/nvim/.gitignore b/config/nvim/.gitignore new file mode 100644 index 0000000..e033bc6 --- /dev/null +++ b/config/nvim/.gitignore @@ -0,0 +1 @@ +lazy-lock.json diff --git a/config/nvim/README.md b/config/nvim/README.md new file mode 100644 index 0000000..1779e97 --- /dev/null +++ b/config/nvim/README.md @@ -0,0 +1,117 @@ +# Neovim Keybinds Documentation + +This document provides a simple and organized overview of all the custom keybinds defined in my Neovim configuration. + +## General Keybinds + +| Mode | Key | Action | +|------|-----------------|---------------------------------------------------------------------------------------------| +| `n` | `cd` | Open Ex mode (`:Ex`) | +| `n` | `J` | Join lines while keeping the cursor in place | +| `n` | `` | Scroll half-page down and keep the cursor centered | +| `n` | `` | Scroll half-page up and keep the cursor centered | +| `n` | `n` | Move to next search result and keep it centered | +| `n` | `N` | Move to previous search result and keep it centered | +| `n` | `Q` | Disable Ex mode | +| `n` | `` | Jump to next quickfix entry and keep it centered | +| `n` | `` | Jump to previous quickfix entry and keep it centered | +| `n` | `k` | Jump to next location entry and keep it centered | +| `n` | `j` | Jump to previous location entry and keep it centered | +| `i` | `` | Exit insert mode (acts like `Esc`) | +| `n` | `x` | Make current file executable (`chmod +x`) | +| `n` | `u` | Toggle Undotree | +| `n` | `rl` | Reload the Neovim config (`~/.config/nvim/init.lua`) | +| `n` | `` | Source the current file (`:so`) | + +--- + +## Visual Mode Keybinds + +| Mode | Key | Action | +|------|-----------------|---------------------------------------------------------------------------------------------| +| `v` | `J` | Move selected block down | +| `v` | `K` | Move selected block up | +| `x` | `p` | Paste without overwriting clipboard | +| `v` | `y` | Yank into system clipboard (even on SSH) | + +--- + +## Linting and Formatting + +| Mode | Key | Action | +|------|-----------------|---------------------------------------------------------------------------------------------| +| `n` | `cc` | Run `php-cs-fixer` to lint and format PHP files | +| `n` | `` | Format code (`LSP`) | + +--- + +## Telescope Keybinds + +| Mode | Key | Action | +|------|-----------------|---------------------------------------------------------------------------------------------| +| `n` | `ff` | Find files | +| `n` | `fg` | Find git-tracked files | +| `n` | `fo` | Open recent files | +| `n` | `fq` | Open quickfix list | +| `n` | `fh` | Open help tags | +| `n` | `fb` | Open buffer list | +| `n` | `fs` | Grep current string | +| `n` | `fc` | Grep instances of the current file name without the extension | +| `n` | `fi` | Find files in Neovim configuration directory (`~/.config/nvim/`) | + +--- + +## Harpoon Integration + +| Mode | Key | Action | +|------|-----------------|---------------------------------------------------------------------------------------------| +| `n` | `a` | Add current file to Harpoon list | +| `n` | `` | Toggle Harpoon quick menu | +| `n` | `fl` | Open Harpoon window with Telescope | +| `n` | `` | Go to previous Harpoon mark | +| `n` | `` | Go to next Harpoon mark | + +--- + +## LSP Keybinds + +| Mode | Key | Action | +|-----------|------------|---------------------------------------------------------------------------------------------| +| `n` | `K` | Show hover information | +| `n` | `gd` | Go to definition | +| `n` | `gD` | Go to declaration | +| `n` | `gi` | Go to implementation | +| `n` | `go` | Go to type definition | +| `n` | `gr` | Show references | +| `n` | `gs` | Show signature help | +| `n` | `gl` | Show diagnostics in a floating window | +| `n` | `` | Rename symbol | +| `n`, `x` | `` | Format code asynchronously | +| `n` | `` | Show code actions | + +--- + +## Miscellaneous + +| Mode | Key | Action | +|------|-----------------|---------------------------------------------------------------------------------------------| +| `n` | `dg` | Run `DogeGenerate` (comment documentation generation) | +| `n` | `s` | Replace all instances of the word under the cursor on the current line | + +--- + +# LSP servers: + +I am migrating my lsp config to /lua/plugins/lsp.lua because nvim v0.11 allows a very minimal debloated way to setup language server protocols. + +Below is a running list of what and how to install the lsp's that are going to be configured in this build. I will avoid mason for now because I think its better to have full control over your system, and not outsource it to mason. Just uncommonet `return {` in /plugins/lsp.lua from the original lspconfig if you want to go that route. + +1. { lua-language-server } + - refer to distro ( pacman -Ss lua-language-server ) +2. { css-language-server --studio, html-language-server } + - npm install -g vscode-langservers-extracted +3. { intelephense } + - npm install -g intelephense +4. { typescript-language-server } + - npm install -g typescript-language-server typescript + diff --git a/config/nvim/after/ftplugin/nix.lua b/config/nvim/after/ftplugin/nix.lua new file mode 100644 index 0000000..5507b9e --- /dev/null +++ b/config/nvim/after/ftplugin/nix.lua @@ -0,0 +1,11 @@ +-- ~/.config/nvim/after/ftplugin/nix.lua +local set = vim.opt_local + +set.shiftwidth = 2 +set.tabstop = 2 +set.softtabstop = 2 +set.expandtab = true + +-- extras you want for Nix buffers +set.number = true +set.relativenumber = true diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..e7df95d --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,3 @@ +require('config.options') +require('config.keybinds') +require('config.lazy') diff --git a/config/nvim/lua/config/keybinds.lua b/config/nvim/lua/config/keybinds.lua new file mode 100644 index 0000000..1c1b42c --- /dev/null +++ b/config/nvim/lua/config/keybinds.lua @@ -0,0 +1,63 @@ +-- KEYBINDS +vim.g.mapleader = " " +vim.keymap.set("n", "cd", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") -- Alt Up/Down in vscode +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") -- Remap joining lines +vim.keymap.set("n", "", "zz") -- Keep cursor in place while moving up/down page +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") -- center screen when looping search results +vim.keymap.set("n", "N", "Nzzzv") + +-- paste and don't replace clipboard over deleted text +vim.keymap.set("x", "p", [["_dP]]) +vim.keymap.set({ "n", "v" }, "d", [["_d]]) + + +-- sometimes in insert mode, control-c doesn't exactly work like escape +vim.keymap.set("i", "", "") + +-- add binds for Control J/K to scroll thru quickfix list +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") + +-- What the heck is Ex mode? +vim.keymap.set("n", "Q", "") + +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +-- getting Alex off my back :) +vim.keymap.set("n", "dg", "DogeGenerate") + +-- lint / format php files for LC +vim.keymap.set("n", "cc", "!php-cs-fixer fix % --using-cache=no") + +-- Replace all instances of whatever is under cursor (on line) +vim.keymap.set("n", "s", [[:s/\<\>//gI]]) + +-- make file executable +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) + +-- yank into clipboard even if on ssh +vim.keymap.set('n', 'y', 'OSCYankOperator') +vim.keymap.set('v', 'y', 'OSCYankVisual') + +-- reload without exiting vim +vim.keymap.set("n", "rl", "source ~/.config/nvim/init.lua") + +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + +-- Quickfix list stuff +vim.keymap.set("n", "cl", ":cclose", { silent = true }) +vim.keymap.set("n", "co", ":copen", { silent = true }) +vim.keymap.set("n", "cn", ":cnextzz") +vim.keymap.set("n", "cp", ":cprevzz") +vim.keymap.set("n", "li", ":checkhealth vim.lsp", { desc = "LSP Info" }) + +-- source file +vim.keymap.set("n", "", function() + vim.cmd("so") +end) diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..987478a --- /dev/null +++ b/config/nvim/lua/config/lazy.lua @@ -0,0 +1,21 @@ +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) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = "plugins", + change_detection = { notify = false }, +}) diff --git a/config/nvim/lua/config/options.lua b/config/nvim/lua/config/options.lua new file mode 100644 index 0000000..52de0a7 --- /dev/null +++ b/config/nvim/lua/config/options.lua @@ -0,0 +1,55 @@ +-- OPTIONS +local set = vim.opt + +--line nums +set.relativenumber = true +set.number = true + +-- indentation and tabs +set.tabstop = 4 +set.shiftwidth = 4 +set.autoindent = true +set.expandtab = true + +-- search settings +set.ignorecase = true +set.smartcase = true + +-- appearance +set.termguicolors = true +set.background = "dark" +set.signcolumn = "yes" + +-- cursor line +set.cursorline = true + +-- 80th column +set.colorcolumn = "80" + +-- clipboard +set.clipboard:append("unnamedplus") + +-- backspace +set.backspace = "indent,eol,start" + +-- split windows +set.splitbelow = true +set.splitright = true + +-- dw/diw/ciw works on full-word +set.iskeyword:append("-") + +-- keep cursor at least 8 rows from top/bot +set.scrolloff = 8 + +-- undo dir settings +set.swapfile = false +set.backup = false +set.undodir = os.getenv("HOME") .. "/.vim/undodir" +set.undofile = true + +-- incremental search +set.incsearch = true + +-- faster cursor hold +set.updatetime = 50 diff --git a/config/nvim/lua/plugins/backup-lsp.lua b/config/nvim/lua/plugins/backup-lsp.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/config/nvim/lua/plugins/backup-lsp.lua @@ -0,0 +1 @@ +return {} diff --git a/config/nvim/lua/plugins/colors.lua b/config/nvim/lua/plugins/colors.lua new file mode 100644 index 0000000..c1106e9 --- /dev/null +++ b/config/nvim/lua/plugins/colors.lua @@ -0,0 +1,27 @@ +local function enable_transparency() + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + vim.api.nvim_set_hl(0, "LineNr", { bg = "none" }) +end + +return { + { + "folke/tokyonight.nvim", + config = function() + vim.cmd.colorscheme "tokyonight" + vim.cmd('hi Directory guibg=NONE') + vim.cmd('hi SignColumn guibg=NONE') + enable_transparency() + end + }, + -- { + -- "Mofiqul/vscode.nvim", + -- name = 'vscode', + -- config = function() + -- vim.cmd.colorscheme "vscode" + -- vim.cmd('hi Directory guibg=NONE') + -- vim.cmd('hi SignColumn guibg=NONE') + -- enable_transparency() + -- end + -- } +} diff --git a/config/nvim/lua/plugins/completion.lua b/config/nvim/lua/plugins/completion.lua new file mode 100644 index 0000000..42ff2c4 --- /dev/null +++ b/config/nvim/lua/plugins/completion.lua @@ -0,0 +1,40 @@ +return { + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "hrsh7th/cmp-buffer", + }, + config = function() + local cmp = require("cmp") + + cmp.setup({ + preselect = cmp.PreselectMode.Item, -- <— preselect first item + completion = { completeopt = "menu,menuone,noinsert" }, + window = { documentation = cmp.config.window.bordered() }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.confirm({ select = false }), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.complete(), -- manual trigger if you want it + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then cmp.select_next_item() else fallback() end + end, { "i", "s" }), + [""] = cmp.mapping(function() + if cmp.visible() then cmp.select_prev_item() end + end, { "i", "s" }), + }), + sources = { + { name = "nvim_lsp" }, + { name = "path" }, + { name = "buffer", keyword_length = 3 }, + }, + }) + end, + }, +} diff --git a/config/nvim/lua/plugins/harpoon.lua b/config/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..d016039 --- /dev/null +++ b/config/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,39 @@ +local conf = require('telescope.config').values +local themes = require('telescope.themes') + +-- helper function to use telescope on harpoon list. +-- change get_ivy to other themes if wanted +local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + local opts = themes.get_ivy({ + promt_title = "Working List" + }) + + require("telescope.pickers").new(opts, { + finder = require("telescope.finders").new_table({ + results = file_paths, + }), + previewer = conf.file_previewer(opts), + sorter = conf.generic_sorter(opts), + }):find() +end + +return { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { + "nvim-lua/plenary.nvim" + }, + config = function() + local harpoon = require('harpoon') + vim.keymap.set("n", "a", function() harpoon:list():add() end) + vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + vim.keymap.set("n", "fl", function() toggle_telescope(harpoon:list()) end, + { desc = "Open harpoon window" }) + vim.keymap.set("n", "", function() harpoon:list():prev() end) + vim.keymap.set("n", "", function() harpoon:list():next() end) + end +} diff --git a/config/nvim/lua/plugins/init.lua b/config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..e5acb8b --- /dev/null +++ b/config/nvim/lua/plugins/init.lua @@ -0,0 +1,6 @@ +return { + -- { + -- "nvim-lua/plenary.nvim", + -- name = "plenary" + -- }, +} diff --git a/config/nvim/lua/plugins/lsp.lua b/config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..1769f85 --- /dev/null +++ b/config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,228 @@ +return {} +-- return { +-- 'neovim/nvim-lspconfig', +-- dependencies = { +-- 'williamboman/mason.nvim', +-- 'williamboman/mason-lspconfig.nvim', +-- -- Autocompletion +-- 'hrsh7th/nvim-cmp', +-- 'hrsh7th/cmp-buffer', +-- 'hrsh7th/cmp-path', +-- 'saadparwaiz1/cmp_luasnip', +-- 'hrsh7th/cmp-nvim-lsp', +-- 'hrsh7th/cmp-nvim-lua', +-- -- Snippets +-- 'L3MON4D3/LuaSnip', +-- 'rafamadriz/friendly-snippets', +-- }, +-- config = function() +-- local autoformat_filetypes = { +-- "lua", +-- } +-- -- Create a keymap for vim.lsp.buf.implementation +-- vim.api.nvim_create_autocmd('LspAttach', { +-- callback = function(args) +-- local client = vim.lsp.get_client_by_id(args.data.client_id) +-- if not client then return end +-- if vim.tbl_contains(autoformat_filetypes, vim.bo.filetype) then +-- vim.api.nvim_create_autocmd("BufWritePre", { +-- buffer = args.buf, +-- callback = function() +-- vim.lsp.buf.format({ +-- formatting_options = { tabSize = 4, insertSpaces = true }, +-- bufnr = args.buf, +-- id = client.id +-- }) +-- end +-- }) +-- end +-- end +-- }) +-- +-- -- Add borders to floating windows +-- vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( +-- vim.lsp.handlers.hover, +-- { border = 'rounded' } +-- ) +-- vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( +-- vim.lsp.handlers.signature_help, +-- { border = 'rounded' } +-- ) +-- +-- -- Configure error/warnings interface +-- vim.diagnostic.config({ +-- virtual_text = true, +-- severity_sort = true, +-- float = { +-- style = 'minimal', +-- border = 'rounded', +-- header = '', +-- prefix = '', +-- }, +-- signs = { +-- text = { +-- [vim.diagnostic.severity.ERROR] = '✘', +-- [vim.diagnostic.severity.WARN] = '▲', +-- [vim.diagnostic.severity.HINT] = '⚑', +-- [vim.diagnostic.severity.INFO] = '»', +-- }, +-- }, +-- }) +-- +-- local lspconfig_defaults = require('lspconfig').util.default_config +-- lspconfig_defaults.capabilities = vim.tbl_deep_extend( +-- 'force', +-- lspconfig_defaults.capabilities, +-- require('cmp_nvim_lsp').default_capabilities() +-- ) +-- +-- -- This is where you enable features that only work +-- -- if there is a language server active in the file +-- vim.api.nvim_create_autocmd('LspAttach', { +-- callback = function(event) +-- local opts = { buffer = event.buf } +-- +-- vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) +-- vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) +-- vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) +-- vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) +-- vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) +-- vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) +-- vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) +-- vim.keymap.set('n', 'gl', 'lua vim.diagnostic.open_float()', opts) +-- vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) +-- vim.keymap.set({ 'n', 'x' }, '', 'lua vim.lsp.buf.format({async = true})', opts) +-- vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) +-- end, +-- }) +-- +-- require('mason').setup({}) +-- require('mason-lspconfig').setup({ +-- ensure_installed = { +-- "lua_ls", +-- "intelephense", +-- "ts_ls", +-- "eslint", +-- "pyright", +-- }, +-- handlers = { +-- function(server_name) +-- if server_name == "luals" then return end -- avoid starting with {} +-- require('lspconfig')[server_name].setup({}) +-- end, +-- +-- lua_ls = function() +-- require('lspconfig').luals.setup({ +-- settings = { +-- Lua = { +-- runtime = { +-- version = 'LuaJIT', +-- }, +-- diagnostics = { +-- globals = { 'vim' }, +-- }, +-- workspace = { +-- library = { vim.env.VIMRUNTIME }, +-- }, +-- }, +-- }, +-- }) +-- end, +-- }, +-- }) +-- +-- local cmp = require('cmp') +-- +-- require('luasnip.loaders.from_vscode').lazy_load() +-- +-- vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } +-- +-- cmp.setup({ +-- preselect = 'item', +-- completion = { +-- completeopt = 'menu,menuone,noinsert' +-- }, +-- window = { +-- documentation = cmp.config.window.bordered(), +-- }, +-- sources = { +-- { name = 'path' }, +-- { name = 'nvim_lsp' }, +-- { name = 'buffer', keyword_length = 3 }, +-- { name = 'luasnip', keyword_length = 2 }, +-- }, +-- snippet = { +-- expand = function(args) +-- require('luasnip').lsp_expand(args.body) +-- end, +-- }, +-- formatting = { +-- fields = { 'abbr', 'menu', 'kind' }, +-- format = function(entry, item) +-- local n = entry.source.name +-- if n == 'nvim_lsp' then +-- item.menu = '[LSP]' +-- else +-- item.menu = string.format('[%s]', n) +-- end +-- return item +-- end, +-- }, +-- mapping = cmp.mapping.preset.insert({ +-- -- confirm completion item +-- [''] = cmp.mapping.confirm({ select = false }), +-- +-- -- scroll documentation window +-- [''] = cmp.mapping.scroll_docs(5), +-- [''] = cmp.mapping.scroll_docs(-5), +-- +-- -- toggle completion menu +-- [''] = cmp.mapping(function(fallback) +-- if cmp.visible() then +-- cmp.abort() +-- else +-- cmp.complete() +-- end +-- end), +-- +-- -- tab complete +-- [''] = cmp.mapping(function(fallback) +-- local col = vim.fn.col('.') - 1 +-- +-- if cmp.visible() then +-- cmp.select_next_item({ behavior = 'select' }) +-- elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then +-- fallback() +-- else +-- cmp.complete() +-- end +-- end, { 'i', 's' }), +-- +-- -- go to previous item +-- [''] = cmp.mapping.select_prev_item({ behavior = 'select' }), +-- +-- -- navigate to next snippet placeholder +-- [''] = cmp.mapping(function(fallback) +-- local luasnip = require('luasnip') +-- +-- if luasnip.jumpable(1) then +-- luasnip.jump(1) +-- else +-- fallback() +-- end +-- end, { 'i', 's' }), +-- +-- -- navigate to the previous snippet placeholder +-- [''] = cmp.mapping(function(fallback) +-- local luasnip = require('luasnip') +-- +-- if luasnip.jumpable(-1) then +-- luasnip.jump(-1) +-- else +-- fallback() +-- end +-- end, { 'i', 's' }), +-- }), +-- }) +-- end +-- } diff --git a/config/nvim/lua/plugins/lualine.lua b/config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..94a37ef --- /dev/null +++ b/config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,11 @@ +return { + { + 'nvim-lualine/lualine.nvim', + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + opts = { + theme = 'tokyonight', + } + } +} diff --git a/config/nvim/lua/plugins/one-liners.lua b/config/nvim/lua/plugins/one-liners.lua new file mode 100644 index 0000000..17ffc91 --- /dev/null +++ b/config/nvim/lua/plugins/one-liners.lua @@ -0,0 +1,24 @@ +return { + { -- This helps with php/html for indentation + 'captbaritone/better-indent-support-for-php-with-html', + }, + { -- This helps with ssh tunneling and copying to clipboard + 'ojroques/vim-oscyank', + }, + { -- This generates docblocks + 'kkoomen/vim-doge', + build = ':call doge#install()' + }, + { -- Git plugin + 'tpope/vim-fugitive', + }, + { -- Show historical versions of the file locally + 'mbbill/undotree', + }, + { -- Show CSS Colors + 'brenoprata10/nvim-highlight-colors', + config = function() + require('nvim-highlight-colors').setup({}) + end + }, +} diff --git a/config/nvim/lua/plugins/orgmode.lua b/config/nvim/lua/plugins/orgmode.lua new file mode 100644 index 0000000..f4b36e0 --- /dev/null +++ b/config/nvim/lua/plugins/orgmode.lua @@ -0,0 +1,12 @@ +return { + 'nvim-orgmode/orgmode', + event = 'VeryLazy', + ft = { 'org' }, + config = function() + -- Setup orgmode + require('orgmode').setup({ + org_agenda_files = '~/orgfiles/**/*', + org_default_notes_file = '~/orgfiles/refile.org', + }) + end, +} diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..3c10c7e --- /dev/null +++ b/config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,48 @@ +return { + 'nvim-telescope/telescope.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + config = function() + local actions = require('telescope.actions') + require('telescope').setup({ + defaults = { + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist + } + } + } + }) + + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fo', builtin.oldfiles, {}) + vim.keymap.set('n', 'fq', builtin.quickfix, {}) + vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) + vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) + + -- Rip grep + Fzf + vim.keymap.set('n', 'fg', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }); + end) + + -- Find instance instance of current view being included + vim.keymap.set('n', 'fc', function() + local filename_without_extension = vim.fn.expand('%:t:r') + builtin.grep_string({ search = filename_without_extension }) + end, { desc = "Find current file: " }) + + -- Grep current string (for when gd doesn't work) + vim.keymap.set('n', 'fs', function() + builtin.grep_string({}) + end, { desc = "Find current string: " }) + + -- find files in vim config + vim.keymap.set('n', 'fi', function() + builtin.find_files({ cwd = "~/.config/nvim/" }); + end) + end +} diff --git a/config/nvim/lua/plugins/treesitter.lua b/config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..71cbc58 --- /dev/null +++ b/config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,58 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + config = function() + local configs = require("nvim-treesitter.configs") + ---@diagnostic disable-next-line: missing-fields + configs.setup({ + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + }, + }, + }, + -- enable syntax highlighting + highlight = { + enable = true, + }, + -- enable indentation + indent = { enable = true }, + -- enable autotagging (w/ nvim-ts-autotag plugin) + autotag = { enable = true }, + -- ensure these language parsers are installed + ensure_installed = { + "json", + "python", + "javascript", + "query", + "typescript", + "tsx", + "php", + "yaml", + "html", + "css", + "markdown", + "markdown_inline", + "bash", + "lua", + "vim", + "vimdoc", + "c", + "dockerfile", + "gitignore", + "astro", + }, + -- auto install above language parsers + auto_install = false, + }) + end + } +} diff --git a/config/nvim/plugin/flterm.lua b/config/nvim/plugin/flterm.lua new file mode 100644 index 0000000..d766181 --- /dev/null +++ b/config/nvim/plugin/flterm.lua @@ -0,0 +1,55 @@ +-- Remap leaving 'terminal mode' to double tap esc +vim.keymap.set("t", "", "") + +local state = { + floating = { + buf = -1, + win = -1, + } +} + +local function open_floating_terminal(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 row = math.floor((vim.o.lines - height) / 2) + local col = math.floor((vim.o.columns - width) / 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 + if not buf then + error("Failed to create buffer") + end + + local win = vim.api.nvim_open_win(buf, true, { + relative = 'editor', + width = width, + height = height, + row = row, + col = col, + style = 'minimal', + border = 'rounded', + }) + + return { buf = buf, win = win } +end + +local toggle_terminal = function() + if not vim.api.nvim_win_is_valid(state.floating.win) then + state.floating = open_floating_terminal({ buf = state.floating.buf }); + if vim.bo[state.floating.buf].buftype ~= "terminal" then + vim.cmd.terminal() + vim.cmd("startinsert!") + end + else + vim.api.nvim_win_hide(state.floating.win) + end +end + +vim.api.nvim_create_user_command("Flterm", toggle_terminal, {}) +vim.api.nvim_set_keymap('n', 'ft', [[:Flterm]], { noremap = true, silent = true }) diff --git a/config/nvim/plugin/lsp.lua b/config/nvim/plugin/lsp.lua new file mode 100644 index 0000000..a56c3a2 --- /dev/null +++ b/config/nvim/plugin/lsp.lua @@ -0,0 +1,159 @@ +vim.lsp.config('*', { + root_markers = { '.git' }, +}) + +vim.diagnostic.config({ + virtual_text = true, + severity_sort = true, + float = { + style = 'minimal', + border = 'rounded', + source = 'if_many', + header = '', + prefix = '', + }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = '✘', + [vim.diagnostic.severity.WARN] = '▲', + [vim.diagnostic.severity.HINT] = '⚑', + [vim.diagnostic.severity.INFO] = '»', + }, + }, +}) +-- put early in lsp.lua +local orig = vim.lsp.util.open_floating_preview +---@diagnostic disable-next-line: duplicate-set-field +function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) + opts = opts or {} + opts.border = opts.border or 'rounded' + opts.max_width = opts.max_width or 80 + opts.max_height = opts.max_height or 24 + opts.wrap = opts.wrap ~= false + return orig(contents, syntax, opts, ...) +end + +-- 4) Per-buffer behavior on LSP attach (keymaps, auto-format, completion) +-- See :help LspAttach for the recommended pattern +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('my.lsp', {}), + callback = function(args) + local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) + local buf = args.buf + local map = function(mode, lhs, rhs) vim.keymap.set(mode, lhs, rhs, { buffer = buf }) end + + -- Keymaps (use builtin LSP buffer functions) + map('n', 'K', vim.lsp.buf.hover) + map('n', 'gd', vim.lsp.buf.definition) + map('n', 'gD', vim.lsp.buf.declaration) + map('n', 'gi', vim.lsp.buf.implementation) + map('n', 'go', vim.lsp.buf.type_definition) + map('n', 'gr', vim.lsp.buf.references) + map('n', 'gs', vim.lsp.buf.signature_help) + map('n', 'gl', vim.diagnostic.open_float) + map('n', '', vim.lsp.buf.rename) + map({ 'n', 'x' }, '', function() vim.lsp.buf.format({ async = true }) end) + map('n', '', vim.lsp.buf.code_action) + + -- Put near your LSP on_attach + local excluded_filetypes = { php = true } + + -- Auto-format on save (only if server can't do WillSaveWaitUntil) + if not client:supports_method('textDocument/willSaveWaitUntil') + and client:supports_method('textDocument/formatting') + and not excluded_filetypes[vim.bo[buf].filetype] + then + vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('my.lsp.format', { clear = false }), + buffer = buf, + callback = function() + vim.lsp.buf.format({ bufnr = buf, id = client.id, timeout_ms = 1000 }) + end, + }) + end + end, +}) + +-- 5) Define the Lua language server config (no mason/lspconfig) +-- See :help lsp-new-config and :help vim.lsp.config() +local caps = require("cmp_nvim_lsp").default_capabilities() +vim.lsp.config['luals'] = { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' }, + capabilities = caps, + settings = { + Lua = { + runtime = { version = 'LuaJIT' }, + diagnostics = { globals = { 'vim' } }, + workspace = { + checkThirdParty = false, + library = vim.api.nvim_get_runtime_file('', true), + }, + telemetry = { enable = false }, + }, + }, +} + +vim.lsp.config['cssls'] = { + cmd = { 'vscode-css-language-server', '--stdio' }, + filetypes = { 'css', 'scss', 'less' }, + root_markers = { 'package.json', '.git' }, + capabilities = caps, + settings = { + css = { validate = true }, + scss = { validate = true }, + less = { validate = true }, + }, +} + +vim.lsp.config['phpls'] = { + cmd = { 'intelephense', '--stdio' }, + filetypes = { 'php' }, + root_markers = { 'composer.json', '.git' }, + capabilities = caps, + settings = { + intelephense = { + files = { + maxSize = 5000000, -- default 5MB + }, + }, + }, +} + +vim.lsp.config['ts_ls'] = { + cmd = { 'typescript-language-server', '--stdio' }, + filetypes = { + 'javascript', 'javascriptreact', 'javascript.jsx', + 'typescript', 'typescriptreact', 'typescript.tsx', + }, + root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' }, + capabilities = caps, + settings = { + completions = { + completeFunctionCalls = true, + }, + }, +} + +-- Nix LSP (nil) +vim.lsp.config['nil_ls'] = { + cmd = { 'nil' }, + filetypes = { 'nix' }, + root_markers = { 'flake.nix', 'default.nix', '.git' }, + capabilities = caps, + settings = { + ['nil'] = { + formatting = { + command = { "nixpkgs-fmt" } -- or "alejandra" if you prefer + } + } + } +} + + +vim.lsp.enable('luals') +vim.lsp.enable('cssls') +vim.lsp.enable('ts_ls') +vim.lsp.enable('phpls') +vim.lsp.enable('nil_ls') diff --git a/config/nvim/plugin/quickformat.lua b/config/nvim/plugin/quickformat.lua new file mode 100644 index 0000000..038dadf --- /dev/null +++ b/config/nvim/plugin/quickformat.lua @@ -0,0 +1,40 @@ +local function reformat_parenthesized_content() + local bufnr = vim.api.nvim_get_current_buf() + local row = vim.api.nvim_win_get_cursor(0)[1] + local line = vim.api.nvim_buf_get_lines(bufnr, row - 1, row, false)[1] + + local inside = line:match("%((.-)%)") + if not inside then + vim.notify( + "No content found inside parentheses", + vim.log.levels.ERROR + ) + return + end + + local prefix = line:match("^(.-)%(") or "" + local suffix = line:match("%)(.*)$") or "" + + local parts = vim.split(inside, ",%s*") + if #parts == 0 then + vim.notify("No comma-separated content found", vim.log.levels.ERROR) + return + end + + local new_lines = {} + table.insert(new_lines, prefix .. "(") + for i, part in ipairs(parts) do + if i < #parts then + table.insert(new_lines, " " .. part .. ",") + else + table.insert(new_lines, " " .. part) + end + end + table.insert(new_lines, " )" .. suffix) + + vim.api.nvim_buf_set_lines(bufnr, row - 1, row, false, new_lines) +end + +vim.keymap.set("n", "qq", function() + reformat_parenthesized_content() +end) diff --git a/config/picom/picom.conf b/config/picom/picom.conf new file mode 100644 index 0000000..b43ec96 --- /dev/null +++ b/config/picom/picom.conf @@ -0,0 +1,21 @@ +backend = "glx" +fading = true; +fade-in-step = 0.03; +fade-out-step = 0.03; +fade-delta = 5; + +corner-radius=0; + +inactive-opacity = 1.0; +active-opacity = 1.0; +frame-opacity = 0.7; +wintypes: +{ + popup_menu = { opacity = 0.9; }; + dropdown_menu = { opacity = 0.9; }; +} + +opacity-rule = [ + "100:class_g = 'dwm'", + "85:class_g = 'st'", +]; diff --git a/config/qtile/__pycache__/config.cpython-312.pyc b/config/qtile/__pycache__/config.cpython-312.pyc new file mode 100644 index 0000000..9e8cc2c Binary files /dev/null and b/config/qtile/__pycache__/config.cpython-312.pyc differ diff --git a/config/qtile/__pycache__/config.cpython-313.pyc b/config/qtile/__pycache__/config.cpython-313.pyc new file mode 100644 index 0000000..78d6a78 Binary files /dev/null and b/config/qtile/__pycache__/config.cpython-313.pyc differ diff --git a/config/qtile/config.py b/config/qtile/config.py new file mode 100644 index 0000000..3d3432c --- /dev/null +++ b/config/qtile/config.py @@ -0,0 +1,330 @@ +from libqtile import bar, extension, hook, layout, qtile, widget +from libqtile.config import Click, Drag, Group, Key, KeyChord, Match, Screen +from libqtile.lazy import lazy +from libqtile.utils import guess_terminal +import os +import subprocess + + +mod = "mod4" +terminal = guess_terminal() + +myTerm = "alacritty" # My terminal of choice + +keys = [ + Key([mod], "h", lazy.layout.left(), desc="Move focus to left"), + Key([mod], "l", lazy.layout.right(), desc="Move focus to right"), + Key([mod], "j", lazy.layout.down(), desc="Move focus down"), + Key([mod], "k", lazy.layout.up(), desc="Move focus up"), + Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"), + # Move windows between left/right columns or move up/down in current stack. + # Moving out of range in Columns layout will create new column. + Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"), + Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"), + Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"), + Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"), + # Grow windows. If current window is on the edge of screen and direction + # will be to screen edge - window would shrink. + Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"), + Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"), + Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"), + Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"), + Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), + # Toggle between split and unsplit sides of stack. + # Split = all windows displayed + # Unsplit = 1 window displayed, like Max layout, but still with + # multiple stack panes + Key( + [mod, "shift"], + "Return", + lazy.layout.toggle_split(), + desc="Toggle between split and unsplit sides of stack", + ), + Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), + # Toggle between different layouts as defined below + Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), + Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), + Key( + [mod], + "f", + lazy.window.toggle_fullscreen(), + desc="Toggle fullscreen on the focused window", + ), + Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"), + Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), + Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), + Key([mod], "d", lazy.spawn("rofi -show drun -show-icons"), desc='Run Launcher'), + Key( + ["control"], + "F12", + lazy.spawn('sh -c "maim -s | xclip -selection clipboard -t image/png -i"'), + desc="Screenshot" + ), +] + +# Add key bindings to switch VTs in Wayland. +# We can't check qtile.core.name in default config as it is loaded before qtile is started +# We therefore defer the check until the key binding is run by using .when(func=...) +for vt in range(1, 8): + keys.append( + Key( + ["control", "mod1"], + f"f{vt}", + lazy.core.change_vt(vt).when(func=lambda: qtile.core.name == "wayland"), + desc=f"Switch to VT{vt}", + ) + ) + + +groups = [Group(i) for i in "123456789"] + +for i in groups: + keys.extend( + [ + # mod + group number = switch to group + Key( + [mod], + i.name, + lazy.group[i.name].toscreen(), + desc=f"Switch to group {i.name}", + ), + # mod + shift + group number = switch to & move focused window to group + # Key( + # [mod, "shift"], + # i.name, + # lazy.window.togroup(i.name, switch_group=True), + # desc=f"Switch to & move focused window to group {i.name}", + # ), + # Or, use below if you prefer not to switch to that group. + # # mod + shift + group number = move focused window to group + Key([mod, "shift"], i.name, lazy.window.togroup(i.name), + desc="move focused window to group {}".format(i.name)), + ] + ) + +colors = [ + ["#1a1b26", "#1a1b26"], # bg (primary.background) + ["#a9b1d6", "#a9b1d6"], # fg (primary.foreground) + ["#32344a", "#32344a"], # color01 (normal.black) + ["#f7768e", "#f7768e"], # color02 (normal.red) + ["#9ece6a", "#9ece6a"], # color03 (normal.green) + ["#e0af68", "#e0af68"], # color04 (normal.yellow) + ["#7aa2f7", "#7aa2f7"], # color05 (normal.blue) + ["#ad8ee6", "#ad8ee6"], # color06 (normal.magenta) + ["#0db9d7", "#0db9d7"], # color15 (bright.cyan) + ["#444b6a", "#444b6a"] # color[9] (bright.black) +] + +# helper in case your colors are ["#hex", "#hex"] +def C(x): return x[0] if isinstance(x, (list, tuple)) else x + +layout_theme = { + "border_width" : 1, + "margin" : 1, + "border_focus" : colors[6], + "border_normal" : colors[0], +} + +layouts = [ + layout.Columns(**layout_theme), + layout.Max(), + # Try more layouts by unleashing below layouts. + # layout.Stack(num_stacks=2), + # layout.Bsp(), + # layout.Matrix(), + layout.MonadTall(**layout_theme), + # layout.MonadWide(), + # layout.RatioTile(), + # layout.Tile(), + # layout.TreeTab(), + # layout.VerticalTile(), + # layout.Zoomy(), +] + +widget_defaults = dict( + font="JetBrainsMono Nerd Font Propo Bold", + # font="Ubuntu Bold", + fontsize=14, + padding=0, + background=colors[0], +) + + +extension_defaults = widget_defaults.copy() + +sep = widget.Sep(linewidth=1, padding=8, foreground=colors[9]) + +screens = [ + Screen( + top=bar.Bar( + widgets = [ + widget.Spacer(length = 8), + widget.Image( + filename = "~/.config/qtile/icons/tonybtw.png", + # filename = "~/.config/qtile/icons/debian.png", + scale = "False", + mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn("qtilekeys-yad")}, + ), + widget.Prompt( + font = "Ubuntu Mono", + fontsize=14, + foreground = colors[1] + ), + widget.GroupBox( + fontsize = 16, + margin_y = 5, + margin_x = 5, + padding_y = 0, + padding_x = 2, + borderwidth = 3, + active = colors[8], + inactive = colors[9], + rounded = False, + highlight_color = colors[0], + highlight_method = "line", + this_current_screen_border = colors[7], + this_screen_border = colors [4], + other_current_screen_border = colors[7], + other_screen_border = colors[4], + ), + widget.TextBox( + text = '|', + font = "JetBrainsMono Nerd Font Propo Bold", + foreground = colors[9], + padding = 2, + fontsize = 14 + ), + widget.CurrentLayout( + foreground = colors[1], + padding = 5 + ), + widget.TextBox( + text = '|', + font = "JetBrainsMono Nerd Font Propo Bold", + foreground = colors[9], + padding = 2, + fontsize = 14 + ), + widget.WindowName( + foreground = colors[6], + padding = 8, + max_chars = 40 + ), + widget.GenPollText( + update_interval = 300, + func = lambda: subprocess.check_output("printf $(uname -r)", shell=True, text=True), + foreground = colors[3], + padding = 8, + fmt = '{}', + ), + sep, + widget.CPU( + foreground = colors[4], + padding = 8, + mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e btop')}, + format="CPU: {load_percent}%", + ), + sep, + widget.Memory( + foreground = colors[8], + padding = 8, + mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e btop')}, + format = 'Mem: {MemUsed:.0f}{mm}', + ), + sep, + widget.DF( + update_interval = 60, + foreground = colors[5], + padding = 8, + mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn('notify-disk')}, + partition = '/', + #format = '[{p}] {uf}{m} ({r:.0f}%)', + format = '{uf}{m} free', + fmt = 'Disk: {}', + visible_on_warn = False, + ), + # sep, + # widget.Battery( + # foreground=colors[6], # pick a palette slot you like + # padding=8, + # update_interval=5, + # format='{percent:2.0%} {char} {hour:d}:{min:02d}', # e.g. "73% ⚡ 1:45" + # fmt='Bat: {}', + # charge_char='', # shown while charging + # discharge_char='', # Nerd icon; use '-' if you prefer plain ascii + # full_char='✔', # when at/near 100% + # unknown_char='?', + # empty_char='!', + # mouse_callbacks={ + # 'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e upower -i $(upower -e | grep BAT)'), + # }, + # ), + sep, + widget.Volume( + foreground = colors[7], + padding = 8, + fmt = 'Vol: {}', + ), + sep, + widget.Clock( + foreground = colors[8], + padding = 8, + mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn('notify-date')}, + ## Uncomment for date and time + format = "%a, %b %d - %H:%M", + ## Uncomment for time only + # format = "%I:%M %p", + ), + widget.Systray(padding = 6), + widget.Spacer(length = 8), + ], + # 24, + # border_width=[2, 0, 2, 0], # Draw top and bottom borders + # border_color=["ff00ff", "000000", "ff00ff", "000000"], # Borders are magenta + margin=[0, 0, 1, 0], + size=30 + ), + ), +] + +# Drag floating layouts. +mouse = [ + Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), + Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()), + Click([mod], "Button2", lazy.window.bring_to_front()), +] + +dgroups_key_binder = None +dgroups_app_rules = [] # type: list +follow_mouse_focus = True +bring_front_click = False +floats_kept_above = True +cursor_warp = False +floating_layout = layout.Floating( + float_rules=[ + # Run the utility of `xprop` to see the wm class and name of an X client. + *layout.Floating.default_float_rules, + Match(wm_class="confirmreset"), # gitk + Match(wm_class="makebranch"), # gitk + Match(wm_class="maketag"), # gitk + Match(wm_class="ssh-askpass"), # ssh-askpass + Match(title="branchdialog"), # gitk + Match(title="pinentry"), # GPG key password entry + ] +) +auto_fullscreen = True +focus_on_window_activation = "smart" +reconfigure_screens = True + +# If things like steam games want to auto-minimize themselves when losing +# focus, should we respect this or not? +auto_minimize = True + +# When using the Wayland backend, this can be used to configure input devices. +wl_input_rules = None + +# xcursor theme (string or None) and size (integer) for Wayland backend +wl_xcursor_theme = None +wl_xcursor_size = 24 + +wmname = "LG3D" diff --git a/config/qtile/icons/debian.png b/config/qtile/icons/debian.png new file mode 100644 index 0000000..85ba883 Binary files /dev/null and b/config/qtile/icons/debian.png differ diff --git a/config/qtile/icons/tonybtw.png b/config/qtile/icons/tonybtw.png new file mode 100644 index 0000000..5ba7616 Binary files /dev/null and b/config/qtile/icons/tonybtw.png differ diff --git a/config/rofi/backup-config b/config/rofi/backup-config new file mode 100644 index 0000000..57fdb88 --- /dev/null +++ b/config/rofi/backup-config @@ -0,0 +1,48 @@ +configuration { + modi: "drun,run"; + show-icons: false; + font: "monospace 10"; + fullscreen: false; + dpi: 96; +} + +* { + background: #2E3440; /* Nord0 */ + foreground: #D8DEE9; /* Nord4 */ + selected-background: #88C0D0; /* Nord8 */ + selected-foreground: #2E3440; /* Nord0 */ + border: 0; + padding: 6; + spacing: 5; + width: 50%; +} + +window { + location: center; + border-radius: 6px; +} + +inputbar { + background: @background; + text-color: @foreground; + padding: 10px; + border-radius: 6px; +} + +listview { + padding: 5px; + lines: 10; +} + +element { + background: transparent; + text-color: @foreground; +} + +element selected { + background: @selected-background; + text-color: @selected-foreground; + border-radius: 4px; +} + +@theme "/usr/share/rofi/themes/DarkBlue.rasi" diff --git a/config/rofi/config.rasi b/config/rofi/config.rasi new file mode 100644 index 0000000..488136c --- /dev/null +++ b/config/rofi/config.rasi @@ -0,0 +1,29 @@ +configuration{ + modi: ["drun", "window", "run"]; + icon-theme: "Papirus-Dark"; + show-icons: true; + terminal: "alacritty"; + drun-display-format: "{icon} {name}"; + location: 0; + disable-history: false; + sidebar-mode: false; + display-drun: " "; + display-run: " "; + display-window: " "; + + //adding vim keybindings + kb-row-up: "Up,Control+k"; + kb-row-left: "Left,Control+h"; + kb-row-right: "Right,Control+l"; + kb-row-down: "Down,Control+j"; + + kb-accept-entry: "Control+z,Control+y,Return,KP_Enter"; + + //fixing up + kb-remove-to-eol: ""; + kb-move-char-back: "Control+b"; + kb-remove-char-back: "BackSpace"; + kb-move-char-forward: "Control+f"; + kb-mode-complete: "Control+o"; +} +@theme "tokyonight.rasi" diff --git a/config/rofi/dwm-config.rasi b/config/rofi/dwm-config.rasi new file mode 100644 index 0000000..e2ae40c --- /dev/null +++ b/config/rofi/dwm-config.rasi @@ -0,0 +1,93 @@ +configuration { + modi: "drun"; + font: "JetBrainsMono Nerd Font 10"; + show-icons: false; + terminal: "alacritty"; + icon-theme: "Papirus-Dark"; + drun-display-format: "{name}"; + display-drun: ""; + timeout { + action: "kb-cancel"; + delay: 0; + } + filebrowser { + directories-first: true; + sorting-method: "name"; + } +} + +@theme "/dev/null" + +* { + bg: #232933; + fg: #d8dee9; + selected: #2d3543; + accent: #4d6a8e; + background-color: @bg; + + color: @fg; + border: 0; + border-color: @bg; + margin: 0; + padding: 0; + spacing: 0; + highlight: none; +} + +window { + width: 700px; +} + +element { + padding: 6 5 7 5; + text-color: @fg; +} + +element-text { + vertical-align: 0.5; + padding: 5px; +} + +element selected { + background-color: @selected; +} + +element-text selected { + background-color: @selected; +} + +element-icon selected { + background-color: @selected; +} + +element-icon { + size: 30; +} + +entry { + background-color: @bg; + columns: 1; + lines: 20; +} + +inputbar { + children: [prompt, entry]; +} + +prompt { + text-color: @bg; + background-color: @accent; + padding: 12 12 12 12; +} + +entry { + text-color: @bg; + background-color: @accent; + padding: 12 5 12 0; +} + +listview { + background-color: @bg; + columns: 3; + lines: 6; +} diff --git a/config/rofi/tokyonight.rasi b/config/rofi/tokyonight.rasi new file mode 100644 index 0000000..bd64a99 --- /dev/null +++ b/config/rofi/tokyonight.rasi @@ -0,0 +1,137 @@ +/* + * Tokyonight colorscheme (big icons) for rofi + * User: w8ste + */ + + +// define colors etc. +* { + bg: #24283b; + hv: #9274ca; + primary: #444b6a; // TokyoNight bright black + ug: #0B2447; + font: "Monospace 11"; + background-color: @bg; + //dark: @bg; + border: 0px; + kl: #7aa2f7; + black: #000000; + + transparent: rgba(46,52,64,0); +} + +// defines different aspects of the window +window { + width: 700; + /*since line wont work with height, i comment it out + if you rather control the size via height + just comment it out */ + //height: 500; + + orientation: horizontal; + location: center; + anchor: center; + transparency: "screenshot"; + border-color: @transparent; + border: 0px; + border-radius: 6px; + spacing: 0; + children: [ mainbox ]; +} + +mainbox { + spacing: 0; + children: [ inputbar, message, listview ]; +} + +inputbar { + color: @kl; + padding: 11px; + border: 3px 3px 2px 3px; + border-color: @primary; + border-radius: 6px 6px 0px 0px; +} + +message { + padding: 0; + border-color: @primary; + border: 0px 1px 1px 1px; +} + +entry, prompt, case-indicator { + text-font: inherit; + text-color: inherit; +} + +entry { + cursor: pointer; +} + +prompt { + margin: 0px 5px 0px 0px; +} + +listview { + layout: vertical; + //spacing: 5px; + padding: 8px; + lines: 7; + columns: 2; + border: 0px 3px 3px 3px; + border-radius: 0px 0px 6px 6px; + border-color: @primary; + dynamic: false; +} + +element { + padding: 2px; + vertical-align: 1; + color: @kl; + font: inherit; +} + +element-text { + background-color: inherit; + text-color: inherit; + vertical-align: 0.5; +} + +element selected.normal { + color: @black; + background-color: @hv; +} + +element normal active { + background-color: @hv; + color: @black; +} + +element-icon { + background-color: inherit; + text-color: inherit; + size: 2.5em; +} + +element normal urgent { + background-color: @primary; +} + +element selected active { + background: @hv; + foreground: @bg; +} + +button { + padding: 6px; + color: @primary; + horizonatal-align: 0.5; + + border: 2px 0px 2px 2px; + border-radius: 4px 0px 0px 4px; + border-color: @primary; +} + +button selected normal { + border: 2px 0px 2px 2px; + border-color: @primary; +} diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..e231fe4 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixos-btw"; + networking.networkmanager.enable = true; + + time.timeZone = "America/Los_Angeles"; + + services.displayManager.ly.enable = true; + services.xserver = { + enable = true; + autoRepeatDelay = 200; + autoRepeatInterval = 35; + windowManager.qtile.enable = true; + displayManager.sessionCommands = '' + xwallpaper --zoom ~/nixos-dotfiles/walls/wall1.png + ''; + extraConfig = '' + Section "Monitor" + Identifier "Virtual-1" + Option "PreferredMode" "1920x1080" + EndSection + ''; + }; + + services.picom.enable = true; + + users.users.tony = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + packages = with pkgs; [ + tree + ]; + }; + + programs.firefox.enable = true; + + environment.systemPackages = with pkgs; [ + vim + wget + git + alacritty + ]; + + fonts.packages = with pkgs; [ + nerd-fonts.jetbrains-mono + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + system.stateVersion = "25.05"; +} + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..03bbcf1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1756679287, + "narHash": "sha256-Xd1vOeY9ccDf5VtVK12yM0FS6qqvfUop8UQlxEB+gTQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "07fc025fe10487dd80f2ec694f1cd790e752d0e8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1756617294, + "narHash": "sha256-aGnd4AHIYCWQKChAkHPpX+YYCt7pA6y2LFFA/s8q0wQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b4c2c57c31e68544982226d07e4719a2d86302a8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..11863c3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "NixOS from Scratch"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + home-manager.url = "github:nix-community/home-manager/release-25.05"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, home-manager, ... }: + let + system = "x86_64-linux"; + in { + nixosConfigurations.nixos-btw = nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.tony = import ./home.nix; + home-manager.backupFileExtension = "backup"; + } + ]; + }; + }; +} + diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..dfaf4c3 --- /dev/null +++ b/home.nix @@ -0,0 +1,51 @@ +{ config, pkgs, ... }: + +let + dotfiles = "${config.home.homeDirectory}/nixos-dotfiles/config"; + create_symlink = path: config.lib.file.mkOutOfStoreSymlink path; + + # Standard .config/directory + configs = { + qtile = "qtile"; + nvim = "nvim"; + rofi = "rofi"; + alacritty = "alacritty"; + picom = "picom"; + }; +in + +{ + home.username = "tony"; + home.homeDirectory = "/home/tony"; + programs.git.enable = true; + home.stateVersion = "25.05"; + programs.bash = { + enable = true; + shellAliases = { + btw = "echo i use nixos-btw"; + nrs = "sudo nixos-rebuild switch --flake ~/nixos-dotfiles#nixos-btw"; + }; + initExtra = '' + export PS1="\[\e[38;5;75m\]\u@\h \[\e[38;5;113m\]\w \[\e[38;5;189m\]\$ \[\e[0m\]" + ''; + }; + + xdg.configFile = builtins.mapAttrs + (name: subpath: { + source = create_symlink "${dotfiles}/${subpath}"; + recursive = true; + }) + configs; + + home.packages = with pkgs; [ + neovim + ripgrep + nil + nixpkgs-fmt + nodejs + gcc + rofi + xwallpaper + ]; + +} diff --git a/walls/wall1.png b/walls/wall1.png new file mode 100644 index 0000000..1917454 Binary files /dev/null and b/walls/wall1.png differ