all repos

dotfiles @ 116df19

i use rach linux btw
37 files changed, 1224 insertions(+), 0 deletions(-)
move nvim config in here
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-08-29 18:36:49 +0300
Parent: 5884baf
A config/nvim/after/ftplugin/fish.lua
···
        
        1
        +vim.opt_local.tabstop = 2

      
        
        2
        +vim.opt_local.shiftwidth = 2

      
        
        3
        +vim.opt_local.softtabstop = 2

      
A config/nvim/after/ftplugin/gleam.lua
···
        
        1
        +vim.opt_local.tabstop = 2

      
        
        2
        +vim.opt_local.shiftwidth = 2

      
        
        3
        +vim.opt_local.softtabstop = 2

      
A config/nvim/after/ftplugin/go.lua
···
        
        1
        +vim.opt_local.expandtab = false

      
        
        2
        +vim.opt_local.tabstop = 4

      
        
        3
        +vim.opt_local.shiftwidth = 4

      
        
        4
        +vim.opt_local.softtabstop = 4

      
        
        5
        +

      
        
        6
        +Config.map("n", "<localleader>f", "<cmd>GoIfErr<cr>", true)

      
        
        7
        +Config.map("n", "<localleader>c", "<cmd>GoCmt<cr>", true)

      
        
        8
        +Config.map("n", "<localleader>t", "<cmd>GoTestAdd<cr>", true)

      
        
        9
        +Config.map("n", "<localleader>a", "<cmd>GoTestsAll<cr>", true)

      
        
        10
        +Config.map("n", "<localleader>e", "<cmd>GoTestsExp<cr>", true)

      
        
        11
        +

      
        
        12
        +-- DLV

      
        
        13
        +vim.fn.sign_define("Breakpoint", { text = "b", texthl = "Error" })

      
        
        14
        +local dlv = { pane_id = nil, signs = {} }

      
        
        15
        +local function get_dlv_pane_id()

      
        
        16
        +  if dlv.pane_id then return dlv.pane_id end

      
        
        17
        +  local res = vim

      
        
        18
        +    .system(

      
        
        19
        +      { "tmux", "list-panes", "-s", "-F", "#{pane_id}:#{pane_current_command}" },

      
        
        20
        +      { text = true }

      
        
        21
        +    )

      
        
        22
        +    :wait()

      
        
        23
        +  if res.code ~= 0 then

      
        
        24
        +    vim.notify("Failed to list tmux panes", vim.log.levels.ERROR)

      
        
        25
        +    return

      
        
        26
        +  end

      
        
        27
        +

      
        
        28
        +  for line in res.stdout:gmatch "[^\n]+" do

      
        
        29
        +    local pane_id, command = line:match "([^:]+):(.*)"

      
        
        30
        +    if command and command:match "^dlv" then

      
        
        31
        +      dlv.pane_id = pane_id

      
        
        32
        +      return pane_id

      
        
        33
        +    end

      
        
        34
        +  end

      
        
        35
        +

      
        
        36
        +  vim.notify("No dlv session found", vim.log.levels.ERROR)

      
        
        37
        +end

      
        
        38
        +

      
        
        39
        +Config.map("n", "<localleader>B", function()

      
        
        40
        +  for _, sid in ipairs(dlv.signs) do

      
        
        41
        +    vim.fn.sign_unplace("Breakpoints", { id = sid })

      
        
        42
        +  end

      
        
        43
        +  dlv.signs = {}

      
        
        44
        +  dlv.tab_id = nil

      
        
        45
        +  vim.system { "tmux", "send-keys", "-t", get_dlv_pane_id(), "clearall", "Enter" }

      
        
        46
        +  vim.notify("Cleared all breakpoints.", vim.log.levels.INFO)

      
        
        47
        +end, true)

      
        
        48
        +

      
        
        49
        +Config.map("n", "<localleader>b", function()

      
        
        50
        +  local line = vim.fn.line "."

      
        
        51
        +  local cmd = string.format("break %s:%d", vim.fn.expand "%:p", line)

      
        
        52
        +  vim.system { "tmux", "send-keys", "-t", get_dlv_pane_id(), cmd, "Enter" }

      
        
        53
        +

      
        
        54
        +  local fullpath = vim.fn.expand "%:p"

      
        
        55
        +  local sid = tonumber(string.format("%d%04d", vim.fn.bufnr(), line)) --[[ @as number]]

      
        
        56
        +  vim.fn.sign_place(sid, "Breakpoints", "Breakpoint", fullpath, { lnum = line })

      
        
        57
        +  table.insert(dlv.signs, sid)

      
        
        58
        +end, true)

      
A config/nvim/after/ftplugin/help.lua
···
        
        1
        +Config.map("n", "q", not vim.bo.modifiable and vim.cmd.quit or nil, true)

      
A config/nvim/after/ftplugin/jjdescription.lua
···
        
        1
        +vim.opt_local.spell = true

      
        
        2
        +

      
        
        3
        +Config.map("n", "q", "<cmd>wq<cr>", true)

      
A config/nvim/after/ftplugin/json.lua
···
        
        1
        +vim.opt_local.tabstop = 2

      
        
        2
        +vim.opt_local.shiftwidth = 2

      
        
        3
        +vim.opt_local.softtabstop = 2

      
A config/nvim/after/ftplugin/kitty.lua
···
        
        1
        +vim.treesitter.language.register("bash", "kitty")

      
A config/nvim/after/ftplugin/ledger.lua
···
        
        1
        +vim.bo.commentstring = "; %s"

      
        
        2
        +vim.opt_local.foldmethod = "marker"

      
        
        3
        +vim.opt_local.foldenable = true

      
        
        4
        +vim.opt_local.tabstop = 2

      
        
        5
        +vim.opt_local.shiftwidth = 2

      
A config/nvim/after/ftplugin/lua.lua
···
        
        1
        +vim.opt_local.tabstop = 2

      
        
        2
        +vim.opt_local.shiftwidth = 2

      
        
        3
        +vim.opt_local.softtabstop = 2

      
        
        4
        +

      
        
        5
        +Config.map("n", "<localleader>x", function()

      
        
        6
        +  vim.cmd.source "%"

      
        
        7
        +  vim.print((vim.fn.expand "%:t") .. " reloaded")

      
        
        8
        +end, true)

      
A config/nvim/after/ftplugin/markdown.lua
···
        
        1
        +vim.opt_local.wrap = true

      
        
        2
        +vim.opt_local.tabstop = 2

      
        
        3
        +vim.opt_local.shiftwidth = 2

      
        
        4
        +

      
        
        5
        +vim.b.minihipatterns_config = { highlighters = {

      
        
        6
        +  next = { pattern = "%#n[ext]*", group = "MiniTestPass" },

      
        
        7
        +  tags = { pattern = "^tags%:", group = "Boolean" },

      
        
        8
        +  links = { pattern = "https?://[^%s]+", group = "Tag" },

      
        
        9
        +} }

      
        
        10
        +

      
        
        11
        +-- TASKS

      
        
        12
        +local function find_archive_heading(lines)

      
        
        13
        +  return vim

      
        
        14
        +    .iter(ipairs(lines))

      
        
        15
        +    :find(function(_, line) return line:match "^%s*# Archive" end)

      
        
        16
        +end

      
        
        17
        +

      
        
        18
        +local function can_be_completed(str) return str:match "^-%s*" ~= nil end

      
        
        19
        +local function is_labled(str) return str:match "^%s*[%-*] .*`done:%d" ~= nil end

      
        
        20
        +local function to_labled(str)

      
        
        21
        +  local task_prefix = str:match "^(%s*%- %[[x ]%])"

      
        
        22
        +  local prefix = task_prefix or str:match "^(%s*[%-*] )"

      
        
        23
        +  if not prefix then return nil end

      
        
        24
        +  local label = "`" .. os.date "done:%Y%m%d-%H%M" .. "`"

      
        
        25
        +  if task_prefix then

      
        
        26
        +    str = task_prefix .. " " .. label .. str:sub(#task_prefix + 1)

      
        
        27
        +    str = str:gsub("^(%s*%- )%[%s*%]", "%1[x]") -- mark task as complete

      
        
        28
        +  else

      
        
        29
        +    str = prefix .. label .. " " .. str:sub(#prefix + 1)

      
        
        30
        +  end

      
        
        31
        +  str = str:gsub("%[%[(.-)%]%]", "[%1]") -- remove link within a task

      
        
        32
        +  str = str:gsub(" %#n[ext]*", "") -- remove next tag

      
        
        33
        +  str = str:gsub("%s+$", "") -- white space in the end

      
        
        34
        +  return str

      
        
        35
        +end

      
        
        36
        +

      
        
        37
        +Config.map("n", "<localleader>t", function()

      
        
        38
        +  local bufnr = vim.api.nvim_get_current_buf()

      
        
        39
        +  local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)

      
        
        40
        +  local line_idx = vim.api.nvim_win_get_cursor(0)[1]

      
        
        41
        +  local line = lines[line_idx]

      
        
        42
        +  if not can_be_completed(line) then

      
        
        43
        +    vim.notify("Can't be complated", vim.log.levels.ERROR)

      
        
        44
        +    return

      
        
        45
        +  end

      
        
        46
        +

      
        
        47
        +  if is_labled(line) then

      
        
        48
        +    vim.notify("Already completed", vim.log.levels.ERROR)

      
        
        49
        +    return

      
        
        50
        +  end

      
        
        51
        +

      
        
        52
        +  local archived_heading = find_archive_heading(lines)

      
        
        53
        +  if archived_heading == nil then

      
        
        54
        +    table.insert(lines, "")

      
        
        55
        +    table.insert(lines, "# Archive")

      
        
        56
        +    archived_heading = #lines

      
        
        57
        +  end

      
        
        58
        +

      
        
        59
        +  table.remove(lines, line_idx)

      
        
        60
        +  table.insert(lines, archived_heading, to_labled(line))

      
        
        61
        +  vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, lines)

      
        
        62
        +  vim.cmd.update()

      
        
        63
        +end, true)

      
