commit 06d0cc4c49d0c977614496bdf80214dc84cf6ca1 Author: antonl Date: Wed Mar 18 12:32:32 2026 +0100 first diff --git a/ginit.vim b/ginit.vim new file mode 100644 index 0000000..f4a93d7 --- /dev/null +++ b/ginit.vim @@ -0,0 +1,35 @@ +" Force load nvim-qt GUI shim +let s:nvim_qt_shim = 'C:/misc/nvim/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim' +if filereadable(s:nvim_qt_shim) + execute 'source' s:nvim_qt_shim +endif + +" Enable Mouse +set mouse=a + +" Set Editor Font +if exists(':GuiFont') + " Use GuiFont! to ignore font errors + GuiFont {font_name}:h{size} +endif + +" Disable GUI Tabline +if exists(':GuiTabline') + GuiTabline 0 +endif + +" Disable GUI Popupmenu +if exists(':GuiPopupmenu') + GuiPopupmenu 0 +endif + +" Enable GUI ScrollBar +if exists(':GuiScrollBar') + GuiScrollBar 1 +endif + +" Right Click Context Menu (Copy-Cut-Paste) +nnoremap :call GuiShowContextMenu() +inoremap :call GuiShowContextMenu() +xnoremap :call GuiShowContextMenu()gv +snoremap :call GuiShowContextMenu()gv diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..2c4c458 --- /dev/null +++ b/init.lua @@ -0,0 +1,398 @@ +if vim.g.neovide then + vim.o.guifont = "Iosevka:h14" +end + + +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = "\\" +vim.g.maplocalleader = "\\" + +-- Indentation settings +vim.opt.expandtab = true -- Use spaces instead of tabs +vim.opt.shiftwidth = 2 -- Number of spaces for auto-indent +vim.opt.tabstop = 2 -- Number of spaces a tab counts for +vim.opt.softtabstop = 2 -- Number of spaces for key +vim.opt.autoindent = true + +vim.opt.colorcolumn = "90" + +vim.opt.number = true +vim.opt.relativenumber = true + +-- To use LF default instead of CRLF +vim.opt.fileformat = 'unix' +vim.opt.fileformats = { 'unix', 'dos' } + +vim.opt.list = true +vim.opt.listchars = { + space = "·", + tab = "▸ ", + trail = "·", + extends = "→", + precedes = "←", + nbsp = "␣", +} +vim.opt.cursorline = true + + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- add your plugins here + "stevearc/conform.nvim", + opts = { + notify_on_error = false, + -- Odinfmt gets its configuration from odinfmt.json. It defaults + -- writing to stdout but needs to be told to read from stdin. + formatters = { + odinfmt = { + -- Change where to find the command if it isn't in your path. + command = "odinfmt", + args = { "-stdin" }, + stdin = true, + }, + }, + -- and instruct conform to use odinfmt. + formatters_by_ft = { + odin = { "odinfmt" }, + }, + format_on_save = { + timeout_ms = 500, + lsp_format = "fallback", + }, + }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) + +-- C/cpp language server +vim.lsp.config.clangd = { + cmd = { "clangd" }, + filetypes = { "c", "cpp", "objc", "objcpp" }, + root_markers = { + ".clangd", + "compile_commands.json", + "compile_flags.txt", + ".git", + }, +} + +vim.lsp.enable("clangd") + +-- Odin language server +vim.lsp.config.ols = { + cmd = { 'ols' }, -- I have added ols to the PATH + filetypes = { 'odin' }, + root_dir = vim.fs.root(0, {'.git', 'ols.json'}), +} + +vim.lsp.enable('ols') + + +-- Go language server +vim.lsp.config.gopls = { + cmd = { "gopls" }, + + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + root_markers = { "go.mod", ".git", "go.work" }, + settings = { + gopls = { + gofumpt = true, + staticcheck = true, + analyses = { + unusedparams = true, + unusedwrite = true, + }, + }, + }, +} + +vim.lsp.enable('gopls') + +-- ========================= +-- Basic Keymaps +-- ========================= + +local keymap = vim.keymap.set + +-- Clear search highlighting +keymap("n", "h", ":nohlsearch", { silent = true }) + +-- Omni complete ("IDE") +keymap("i", "", "", { noremap = true }) +-- Regular autocomplete +keymap("i", "", "", { noremap = true }) + +-- Show LSP errors/warnings float +vim.keymap.set("n", "", vim.diagnostic.open_float, { noremap = true, silent = true }) + +vim.keymap.set("n", "gd", vim.lsp.buf.definition) +vim.keymap.set("n", "gD", vim.lsp.buf.declaration) +vim.keymap.set("n", "gr", vim.lsp.buf.references) +vim.keymap.set("n", "gi", vim.lsp.buf.implementation) +vim.keymap.set("n", "K", vim.lsp.buf.hover) + +vim.keymap.set("n", "x", function() + vim.cmd("silent! lclose") + vim.cmd("silent! cclose") +end, { silent = true }) + + + +-- Colortheme +local function fleury_brown() + vim.o.termguicolors = true + vim.cmd("highlight clear") + vim.cmd("syntax reset") + vim.g.colors_name = "fleury_brown" + + local set = vim.api.nvim_set_hl + + local c = { + bg = "#1b1713", + bg2 = "#241f19", + bg3 = "#2d271f", + fg = "#d2c1a1", + fg2 = "#b9a27f", + muted = "#8b7962", + comment = "#6f6253", + brown = "#a07a52", + sand = "#c8a46b", + olive = "#8f9b6a", + red = "#b36a5e", + select = "#3a3128", + cursorln = "#221d17", + } + + set(0, "Normal", { fg = c.fg, bg = c.bg }) + set(0, "NormalFloat", { fg = c.fg, bg = c.bg2 }) + set(0, "FloatBorder", { fg = c.muted, bg = c.bg2 }) + set(0, "SignColumn", { bg = c.bg }) + set(0, "LineNr", { fg = c.comment, bg = c.bg }) + set(0, "CursorLineNr", { fg = c.sand, bg = c.cursorln, bold = true }) + set(0, "CursorLine", { bg = c.cursorln }) + set(0, "ColorColumn", { bg = c.bg2 }) + set(0, "VertSplit", { fg = c.bg3, bg = c.bg }) + set(0, "WinSeparator", { fg = c.bg3, bg = c.bg }) + set(0, "Visual", { bg = c.select }) + set(0, "Search", { fg = c.bg, bg = c.sand }) + set(0, "IncSearch", { fg = c.bg, bg = c.brown }) + set(0, "Pmenu", { fg = c.fg, bg = c.bg2 }) + set(0, "PmenuSel", { fg = c.bg, bg = c.fg2 }) + set(0, "StatusLine", { fg = c.fg2, bg = c.bg2 }) + set(0, "StatusLineNC", { fg = c.muted, bg = c.bg2 }) + + set(0, "Comment", { fg = c.comment, italic = true }) + set(0, "Constant", { fg = c.fg2 }) + set(0, "String", { fg = c.olive }) + set(0, "Character", { fg = c.olive }) + set(0, "Number", { fg = c.fg2 }) + set(0, "Boolean", { fg = c.fg2 }) + + set(0, "Identifier", { fg = c.fg }) + set(0, "Function", { fg = c.sand }) + set(0, "Type", { fg = c.brown }) + set(0, "StorageClass", { fg = c.brown }) + set(0, "Structure", { fg = c.brown }) + set(0, "Typedef", { fg = c.brown }) + + set(0, "Keyword", { fg = c.fg2 }) + set(0, "Statement", { fg = c.fg2 }) + set(0, "Conditional", { fg = c.fg2 }) + set(0, "Repeat", { fg = c.fg2 }) + set(0, "Operator", { fg = c.fg }) + set(0, "PreProc", { fg = c.brown }) + set(0, "Include", { fg = c.brown }) + + set(0, "Special", { fg = c.fg2 }) + set(0, "Todo", { fg = c.bg, bg = c.brown, bold = true }) + + set(0, "DiagnosticError", { fg = c.red }) + set(0, "DiagnosticWarn", { fg = c.sand }) + set(0, "DiagnosticInfo", { fg = c.fg2 }) + set(0, "DiagnosticHint", { fg = c.muted }) + + set(0, "DiagnosticUnderlineError", { undercurl = true, sp = c.red }) + set(0, "DiagnosticUnderlineWarn", { undercurl = true, sp = c.sand }) + set(0, "DiagnosticUnderlineInfo", { undercurl = true, sp = c.fg2 }) + set(0, "DiagnosticUnderlineHint", { undercurl = true, sp = c.muted }) +end + +local function fleury_theme() + vim.o.termguicolors = true + vim.cmd("highlight clear") + vim.cmd("syntax reset") + vim.g.colors_name = "fleury_custom" + + local set = vim.api.nvim_set_hl + + local c = { + bar = "#000000", + base = "#fcaa05", + pop1 = "#de8150", + pop2 = "#ff0000", + back = "#020202", + margin = "#222425", + margin_hover = "#63523d", + cursorline = "#1E1E1E", + highlight = "#303040", + mark = "#494949", + +-- text = "#b99468", + keyword = "#d8a245", + text = "#dac08d", + comment = "#666666", +-- keyword = "#f0c674", +-- constant = "#ffa900", + constant = "#d0e4e8", + string = "#6e9d36", + preproc = "#dc7575", + include = "#ffa900", + operators = "#b99468", +-- operators = "#bd2d2d", + syntax_crap = "#5c4d3c", + + index_type = "#edb211", + index_sum = "#a7eb13", + index_fn = "#dc6345", +-- index_fn = "#de451f", + index_macro = "#2895c7", + index_const = "#6eb535", + index_decl = "#c9598a", + + token_hi = "#f2d357", + token_hi_bg = "#443800", + error = "#ff0000", + warn = "#efaf2f", + info = "#2895c7", + hint = "#6eb535", + + line_nr_bg = "#101010", + line_nr_fg = "#404040", + at_cursor = "#0C0C0C", + white_hi = "#003A3A", + junk_hi = "#3A0000", + } + + -- UI + set(0, "Normal", { fg = c.text, bg = c.back }) + set(0, "NormalFloat", { fg = c.text, bg = c.margin }) + set(0, "FloatBorder", { fg = c.margin_hover, bg = c.margin }) + set(0, "SignColumn", { bg = c.back }) + set(0, "LineNr", { fg = c.line_nr_fg, bg = c.line_nr_bg }) + set(0, "CursorLineNr", { fg = c.base, bg = c.cursorline, bold = true }) + set(0, "CursorLine", { bg = c.cursorline }) + set(0, "ColorColumn", { bg = c.margin }) + set(0, "Visual", { bg = c.margin_hover }) + set(0, "Search", { fg = c.at_cursor, bg = c.base }) + set(0, "IncSearch", { fg = c.at_cursor, bg = c.pop1 }) + set(0, "MatchParen", { fg = c.base, bg = c.margin_hover, bold = true }) + set(0, "StatusLine", { fg = c.text, bg = c.margin }) + set(0, "StatusLineNC", { fg = c.comment, bg = c.line_nr_bg }) + set(0, "VertSplit", { fg = c.margin, bg = c.back }) + set(0, "WinSeparator", { fg = c.margin, bg = c.back }) + set(0, "Pmenu", { fg = c.text, bg = c.margin }) + set(0, "PmenuSel", { fg = c.at_cursor, bg = c.base }) + set(0, "PmenuThumb", { bg = c.margin_hover }) + set(0, "Folded", { fg = c.comment, bg = c.line_nr_bg }) + + -- Syntax + set(0, "Comment", { fg = c.comment, italic = true }) + set(0, "Keyword", { fg = c.keyword, bold = false }) + set(0, "Conditional", { fg = c.keyword }) + set(0, "Repeat", { fg = c.keyword }) + set(0, "Statement", { fg = c.keyword }) + set(0, "Operator", { fg = c.text }) + set(0, "Identifier", { fg = c.text }) + set(0, "Function", { fg = c.index_fn }) + set(0, "Type", { fg = c.index_type }) + set(0, "Structure", { fg = c.index_type }) + set(0, "Typedef", { fg = c.index_decl }) + set(0, "StorageClass", { fg = c.keyword }) + + set(0, "Constant", { fg = c.constant }) + set(0, "String", { fg = c.string}) + set(0, "Character", { fg = c.string}) + set(0, "Number", { fg = c.constant }) + set(0, "Float", { fg = c.constant }) + set(0, "Boolean", { fg = c.constant }) + + set(0, "PreProc", { fg = c.preproc }) + set(0, "Include", { fg = c.include }) + set(0, "Define", { fg = c.index_macro }) + set(0, "Macro", { fg = c.index_macro }) + + set(0, "Special", { fg = c.syntax_crap }) + set(0, "Delimiter", { fg = c.text }) + set(0, "SpecialChar", { fg = c.string}) + set(0, "Todo", { fg = c.at_cursor, bg = c.base, bold = true }) + + -- Diagnostics + set(0, "DiagnosticError", { fg = c.error }) + set(0, "DiagnosticWarn", { fg = c.warn }) + set(0, "DiagnosticInfo", { fg = c.info }) + set(0, "DiagnosticHint", { fg = c.hint }) + set(0, "DiagnosticUnderlineError", { undercurl = true, sp = c.error }) + set(0, "DiagnosticUnderlineWarn", { undercurl = true, sp = c.warn }) + set(0, "DiagnosticUnderlineInfo", { undercurl = true, sp = c.info }) + set(0, "DiagnosticUnderlineHint", { undercurl = true, sp = c.hint }) + + -- Diff / misc + set(0, "DiffAdd", { bg = c.white_hi }) + set(0, "DiffDelete", { bg = c.junk_hi }) + set(0, "DiffChange", { bg = c.margin }) + set(0, "DiffText", { bg = c.highlight }) + + -- LSP references / token highlight + set(0, "LspReferenceText", { bg = c.token_hi_bg }) + set(0, "LspReferenceRead", { bg = c.token_hi_bg }) + set(0, "LspReferenceWrite", { bg = c.token_hi_bg }) + + -- Common Treesitter captures + set(0, "@comment", { link = "Comment" }) + set(0, "@keyword", { link = "Keyword" }) + set(0, "@keyword.return", { link = "Keyword" }) + set(0, "@operator", { link = "Operator" }) + set(0, "@function", { link = "Function" }) + set(0, "@function.call", { link = "Function" }) + set(0, "@method", { link = "Function" }) + set(0, "@type", { link = "Type" }) + set(0, "@type.builtin", { fg = c.keyword }) + set(0, "@variable", { fg = c.text }) + set(0, "@variable.builtin", { fg = c.base }) + set(0, "@constant", { link = "Constant" }) + set(0, "@constant.builtin", { fg = c.constant }) + set(0, "@string", { link = "String" }) + set(0, "@number", { link = "Number" }) + set(0, "@boolean", { link = "Boolean" }) + set(0, "@include", { link = "Include" }) + set(0, "@preproc", { link = "PreProc" }) + set(0, "@punctuation.delimiter", { fg = c.text }) + set(0, "@punctuation.bracket", { fg = c.text }) +end + +fleury_theme() +--fleury_brown() diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..8fc5aa8 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,4 @@ +{ + "conform.nvim": { "branch": "master", "commit": "8314f4c9e205e7f30b62147069729f9a1227d8bf" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" } +}