diff options
| author | hachem <im@hachem.wtf> | 2026-08-25 10:59:06 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-25 10:59:06 +0200 |
| commit | ed6fb2af238776df4d2b707d0ce99121f0dcc2ca (patch) | |
| tree | fcf9be1181dddd87cb109fa0e582e05c589edc9f | |
| parent | 423b2c2d62064057593e504d79b3f749733c611c (diff) | |
[chore]: update
| -rw-r--r-- | .config/alacritty/alacritty.toml | 65 | ||||
| -rw-r--r-- | .config/alacritty/alacritty.yml | 52 | ||||
| -rw-r--r-- | .config/ghostty/config.ghostty | 51 | ||||
| -rw-r--r-- | .config/nvim/init.lua | 460 | ||||
| -rw-r--r-- | .config/nvim/lazy-lock.json | 26 | ||||
| -rw-r--r-- | .config/nvim/nvim.log | 2 | ||||
| -rwxr-xr-x | .local/bin/init_c | 168 | ||||
| -rw-r--r-- | .zshrc | 50 | ||||
| -rw-r--r-- | README.md | 13 |
9 files changed, 485 insertions, 402 deletions
diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml deleted file mode 100644 index 03d873a..0000000 --- a/.config/alacritty/alacritty.toml +++ /dev/null @@ -1,65 +0,0 @@ - -[colors] -draw_bold_text_with_bright_colors = false - -[colors.bright] -black = "0x808080" -blue = "0x0066ff" -cyan = "0x00ffff" -green = "0x33ff00" -magenta = "0xcc00ff" -red = "0xfe0100" -white = "0xFFFFFF" -yellow = "0xfeff00" - -[colors.cursor] -cursor = "0xffff00" -text = "0x000000" - -[colors.normal] -black = "0x222222" -blue = "0x0066ff" -cyan = "0x00ffff" -green = "0x33ff00" -magenta = "0xcc00ff" -red = "0xfe0100" -white = "0xd0d0d0" -yellow = "0xfeff00" - -[colors.primary] -background = "0x111111" -foreground = "0xffffff" - -[font] -size = 12.0 - -[font.bold] -family = "Monolisa" -style = "Bold" - -[font."bold_italic"] -family = "Monolisa" -style = "Bold Italic" - -[font.italic] -family = "Monolisa" -style = "Italic" - -[font.normal] -family = "Monolisa" -style = "Medium" - -[window] -dynamic_padding = true -dynamic_title = true - -[window.padding] -x = 10 -y = 10 - -[general] -live_config_reload = true -working_directory = "C:/Users/Hachem" - -[terminal] -shell = "nu" diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml deleted file mode 100644 index 126ac26..0000000 --- a/.config/alacritty/alacritty.yml +++ /dev/null @@ -1,52 +0,0 @@ -window: - padding: - x: 10 - y: 10 - dynamic_padding: true - -font: - normal: - family: Cascadia Code - style: Regular - italic: - family: Cascadia Code - style: Italic - bold: - family: Cascadia Code - style: Bold - bold italic: - family: Cascadia Code - style: Bold Italic - - size: 8.0 - -colors: - primary: - background: '0x020202' - foreground: '0xffffff' - cursor: - text: '0x000000' - cursor: '0xffff00' - normal: - black: '0x222222' - red: '0xfe0100' - green: '0x33ff00' - yellow: '0xfeff00' - blue: '0x0066ff' - magenta: '0xcc00ff' - cyan: '0x00ffff' - white: '0xd0d0d0' - bright: - black: '0x808080' - red: '0xfe0100' - green: '0x33ff00' - yellow: '0xfeff00' - blue: '0x0066ff' - magenta: '0xcc00ff' - cyan: '0x00ffff' - white: '0xFFFFFF' - -draw_bold_text_with_bright_colors: false -live_config_reload: true -dynamic_title: true - diff --git a/.config/ghostty/config.ghostty b/.config/ghostty/config.ghostty new file mode 100644 index 0000000..6798d1c --- /dev/null +++ b/.config/ghostty/config.ghostty @@ -0,0 +1,51 @@ +background = #000000 +foreground = #ffffff + +# Normal colors +palette = 0=#222222 +palette = 1=#fe0100 +palette = 2=#33ff00 +palette = 3=#feff00 +palette = 4=#0066ff +palette = 5=#cc00ff +palette = 6=#00ffff +palette = 7=#d0d0d0 + +# Bright colors +palette = 8=#808080 +palette = 9=#fe0100 +palette = 10=#33ff00 +palette = 11=#feff00 +palette = 12=#0066ff +palette = 13=#cc00ff +palette = 14=#00ffff +palette = 15=#ffffff + +# Cursor +cursor-style = bar +cursor-color = #ff0000 +cursor-text = #000000 +adjust-cursor-thickness = 200% +shell-integration-features = no-cursor + +# Font +font-family = "0xProto" +font-style = Regular +font-style-bold = Bold +font-style-italic = Italic +font-style-bold-italic = Bold Italic + +font-size = 18 +font-thicken = true + +font-feature = +calt +font-feature = +liga +font-feature = +dlig + +font-thicken = true + +font-size = 18 + +# Window +window-padding-x = 10 +window-padding-y = 10
\ No newline at end of file diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index d4776ed..f044682 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,6 +1,7 @@ --- BOOTSTRAP lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then +local uv = vim.uv or vim.loop + +if not uv.fs_stat(lazypath) then vim.fn.system({ "git", "clone", @@ -16,13 +17,11 @@ vim.g.mapleader = " " vim.g.maplocalleader = " " require("lazy").setup({ - - -- UI / Usability "tpope/vim-sleuth", "lukas-reineke/indent-blankline.nvim", + "andreasvc/vim-256noir", "windwp/nvim-autopairs", - -- File explorer { "stevearc/oil.nvim", opts = { @@ -33,262 +32,113 @@ require("lazy").setup({ }, }, - -- Theme { - "luisiacc/gruvbox-baby", - name = "gruvbox-baby", - priority = 1000, - config = function() - vim.g.gruvbox_baby_background_color = "medium" - vim.g.gruvbox_baby_telescope_theme = 1 - vim.g.gruvbox_baby_transparent_mode = 1 - vim.cmd.colorscheme("gruvbox-baby") - end, - }, + "nvim-lualine/lualine.nvim", + opts = { + options = { + globalstatus = true, + component_separators = "", + section_separators = "", + }, - -- Noice UI - { - "folke/noice.nvim", - event = "VeryLazy", - dependencies = { - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, }, - config = function() - require("noice").setup({ - presets = { - bottom_search = true, - command_palette = true, - long_message_to_split = true, - inc_rename = false, - lsp_doc_border = true, - }, - -- ASCII-only UI patch - routes = { - { - filter = { event = "msg_show", kind = "", find = "" }, - opts = { skip = true }, - }, - }, + config = function(_, opts) + local function fg(group, fallback) + local ok, hl = pcall(vim.api.nvim_get_hl, 0, { name = group, link = false }) + if ok and hl.fg then + return string.format("#%06x", hl.fg) + end + return fallback + end - cmdline = { - format = { - cmdline = { icon = ":" }, - search_down = { icon = "/" }, - search_up = { icon = "?" }, - }, - }, + local text = fg("Normal", "#b4b7ad") + local accent = fg("Statement", "#f0624b") + local cool = fg("Function", "#3d8e91") -- teal + local warm = fg("String", "#f7a21b") -- orange - lsp = { - progress = { - enabled = true, - format = { - progress = function(msg) - return string.format("%s [%s%%]", - msg.title or "LSP", - msg.percentage or "?" - ) - end, - }, - format_done = function(_) return "LSP done" end, - }, - }, - }) + opts.sections = { + lualine_a = {}, + lualine_b = {}, - -- nvim-notify ASCII settings - local notify = require("notify") - notify.setup({ - render = "compact", - stages = "static", - icons = { - ERROR = "E", - WARN = "W", - INFO = "I", - DEBUG = ">", - TRACE = "-", + lualine_c = { + { "mode", color = { fg = accent, bg = "NONE", gui = "bold" } }, + { "filename", color = { fg = text } }, }, - }) - vim.notify = notify - end, - }, - - -- Lualine ASCII UI - { - "nvim-lualine/lualine.nvim", - config = function() - local lualine = require("lualine") - local colors = { - bg = "NONE", - fg = "#bbc2cf", - yellow = "#ECBE7B", - cyan = "#008080", - green = "#98be65", - orange = "#FF8800", - violet = "#a9a1e1", - magenta = "#c678dd", - blue = "#51afef", - red = "#ec5f67", - } - - local conditions = { - buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 - end, - hide_in_width = function() - return vim.fn.winwidth(0) > 80 - end, - } - - local config = { - options = { - globalstatus = true, - component_separators = "", - section_separators = "", - theme = { - normal = { c = { fg = colors.fg, bg = "NONE" } }, - inactive = { c = { fg = colors.fg, bg = "NONE" } }, + lualine_x = { + { "branch", color = { fg = cool } }, + { + "diagnostics", + symbols = { error = "E:", warn = "W:", info = "I:", hint = "H:" }, + -- no color override: lualine tints each severity from the theme }, }, - sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = {}, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = {}, - }, - } - - local function ins_left(component) - table.insert(config.sections.lualine_c, component) - end - - local function ins_right(component) - table.insert(config.sections.lualine_x, component) - end - - ins_left({ - function() return "|" end, - color = { fg = colors.blue }, - }) - - ins_left({ - function() return "*" end, - color = function() - local mode_color = { - n = colors.red, - i = colors.green, - v = colors.blue, - V = colors.blue, - c = colors.magenta, - s = colors.orange, - S = colors.orange, - ic = colors.yellow, - R = colors.violet, - t = colors.red, - } - return { fg = mode_color[vim.fn.mode()] } - end, - }) - ins_left({ - "filesize", - cond = conditions.buffer_not_empty, - }) - - ins_left({ - "filename", - cond = conditions.buffer_not_empty, - color = { fg = colors.magenta, gui = "bold" }, - }) - - ins_left("location") - ins_left({ "progress", color = { gui = "bold" } }) - - ins_left({ - "diagnostics", - sources = { "nvim_diagnostic" }, - symbols = { error = "E:", warn = "W:", info = "I:" }, - }) - - ins_left(function() return "%=" end) - - ins_left({ - function() - local msg = "No LSP" - local buf_ft = vim.bo.filetype - for _, client in ipairs(vim.lsp.get_clients({ bufnr = 0 })) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end, - icon = "LSP:", - color = { fg = "#ffffff", gui = "bold" }, - }) - - ins_right({ - "o:encoding", - fmt = string.upper, - color = { fg = colors.green, gui = "bold" }, - }) - - ins_right({ - "fileformat", - fmt = string.upper, - icons_enabled = false, - color = { fg = colors.green, gui = "bold" }, - }) - - ins_right({ - "branch", - icon = "git:", - color = { fg = colors.violet, gui = "bold" }, - }) + lualine_y = {}, - ins_right({ - "diff", - symbols = { added = "+", modified = "~", removed = "-" }, - }) + lualine_z = { + { "location", color = { fg = warm } }, + }, + } - ins_right({ - function() return "|" end, - color = { fg = colors.blue }, - }) + local none = { fg = text, bg = "NONE" } + local mirror = { a = none, b = none, c = none } + opts.options.theme = { + normal = mirror, + insert = mirror, + visual = mirror, + replace = mirror, + command = mirror, + inactive = mirror, + } - lualine.setup(config) + require("lualine").setup(opts) vim.api.nvim_set_hl(0, "StatusLine", { bg = "NONE" }) vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "NONE" }) end, }, - -- Telescope { "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" }, + + config = function() + require("telescope").setup({ + pickers = { + find_files = { + file_ignore_patterns = { + "^build/", + "^builddir/", + "^_build/", + + "^ext/", + "^vendor/", + }, + }, + }, + }) + end, }, - -- Treesitter { "nvim-treesitter/nvim-treesitter", + branch = "master", + lazy = false, build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup({ highlight = { enable = true }, - indent = { enable = true }, + indent = { enable = false }, ensure_installed = { "lua", "vim", "c", "cpp", "markdown", "python", "rust", "bash", @@ -297,6 +147,40 @@ require("lazy").setup({ end, }, + + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + + opts = { + indent = { + enabled = true, + + indent = { + enabled = false, + }, + + scope = { + enabled = false, + }, + + chunk = { + enabled = true, + hl = "Comment", + + char = { + corner_top = "┌", + corner_bottom = "└", + horizontal = "─", + vertical = "│", + arrow = "→", + }, + }, + }, + }, + }, + -- Completion { "hrsh7th/nvim-cmp", @@ -306,6 +190,7 @@ require("lazy").setup({ "L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets", }, + config = function() local cmp = require("cmp") local luasnip = require("luasnip") @@ -313,14 +198,34 @@ require("lazy").setup({ require("luasnip.loaders.from_vscode").lazy_load() cmp.setup({ + -- No automatic completion popup. + completion = { + autocomplete = false, + }, + snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, + mapping = cmp.mapping.preset.insert({ - ["<CR>"] = cmp.mapping.confirm({ select = true }), + -- Accept selected completion. + ["<CR>"] = cmp.mapping.confirm({ + select = true, + }), + + -- Manually open completion. + ["<M-Space>"] = cmp.mapping.complete(), + + -- Navigate completion menu. + ["<C-n>"] = cmp.mapping.select_next_item(), + ["<C-p>"] = cmp.mapping.select_prev_item(), + + -- Close completion menu. + ["<C-e>"] = cmp.mapping.abort(), }), + sources = { { name = "nvim_lsp" }, { name = "luasnip" }, @@ -328,7 +233,6 @@ require("lazy").setup({ }) end, }, - -- LSP { "neovim/nvim-lspconfig", @@ -343,6 +247,8 @@ require("lazy").setup({ require("mason").setup() require("fidget").setup() + -- Per-server settings. Mason installs these; Neovim's native LSP + -- (vim.lsp.config / vim.lsp.enable) configures and starts them. local servers = { lua_ls = { settings = { @@ -352,23 +258,33 @@ require("lazy").setup({ }, }, }, + rust_analyzer = { + settings = { + ["rust-analyzer"] = { + cargo = { buildScripts = { enable = true } }, + procMacro = { enable = true }, + }, + }, + }, } - require("mason-tool-installer").setup({ - ensure_installed = vim.tbl_keys(servers), + -- Advertise nvim-cmp completion capabilities to every server. + vim.lsp.config("*", { + capabilities = require("cmp_nvim_lsp").default_capabilities(), }) - local capabilities = require("cmp_nvim_lsp").default_capabilities() + -- Merge each server's settings on top of nvim-lspconfig's defaults. + for name, cfg in pairs(servers) do + vim.lsp.config(name, cfg) + end + -- Install the servers (mason-tool-installer), then auto-enable the + -- installed ones via vim.lsp.enable (mason-lspconfig v2). + require("mason-tool-installer").setup({ + ensure_installed = vim.tbl_keys(servers), + }) require("mason-lspconfig").setup({ - handlers = { - function(server) - require("lspconfig")[server].setup({ - capabilities = capabilities, - settings = servers[server], - }) - end, - }, + automatic_enable = true, }) end, }, @@ -377,9 +293,13 @@ require("lazy").setup({ { "stevearc/conform.nvim", opts = { + notify_on_error = false, formatters_by_ft = { lua = { "stylua" }, python = { "black" }, + -- rustfmt reads the edition from Cargo.toml (defaults to 2021) + -- and respects rustfmt.toml, so no extra args are needed. + rust = { "rustfmt" }, }, }, }, @@ -409,15 +329,11 @@ require("lazy").setup({ }, }) --- Cursor/selection aesthetics -vim.api.nvim_set_hl(0, "CursorLine", { bg = "#1c1c1c" }) -vim.api.nvim_set_hl(0, "Visual", { bg = "#262626" }) - -- ASCII diagnostics vim.fn.sign_define("DiagnosticSignError", { text = "E", texthl = "DiagnosticError" }) -vim.fn.sign_define("DiagnosticSignWarn", { text = "W", texthl = "DiagnosticWarn" }) -vim.fn.sign_define("DiagnosticSignInfo", { text = "I", texthl = "DiagnosticInfo" }) -vim.fn.sign_define("DiagnosticSignHint", { text = "H", texthl = "DiagnosticHint" }) +vim.fn.sign_define("DiagnosticSignWarn", { text = "W", texthl = "DiagnosticWarn" }) +vim.fn.sign_define("DiagnosticSignInfo", { text = "I", texthl = "DiagnosticInfo" }) +vim.fn.sign_define("DiagnosticSignHint", { text = "H", texthl = "DiagnosticHint" }) -- Options local opt = vim.opt @@ -425,6 +341,7 @@ opt.number = true opt.mouse = "a" opt.splitright = true opt.splitbelow = true +opt.autoindent = true opt.smartindent = true opt.expandtab = true opt.shiftwidth = 4 @@ -432,9 +349,11 @@ opt.tabstop = 4 opt.ignorecase = true opt.smartcase = true opt.termguicolors = true -opt.cursorline = true +opt.cursorline = false +opt.linebreak = true opt.scrolloff = 10 opt.clipboard = "unnamedplus" +opt.completeopt = { "menu", "menuone", "noinsert", "noselect" } -- Typo forgiveness vim.cmd([[ @@ -452,15 +371,48 @@ vim.cmd([[ local map = vim.keymap.set map("n", "<Esc>", ":nohl<CR>") map("n", "-", require("oil").open, { desc = "Open parent directory" }) +map("n", "<C-e>", function() + require("oil").open(vim.fn.getcwd()) +end, { desc = "Browse working directory" }) local telescope = require("telescope.builtin") -map("n", "<leader>ff", telescope.find_files) -map("n", "<leader>fg", telescope.live_grep) -map("n", "<leader>fb", telescope.buffers) +map("n", "<leader>ff", telescope.find_files, { desc = "Find files" }) +map("n", "<leader>fg", telescope.live_grep, { desc = "Find text" }) +map("n", "<leader>fb", telescope.buffers, { desc = "Find buffers" }) + +map("n", "<leader>cf", function() + require("conform").format({ async = true, lsp_format = "fallback" }) +end, { desc = "Format buffer" }) + +vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + severity_sort = true, +}) --- Yank highlight vim.api.nvim_create_autocmd("TextYankPost", { callback = function() vim.highlight.on_yank() end, }) + +vim.cmd.colorscheme("256_noir") + +vim.cmd([[ + highlight Normal guibg=NONE ctermbg=NONE + highlight NormalNC guibg=NONE ctermbg=NONE + highlight SignColumn guibg=NONE ctermbg=NONE + highlight EndOfBuffer guibg=NONE ctermbg=NONE + highlight LineNr guibg=NONE ctermbg=NONE + highlight CursorLineNr guibg=NONE ctermbg=NONE + highlight CursorLine guibg=NONE ctermbg=NONE + highlight StatusLine guibg=NONE ctermbg=NONE + highlight StatusLineNC guibg=NONE ctermbg=NONE +]]) + +vim.api.nvim_set_hl(0, "Visual", { bg = "#222222" }) +vim.api.nvim_set_hl(0, "Search", { bg = "#222222" }) +vim.api.nvim_set_hl(0, "IncSearch", { bg = "#222222" }) +vim.api.nvim_set_hl(0, "PMenu", { bg = "#222222" }) +vim.api.nvim_set_hl(0, "PMenySelf", { bg = "#333333", bold=true }) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..e74bc8d --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,26 @@ +{ + "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, + "fidget.nvim": { "branch": "main", "commit": "6f793b2bcd2d35e201c09520f698bb763220908a" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "gitsigns.nvim": { "branch": "main", "commit": "5be654f2232c10ddcad19c1607a67b6b4b78fc29" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "67029ccdac1ef8941e13b826417bc0ffac24cc86" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, + "mini.indentscope": { "branch": "main", "commit": "d3f955f09b1a05d25d5a7740338fba2baaee41a3" }, + "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" }, + "nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" }, + "nvim-lspconfig": { "branch": "master", "commit": "51dbf5359da86721662c87ca10eb73add973737b" }, + "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "oil.nvim": { "branch": "master", "commit": "b73018b75affd13fa38e2fc94ef753b465f770d7" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "telescope.nvim": { "branch": "master", "commit": "427b576c16792edad01a92b89721d923c19ad60f" }, + "vim-256noir": { "branch": "master", "commit": "e8668a18a4a90272c1cae87e655f8bddc5ac3665" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/.config/nvim/nvim.log b/.config/nvim/nvim.log new file mode 100644 index 0000000..8205bb1 --- /dev/null +++ b/.config/nvim/nvim.log @@ -0,0 +1,2 @@ +WRN 2026-08-24T01:09:40.992 ?.58675 server_start:197: Failed to start server: operation not permitted: /var/folders/cg/j_zdjyp57vsgnxlj_4809wb00000gn/T/nvim.hachem/3i6l1a/nvim.58675.0 +WRN 2026-08-24T01:21:43.568 ?.63997 server_start:197: Failed to start server: operation not permitted: /var/folders/cg/j_zdjyp57vsgnxlj_4809wb00000gn/T/nvim.hachem/GPEBOe/nvim.63997.0 diff --git a/.local/bin/init_c b/.local/bin/init_c new file mode 100755 index 0000000..9e570b5 --- /dev/null +++ b/.local/bin/init_c @@ -0,0 +1,168 @@ +#!/usr/bin/env python3 + +""" +init_c - small makefile project generator. + +a small dumb script cause i dont want to keep +writing makefiles for small dumb c projects. + +Author: hachem +Version: 0.1.0 +""" + +from pathlib import Path +import subprocess +import questionary + + +def ask_project_name(): + return questionary.text( + "Project name:", + validate=lambda value: ( + True + if value and not Path(value).exists() + else "Project already exists or name is empty." + ), + ).ask() + + +def generate_makefile(project, use_intermediate): + target_dir = "bin" + + if use_intermediate: + obj_dir = "bin-int" + else: + obj_dir = "bin" + + target = f"{target_dir}/{project}" + + return f"""CC := clang + +CFLAGS := -Wall -Wextra -Werror -pedantic -std=c2y -Isrc +LDFLAGS := + +TARGET := {target} +SRC := $(wildcard src/*.c) +OBJ := $(SRC:src/%.c={obj_dir}/%.o) + +all: $(TARGET) + +$(TARGET): $(OBJ) +\t@mkdir -p {target_dir} +\t$(CC) $^ -o $@ $(LDFLAGS) + +{obj_dir}/%.o: src/%.c +\t@mkdir -p {obj_dir} +\t$(CC) $(CFLAGS) -c $< -o $@ + +clean: +\trm -rf bin bin-int + +.PHONY: all clean +""" + + +def main(): + project = ask_project_name() + + if project is None: + return + + options = questionary.checkbox( + "Options:", + choices=[ + questionary.Choice( + "Initialize git", + value="git", + checked=True, + ), + questionary.Choice( + "Use separate intermediate directory", + value="intermediate", + ), + questionary.Choice( + "Ignore clangd files", + value="clangd_ignore", + checked=True, + ), + ], + ).ask() + + if options is None: + return + + use_git = "git" in options + use_intermediate = "intermediate" in options + use_clangd_ignore = "clangd_ignore" in options + + root = Path(project) + root.mkdir() + (root / "src").mkdir() + + makefile = generate_makefile( + project, + use_intermediate, + ) + + (root / "Makefile").write_text(makefile) + + (root / "src" / "main.c").write_text( + """#include <stdio.h> + +int main(void) +{ + puts("type shi"); +} +""" + ) + + ignored = [] + + if use_intermediate: + ignored.extend([ + "bin/", + "bin-int/", + ]) + else: + ignored.append("bin/") + + if use_clangd_ignore: + ignored.extend([ + "", + ".clangd", + "compile_flags.txt", + "compile_commands.json", + ]) + + if ignored: + (root / ".gitignore").write_text( + "\n".join(ignored) + "\n" + ) + + if use_git: + try: + subprocess.run( + ["git", "init"], + cwd=root, + check=True, + stdout=subprocess.DEVNULL, + ) + except FileNotFoundError: + # legit how bro + print("Warning: git is not installed.") + + print() + print(f"✔ Created {project}") + print() + + try: + subprocess.run( + ["tree", "-a", "--dirsfirst", "-I", ".git", project], + check=False, + ) + except FileNotFoundError: + print("(tree is not installed)") + + +if __name__ == "__main__": + main()
\ No newline at end of file @@ -1,34 +1,30 @@ -export ZSH="$HOME/.config/oh-my-zsh" -export ZSH_THEME="mh" -export ZSH_COMPDUMP="${ZDOTDIR:-${ZSH}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" +export BUN_INSTALL="$HOME/.bun" +export HOMEBREW_NO_ENV_HINTS=1 -HISTFILE="$HOME/.cache/zsh_history" -export PAGER=nvimpager +export PATH="$BUN_INSTALL/bin:$PATH" +export PATH="/Users/hachem/Library/Python/3.9/bin:$PATH" +export PATH="/Users/hachem/.local/bin:$PATH" +export PATH="/opt/metasploit-framework/bin:$PATH" -plugins=(git) +alias ls='exa --color=auto --classify --group-directories-first' +alias ll='exa -la --color=auto --classify' +alias la='exa -a --color=auto --classify' +alias l='exa -l --color=auto --classify' -fonction FontTest() -{ - echo -e "\e[1mbold\e[0m" - echo -e "\e[3mitalic\e[0m" - echo -e "\e[3m\e[1mbold italic\e[0m" - echo -e "\e[4munderline\e[0m" - echo -e "\e[9mstrikethrough\e[0m" -} - -source $ZSH/oh-my-zsh.sh - -alias dev="cd $HOME/.h/Dev" -alias devel="cd $HOME/.h/Devel" +alias grep='rg' +alias fgrep='rg -F' +alias egrep='rg -E' alias vi="nvim" -alias vim="nvim" -alias nvi="nvim" - -alias ls="lsd --icon=never" -alias cat="bat" - -alias open="xdg-open" -. $HOME/.cargo/env +export PS1='%n@%m %1~ %% ' +source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +[ -f "/Users/hachem/.ghcup/env" ] && . "/Users/hachem/.ghcup/env" # ghcup-env +# BEGIN opam configuration +# This is useful if you're using opam as it adds: +# - the correct directories to the PATH +# - auto-completion for the opam binary +# This section can be safely removed at any time if needed. +[[ ! -r '/Users/hachem/.opam/opam-init/init.zsh' ]] || source '/Users/hachem/.opam/opam-init/init.zsh' > /dev/null 2> /dev/null +# END opam configuration @@ -1,7 +1,12 @@ -# .files -These are all the config files for the programs I use on the daily. Since I tend to use several machines each running different instances of linux, I created this repository so I would only have to clown it and use GNU-stow as follows, - +# .* +These are the config files I've accumulated for the programs I use on a daily basis. Since I regularly use multiple machines, I keep my dotfiles in this repository so I can clone it and just use `stow`. Running `stow` simply symlinks all the files in this repository into your home directory. ```sh -$ git clone https://github.com/Hachem-H/dotfiles.git +$ git clone https://github.com/im-hachem/dotfiles.git $ cd dotfiles && stow . ``` + +## Maintenance +I don't distro hop or modify my configs particularly often, so this repository doesn't receive frequent updates. I primarily use these configs between my main machine running macOS and my secondary machines running NixOS/Arch. Because of that, not every config file in this repository is actively used or maintained, and some files may be outdated. For example, I rarely ever use tiling window managers nowadays, so my `i3`/`polybar` config is generally never used. The config files that tend to stay up to date are mainly whichever terminal emulator I'm using, Neovim, Zsh, and a couple of scripts under `~/.local`. Some config files are mostly here for historical reasons or because I may still find them useful when setting up another machine. + +## Note +This repository is primarily for my own convenience rather than a collection of universally useful, tasteful, or beautiful configs. Some of the files may contain machine-specific assumptions, old things, or stuff that only makes sense in my particular environment. If you happen to find something useful in here, then great. Otherwise, don't expect a [r/unixporn](https://reddit.com/r/unixporn) level rice. |
