diff options
| -rw-r--r-- | .config/nvim/init.lua | 710 | ||||
| -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-- | README.md | 7 | ||||
| -rwxr-xr-x | install.sh | 20 |
6 files changed, 521 insertions, 412 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index f044682..b8ac67f 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,3 +1,4 @@ +-- Bootstrap local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local uv = vim.uv or vim.loop @@ -11,118 +12,109 @@ if not uv.fs_stat(lazypath) then lazypath, }) end + vim.opt.rtp:prepend(lazypath) +-- Globals vim.g.mapleader = " " vim.g.maplocalleader = " " +-- Plugins require("lazy").setup({ "tpope/vim-sleuth", - "lukas-reineke/indent-blankline.nvim", - "andreasvc/vim-256noir", - "windwp/nvim-autopairs", { - "stevearc/oil.nvim", - opts = { - default_file_explorer = true, - view_options = { - show_hidden = true, - }, - }, + "rainglow/vim", + lazy = false, + priority = 1000, }, { - "nvim-lualine/lualine.nvim", + "nvim-tree/nvim-web-devicons", + lazy = true, + }, + + { + "windwp/nvim-autopairs", + opts = {}, + }, + + { + "nvim-mini/mini.indentscope", + version = false, + opts = { + symbol = "│", + + draw = { + predicate = function(scope) + return vim.bo.filetype ~= "snacks_dashboard" + and not scope.body.is_incomplete + end, + }, + options = { - globalstatus = true, - component_separators = "", - section_separators = "", + try_as_border = true, }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = {}, + mappings = { + object_scope = "", + object_scope_with_border = "", + goto_top = "", + goto_bottom = "", }, }, 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 - - local text = fg("Normal", "#b4b7ad") - local accent = fg("Statement", "#f0624b") - local cool = fg("Function", "#3d8e91") -- teal - local warm = fg("String", "#f7a21b") -- orange - - opts.sections = { - lualine_a = {}, - lualine_b = {}, - - lualine_c = { - { "mode", color = { fg = accent, bg = "NONE", gui = "bold" } }, - { "filename", color = { fg = text } }, - }, - - 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 - }, - }, - - lualine_y = {}, + require("mini.indentscope").setup(opts) - lualine_z = { - { "location", color = { fg = warm } }, + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "snacks_dashboard", + "Trouble", + "lazy", + "mason", + "help", }, - } - 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, - } + callback = function() + vim.b.miniindentscope_disable = true + end, + }) - require("lualine").setup(opts) + vim.api.nvim_create_autocmd("User", { + pattern = "SnacksDashboardOpened", - vim.api.nvim_set_hl(0, "StatusLine", { bg = "NONE" }) - vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "NONE" }) + callback = function() + vim.b.miniindentscope_disable = true + end, + }) end, }, - -- Telescope + { "nvim-telescope/telescope.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, + + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + }, config = function() require("telescope").setup({ + defaults = { + prompt_prefix = " ", + selection_caret = "❯ ", + }, + pickers = { find_files = { file_ignore_patterns = { - "^build/", - "^builddir/", - "^_build/", - - "^ext/", - "^vendor/", + "build/", + "builddir/", + "_build/", + "ext/", + "vendor/", }, }, }, @@ -135,19 +127,26 @@ require("lazy").setup({ branch = "master", lazy = false, build = ":TSUpdate", + config = function() require("nvim-treesitter.configs").setup({ - highlight = { enable = true }, - indent = { enable = false }, ensure_installed = { - "lua", "vim", "c", "cpp", "markdown", - "python", "rust", "bash", + "bash", + "c", + "cpp", + "lua", + "markdown", + "python", + "rust", + "vim", }, + + highlight = { enable = true }, + indent = { enable = false }, }) end, }, - { "folke/snacks.nvim", priority = 1000, @@ -155,35 +154,122 @@ require("lazy").setup({ opts = { indent = { + enabled = false, + }, + + dashboard = { enabled = true, - indent = { - enabled = false, - }, + preset = { + header = [[ +██████╗ ██████╗ ██╗ ██╗██╗ ██╗ +██╔══██╗██╔══██╗██║ ██║██║ ██║ +██████╔╝██████╔╝██║ ██║███████║ +██╔══██╗██╔══██╗██║ ██║██╔══██║ +██████╔╝██║ ██║╚██████╔╝██║ ██║ +╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ +]], - scope = { - enabled = false, + keys = { + { + icon = " ", + key = "f", + desc = "Find File", + action = ":Telescope find_files", + }, + { + icon = " ", + key = "n", + desc = "New File", + action = ":enew", + }, + { + icon = " ", + key = "r", + desc = "Recent Files", + action = ":Telescope oldfiles", + }, + { + icon = " ", + key = "g", + desc = "Find Text", + action = ":Telescope live_grep", + }, + { + icon = " ", + key = "l", + desc = "Lazy", + action = ":Lazy", + }, + { + icon = " ", + key = "q", + desc = "Quit", + action = ":qa", + }, + }, }, + }, + }, + }, - chunk = { - enabled = true, - hl = "Comment", + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, - char = { - corner_top = "┌", - corner_bottom = "└", - horizontal = "─", - vertical = "│", - arrow = "→", - }, - }, + opts = { + signs = true, + + keywords = { + FIX = { icon = " " }, + TODO = { icon = " " }, + HACK = { icon = " " }, + WARN = { icon = " " }, + NOTE = { icon = " " }, + }, + }, + }, + + { + "folke/trouble.nvim", + opts = {}, + }, + + { + "nvimdev/lspsaga.nvim", + + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + + opts = { + ui = { + border = "rounded", + }, + + lightbulb = { + enable = false, + }, + + symbol_in_winbar = { + enable = false, + }, + + hover = { + max_width = 0.8, + max_height = 0.6, + }, + + code_action = { + show_server_name = false, }, }, }, - -- Completion { "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-nvim-lsp", "saadparwaiz1/cmp_luasnip", @@ -195,14 +281,37 @@ require("lazy").setup({ local cmp = require("cmp") local luasnip = require("luasnip") + local icons = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", + } + 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) @@ -210,22 +319,19 @@ require("lazy").setup({ }, mapping = cmp.mapping.preset.insert({ - -- 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(), + ["<C-y>"] = cmp.mapping.confirm({ select = true }), + ["<C-Space>"] = cmp.mapping.complete(), }), + formatting = { + format = function(_, item) + item.kind = icons[item.kind] or "" + return item + end, + }, + sources = { { name = "nvim_lsp" }, { name = "luasnip" }, @@ -233,9 +339,10 @@ require("lazy").setup({ }) end, }, - -- LSP + { "neovim/nvim-lspconfig", + dependencies = { "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", @@ -243,119 +350,152 @@ require("lazy").setup({ "hrsh7th/cmp-nvim-lsp", "j-hui/fidget.nvim", }, + config = function() 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 = { - Lua = { - diagnostics = { globals = { "vim" } }, - completion = { callSnippet = "Replace" }, + vim.lsp.config("*", { + capabilities = require("cmp_nvim_lsp").default_capabilities(), + }) + + vim.lsp.config("lua_ls", { + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + + completion = { + callSnippet = "Replace", }, }, }, - rust_analyzer = { - settings = { - ["rust-analyzer"] = { - cargo = { buildScripts = { enable = true } }, - procMacro = { enable = true }, + }) + + vim.lsp.config("rust_analyzer", { + settings = { + ["rust-analyzer"] = { + cargo = { + buildScripts = { enable = true }, }, + + procMacro = { enable = true }, }, }, - } - - -- Advertise nvim-cmp completion capabilities to every server. - vim.lsp.config("*", { - 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 + local servers = { + "lua_ls", + "rust_analyzer", + } - -- 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), + ensure_installed = servers, }) + require("mason-lspconfig").setup({ automatic_enable = true, }) end, }, - -- Formatting { - "stevearc/conform.nvim", + "lewis6991/gitsigns.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" }, + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "‾" }, + changedelete = { text = "" }, }, }, }, - -- Git signs ASCII - { - "lewis6991/gitsigns.nvim", - config = function() - require("gitsigns").setup({ - signs = { - add = { text = "+" }, - change = { text = "~" }, - delete = { text = "-" }, - topdelete = { text = "-" }, - changedelete = { text = "~" }, - }, - }) - end, - }, - - -- Which-key { "folke/which-key.nvim", + config = function() require("which-key").setup() + + require("which-key").add({ + { "<leader>f", group = "Find", icon = "" }, + { "<leader>c", group = "Code", icon = "" }, + { "<leader>d", group = "Diagnostics", icon = "" }, + { "<leader>x", group = "Trouble", icon = "" }, + }) end, }, }) --- 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" }) +-- Diagnostics +for type, icon in pairs({ + Error = " ", + Warn = " ", + Info = " ", + Hint = " ", +}) do + vim.fn.sign_define("DiagnosticSign" .. type, { + text = icon, + texthl = "Diagnostic" .. type, + }) +end + +vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + severity_sort = true, + + float = { + border = "rounded", + }, +}) -- Options local opt = vim.opt + opt.number = true opt.mouse = "a" + opt.splitright = true opt.splitbelow = true + opt.autoindent = true opt.smartindent = true + opt.expandtab = true opt.shiftwidth = 4 opt.tabstop = 4 + opt.ignorecase = true opt.smartcase = true + opt.termguicolors = true -opt.cursorline = false opt.linebreak = true opt.scrolloff = 10 opt.clipboard = "unnamedplus" -opt.completeopt = { "menu", "menuone", "noinsert", "noselect" } --- Typo forgiveness +opt.laststatus = 0 +opt.showmode = true +opt.showcmd = false +opt.ruler = false + +opt.completeopt = { + "menu", + "menuone", + "noinsert", + "noselect", +} + +opt.fillchars:append({ + vert = " ", + eob = " ", +}) + +-- Commands vim.cmd([[ cnoreabbrev W w cnoreabbrev Q q @@ -367,52 +507,194 @@ vim.cmd([[ cnoreabbrev Wqa wqa ]]) +-- Autocommands +vim.api.nvim_create_autocmd("TextYankPost", { + callback = function() + vim.highlight.on_yank() + end, +}) + -- Keymaps 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, { 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" }) +-- General +map("n", "<Esc>", "<cmd>nohlsearch<CR>") -vim.diagnostic.config({ - virtual_text = true, - signs = true, - underline = true, - severity_sort = true, +-- Telescope +map("n", "<leader>ff", telescope.find_files, { + desc = "Find files", }) -vim.api.nvim_create_autocmd("TextYankPost", { - callback = function() - vim.highlight.on_yank() - end, +map("n", "<leader>fg", telescope.live_grep, { + desc = "Find text", }) -vim.cmd.colorscheme("256_noir") +map("n", "<leader>fb", telescope.buffers, { + desc = "Find buffers", +}) -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 -]]) +-- Diagnostics +map("n", "[d", vim.diagnostic.goto_prev, { + desc = "Previous diagnostic", +}) + +map("n", "]d", vim.diagnostic.goto_next, { + desc = "Next diagnostic", +}) + +map("n", "<leader>d", vim.diagnostic.open_float, { + desc = "Show diagnostic", +}) + +-- Trouble +map("n", "<leader>xx", "<cmd>Trouble diagnostics toggle<CR>", { + desc = "Diagnostics", +}) + +map("n", "<leader>xq", "<cmd>Trouble qflist toggle<CR>", { + desc = "Quickfix list", +}) + +map("n", "<leader>xl", "<cmd>Trouble loclist toggle<CR>", { + desc = "Location list", +}) + +map("n", "<leader>xr", "<cmd>Trouble lsp_references toggle<CR>", { + desc = "References", +}) + +-- LSP +map("n", "gd", vim.lsp.buf.definition, { + desc = "Go to definition", +}) + +map("n", "gr", vim.lsp.buf.references, { + desc = "Find references", +}) + +map("n", "K", "<cmd>Lspsaga hover_doc<CR>", { + desc = "Hover documentation", +}) + +map("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", { + desc = "Rename symbol", +}) + +map("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", { + desc = "Code action", +}) + +-- Appearance +vim.cmd.colorscheme("bold-contrast") + +for _, group in ipairs({ + "Normal", + "NormalNC", + "SignColumn", + "CursorLine", + "StatusLine", + "StatusLineNC", + "MsgArea", + "MsgSeparator", + "TabLine", + "TabLineFill", +}) do + vim.api.nvim_set_hl(0, group, { + bg = "NONE", + }) +end + +vim.api.nvim_set_hl(0, "EndOfBuffer", { + fg = "NONE", + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "LineNr", { + fg = "#555555", + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "CursorLineNr", { + fg = "#aaaaaa", + bg = "NONE", + bold = true, +}) + +vim.api.nvim_set_hl(0, "VertSplit", { + fg = "NONE", + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "WinSeparator", { + fg = "NONE", + bg = "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 = "#333333", +}) + +vim.api.nvim_set_hl(0, "PMenu", { + bg = "#222222", +}) + +vim.api.nvim_set_hl(0, "PMenuSel", { + bg = "#333333", + bold = true, +}) + +-- Telescope +vim.api.nvim_set_hl(0, "TelescopeNormal", { + fg = "#aaaaaa", + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "TelescopeBorder", { + fg = "#555555", + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "TelescopePromptNormal", { + fg = "#b0b0b0", + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "TelescopeResultsNormal", { + fg = "#aaaaaa", + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "TelescopePreviewNormal", { + fg = "#aaaaaa", + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "TelescopeSelection", { + fg = "#dddddd", + bg = "#222222", + bold = true, +}) + +-- Lspsaga +vim.api.nvim_set_hl(0, "SagaNormal", { + bg = "NONE", +}) + +vim.api.nvim_set_hl(0, "SagaBorder", { + fg = "#555555", + bg = "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 }) +-- Current indent scope +vim.api.nvim_set_hl(0, "MiniIndentscopeSymbol", { + fg = "#666666", +})
\ No newline at end of file diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json deleted file mode 100644 index e74bc8d..0000000 --- a/.config/nvim/lazy-lock.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "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 deleted file mode 100644 index 8205bb1..0000000 --- a/.config/nvim/nvim.log +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100755 index 9e570b5..0000000 --- a/.local/bin/init_c +++ /dev/null @@ -1,168 +0,0 @@ -#!/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,10 +1,13 @@ # .* -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. +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 set everything up with a single command. + ```sh $ git clone https://github.com/hachem-wtf/dotfiles.git -$ cd dotfiles && stow . +$ cd dotfiles && ./install.sh ``` +The installation script symlinks the files in this repository into your home directory using `stow` and installs a few external scripts I use. + ## 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. diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..15fcfe8 --- /dev/null +++ b/install.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +GIST_ID="a0b93c1a0e821e977637172a356e3051" +GIST_USER="hachem-wtf" +GIST_FILE="init_c.py" + +echo "Installing dotfiles..." +stow . + +echo "Installing init_c..." +mkdir -p "$HOME/.local/bin" + +curl -fsSL \ + "https://gist.githubusercontent.com/$GIST_USER/$GIST_ID/raw/$GIST_FILE" \ + -o "$HOME/.local/bin/init_c" +chmod +x "$HOME/.local/bin/init_c" + +echo "Done!" |