A config/nvim/after/ftplugin/nix.lua
···
        
        1
        +vim.opt_local.tabstop = 2

      
        
        2
        +vim.opt_local.shiftwidth = 2

      
        
        3
        +vim.opt_local.softtabstop = 2

      
A config/nvim/after/ftplugin/nvim-undotree.lua
···
        
        1
        +Config.map("n", "q", "<cmd>quit<cr>", true)

      
A config/nvim/after/ftplugin/qf.lua
···
        
        1
        +Config.map("n", "q", "<cmd>quit<cr>", true)

      
A config/nvim/after/ftplugin/sh.lua
···
        
        1
        +vim.opt_local.tabstop = 2

      
        
        2
        +vim.opt_local.shiftwidth = 2

      
        
        3
        +vim.opt_local.softtabstop = 2

      
        
        4
        +

      
        
        5
        +Config.map("n", "<localleader>x", ":!chmod +x %<CR><CR>", true)

      
A config/nvim/after/ftplugin/tsv.lua
···
        
        1
        +vim.opt_local.spell = true

      
        
        2
        +vim.opt_local.expandtab = false

      
        
        3
        +vim.opt_local.softtabstop = 0

      
        
        4
        +

      
        
        5
        +Config.map("x", "<localleader>b", "<Esc>`>a</b><Esc>`<i<b><Esc>", true)

      
        
        6
        +Config.map("n", "<localleader>b", "viw<Esc>`>a</b><Esc>`<i<b><Esc>", true)

      
        
        7
        +Config.map("n", "<localleader>a", "viw:'<'>!anpi<cr>", true)

      
        
        8
        +Config.map("n", "<localleader>A", "viw:'<'>!anpi --all<cr>", true)

      
        
        9
        +Config.map("x", "<localleader>a", ":'<'>!anpi<cr>", true)

      
        
        10
        +Config.map("n", "<localleader>r", function() vim.ui.open("https://context.reverso.net/translation/english-ukrainian/".. vim.fn.expand "<cword>") end)

      
        
        11
        +

      
        
        12
        +vim.b.minihipatterns_config = { highlighters = {

      
        
        13
        +  bold = { pattern = "<b>.-</b>", group = "Underlined" },

      
        
        14
        +  anpi = { pattern = "anpi%:.*", group = "Error" },

      
        
        15
        +} }

      
A config/nvim/after/lsp/clerk.lua
···
        
        1
        +---@return vim.lsp.Config

      
        
        2
        +return {

      
        
        3
        +  cmd = { "clerk", "lsp" },

      
        
        4
        +  filetypes = { "ledger" },

      
        
        5
        +  settings = {

      
        
        6
        +    latinToCyrillicCompletion = true,

      
        
        7
        +  }

      
        
        8
        +}

      
A config/nvim/after/lsp/gleam.lua
···
        
        1
        +---@return vim.lsp.Config

      
        
        2
        +return {

      
        
        3
        +  cmd = { "gleam", "lsp" },

      
        
        4
        +  filetypes = { "gleam" },

      
        
        5
        +  root_markers = { "gleam.toml" },

      
        
        6
        +}

      
A config/nvim/after/lsp/gopls.lua
···
        
        1
        +---@return vim.lsp.Config

      
        
        2
        +return {

      
        
        3
        +  cmd = { "gopls" },

      
        
        4
        +  filetypes = { "go", "gomod", "gosum", "gowork", "gotmpl" },

      
        
        5
        +  root_markers = { "go.mod", "go.work" },

      
        
        6
        +  on_attach = function(_, buf)

      
        
        7
        +    Config.map("n", "<leader>lf", function()

      
        
        8
        +      vim.lsp.buf.format()

      
        
        9
        +

      
        
        10
        +      local params = vim.lsp.util.make_range_params(0, "utf-8")

      
        
        11
        +      params.context = { only = { "source.organizeImports" } } ---@diagnostic disable-line: inject-field

      
        
        12
        +      local result = vim.lsp.buf_request_sync(buf, "textDocument/codeAction", params)

      
        
        13
        +      for cid, res in pairs(result or {}) do

      
        
        14
        +        for _, r in pairs(res.result or {}) do

      
        
        15
        +          if r.edit then

      
        
        16
        +            vim.lsp.util.apply_workspace_edit(r.edit, (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-8")

      
        
        17
        +          end

      
        
        18
        +        end

      
        
        19
        +      end

      
        
        20
        +    end, buf)

      
        
        21
        +  end,

      
        
        22
        +  settings = {

      
        
        23
        +    gopls = {

      
        
        24
        +      staticcheck = true,

      
        
        25
        +      gofumpt = true,

      
        
        26
        +      renameMovesSubpackages = true,

      
        
        27
        +      directoryFilters = { "-.git", "-.jj", "-node_modules" },

      
        
        28
        +      analyses = {

      
        
        29
        +        unusedparams = true,

      
        
        30
        +        unreachable = true,

      
        
        31
        +        unusedwrite = true,

      
        
        32
        +        nilness = true,

      
        
        33
        +        shadow = true,

      
        
        34
        +        S1008 = true, -- simplify returning boolean expression

      
        
        35
        +        SA5000 = true, -- assignment to nil map

      
        
        36
        +        SA5007 = true, -- infinite recursion call

      
        
        37
        +        ST1019 = true, -- importing the same package multiple times

      
        
        38
        +        SA1000 = true, -- invalid regular expression

      
        
        39
        +        SA1020 = true, -- using an invalid host:port pair with a net.Listen-related function

      
        
        40
        +        SA1023 = true, -- modifying the buffer in an io.Writer implementation

      
        
        41
        +        SA9001 = true, -- defers in range loops may not run when you expect them to

      
        
        42
        +        ST1013 = true, -- should use constants for HTTP error codes, not magic numbers

      
        
        43
        +        ST1000 = false, -- Incorrect or missing package comment

      
        
        44
        +      },

      
        
        45
        +      hints = {

      
        
        46
        +        assignVariableTypes = true,

      
        
        47
        +        compositeLiteralFields = true,

      
        
        48
        +        compositeLiteralTypes = false,

      
        
        49
        +        constantValues = true,

      
        
        50
        +        ignoredError = true,

      
        
        51
        +        functionTypeParameters = false,

      
        
        52
        +        parameterNames = true,

      
        
        53
        +        rangeVariableTypes = true,

      
        
        54
        +      },

      
        
        55
        +      codelenses = {

      
        
        56
        +        generate = true,

      
        
        57
        +        regenerate_cgo = true,

      
        
        58
        +        gc_details = true,

      
        
        59
        +        test = false,

      
        
        60
        +        tidy = true,

      
        
        61
        +        upgrade_dependency = true,

      
        
        62
        +        vendor = true,

      
        
        63
        +      },

      
        
        64
        +    },

      
        
        65
        +  },

      
        
        66
        +}

      
A config/nvim/after/lsp/lua_ls.lua
···
        
        1
        +---@return vim.lsp.Config

      
        
        2
        +return {

      
        
        3
        +  cmd = { "lua-language-server" },

      
        
        4
        +  filetypes = { "lua" },

      
        
        5
        +  root_markers = { ".luarc.json", ".luarc.jsonc", ".luacheckrc", ".stylua.toml", "stylua.toml", "selene.toml" },

      
        
        6
        +  settings = { Lua = {

      
        
        7
        +    runtime = { version = "LuaJIT", path = { 'lua/?.lua', 'lua/?/init.lua' } },

      
        
        8
        +    telemetry = { enable = false },

      
        
        9
        +    semantic = { enable = false },

      
        
        10
        +    format = { defaultConfig = {

      
        
        11
        +      indent_size = 2,

      
        
        12
        +      align_if_branch = "false",

      
        
        13
        +      align_continuous_inline_comment = "false",

      
        
        14
        +      align_continuous_assign_statement =  "false",

      
        
        15
        +      align_continuous_rect_table_field = "false",

      
        
        16
        +      align_table_field = "false",

      
        
        17
        +      align_array_table = "false",

      
        
        18
        +    } },

      
        
        19
        +    diagnostics = {

      
        
        20
        +      globals = { "vim", "Config" },

      
        
        21
        +      disable = { "unused-function", "unused-label", "unused-vararg" },

      
        
        22
        +      severity = {

      
        
        23
        +        ["unused-local"] = "Warning",

      
        
        24
        +      },

      
        
        25
        +    },

      
        
        26
        +    completion = {

      
        
        27
        +      keywordSnippet = "Disable",

      
        
        28
        +      callSnippet = "Disable",

      
        
        29
        +    },

      
        
        30
        +    hint = {

      
        
        31
        +      enable = true,

      
        
        32
        +      arrayIndex = "Disable",

      
        
        33
        +      await = true,

      
        
        34
        +      paramName = "Disable",

      
        
        35
        +      paramType = false,

      
        
        36
        +      semicolon = "Disable",

      
        
        37
        +      setType = true,

      
        
        38
        +    },

      
        
        39
        +    workspace = {

      
        
        40
        +      checkThirdParty = false,

      
        
        41
        +      library = {

      
        
        42
        +        vim.env.VIMRUNTIME,

      
        
        43
        +        "${3rd}/luv/library",

      
        
        44
        +        "$HOME/.local/share/nvim/site/pack/core"

      
        
        45
        +      },

      
        
        46
        +    },

      
        
        47
        +  } },

      
        
        48
        +}

      
A config/nvim/after/lsp/ts_ls.lua
···
        
        1
        +---@return vim.lsp.Config

      
        
        2
        +return {

      
        
        3
        +  cmd = { "typescript-language-server", "--stdio" },

      
        
        4
        +  root_markers = { "tsconfig.json", "jsconfig.json", "package.json" },

      
        
        5
        +  filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" },

      
        
        6
        +  init_options = { hostInfo = "neovim" },

      
        
        7
        +  handlers = {

      
        
        8
        +    -- handle rename request for certain code actions like extracting functions / types

      
        
        9
        +    ["_typescript.rename"] = function(_, result, ctx)

      
        
        10
        +      local client = assert(vim.lsp.get_client_by_id(ctx.client_id))

      
        
        11
        +      vim.lsp.util.show_document({

      
        
        12
        +        uri = result.textDocument.uri,

      
        
        13
        +        range = { start = result.position, ["end"] = result.position },

      
        
        14
        +      }, client.offset_encoding)

      
        
        15
        +      vim.lsp.buf.rename()

      
        
        16
        +      return vim.NIL

      
        
        17
        +    end,

      
        
        18
        +  },

      
        
        19
        +}

      
A config/nvim/after/queries/go/highlights.scm
···
        
        1
        +;; extends

      
        
        2
        +

      
        
        3
        +((comment) @_cmt

      
        
        4
        +  (#lua-match? @_cmt "^//go:[a-z]")) @keyword.directive

      
A config/nvim/after/queries/go/injections.scm
···
        
        1
        +;; extends

      
        
        2
        +

      
        
        3
        +;; sql

      
        
        4
        +((call_expression

      
        
        5
        +   (selector_expression

      
        
        6
        +     field: (field_identifier) @_field

      
        
        7
        +     (#any-of? @_field "Exec" "ExecContext" "Query" "QueryContext" "QueryRow" "QueryRowContext"))

      
        
        8
        +   (argument_list [(interpreted_string_literal)

      
        
        9
        +                   (raw_string_literal)] @injection.content))

      
        
        10
        + (#offset! @injection.content 0 1 0 -1)

      
        
        11
        + (#set! injection.include-children)

      
        
        12
        + (#set! injection.language sql))

      
        
        13
        +

      
        
        14
        +([(raw_string_literal)

      
        
        15
        +  (interpreted_string_literal)] @injection.content

      
        
        16
        + (#match? @injection.content "--sql" "-- sql" "--SQL" "-- SQL")

      
        
        17
        + (#offset! @injection.content 0 1 0 -1)

      
        
        18
        + (#set! injection.include-children)

      
        
        19
        + (#set! injection.language sql))

      
A config/nvim/after/queries/html/injections.scm
···
        
        1
        +;; extends

      
        
        2
        +

      
        
        3
        +((text) @injection.content

      
        
        4
        +        (#match? @injection.content "\\{\\{")

      
        
        5
        +        (#set! injection.language "gotmpl")

      
        
        6
        +        (#set! injection.combined))

      
A config/nvim/after/queries/lua/injections.scm
···
        
        1
        +;; extends

      
        
        2
        +

      
        
        3
        +;; MiniTest

      
        
        4
        +((function_call

      
        
        5
        +   name: (_) @_vimcmd_identifier

      
        
        6
        +   arguments: (arguments

      
        
        7
        +                (string

      
        
        8
        +                  content: _ @injection.content)))

      
        
        9
        + (#set! injection.language "lua")

      
        
        10
        + (#any-of? @_vimcmd_identifier "child.lua" "c.lua"))

      
        
        11
        +

      
        
        12
        +((function_call

      
        
        13
        +   name: (_) @_vimcmd_identifier

      
        
        14
        +   arguments: (arguments (string content: _ @injection.content)))

      
        
        15
        + (#set! injection.language "vim")

      
        
        16
        + (#any-of? @_vimcmd_identifier "child.cmd" "c.cmd"))

      
A config/nvim/colors/kolir.lua
···
        
        1
        +vim.cmd.highlight "clear"

      
        
        2
        +if vim.fn.exists "syntax_on" then vim.cmd.syntax "reset" end

      
        
        3
        +vim.g.colors_name = "kolir"

      
        
        4
        +if vim.o.background == "dark" then

      
        
        5
        +  require "kolir" {

      
        
        6
        +    fg = "#c0caf5",

      
        
        7
        +    bg = "#1a1b26",

      
        
        8
        +    primary = "#85a6eb",   -- declarations

      
        
        9
        +    secondary = "#94c85a", -- vars/consts

      
        
        10
        +    muted = "#9d7cd8",     -- keywords

      
        
        11
        +    marker = "#d4a06a",    -- comments, search, warnings

      
        
        12
        +    danger = "#db6f6f",    -- errors, deletions

      
        
        13
        +  }

      
        
        14
        +else

      
        
        15
        +  require "kolir" {

      
        
        16
        +    fg = "#774f38",

      
        
        17
        +    bg = "#f7efdf",

      
        
        18
        +    primary = "#308444",

      
        
        19
        +    secondary = "#b95942",

      
        
        20
        +    muted = "#308090",

      
        
        21
        +    marker = "#878787",

      
        
        22
        +    danger = "#f10000",

      
        
        23
        +  }

      
        
        24
        +end

      
A config/nvim/filetype.lua
···
        
        1
        +vim.filetype.add {

      
        
        2
        +  extension = {

      
        
        3
        +    lock = "yaml",

      
        
        4
        +    gotmpl = "gotmpl",

      
        
        5
        +    vil = "json",

      
        
        6
        +  },

      
        
        7
        +  filename = {

      
        
        8
        +    [".stignore"] = "gitignore",

      
        
        9
        +  },

      
        
        10
        +  pattern = {

      
        
        11
        +    ["%.env%.[%w_.-]+"] = "sh",

      
        
        12
        +    [".*Dockerfile.*"] = "dockerfile",

      
        
        13
        +    [".*/hypr/.+%.conf"] = "hyprlang",

      
        
        14
        +    [".*/kitty/.+%.conf"] = "kitty",

      
        
        15
        +  },

      
        
        16
        +}

      
A config/nvim/init.lua
···
        
        1
        +vim.loader.enable()

      
        
        2
        +require("vim._core.ui2").enable { enable = true }

      
        
        3
        +

      
        
        4
        +vim.cmd.packadd "nvim.undotree"

      
        
        5
        +vim.cmd.packadd "cfilter"

      
        
        6
        +

      
        
        7
        +vim.g.loaded_perl_provider = 0

      
        
        8
        +vim.g.loaded_ruby_provider = 0

      
        
        9
        +vim.g.loaded_node_provider = 0

      
        
        10
        +vim.g.loaded_python3_provider = 0

      
        
        11
        +for _, p in ipairs {

      
        
        12
        +  "netrw", "netrwPlugin", "netrwSettings", "netrwFileHandlers", "nvim_dir_plugin",

      
        
        13
        +  "gzip", "zip", "zipPlugin", "tar", "tarPlugin",

      
        
        14
        +  "getscript", "getscriptPlugin", "vimball", "vimballPlugin", "remote_plugins", "rrhelper",

      
        
        15
        +  "tohtml", "2html_plugin",

      
        
        16
        +  "logipat", "matchit",

      
        
        17
        +} do vim.g["loaded_" .. p] = 1 end

      
        
        18
        +

      
        
        19
        +-- i like my helpers -------------------------------------------------

      
        
        20
        +Config = {}

      
        
        21
        +Config.map = function(mode, from, to, buffer)

      
        
        22
        +  vim.keymap.set(mode, from, to, { silent = true, buffer = buffer or false })

      
        
        23
        +end

      
        
        24
        +

      
        
        25
        +Config.add = function(opts)

      
        
        26
        +  local spec = type(opts) == "string" and { src = opts } or opts

      
        
        27
        +  spec.src = "https://github.com/" .. spec.src

      
        
        28
        +  spec.version = spec.version or vim.version.range "*"

      
        
        29
        +  spec.name = spec.name or nil

      
        
        30
        +  vim.pack.add { spec }

      
        
        31
        +end

      
        
        32
        +

      
        
        33
        +local grp = vim.api.nvim_create_augroup("olexsmir", { clear = true })

      
        
        34
        +Config.autocmd = function(ev, opts)

      
        
        35
        +  vim.api.nvim_create_autocmd(ev, vim.tbl_extend("force", { group = grp }, opts))

      
        
        36
        +end

      
        
        37
        +Config.aucmd = function(ev, pattern, callback, once)

      
        
        38
        +  Config.autocmd(ev, { pattern = pattern, callback = callback, once = once })

      
        
        39
        +end

      
        
        40
        +

      
        
        41
        +Config.later = vim.schedule

      
        
        42
        +Config.onpack = function(pname, kinds, callback)

      
        
        43
        +  if type(kinds) == "string" then kinds = { kinds } end

      
        
        44
        +  Config.aucmd("PackChanged", "*", function(ev)

      
        
        45
        +    if not (ev.data.spec.name == pname and vim.tbl_contains(kinds, ev.data.kind)) then return end

      
        
        46
        +    if not ev.data.active then vim.cmd.packadd(pname) end

      
        
        47
        +    callback()

      
        
        48
        +  end)

      
        
        49
        +end

      
        
        50
        +

      
        
        51
        +-- settings ----------------------------------------------------------

      
        
        52
        +Config.later(function() vim.o.clipboard = "unnamedplus" end)

      
        
        53
        +Config.later(function()

      
        
        54
        +  vim.diagnostic.config {

      
        
        55
        +    virtual_text = { virt_text_pos = "eol", current_line = false },

      
        
        56
        +    float = { source = "if_many" },

      
        
        57
        +    signs = { text = {

      
        
        58
        +      [vim.diagnostic.severity.ERROR] = "",

      
        
        59
        +      [vim.diagnostic.severity.WARN] = "",

      
        
        60
        +      [vim.diagnostic.severity.HINT] = "",

      
        
        61
        +      [vim.diagnostic.severity.INFO] = "",

      
        
        62
        +    } },

      
        
        63
        +  }

      
        
        64
        +end)

      
        
        65
        +

      
        
        66
        +vim.cmd.colorscheme "kolir"

      
        
        67
        +

      
        
        68
        +vim.g.mapleader = " "

      
        
        69
        +vim.g.maplocalleader = "-"

      
        
        70
        +

      
        
        71
        +vim.o.smartindent = true

      
        
        72
        +vim.o.expandtab = true

      
        
        73
        +vim.o.shiftwidth = 4

      
        
        74
        +vim.o.softtabstop = 4

      
        
        75
        +vim.o.tabstop = 4

      
        
        76
        +

      
        
        77
        +vim.o.exrc = true

      
        
        78
        +vim.o.secure = true

      
        
        79
        +vim.o.ignorecase = true

      
        
        80
        +vim.o.smartcase = true

      
        
        81
        +vim.o.cursorline = true

      
        
        82
        +vim.o.number = true

      
        
        83
        +vim.o.termguicolors = true

      
        
        84
        +vim.o.infercase = true

      
        
        85
        +vim.o.completeopt = "menuone,noselect,noinsert,fuzzy,popup"

      
        
        86
        +vim.o.splitbelow = true

      
        
        87
        +vim.o.splitright = true

      
        
        88
        +vim.o.pumheight = 8

      
        
        89
        +vim.o.scrolloff = 14

      
        
        90
        +vim.o.sidescrolloff = 16

      
        
        91
        +vim.o.smoothscroll = true

      
        
        92
        +vim.o.signcolumn = "yes"

      
        
        93
        +vim.o.title = true

      
        
        94
        +vim.o.wrap = false

      
        
        95
        +vim.o.foldenable = false

      
        
        96
        +

      
        
        97
        +vim.o.undofile = true

      
        
        98
        +vim.o.swapfile = false

      
        
        99
        +vim.o.writebackup = false

      
        
        100
        +

      
        
        101
        +vim.o.spell = false

      
        
        102
        +vim.o.spelllang = "en_us,uk"

      
        
        103
        +

      
        
        104
        +vim.o.laststatus = 0

      
        
        105
        +vim.o.showmode = false

      
        
        106
        +vim.o.ruler = true

      
        
        107
        +vim.o.rulerformat = "%30(%=%{%v:lua.require'ruler'()%}%)"

      
        
        108
        +

      
        
        109
        +vim.o.list = true

      
        
        110
        +vim.opt.listchars:append {

      
        
        111
        +  space = "·",

      
        
        112
        +  trail = "~",

      
        
        113
        +  tab = "│·",

      
        
        114
        +}

      
        
        115
        +

      
        
        116
        +--- keymaps ----------------------------------------------------------

      
        
        117
        +vim.o.langmap = table.concat({

      
        
        118
        +  "\'ʼ;`~", "№;#",

      
        
        119
        +  "йЙ;qQ", "цЦ;wW", "уУ;eE", "кК;rR", "еЕ;tT", "нН;yY", "гГ;uU", "шШ;iI", "щЩ;oO", "зЗ;pP", "хХ;[{", "їЇ;]}", -- "ґҐ;\\|",

      
        
        120
        +  "фФ;aA", "ыЫ;sS", "вВ;dD", "аА;fF", "пП;gG", "рР;hH", "оО;jJ", "лЛ;kK", "дД;lL", [[жЖ]], [[єЄ;'"]],

      
        
        121
        +  "яЯ;zZ", "чЧ;xX", "сС;cC", "мМ;vV", "иИ;bB", "тТ;nN", "ьЬ;mM", [[бБ;\,<]], "юЮ;.>",

      
        
        122
        +}, ',')

      
        
        123
        +

      
        
        124
        +vim.keymap.del("n", "grn")

      
        
        125
        +vim.keymap.del({ "n", "x" }, "gra")

      
        
        126
        +vim.keymap.del("n", "grr")

      
        
        127
        +vim.keymap.del("n", "grx")

      
        
        128
        +vim.keymap.del("n", "gri")

      
        
        129
        +vim.keymap.del("n", "grt")

      
        
        130
        +

      
        
        131
        +Config.map("i", "<c-r><c-d>", "<c-r>=strftime('%F')<cr>")

      
        
        132
        +

      
        
        133
        +Config.map("t", "<esc><esc>", "<C-\\><C-n>")

      
        
        134
        +Config.map("i", "jk", "<esc>")

      
        
        135
        +Config.map("n", "gd", "<C-]>") -- tags ux

      
        
        136
        +Config.map("n", "<C-d>", "<C-d>zz")

      
        
        137
        +Config.map("n", "<C-u>", "<C-u>zz")

      
        
        138
        +Config.map("n", "<leader>q", "<cmd>quit!<cr>")

      
        
        139
        +Config.map("n", "<leader>w", "<cmd>update<cr>")

      
        
        140
        +Config.map("n", "<leader>h", "<cmd>nohlsearch<cr>")

      
        
        141
        +Config.map("n", "<leader>u", "<cmd>Undotree<cr>")

      
        
        142
        +Config.map("n", "<leader>n", "<cmd>e ~/org/todo.md<cr>")

      
        
        143
        +Config.map({ "n", "x" }, "<leader>z", "1z=")

      
        
        144
        +

      
        
        145
        +Config.map("n", "<C-h>", "<cmd>wincmd h<cr>")

      
        
        146
        +Config.map("n", "<C-j>", "<cmd>wincmd j<cr>")

      
        
        147
        +Config.map("n", "<C-k>", "<cmd>wincmd k<cr>")

      
        
        148
        +Config.map("n", "<C-l>", "<cmd>wincmd l<cr>")

      
        
        149
        +Config.map("n", "<C-Left>", "<cmd>vertical resize -2<cr>")

      
        
        150
        +Config.map("n", "<C-Down>", "<cmd>resize +2<cr>")

      
        
        151
        +Config.map("n", "<C-Up>", "<cmd>resize -1<cr>")

      
        
        152
        +Config.map("n", "<C-Right>", "<cmd>vertical resize +2<cr>")

      
        
        153
        +

      
        
        154
        +Config.map("n", "<A-j>", ":move .+1<CR>==")

      
        
        155
        +Config.map("n", "<A-k>", ":move .-2<CR>==")

      
        
        156
        +Config.map("v", "<A-j>", ":move '>+1<CR>gv-gv")

      
        
        157
        +Config.map("v", "<A-k>", ":move '<-2<CR>gv-gv")

      
        
        158
        +Config.map("v", "<", "<gv")

      
        
        159
        +Config.map("v", ">", ">gv")

      
        
        160
        +

      
        
        161
        +Config.map("n", "<C-q>", function()

      
        
        162
        +  for _, win in ipairs(vim.fn.getwininfo()) do

      
        
        163
        +    if win.quickfix == 1 and win.loclist == 0 then

      
        
        164
        +      vim.cmd.cclose()

      
        
        165
        +      return

      
        
        166
        +    end

      
        
        167
        +  end

      
        
        168
        +  vim.cmd.copen()

      
        
        169
        +end)

      
        
        170
        +

      
        
        171
        +Config.map("n", "<C-n>", function() vim.cmd "silent! 1argument" end)

      
        
        172
        +Config.map("n", "<C-m>", function() vim.cmd "silent! 2argument" end)

      
        
        173
        +Config.map("n", "<C-,>", function() vim.cmd "silent! 3argument" end)

      
        
        174
        +Config.map("n", "<C-.>", function() vim.cmd "silent! 4argument" end)

      
        
        175
        +Config.map("n", "<leader>a", function()

      
        
        176
        +  vim.cmd("argadd %")

      
        
        177
        +  vim.cmd("argdedup")

      
        
        178
        +end)

      
        
        179
        +

      
        
        180
        +--- autocmds ---------------------------------------------------------

      
        
        181
        +Config.aucmd("TextYankPost", nil, function() vim.hl.hl_op { higroup = "Visual" } end)

      
        
        182
        +

      
        
        183
        +Config.aucmd("VimResized", nil, function()

      
        
        184
        +  vim.cmd "tabdo wincmd ="

      
        
        185
        +  vim.cmd("tabnext " .. vim.fn.tabpagenr())

      
        
        186
        +end)

      
        
        187
        +

      
        
        188
        +Config.aucmd("BufReadPost", "*", function() vim.fn.setpos(".", vim.fn.getpos "'\"") end)

      
        
        189
        +

      
        
        190
        +Config.aucmd("TermOpen", "term://*", function()

      
        
        191
        +  vim.cmd.startinsert()

      
        
        192
        +  vim.keymap.set('n', '<leader>q', '<cmd>hide<CR>', { buffer = true })

      
        
        193
        +end)

      
        
        194
        +Config.aucmd("TermRequest", nil, function(ev)

      
        
        195
        +  local pwd, n = string.gsub(ev.data.sequence, "\027]7;file://[^/]*", "")

      
        
        196
        +  if n <= 0 then return end

      
        
        197
        +  if vim.fn.isdirectory(pwd) == 0 then return end

      
        
        198
        +  if vim.api.nvim_get_current_buf() ~= ev.buf then return end

      
        
        199
        +  vim.cmd.cd(pwd)

      
        
        200
        +end)

      
        
        201
        +

      
        
        202
        +Config.autocmd("FileType", { pattern = { "help", "man" }, command = "wincmd L" })

      
        
        203
        +Config.aucmd("FileType", "*", function()

      
        
        204
        +  vim.opt_local.formatoptions:append("l") -- long lines not broken in insert mode

      
        
        205
        +  vim.opt_local.formatoptions:append("1") -- don't break a line after a one-letter word

      
        
        206
        +

      
        
        207
        +  vim.opt_local.formatoptions:remove("c") -- autowrap comments using textwidth with leader

      
        
        208
        +  vim.opt_local.formatoptions:remove("r") -- don't auto-insert comment leader on enter in insert

      
        
        209
        +  vim.opt_local.formatoptions:remove("o") -- don't auto-insert comment leader on o/O in normal

      
        
        210
        +  vim.opt_local.formatoptions:remove("n") -- don't recognizes numbered lists

      
        
        211
        +  vim.opt_local.formatoptions:remove("2") -- don't use the indent of second paragraph line

      
        
        212
        +end)

      
        
        213
        +

      
        
        214
        +--- lsp --------------------------------------------------------------

      
        
        215
        +vim.lsp.enable { "clerk", "gleam", "gopls", "lua_ls", "ts_ls" }

      
        
        216
        +Config.aucmd("LspAttach", nil, function(ev)

      
        
        217
        +  local bufnr = ev.buf

      
        
        218
        +  local client = vim.lsp.get_client_by_id(ev.data.client_id)

      
        
        219
        +  if not client then error "couldn't get an lsp server" end

      
        
        220
        +

      
        
        221
        +  if client.name ~= "clerk" then client.server_capabilities.semanticTokensProvider = nil end

      
        
        222
        +  if client:supports_method(vim.lsp.protocol.Methods.textDocument_codeLens) then

      
        
        223
        +    vim.lsp.codelens.enable(true, { bufnr = bufnr })

      
        
        224
        +  end

      
        
        225
        +

      
        
        226
        +  Config.map("n", "gd", Snacks.picker.lsp_definitions, bufnr)

      
        
        227
        +  Config.map("n", "gr", Snacks.picker.lsp_references, bufnr)

      
        
        228
        +  Config.map("n", "gi", Snacks.picker.lsp_implementations, bufnr)

      
        
        229
        +  Config.map("n", "gl", vim.diagnostic.open_float, bufnr)

      
        
        230
        +  Config.map({ "n", "x" }, "<leader>la", vim.lsp.buf.code_action, bufnr)

      
        
        231
        +  Config.map("n", "<leader>lf", function() vim.lsp.buf.format { async = true } end, bufnr)

      
        
        232
        +  Config.map("n", "<leader>ll", vim.lsp.codelens.run, bufnr)

      
        
        233
        +  Config.map("n", "<leader>lr", vim.lsp.buf.rename, bufnr)

      
        
        234
        +  Config.map("n", "<leader>lS", Snacks.picker.lsp_symbols, bufnr)

      
        
        235
        +  Config.map("n", "<leader>ls", Snacks.picker.lsp_workspace_symbols, bufnr)

      
        
        236
        +  Config.map("n", "<leader>li", function()

      
        
        237
        +    vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = bufnr }, { bufnr = bufnr })

      
        
        238
        +    vim.print "Inlay hints toggled"

      
        
        239
        +  end, bufnr)

      
        
        240
        +end)

      
        
        241
        +

      
        
        242
        +--- plugins ----------------------------------------------------------

      
        
        243
        +Config.add { src = "tpope/vim-surround", version = "master" }

      
        
        244
        +Config.add { src = "tpope/vim-speeddating", version = "master" }

      
        
        245
        +Config.add { src = "tpope/vim-repeat", version = "master" }

      
        
        246
        +Config.add "wakatime/vim-wakatime"

      
        
        247
        +

      
        
        248
        +Config.add "j-hui/fidget.nvim"

      
        
        249
        +Config.later(function()

      
        
        250
        +  require("fidget").setup {

      
        
        251
        +    progress = { display = {

      
        
        252
        +      render_limit = 2,

      
        
        253
        +      done_ttl = 2,

      
        
        254
        +    } },

      
        
        255
        +  }

      
        
        256
        +end)

      
        
        257
        +

      
        
        258
        +vim.cmd.packadd "viye"

      
        
        259
        +Config.later(function()

      
        
        260
        +  -- HACK: wait till https://github.com/neovim/neovim/pull/37727 gets merged

      
        
        261
        +  -- ln -s ~/code/gopher.nvim ~/.local/share/nvim/site/pack/my-plugins/opt/gopher.nvim

      
        
        262
        +  vim.cmd.packadd "gopher.nvim"

      
        
        263
        +

      
        
        264
        +  vim.cmd.packadd "curl.nvim"

      
        
        265
        +

      
        
        266
        +  vim.cmd.packadd "utest.nvim"

      
        
        267
        +  require("utest").setup {}

      
        
        268
        +  Config.map("n", "<leader>tn", require("utest").run)

      
        
        269
        +  Config.map("n", "<leader>tt", require("utest").run_file)

      
        
        270
        +  Config.map("n", "<leader>tc", require("utest").cancel)

      
        
        271
        +  Config.map("n", "<leader>tr", require("utest").clear)

      
        
        272
        +  Config.map("n", "<leader>tq", require("utest").qf)

      
        
        273
        +end)

      
        
        274
        +

      
        
        275
        +Config.add { src = "saghen/blink.cmp", version = vim.version.range "1.x" }

      
        
        276
        +Config.later(function()

      
        
        277
        +  require("blink.cmp").setup {

      
        
        278
        +    keymap = {

      
        
        279
        +      preset = "enter",

      
        
        280
        +      ["<C-u>"] = { "scroll_documentation_up", "fallback" },

      
        
        281
        +      ["<C-d>"] = { "scroll_documentation_down", "fallback" },

      
        
        282
        +      ["<C-l>"] = { "snippet_forward", "accept", "fallback" },

      
        
        283
        +    },

      
        
        284
        +    completion = { documentation = {

      
        
        285
        +      auto_show = true,

      
        
        286
        +      auto_show_delay_ms = 300,

      
        
        287
        +    } },

      
        
        288
        +    sources = { default = { "lsp", "path", "snippets", "buffer" } },

      
        
        289
        +  }

      
        
        290
        +

      
        
        291
        +  vim.lsp.config("*", {

      
        
        292
        +    flags = { debounce_text_changes = 150 },

      
        
        293
        +    capabilities = require("blink.cmp").get_lsp_capabilities(),

      
        
        294
        +  })

      
        
        295
        +end)

      
        
        296
        +

      
        
        297
        +-- treesitter

      
        
        298
        +Config.onpack("nvim-treesitter", "update", function() vim.cmd.TSUpdate() end)

      
        
        299
        +Config.add { src = "nvim-treesitter/nvim-treesitter", version = "main" }

      
        
        300
        +Config.add "nvim-treesitter/nvim-treesitter-context"

      
        
        301
        +

      
        
        302
        +Config.later(function() require("treesitter-context").setup { max_lines = 3 } end)

      
        
        303
        +Config.aucmd("FileType", "*", function(ev)

      
        
        304
        +  if not ev.match or ev.match == "" or ev.match == "text" then vim.treesitter.stop() end

      
        
        305
        +  pcall(vim.treesitter.start, ev.buf)

      
        
        306
        +end)

      
A config/nvim/lua/kolir.lua
···
        
        1
        +local function hex_to_rgb(hex)

      
        
        2
        +  hex = hex:gsub("#", "")

      
        
        3
        +  return tonumber(hex:sub(1, 2), 16), tonumber(hex:sub(3, 4), 16), tonumber(hex:sub(5, 6), 16)

      
        
        4
        +end

      
        
        5
        +

      
        
        6
        +local function rgb_to_hex(r, g, b)

      
        
        7
        +  return string.format("#%02x%02x%02x",

      
        
        8
        +    math.min(255, math.max(0, r)),

      
        
        9
        +    math.min(255, math.max(0, g)),

      
        
        10
        +    math.min(255, math.max(0, b)))

      
        
        11
        +end

      
        
        12
        +

      
        
        13
        +local function rgb_to_hsl(r, g, b)

      
        
        14
        +  r, g, b = r / 255, g / 255, b / 255

      
        
        15
        +  local max, min = math.max(r, g, b), math.min(r, g, b)

      
        
        16
        +  local l = (max + min) / 2

      
        
        17
        +  if max == min then return 0, 0, l end

      
        
        18
        +

      
        
        19
        +  local d = max - min

      
        
        20
        +  local s = l > 0.5 and d / (2 - max - min) or d / (max + min)

      
        
        21
        +  local h

      
        
        22
        +  if max == r then

      
        
        23
        +    h = (g - b) / d + (g < b and 6 or 0)

      
        
        24
        +  elseif max == g then

      
        
        25
        +    h = (b - r) / d + 2

      
        
        26
        +  else

      
        
        27
        +    h = (r - g) / d + 4

      
        
        28
        +  end

      
        
        29
        +  return h / 6, s, l

      
        
        30
        +end

      
        
        31
        +

      
        
        32
        +local function hsl_to_rgb(h, s, l)

      
        
        33
        +  if s == 0 then

      
        
        34
        +    local v = math.floor(l * 255)

      
        
        35
        +    return v, v, v

      
        
        36
        +  end

      
        
        37
        +

      
        
        38
        +  local function f(p, q, t)

      
        
        39
        +    if t < 0 then t = t + 1 end

      
        
        40
        +    if t > 1 then t = t - 1 end

      
        
        41
        +    if t < 1 / 6 then return p + (q - p) * 6 * t end

      
        
        42
        +    if t < 1 / 2 then return q end

      
        
        43
        +    if t < 2 / 3 then return p + (q - p) * (2 / 3 - t) * 6 end

      
        
        44
        +    return p

      
        
        45
        +  end

      
        
        46
        +

      
        
        47
        +  local q = l < 0.5 and l * (1 + s) or l + s - l * s

      
        
        48
        +  local p = 2 * l - q

      
        
        49
        +  return math.floor(f(p, q, h + 1 / 3) * 255), math.floor(f(p, q, h) * 255), math.floor(f(p, q, h - 1 / 3) * 255)

      
        
        50
        +end

      
        
        51
        +

      
        
        52
        +local function adjust_hsl(hex, dh, ds, dl)

      
        
        53
        +  local h, s, l = rgb_to_hsl(hex_to_rgb(hex))

      
        
        54
        +  return rgb_to_hex(hsl_to_rgb((h + (dh or 0)) % 1, math.min(1, math.max(0, s + (ds or 0))),

      
        
        55
        +    math.min(1, math.max(0, l + (dl or 0)))))

      
        
        56
        +end

      
        
        57
        +

      
        
        58
        +-- Blend two colors in RGB space (semantic -> background-safe)

      
        
        59
        +local function mix(hex_a, hex_b, t)

      
        
        60
        +  local ar, ag, ab = hex_to_rgb(hex_a)

      
        
        61
        +  local br, bg, bb = hex_to_rgb(hex_b)

      
        
        62
        +  return rgb_to_hex(math.floor(ar + (br - ar) * t), math.floor(ag + (bg - ag) * t), math.floor(ab + (bb - ab) * t))

      
        
        63
        +end

      
        
        64
        +

      
        
        65
        +local function hl(g, o) vim.api.nvim_set_hl(0, g, o) end

      
        
        66
        +

      
        
        67
        +return function(theme)

      
        
        68
        +  local is_dark = vim.o.background == "dark"

      
        
        69
        +

      
        
        70
        +  -- Background shading

      
        
        71
        +  theme.bg_alt = adjust_hsl(theme.bg, 0, 0, is_dark and 0.070 or -0.050)

      
        
        72
        +  theme.bg_dim = adjust_hsl(theme.bg, 0, 0, is_dark and -0.024 or -0.032)

      
        
        73
        +  theme.fg_dim = mix(theme.fg, theme.bg, is_dark and 0.45 or 0.20)

      
        
        74
        +

      
        
        75
        +  -- Semantic surfaces, Accent colors are *pulled toward background*, not crushed in lightness

      
        
        76
        +  theme.highlight_bg = mix(theme.primary, theme.bg, is_dark and 0.58 or 0.45)

      
        
        77
        +  theme.positive_bg = mix(theme.secondary, theme.bg, is_dark and 0.75 or 0.30)

      
        
        78
        +  theme.negative_bg = mix(theme.muted, theme.bg, is_dark and 0.75 or 0.35)

      
        
        79
        +  theme.danger_bg = mix(theme.danger, theme.bg, is_dark and 0.75 or 0.40)

      
        
        80
        +

      
        
        81
        +  theme.black = mix(theme.bg, "#000000", is_dark and 0.20 or 0.50)

      
        
        82
        +  theme.fg_gutter = mix(mix(theme.fg, theme.primary, 0.30), theme.bg, is_dark and 0.60 or 0.55)

      
        
        83
        +  theme.nontext = mix(theme.fg, theme.bg, is_dark and 0.74 or 0.35)

      
        
        84
        +

      
        
        85
        +  -- highlights

      
        
        86
        +  hl("Normal", { fg = theme.fg, bg = theme.bg })

      
        
        87
        +  hl("NormalFloat", { fg = theme.fg, bg = theme.bg_dim })

      
        
        88
        +  hl("FloatBorder", { bg = theme.bg_dim, fg = theme.primary })

      
        
        89
        +  hl("EndOfBuffer", { fg = theme.bg })

      
        
        90
        +  hl("Cursor", { reverse = true })

      
        
        91
        +  hl("CursorLine", { bg = theme.bg_alt })

      
        
        92
        +  hl("CursorLineNr", { bold = true, fg = theme.marker })

      
        
        93
        +  hl("SignColumn", { bg = theme.bg, fg = theme.fg_dim })

      
        
        94
        +  hl("LineNr", { fg = theme.fg_gutter })

      
        
        95
        +  hl("FloatTitle", { bg = theme.bg_dim, fg = theme.primary, bold = true })

      
        
        96
        +  hl("Title", { fg = theme.primary, bold = true })

      
        
        97
        +

      
        
        98
        +  hl("ErrorMsg", { fg = theme.danger })

      
        
        99
        +  hl("WarningMsg", { fg = theme.marker })

      
        
        100
        +  hl("ModeMsg", { bold = true, fg = theme.fg })

      
        
        101
        +  hl("MoreMsg", { fg = theme.fg })

      
        
        102
        +  hl("Question", { fg = theme.fg })

      
        
        103
        +

      
        
        104
        +  hl("Pmenu", { bg = theme.bg_dim, fg = theme.fg })

      
        
        105
        +  hl("PmenuSel", { bg = theme.bg_alt, fg = theme.fg })

      
        
        106
        +  hl("PmenuSbar", { bg = theme.bg_alt })

      
        
        107
        +  hl("PmenuThumb", { bg = theme.fg_dim })

      
        
        108
        +  hl("WildMenu", { bg = theme.bg_alt, fg = theme.fg })

      
        
        109
        +  hl("WinSeparator", { bold = true, fg = theme.black })

      
        
        110
        +  hl("VertSplit", { fg = theme.black })

      
        
        111
        +  hl("Search", { bg = theme.highlight_bg, fg = theme.fg })

      
        
        112
        +  hl("IncSearch", { bg = theme.marker, fg = theme.bg })

      
        
        113
        +  hl("Visual", { bg = theme.negative_bg })

      
        
        114
        +

      
        
        115
        +  hl("MatchParen", { bold = true, fg = theme.marker })

      
        
        116
        +  hl("Directory", { fg = theme.primary })

      
        
        117
        +  hl("NonText", { fg = theme.nontext })

      
        
        118
        +  hl("Folded", { bg = theme.bg_dim, fg = theme.fg_dim, italic = true })

      
        
        119
        +  hl("SpecialKey", { link = "NonText" })

      
        
        120
        +  hl("StatusLine", { bg = theme.bg_dim, fg = theme.fg })

      
        
        121
        +  hl("StatusLineNC", { bg = theme.bg_dim, fg = theme.fg_dim })

      
        
        122
        +  hl("TabLine", { bg = theme.bg_dim, fg = theme.fg_dim })

      
        
        123
        +  hl("TabLineFill", { bg = theme.bg_dim, fg = theme.fg })

      
        
        124
        +  hl("TabLineSel", { bg = theme.primary, fg = theme.bg })

      
        
        125
        +

      
        
        126
        +  hl("Comment", { fg = theme.marker, italic = true })

      
        
        127
        +  hl("SpecialComment", { fg = theme.marker, bold = true })

      
        
        128
        +  hl("Debug", { fg = theme.muted })

      
        
        129
        +  hl("Exception", { fg = theme.muted })

      
        
        130
        +  hl("Label", { fg = theme.muted })

      
        
        131
        +  hl("Repeat", { fg = theme.muted })

      
        
        132
        +  hl("Todo", { fg = theme.bg, bg = theme.marker, bold = true })

      
        
        133
        +

      
        
        134
        +  hl("Keyword", { fg = theme.muted, italic = true })

      
        
        135
        +  hl("Conditional", { fg = theme.muted })

      
        
        136
        +  hl("Statement", { fg = theme.muted })

      
        
        137
        +  hl("Include", { fg = theme.muted })

      
        
        138
        +  hl("PreCondit", { fg = theme.muted })

      
        
        139
        +  hl("PreProc", { fg = theme.muted })

      
        
        140
        +  hl("StorageClass", { fg = theme.muted })

      
        
        141
        +  hl("Operator", { fg = theme.fg })

      
        
        142
        +  hl("Delimiter", { fg = theme.fg_dim })

      
        
        143
        +  hl("Identifier", { fg = theme.fg })

      
        
        144
        +  hl("Error", { fg = theme.danger })

      
        
        145
        +  hl("SpecialChar", { fg = theme.primary })

      
        
        146
        +  hl("Special", { fg = theme.marker })

      
        
        147
        +

      
        
        148
        +  hl("Constant", { fg = theme.fg })

      
        
        149
        +  hl("String", { fg = theme.secondary, italic = true })

      
        
        150
        +  hl("Boolean", { fg = theme.marker })

      
        
        151
        +  hl("Number", { fg = theme.marker })

      
        
        152
        +  hl("Float", { fg = theme.marker })

      
        
        153
        +  hl("Character", { fg = theme.muted })

      
        
        154
        +

      
        
        155
        +  hl("Function", { fg = theme.primary })

      
        
        156
        +  hl("Type", { fg = theme.primary })

      
        
        157
        +  hl("Structure", { fg = theme.primary })

      
        
        158
        +  hl("Typedef", { fg = theme.primary })

      
        
        159
        +  hl("Tag", { fg = theme.primary })

      
        
        160
        +  hl("Define", { fg = theme.primary })

      
        
        161
        +  hl("Macro", { fg = theme.primary })

      
        
        162
        +

      
        
        163
        +  hl("QuickFixLine", { bg = theme.bg_alt, bold = true })

      
        
        164
        +  hl("qfFileName", { fg = theme.primary })

      
        
        165
        +  hl("qfLineNr", { fg = theme.fg_gutter })

      
        
        166
        +

      
        
        167
        +  hl("DiffAdd", { bg = theme.positive_bg, fg = theme.secondary })

      
        
        168
        +  hl("DiffChange", { bg = theme.highlight_bg, fg = theme.primary })

      
        
        169
        +  hl("DiffDelete", { bg = theme.danger_bg, fg = theme.danger })

      
        
        170
        +  hl("DiffText", { bg = theme.bg_alt, fg = theme.primary, bold = true })

      
        
        171
        +  hl("diffAdded", { fg = theme.secondary })

      
        
        172
        +  hl("diffChanged", { fg = theme.primary })

      
        
        173
        +  hl("diffRemoved", { fg = theme.danger })

      
        
        174
        +

      
        
        175
        +  hl("DiagnosticSignError", { fg = theme.danger })

      
        
        176
        +  hl("DiagnosticSignWarn", { fg = theme.marker })

      
        
        177
        +  hl("DiagnosticSignInfo", { fg = theme.primary })

      
        
        178
        +  hl("DiagnosticSignHint", { fg = theme.muted })

      
        
        179
        +  hl("DiagnosticError", { link = "DiagnosticSignError" })

      
        
        180
        +  hl("DiagnosticWarn", { link = "DiagnosticSignWarn" })

      
        
        181
        +  hl("DiagnosticInfo", { link = "DiagnosticSignInfo" })

      
        
        182
        +  hl("DiagnosticHint", { link = "DiagnosticSignHint" })

      
        
        183
        +

      
        
        184
        +  -- treesitter

      
        
        185
        +  hl("@module", { fg = theme.fg })

      
        
        186
        +  hl("@module.builtin", { link = "@module" })

      
        
        187
        +  hl("@variable", { fg = theme.fg })

      
        
        188
        +  hl("@field", { link = "@variable" })

      
        
        189
        +  hl("@property", { link = "@variable" })

      
        
        190
        +  hl("@constant.builtin", { fg = theme.marker })

      
        
        191
        +  hl("@keyword.return", { fg = theme.muted, italic = true })

      
        
        192
        +  hl("@constructor", { link = "Function" })

      
        
        193
        +  hl("@constructor.lua", { link = "@punctuation.bracket" })

      
        
        194
        +  hl("@function.builtin", { link = "Function" })

      
        
        195
        +  hl("@type.builtin", { link = "Type" })

      
        
        196
        +  hl("@markup.italic", { italic = true })

      
        
        197
        +

      
        
        198
        +  hl("@punctuation.delimiter", { fg = theme.fg })

      
        
        199
        +  hl("@punctuation.bracket", { fg = theme.fg_dim })

      
        
        200
        +  hl("@punctuation.special", { fg = theme.fg_dim })

      
        
        201
        +

      
        
        202
        +  -- plugins

      
        
        203
        +  hl("SnacksPickerDir", { fg = theme.fg_gutter })

      
        
        204
        +  hl("SnacksPickerPathHidden", { fg = theme.fg_gutter })

      
        
        205
        +  hl("SnacksPickerPathIgnored", { fg = theme.fg_gutter })

      
        
        206
        +end

      
A config/nvim/lua/ruler.lua
···
        
        1
        +---@param itms table<string>

      
        
        2
        +local function join(itms)

      
        
        3
        +  return vim.iter(itms)

      
        
        4
        +    :filter(function(e) return e ~= "" end)

      
        
        5
        +    :join " "

      
        
        6
        +end

      
        
        7
        +

      
        
        8
        +local function diagnostics()

      
        
        9
        +  local counts = vim.diagnostic.count(vim.api.nvim_get_current_buf())

      
        
        10
        +  local errors = counts[vim.diagnostic.severity.ERROR] or 0

      
        
        11
        +  local warns = counts[vim.diagnostic.severity.WARN] or 0

      
        
        12
        +  local infos = counts[vim.diagnostic.severity.INFO] or 0

      
        
        13
        +  local hints = counts[vim.diagnostic.severity.HINT] or 0

      
        
        14
        +  return join {

      
        
        15
        +    errors > 0 and ("%#DiagnosticError#󰅚 " .. errors .. "%*") or "",

      
        
        16
        +    warns > 0 and ("%#DiagnosticWarn#󰀪 " .. warns .. "%*") or "",

      
        
        17
        +    infos > 0 and ("%#DiagnosticInfo#󰋽 " .. infos .. "%*") or "",

      
        
        18
        +    hints > 0 and ("%#DiagnosticHint#󰌶 " .. hints .. "%*") or "",

      
        
        19
        +  }

      
        
        20
        +end

      
        
        21
        +

      
        
        22
        +local function git_diff()

      
        
        23
        +  local diff = vim.b.gitsigns_status_dict

      
        
        24
        +  if diff == nil then return "" end

      
        
        25
        +  return join {

      
        
        26
        +    (diff.added ~= nil and diff.added > 0) and ("%#GitSignsAdd#+" .. diff.added .. "%*") or "",

      
        
        27
        +    (diff.changed ~= nil and diff.changed > 0) and ("%#GitSignsChange#~" .. diff.changed .. "%*") or "",

      
        
        28
        +    (diff.removed ~= nil and diff.removed > 0) and ("%#GitSignsDelete#-" .. diff.removed .. "%*") or "",

      
        
        29
        +  }

      
        
        30
        +end

      
        
        31
        +

      
        
        32
        +return function()

      
        
        33
        +  return join { git_diff(), diagnostics(), "%m", "%#TabLineSel# %l:%c %*" }

      
        
        34
        +end

      
A config/nvim/lua/terminal.lua
···
        
        1
        +local M = {}

      
        
        2
        +

      
        
        3
        +function M.attach(opts)

      
        
        4
        +  opts = opts or {}

      
        
        5
        +  local prev_buf = vim.api.nvim_get_current_buf()

      
        
        6
        +  vim.cmd.terminal(opts.program)

      
        
        7
        +  local term_buf = vim.api.nvim_get_current_buf()

      
        
        8
        +  if opts.command ~= nil then

      
        
        9
        +    vim.api.nvim_chan_send(vim.bo.channel, opts.command)

      
        
        10
        +    vim.api.nvim_chan_send(vim.bo.channel, '\n')

      
        
        11
        +  end

      
        
        12
        +  if opts.hide == true then

      
        
        13
        +    vim.api.nvim_set_current_buf(prev_buf)

      
        
        14
        +  end

      
        
        15
        +  return term_buf

      
        
        16
        +end

      
        
        17
        +

      
        
        18
        +return M

      
A config/nvim/nvim-pack-lock.json
···
        
        1
        +{

      
        
        2
        +  "plugins": {

      
        
        3
        +    "blink.cmp": {

      
        
        4
        +      "rev": "451168851e8e2466bc97ee3e026c3dcb9141ce07",

      
        
        5
        +      "src": "https://github.com/saghen/blink.cmp",

      
        
        6
        +      "version": "1.0.0 - 2.0.0"

      
        
        7
        +    },

      
        
        8
        +    "fidget.nvim": {

      
        
        9
        +      "rev": "e1a07a5e46fb65a45a0c76870140bd2d16a73ebf",

      
        
        10
        +      "src": "https://github.com/j-hui/fidget.nvim",

      
        
        11
        +      "version": ">=0.0.0"

      
        
        12
        +    },

      
        
        13
        +    "gitsigns.nvim": {

      
        
        14
        +      "rev": "944ef13cc8d8fe8b846c91f36041c8dfb85ca000",

      
        
        15
        +      "src": "https://github.com/lewis6991/gitsigns.nvim",

      
        
        16
        +      "version": ">=0.0.0"

      
        
        17
        +    },

      
        
        18
        +    "mini.nvim": {

      
        
        19
        +      "rev": "1345d191bb3da9c7b0e977f4387c5761f9bff68d",

      
        
        20
        +      "src": "https://github.com/echasnovski/mini.nvim",

      
        
        21
        +      "version": ">=0.0.0"

      
        
        22
        +    },

      
        
        23
        +    "nvim-treesitter": {

      
        
        24
        +      "rev": "074aa4422bf029908338e855d0c0f71470a971bb",

      
        
        25
        +      "src": "https://github.com/nvim-treesitter/nvim-treesitter",

      
        
        26
        +      "version": "'main'"

      
        
        27
        +    },

      
        
        28
        +    "nvim-treesitter-context": {

      
        
        29
        +      "rev": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636",

      
        
        30
        +      "src": "https://github.com/nvim-treesitter/nvim-treesitter-context",

      
        
        31
        +      "version": ">=0.0.0"

      
        
        32
        +    },

      
        
        33
        +    "snacks.nvim": {

      
        
        34
        +      "rev": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e",

      
        
        35
        +      "src": "https://github.com/folke/snacks.nvim",

      
        
        36
        +      "version": ">=0.0.0"

      
        
        37
        +    },

      
        
        38
        +    "vim-repeat": {

      
        
        39
        +      "rev": "65846025c15494983dafe5e3b46c8f88ab2e9635",

      
        
        40
        +      "src": "https://github.com/tpope/vim-repeat",

      
        
        41
        +      "version": "'master'"

      
        
        42
        +    },

      
        
        43
        +    "vim-speeddating": {

      
        
        44
        +      "rev": "c17eb01ebf5aaf766c53bab1f6592710e5ffb796",

      
        
        45
        +      "src": "https://github.com/tpope/vim-speeddating",

      
        
        46
        +      "version": "'master'"

      
        
        47
        +    },

      
        
        48
        +    "vim-surround": {

      
        
        49
        +      "rev": "3d188ed2113431cf8dac77be61b842acb64433d9",

      
        
        50
        +      "src": "https://github.com/tpope/vim-surround",

      
        
        51
        +      "version": "'master'"

      
        
        52
        +    },

      
        
        53
        +    "vim-wakatime": {

      
        
        54
        +      "rev": "cb7ba055330245b3a9d29f8bb4b82aeb2d52e580",

      
        
        55
        +      "src": "https://github.com/wakatime/vim-wakatime",

      
        
        56
        +      "version": ">=0.0.0"

      
        
        57
        +    }

      
        
        58
        +  }

      
        
        59
        +}

      
A config/nvim/plugin/gitsigns.lua
···
        
        1
        +Config.add "lewis6991/gitsigns.nvim"

      
        
        2
        +

      
        
        3
        +local function wrap(fn)

      
        
        4
        +  return function() return require("gitsigns")[fn]() end

      
        
        5
        +end

      
        
        6
        +

      
        
        7
        +Config.map("n", "]g", wrap "next_hunk")

      
        
        8
        +Config.map("n", "[g", wrap "prev_hunk")

      
        
        9
        +Config.map("n", "<leader>gs", wrap "stage_hunk")

      
        
        10
        +Config.map("n", "<leader>gS", wrap "undo_stage_hunk")

      
        
        11
        +Config.map("n", "<leader>gr", wrap "reset_hunk")

      
        
        12
        +Config.map("n", "<leader>gb", wrap "blame")

      
        
        13
        +

      
        
        14
        +Config.later(function()

      
        
        15
        +  require("gitsigns").setup {

      
        
        16
        +    signs = {

      
        
        17
        +      add = { text = "" },

      
        
        18
        +      change = { text = "" },

      
        
        19
        +      delete = { text = "" },

      
        
        20
        +      topdelete = { text = "" },

      
        
        21
        +      changedelete = { text = "" },

      
        
        22
        +      untracked = { text = "" },

      
        
        23
        +    },

      
        
        24
        +    current_line_blame = true,

      
        
        25
        +    current_line_blame_opts = {

      
        
        26
        +      virt_text_pos = "eol",

      
        
        27
        +      delay = 300,

      
        
        28
        +    },

      
        
        29
        +  }

      
        
        30
        +end)

      
A config/nvim/plugin/mini.lua
···
        
        1
        +Config.add "echasnovski/mini.nvim"

      
        
        2
        +

      
        
        3
        +Config.map("n", "<leader>c", function() MiniBufremove.delete() end)

      
        
        4
        +Config.map("n", "<leader>e", function()

      
        
        5
        +  local path = vim.api.nvim_buf_get_name(0)

      
        
        6
        +  if path == nil or vim.startswith(path, "term://") or vim.fn.filereadable(path) == 0 then path = vim.uv.cwd() or "" end

      
        
        7
        +  MiniFiles.open(path, true)

      
        
        8
        +  MiniFiles.reveal_cwd()

      
        
        9
        +end)

      
        
        10
        +

      
        
        11
        +require("mini.icons").setup {}

      
        
        12
        +Config.later(function()

      
        
        13
        +  require("mini.ai").setup {}

      
        
        14
        +  require("mini.bufremove").setup { silent = true }

      
        
        15
        +  require("mini.comment").setup {}

      
        
        16
        +  require("mini.pairs").setup {}

      
        
        17
        +  require("mini.splitjoin").setup {}

      
        
        18
        +

      
        
        19
        +  local hi_words = require("mini.extra").gen_highlighter.words

      
        
        20
        +  require("mini.hipatterns").setup {

      
        
        21
        +    highlighters = {

      
        
        22
        +      hex_color = require("mini.hipatterns").gen_highlighter.hex_color(),

      
        
        23
        +      fixme = hi_words({ "FIXME" }, "MiniHipatternsFixme"),

      
        
        24
        +      todo = hi_words({ "TODO", "Todo" }, "MiniHipatternsTodo"),

      
        
        25
        +      note = hi_words({ "NOTE" }, "MiniHipatternsNote"),

      
        
        26
        +      hack = hi_words({ "HACK" }, "MiniHipatternsHack"),

      
        
        27
        +    },

      
        
        28
        +  }

      
        
        29
        +end)

      
        
        30
        +

      
        
        31
        +Config.aucmd("User", "MiniFilesBufferCreate", function(ev)

      
        
        32
        +  vim.schedule(function()

      
        
        33
        +    vim.api.nvim_set_option_value("buftype", "acwrite", { buf = 0 })

      
        
        34
        +    vim.api.nvim_create_autocmd("BufWriteCmd", {

      
        
        35
        +      callback = function() require("mini.files").synchronize() end,

      
        
        36
        +      buffer = ev.data.buf_id,

      
        
        37
        +    })

      
        
        38
        +  end)

      
        
        39
        +end)

      
        
        40
        +

      
        
        41
        +require("mini.files").setup {

      
        
        42
        +  content = {

      
        
        43
        +    filter = function(f)

      
        
        44
        +      return ({

      
        
        45
        +        [".bin"] = {},

      
        
        46
        +        [".docker"] = {},

      
        
        47
        +        [".git"] = {},

      
        
        48
        +        [".jj"] = {},

      
        
        49
        +        [".tests"] = {},

      
        
        50
        +        ["build"] = {},

      
        
        51
        +        ["dist"] = {},

      
        
        52
        +        ["elm-stuff"] = {},

      
        
        53
        +        ["node_modules"] = {},

      
        
        54
        +        ["target"] = {},

      
        
        55
        +      })[f.name] == nil

      
        
        56
        +    end,

      
        
        57
        +  },

      
        
        58
        +  mappings = {

      
        
        59
        +    synchronize = "<cr>",

      
        
        60
        +    go_in = "",

      
        
        61
        +    go_in_plus = "l",

      
        
        62
        +  },

      
        
        63
        +}

      
A config/nvim/plugin/snacks.lua
···
        
        1
        +Config.add "folke/snacks.nvim"

      
        
        2
        +

      
        
        3
        +local function wrap(mod, fn, opts)

      
        
        4
        +  return function() return Snacks[mod][fn](opts or {}) end

      
        
        5
        +end

      
        
        6
        +

      
        
        7
        +Config.map("n", "<leader>b", wrap("picker", "buffers"))

      
        
        8
        +Config.map("n", "<leader>d", wrap("picker", "diagnostics"))

      
        
        9
        +Config.map("n", "<leader>f", wrap("picker", "smart"))

      
        
        10
        +Config.map("n", "<leader>sg", wrap("picker", "grep", { args = { "-i" } }))

      
        
        11
        +Config.map("n", "<leader>sh", wrap("picker", "help"))

      
        
        12
        +Config.map("n", "<leader>sr", wrap("picker", "recent"))

      
        
        13
        +Config.map("n", "<leader>ss", wrap("picker", "resume"))

      
        
        14
        +Config.map("n", "<leader>st", wrap("picker", "tags"))

      
        
        15
        +

      
        
        16
        +require("snacks").setup {

      
        
        17
        +  picker = {

      
        
        18
        +    enabled = true,

      
        
        19
        +    main = { current = true },

      
        
        20
        +    layout = {

      
        
        21
        +      preset = "ivy",

      
        
        22
        +      layout = { height = 25 },

      
        
        23
        +    },

      
        
        24
        +    win = { input = { keys = {

      
        
        25
        +      ["<Esc>"] = { "close", mode = { "n", "i" } },

      
        
        26
        +    } } },

      
        
        27
        +    sources = {

      
        
        28
        +      select = { layout = { preset = "ivy" } },

      
        
        29
        +      spelling = { layout = { preset = "ivy" } },

      
        
        30
        +      smart = { multi = { "buffers", "files" } },

      
        
        31
        +    },

      
        
        32
        +  },

      
        
        33
        +}

      
A config/nvim/snippets/go.json
···
        
        1
        +{

      
        
        2
        +  "for i statement": {

      
        
        3
        +    "prefix": "fori",

      
        
        4
        +    "body": "for ${1:i} := ${2:0}; $1 < ${3:count}; $1${4:++} {\n\t$0\n}",

      
        
        5
        +    "description": "Snippet for a for loop"

      
        
        6
        +  },

      
        
        7
        +  "http.ResponseWriter *http.Request": {

      
        
        8
        +    "prefix": "wr",

      
        
        9
        +    "body": "w http.ResponseWriter, r *http.Request",

      
        
        10
        +    "description": "Snippet for http Response"

      
        
        11
        +  },

      
        
        12
        +  "switch statement": {

      
        
        13
        +    "prefix": "switch",

      
        
        14
        +    "body": "switch ${1:expression} {\ncase ${2:condition}:\n\t$0\n}",

      
        
        15
        +    "description": "Snippet for switch statement"

      
        
        16
        +  },

      
        
        17
        +  "select statement": {

      
        
        18
        +    "prefix": ["sel", "select"],

      
        
        19
        +    "body": "select {\ncase ${1:condition}:\n\t$0\ndefault:}",

      
        
        20
        +    "description": "Snippet for select statement"

      
        
        21
        +  }

      
        
        22
        +}

      
A config/nvim/snippets/ledger.json
···
        
        1
        +{

      
        
        2
        +  "Expense transaction": {

      
        
        3
        +    "prefix": "exp",

      
        
        4
        +    "body": [

      
        
        5
        +      "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} * ${1:unknown payee}",

      
        
        6
        +      "  expenses:${2:misc}  ${3:0}.00 UAH",

      
        
        7
        +      "  assets:bank",

      
        
        8
        +      ""

      
        
        9
        +    ]

      
        
        10
        +  },

      
        
        11
        +  "Income transaction": {

      
        
        12
        +    "prefix": "inc",

      
        
        13
        +    "body": [

      
        
        14
        +      "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} * ${1:unknown payee}",

      
        
        15
        +      "  assets:bank  ${2:0}.00 UAH",

      
        
        16
        +      "  income:${3:job}",

      
        
        17
        +      ""

      
        
        18
        +    ]

      
        
        19
        +  },

      
        
        20
        +  "receivable": {

      
        
        21
        +    "prefix": "rec",

      
        
        22
        +    "body": [

      
        
        23
        +      "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} * lend",

      
        
        24
        +      "  assets:receivable:${somebody}  ${1:0}.00 UAH",

      
        
        25
        +      "  assets:${2:bank}",

      
        
        26
        +      ""

      
        
        27
        +    ]

      
        
        28
        +  },

      
        
        29
        +  "reconsile": {

      
        
        30
        +    "prefix": "reconsile",

      
        
        31
        +    "body": [

      
        
        32
        +      "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} * reconcile",

      
        
        33
        +      "  assets:bank  = ${1:0}.00 UAH",

      
        
        34
        +      "  assets:cash  = ${2:0}.00 UAH",

      
        
        35
        +      "  assets:${3:cash}  = ",

      
        
        36
        +      ""

      
        
        37
        +    ]

      
        
        38
        +  }

      
        
        39
        +}

      
A config/nvim/snippets/package.json
···
        
        1
        +{

      
        
        2
        +  "name": "snippets",

      
        
        3
        +  "contributes": {

      
        
        4
        +    "snippets": [

      
        
        5
        +      { "language": "go", "path": "./go.json" },

      
        
        6
        +      { "language": "ledger", "path": "./ledger.json" }

      
        
        7
        +    ]

      
        
        8
        +  }

      
        
        9
        +}