├── .gitmodules ├── after └── plugin │ └── mason.lua ├── ftdetect └── log.vim ├── init.lua ├── lua └── mason-plugin │ ├── cmdline.lua │ ├── init.lua │ ├── providers.lua │ └── serializer.lua ├── mason ├── aerial.nvim.lua ├── dressing.nvim.lua ├── gitsigns.nvim.lua ├── glance.nvim.lua ├── kanagawa.nvim.lua ├── leap.nvim.lua ├── oil.nvim.lua ├── readline.nvim.lua ├── rustaceanvim.lua ├── stylua.vim ├── telescope.nvim.lua ├── typescript-tools.nvim.lua ├── vim-fugitive.vim ├── vim-sleuth.vim ├── vim-surround.vim └── vim-unimpaired.vim ├── pack └── vendor │ └── opt │ └── mason.nvim.1.patch ├── packages ├── aerial.nvim │ └── package.yaml ├── dressing.nvim │ └── package.yaml ├── gitsigns.nvim │ └── package.yaml ├── glance.nvim │ └── package.yaml ├── kanagawa.nvim │ └── package.yaml ├── leap.nvim │ └── package.yaml ├── oil.nvim │ └── package.yaml ├── plenary.nvim │ └── package.yaml ├── readline.nvim │ └── package.yaml ├── ripgrep │ └── package.yaml ├── rustaceanvim │ └── package.yaml ├── telescope-fzf-native.nvim │ └── package.yaml ├── telescope.nvim │ └── package.yaml ├── typescript-tools.nvim │ └── package.yaml ├── vim-fugitive │ └── package.yaml ├── vim-sleuth │ └── package.yaml ├── vim-surround │ └── package.yaml └── vim-unimpaired │ └── package.yaml ├── plugin ├── colors.vim ├── diagnostics.lua ├── keymaps.vim ├── lsp │ ├── config.lua │ └── keymaps.lua ├── opt.vim └── terminal.lua ├── renovate.json └── syntax └── log.vim /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "pack/vendor/start/mason.nvim"] 2 | path = pack/vendor/start/mason.nvim 3 | url = https://github.com/williamboman/mason.nvim 4 | 5 | [submodule "pack/vendor/start/mason-lspconfig.nvim"] 6 | path = pack/vendor/start/mason-lspconfig.nvim 7 | url = https://github.com/williamboman/mason-lspconfig.nvim 8 | 9 | [submodule "pack/vendor/start/nvim-lspconfig"] 10 | path = pack/vendor/start/nvim-lspconfig 11 | url = https://github.com/neovim/nvim-lspconfig 12 | -------------------------------------------------------------------------------- /after/plugin/mason.lua: -------------------------------------------------------------------------------- 1 | local _ = require("mason-core.functional") 2 | vim.opt.packpath:prepend(vim.fn.expand("$MASON/opt")) 3 | 4 | local registry = require("mason-registry") 5 | 6 | local function ends_with(str, ending) 7 | return ending == "" or string.sub(str, - #ending) == ending 8 | end 9 | 10 | local function runtime(prefix, pkg) 11 | xpcall(function() 12 | if ends_with(pkg, ".lua") then 13 | vim.cmd.runtime { prefix .. pkg, bang = true } 14 | end 15 | if ends_with(pkg, ".vim") then 16 | vim.cmd.runtime { prefix .. pkg, bang = true } 17 | end 18 | vim.cmd.runtime { prefix .. pkg .. ".lua", bang = true } 19 | vim.cmd.runtime { prefix .. pkg .. ".vim", bang = true } 20 | end, vim.api.nvim_err_writeln) 21 | end 22 | 23 | local executed_runtimes = {} 24 | 25 | local function runtime_once(prefix, pkg) 26 | if executed_runtimes[pkg] then 27 | vim.notify_once(pkg .. " has already been sourced, restart Neovim.") 28 | return 29 | end 30 | executed_runtimes[pkg] = true 31 | return runtime(prefix, pkg) 32 | end 33 | 34 | local function lspconfig(pkg) 35 | do return end 36 | local lspconfig_path = vim.fn.expand(("$MASON/share/mason/lspconfig/%s.json"):format(pkg)) 37 | if vim.uv.fs_access(lspconfig_path, "r") then 38 | local fd = assert(vim.uv.fs_open(lspconfig_path, "r", 438)) 39 | local stat = assert(vim.uv.fs_fstat(fd)) 40 | local data = assert(vim.uv.fs_read(fd, stat.size, 0)) 41 | assert(vim.uv.fs_close(fd)) 42 | vim.lsp.config(pkg, vim.json.decode(data)) 43 | vim.lsp.enable(pkg) 44 | end 45 | end 46 | 47 | local function init(pkg_name) 48 | runtime_once("mason/", pkg_name) 49 | lspconfig(pkg_name) 50 | end 51 | 52 | _.each(init, registry.get_installed_package_names()) 53 | 54 | registry:on("package:install:success", vim.schedule_wrap(_.compose(init, _.prop "name"))) 55 | 56 | local function to_ms(pair) 57 | return pair[1] * 1000 + pair[2] / 1000 58 | end 59 | -------------------------------------------------------------------------------- /ftdetect/log.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.log set filetype=log 2 | au BufNewFile,BufRead *_log set filetype=log 3 | au BufNewFile,BufRead *.LOG set filetype=log 4 | au BufNewFile,BufRead *_LOG set filetype=log 5 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | function lazy_require(module) 2 | return setmetatable({}, { 3 | __index = function(self, key) 4 | self[key] = require(module)[key] 5 | return self[key] 6 | end, 7 | }) 8 | end 9 | 10 | function defer(jit_fn) 11 | local has_executed_jit_fn = false 12 | return { 13 | keymap = function(...) 14 | local callback = select(3, ...) 15 | return vim.keymap.set(select(1, ...), select(2, ...), has_executed_jit_fn and callback or function(...) 16 | jit_fn() 17 | has_executed_jit_fn = true 18 | return callback(...) 19 | end, select(4, ...)) 20 | end, 21 | require = function(module) 22 | if has_executed_jit_fn then 23 | return require(module) 24 | end 25 | return setmetatable({}, { 26 | __index = function(self, key) 27 | return function(...) 28 | if not has_executed_jit_fn then 29 | jit_fn() 30 | has_executed_jit_fn = true 31 | end 32 | self[key] = require(module)[key] 33 | return self[key](...) 34 | end 35 | end 36 | }) 37 | end 38 | } 39 | end 40 | 41 | require("mason").setup({ 42 | log_level = vim.log.levels.DEBUG, 43 | -- install_root_dir = "/var/folders/g_/krmqfsqd471dm6rkg1015yz40000gn/T/tmp.OmuQ5zxbXX", 44 | registries = { 45 | ("file:%s"):format(vim.fn.stdpath("config")), 46 | -- "github:mason-org/mason-registry", 47 | -- "github:nvim-java/mason-registry", 48 | "file:~/dev/mason-registry", 49 | }, 50 | ui = { 51 | -- check_outdated_packages_on_open = false, 52 | } 53 | }) 54 | 55 | require("mason-lspconfig").setup { 56 | ensure_installed = { "lua_ls" } 57 | } 58 | 59 | -- local registry = require("mason-registry") 60 | -- registry.sources:prepend(("file:%s"):format(vim.fn.stdpath("config"))) 61 | 62 | require("mason-plugin") { 63 | ["stevearc/dressing.nvim"] = "github-refs", 64 | ["lewis6991/gitsigns.nvim"] = "github-refs", 65 | ["DNLHC/glance.nvim"] = "github-refs", 66 | ["rebelot/kanagawa.nvim"] = "github-refs", 67 | ["stevearc/oil.nvim"] = "github-tags", 68 | ["nvim-lua/plenary.nvim"] = "github-refs", 69 | ["nvim-telescope/telescope.nvim"] = "github-refs", 70 | ["pmizio/typescript-tools.nvim"] = "github-refs", 71 | ["tpope/vim-fugitive"] = "github-refs", 72 | ["tpope/vim-sleuth"] = "github-refs", 73 | ["tpope/vim-surround"] = "github-refs", 74 | ["tpope/vim-unimpaired"] = "github-refs", 75 | ["ggandor/leap.nvim"] = "github-refs" 76 | } 77 | -------------------------------------------------------------------------------- /lua/mason-plugin/cmdline.lua: -------------------------------------------------------------------------------- 1 | local _ = require "mason-core.functional" 2 | 3 | local M = {} 4 | 5 | local parse_opts = _.compose( 6 | _.from_pairs, 7 | _.map(_.compose(function(arg) 8 | if #arg == 2 then 9 | return arg 10 | else 11 | return { arg[1], true } 12 | end 13 | end, _.split "=", _.gsub("^%-%-", ""))) 14 | ) 15 | 16 | ---@param args string[] 17 | ---@return table opts, string[] args 18 | function M.parse_args(args) 19 | local opts_list, args = unpack(_.partition(_.starts_with "--", args)) 20 | local opts = parse_opts(opts_list) 21 | return opts, args 22 | end 23 | 24 | return M 25 | -------------------------------------------------------------------------------- /lua/mason-plugin/init.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_user_command("MasonGenerate", function(args) 2 | local a = require("mason-core.async") 3 | local cmdline = require("mason-plugin.cmdline") 4 | local providers = require("mason-plugin.providers") 5 | 6 | local opts, plugins = cmdline.parse_args(args.fargs) 7 | local provider = providers[opts.datasource] 8 | 9 | if provider == nil then 10 | vim.cmd.echoerr([["--datasource needs to be one of: ]] .. table.concat(vim.tbl_keys(providers), ", ") .. '"') 11 | return 12 | end 13 | 14 | a.run_blocking(function() 15 | for _, plugin in ipairs(plugins) do 16 | provider(plugin):on_failure(vim.schedule_wrap(function(err) 17 | vim.api.nvim_err_writeln(tostring(err)) 18 | end)) 19 | end 20 | end) 21 | end, { 22 | nargs = "+", 23 | ---@param arg_lead string 24 | complete = function(arg_lead) 25 | local _ = require("mason-core.functional") 26 | if _.starts_with("--", arg_lead) then 27 | return _.filter(_.starts_with(arg_lead), { 28 | "--datasource=github-refs", 29 | "--datasource=github-tags", 30 | }) 31 | end 32 | end, 33 | }) 34 | 35 | return function(spec) 36 | vim.api.nvim_create_user_command("MasonInstallPlugins", function(args) 37 | local _ = require "mason-core.functional" 38 | for plugin, datasource in pairs(spec) do 39 | vim.cmd(([[MasonGenerate --datasource=%s %s]]):format(datasource, plugin)) 40 | end 41 | local plugins = _.compose( 42 | _.map(_.compose(_.head, _.match("/(.+)$"))), 43 | _.map(_.nth(1)), 44 | _.to_pairs 45 | )(spec) 46 | vim.cmd([[MasonInstall ]] .. _.join(" ", plugins)) 47 | end, { 48 | nargs = 0, 49 | }) 50 | end 51 | -------------------------------------------------------------------------------- /lua/mason-plugin/providers.lua: -------------------------------------------------------------------------------- 1 | local Result = require("mason-core.result") 2 | local _ = require "mason-core.functional" 3 | local fetch = require("mason-core.fetch") 4 | local registry_api = require("mason-registry.api") 5 | local serializer = require "mason-plugin.serializer" 6 | local spawn = require "mason-core.spawn" 7 | 8 | local PACKAGE_TEMPLATE = [=[ 9 | --- 10 | name: %{name} 11 | description: | 12 | %{description} 13 | homepage: %{homepage} 14 | languages: [] 15 | categories: [] 16 | licenses: 17 | - %{license} 18 | 19 | source: 20 | # renovate:datasource=%{datasource} 21 | id: pkg:github/%{namespace}/%{name}@%{version} 22 | archive: 23 | type: zipball 24 | 25 | opt: 26 | pack/mason/opt/%{name}/: "./" 27 | ]=] 28 | 29 | local function json_decode(str) 30 | return vim.json.decode(str, { 31 | luanil = { 32 | object = true, 33 | array = true, 34 | } 35 | }) 36 | end 37 | 38 | local gh = vim.fn.exepath"gh" 39 | 40 | return { 41 | ---@async 42 | ---@param plugin_name string 43 | ["github-refs"] = function(plugin_name) 44 | return Result.try(function(try) 45 | -- local repo = 46 | -- try(fetch(("https://api.github.com/repos/%s"):format(plugin_name)):map_catching(json_decode)) 47 | local repo = try(spawn[gh] { "api", ("repos/%s"):format(plugin_name) }:map(_.prop "stdout"):map_catching(json_decode)) 48 | local default_branch_url = repo.branches_url:gsub("{/branch}", "/" .. repo.default_branch) 49 | local default_branch = try(spawn[gh] {"api", default_branch_url }:map(_.prop "stdout"):map_catching(json_decode)) 50 | 51 | serializer.write(repo.name, PACKAGE_TEMPLATE) { 52 | namespace = repo.owner.login, 53 | name = repo.name, 54 | description = repo.description or plugin_name, 55 | homepage = repo.html_url, 56 | license = vim.tbl_get(repo, "license", "spdx_id") or "proprietary", 57 | version = default_branch.commit.sha, 58 | datasource = "github-refs", 59 | } 60 | end) 61 | end, 62 | ---@async 63 | ---@param plugin_name string 64 | ["github-tags"] = function(plugin_name) 65 | return Result.try(function(try) 66 | -- local repo = 67 | -- try(fetch(("https://api.github.com/repos/%s"):format(plugin_name)):map_catching(json_decode)) 68 | local repo = try(spawn[gh] { "api", ("repos/%s"):format(plugin_name) }:map(_.prop "stdout"):map_catching(json_decode)) 69 | local latest_tag = try(registry_api.github.tags.latest({ repo = plugin_name })) 70 | 71 | serializer.write(repo.name, PACKAGE_TEMPLATE) { 72 | namespace = repo.owner.login, 73 | name = repo.name, 74 | description = repo.description or plugin_name, 75 | homepage = repo.html_url, 76 | license = vim.tbl_get(repo, "license", "spdx_id") or "proprietary", 77 | version = latest_tag.tag, 78 | datasource = "github-tags", 79 | } 80 | end) 81 | end, 82 | } 83 | -------------------------------------------------------------------------------- /lua/mason-plugin/serializer.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | ---@param pkg_name string 4 | ---@param template string 5 | function M.write(pkg_name, template) 6 | ---@param ctx table 7 | return function(ctx) 8 | local fs = require("mason-core.fs") 9 | local contents = template:gsub("%%{([^}]+)}", ctx) 10 | 11 | local package_root = vim.fs.joinpath(vim.fn.stdpath("config"), "packages") 12 | local package_dir = vim.fs.joinpath(package_root, pkg_name) 13 | local package_file = vim.fs.joinpath(package_dir, "package.yaml") 14 | 15 | if not fs.sync.dir_exists(package_dir) then 16 | fs.sync.mkdirp(package_dir) 17 | elseif fs.sync.file_exists(package_file) then 18 | fs.sync.unlink(package_file) 19 | end 20 | 21 | fs.sync.write_file(package_file, contents) 22 | end 23 | end 24 | 25 | return M 26 | -------------------------------------------------------------------------------- /mason/aerial.nvim.lua: -------------------------------------------------------------------------------- 1 | vim.cmd.packadd("aerial.nvim") 2 | require("aerial").setup({ 3 | on_attach = function(bufnr) 4 | vim.keymap.set("n", "[s", "AerialPrev", { buffer = bufnr }) 5 | vim.keymap.set("n", "8s", "[s", { buffer = bufnr, remap = true }) 6 | vim.keymap.set("n", "]s", "AerialNext", { buffer = bufnr }) 7 | vim.keymap.set("n", "9s", "]s", { buffer = bufnr, remap = true }) 8 | end, 9 | }) 10 | vim.keymap.set("n", "s", "AerialToggle") 11 | -------------------------------------------------------------------------------- /mason/dressing.nvim.lua: -------------------------------------------------------------------------------- 1 | vim.cmd.packadd "dressing.nvim" 2 | 3 | require("dressing").setup { 4 | input = { enabled = false }, 5 | } 6 | -------------------------------------------------------------------------------- /mason/gitsigns.nvim.lua: -------------------------------------------------------------------------------- 1 | vim.cmd.packadd("gitsigns.nvim") 2 | local gitsigns = require("gitsigns") 3 | 4 | gitsigns.setup({ 5 | on_attach = function(bufnr) 6 | local function map(mode, l, r, opts) 7 | opts = opts or {} 8 | opts.buffer = bufnr 9 | vim.keymap.set(mode, l, r, opts) 10 | end 11 | 12 | map("n", "]c", function() 13 | if vim.wo.diff then 14 | vim.cmd.normal({ "]c", bang = true }) 15 | else 16 | gitsigns.nav_hunk("next") 17 | end 18 | end) 19 | map("n", "9c", "]c", { remap = true }) 20 | 21 | map("n", "[c", function() 22 | if vim.wo.diff then 23 | vim.cmd.normal({ "[c", bang = true }) 24 | else 25 | gitsigns.nav_hunk("prev") 26 | end 27 | end) 28 | map("n", "8c", "[c", { remap = true }) 29 | 30 | map("n", "ga", gitsigns.stage_hunk) 31 | map("n", "gr", gitsigns.reset_hunk) 32 | 33 | map("v", "ga", function() 34 | gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) 35 | end) 36 | 37 | map("v", "gc", function() 38 | gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) 39 | end) 40 | 41 | map("n", "gA", gitsigns.stage_buffer) 42 | map("n", "gC", gitsigns.reset_buffer) 43 | 44 | map("n", "gQ", function() 45 | gitsigns.setqflist("all") 46 | end) 47 | map("n", "gq", gitsigns.setqflist) 48 | 49 | map("n", "gd", gitsigns.diffthis) 50 | map("n", "gp", gitsigns.preview_hunk_inline) 51 | 52 | -- Toggles 53 | map("n", "tb", gitsigns.toggle_current_line_blame) 54 | map("n", "td", gitsigns.toggle_deleted) 55 | map("n", "tw", gitsigns.toggle_word_diff) 56 | 57 | -- Text object 58 | map({ "o", "x" }, "ih", ":Gitsigns select_hunk") 59 | end, 60 | }) 61 | -------------------------------------------------------------------------------- /mason/glance.nvim.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd("LspAttach", { 2 | once = true, 3 | callback = function() 4 | vim.cmd.packadd "glance.nvim" 5 | local glance = require "glance" 6 | 7 | glance.setup { 8 | mappings = { 9 | list = { 10 | [""] = glance.actions.jump_tab, 11 | [""] = glance.actions.jump_vsplit, 12 | [""] = glance.actions.jump_split, 13 | [""] = glance.actions.quickfix, 14 | ["s"] = false, 15 | ["t"] = false, 16 | ["v"] = false, 17 | }, 18 | }, 19 | hooks = { 20 | -- Don’t open glance when there is only one result and it is located in the current buffer, open otherwise. 21 | before_open = function(results, open, jump) 22 | local uri = vim.uri_from_bufnr(0) 23 | if #results == 1 then 24 | local target_uri = results[1].uri or results[1].targetUri 25 | 26 | if target_uri == uri then 27 | jump(results[1]) 28 | else 29 | open(results) 30 | end 31 | else 32 | open(results) 33 | end 34 | end, 35 | }, 36 | } 37 | end, 38 | }) 39 | -------------------------------------------------------------------------------- /mason/kanagawa.nvim.lua: -------------------------------------------------------------------------------- 1 | vim.cmd.packadd "kanagawa.nvim" 2 | 3 | local function clamp(component) 4 | return math.min(math.max(component, 0), 255) 5 | end 6 | 7 | local function rgb_to_hex(r, g, b) 8 | return string.format("#%06x", clamp(r) * 0x10000 + clamp(g) * 0x100 + clamp(b)) 9 | end 10 | 11 | local function hex_to_rgb(hex) 12 | if string.find(hex, "^#") then 13 | hex = string.sub(hex, 2) 14 | end 15 | 16 | local base16 = tonumber(hex, 16) 17 | return math.floor(base16 / 0x10000), (math.floor(base16 / 0x100) % 0x100), (base16 % 0x100) 18 | end 19 | 20 | local function transform_color(hex, xforms) 21 | local r, g, b = hex_to_rgb(hex) 22 | 23 | for _, x in ipairs(xforms) do 24 | r, g, b = x(r, g, b) 25 | end 26 | 27 | return rgb_to_hex(r, g, b) 28 | end 29 | 30 | local function tint(amt) 31 | return function(r, g, b) 32 | return r + amt, g + amt, b + amt 33 | end 34 | end 35 | 36 | local function saturate(amt) 37 | return function(r, g, b) 38 | if amt ~= 1 then 39 | local rec601_luma = 0.299 * r + 0.587 * g + 0.114 * b 40 | 41 | r = math.floor(r * amt + rec601_luma * (1 - amt)) 42 | g = math.floor(g * amt + rec601_luma * (1 - amt)) 43 | b = math.floor(b * amt + rec601_luma * (1 - amt)) 44 | end 45 | 46 | return r, g, b 47 | end 48 | end 49 | 50 | require("kanagawa").setup { 51 | overrides = function(colors) 52 | local palette = colors.palette 53 | return { 54 | DiagnosticUnderlineError = { sp = transform_color("#2f2424", { saturate(3), tint(40) }) }, 55 | DiagnosticUnnecessary = {}, 56 | DiagnosticUnderlineHint = { sp = transform_color("#24282f", { saturate(3), tint(40) }) }, 57 | DiagnosticUnderlineInfo = { sp = transform_color("#242c2f", { saturate(3), tint(40) }) }, 58 | DiagnosticUnderlineWarn = { sp = transform_color("#2f2b24", { saturate(3), tint(40) }) }, 59 | FloatTitle = { fg = palette.sumiInk0, bg = palette.oniViolet, bold = true }, 60 | GlancePreviewMatch = { undercurl = true }, 61 | GlanceWinBarFilePath = { italic = true, bg = palette.waveBlue2, fg = palette.fujiWhite }, 62 | GlanceWinBarFilename = { bold = true, bg = palette.waveBlue2, fg = palette.fujiWhite }, 63 | GlanceWinBarTitle = { bold = true, bg = palette.waveBlue2, fg = palette.fujiWhite }, 64 | IndentBlanklineChar = { fg = palette.sumiInk2 }, 65 | IndentBlanklineContextStart = { bold = true, underline = false }, 66 | LspInlayHint = { fg = palette.fujiGray, bg = "#272737", italic = true }, 67 | LspInlayHintBorder = { fg = "#272737" }, 68 | MoreMsg = { bg = "none" }, 69 | TabLine = { fg = palette.katanaGray, bg = palette.sumiInk3 }, 70 | TabLineFill = { bg = palette.sumiInk1 }, 71 | TabLineSel = { fg = palette.oniViolet, bg = palette.sumiInk2, bold = true }, 72 | TelescopeBorder = { fg = palette.sumiInk0, bg = palette.sumiInk0 }, 73 | TelescopeMatching = { underline = true, fg = palette.springBlue, sp = palette.springBlue }, 74 | TelescopeNormal = { bg = palette.sumiInk0 }, 75 | TelescopePreviewTitle = { fg = palette.sumiInk0, bg = palette.springBlue }, 76 | TelescopePromptBorder = { fg = palette.sumiInk2, bg = palette.sumiInk2 }, 77 | TelescopePromptNormal = { fg = palette.fujiWhite, bg = palette.sumiInk2 }, 78 | TelescopePromptPrefix = { fg = palette.oniViolet, bg = palette.sumiInk2 }, 79 | TelescopePromptTitle = { fg = palette.sumiInk0, bg = palette.oniViolet }, 80 | TelescopeResultsTitle = { fg = palette.sumiInk0, bg = palette.sumiInk0 }, 81 | TelescopeTitle = { bold = true, fg = palette.oldWhite }, 82 | StatusLine = { bg = palette.sumiInk2 }, 83 | StatusLineTerm = { link = "StatusLine" }, 84 | StatusLineTermNC = { link = "StatusLineNC" }, 85 | WinBar = { link = "StatusLine" }, 86 | WinBarNC = { link = "StatusLineNC" }, 87 | TermNormal = { bg = palette.sumiInk0 } 88 | } 89 | end 90 | } 91 | 92 | vim.cmd.colorscheme "kanagawa" 93 | -------------------------------------------------------------------------------- /mason/leap.nvim.lua: -------------------------------------------------------------------------------- 1 | vim.cmd.packadd("leap.nvim") 2 | local leap = require("leap") 3 | 4 | leap.setup({ 5 | case_sensitive = true, 6 | }) 7 | leap.set_default_keymaps() 8 | -------------------------------------------------------------------------------- /mason/oil.nvim.lua: -------------------------------------------------------------------------------- 1 | local deferred = defer(function() 2 | vim.cmd.packadd("oil.nvim") 3 | require("oil").setup({ 4 | keymaps = { 5 | [""] = { 6 | "actions.select", 7 | opts = { horizontal = true }, 8 | desc = "Open the entry in a horizontal split", 9 | }, 10 | [""] = { "actions.select", opts = { vertical = true }, desc = "Open the entry in a vertical split" }, 11 | }, 12 | }) 13 | end) 14 | 15 | deferred.keymap("n", "a", vim.cmd.Oil) 16 | -------------------------------------------------------------------------------- /mason/readline.nvim.lua: -------------------------------------------------------------------------------- 1 | local autocommand 2 | autocommand = vim.api.nvim_create_autocmd({ "InsertEnter", "CmdlineEnter" }, { 3 | callback = function() 4 | vim.cmd.packadd "readline.nvim" 5 | local readline = require "readline" 6 | 7 | vim.keymap.set("!", "", readline.forward_word) 8 | vim.keymap.set("!", "", readline.backward_word) 9 | vim.keymap.set("!", "", readline.beginning_of_line) 10 | vim.keymap.set("!", "", readline.end_of_line) 11 | vim.keymap.set("!", "", readline.kill_word) 12 | vim.keymap.set("!", "", readline.backward_kill_word) 13 | vim.keymap.set("!", "", readline.kill_line) 14 | vim.keymap.set("!", "", readline.backward_kill_line) 15 | vim.keymap.set("!", "", function() 16 | if vim.fn.pumvisible() == 1 then 17 | return "" 18 | else 19 | return "-" 20 | end 21 | end, { expr = true }) 22 | vim.keymap.set("i", "", "u") 23 | 24 | vim.api.nvim_del_autocmd(autocommand) 25 | end 26 | }) 27 | -------------------------------------------------------------------------------- /mason/rustaceanvim.lua: -------------------------------------------------------------------------------- 1 | vim.cmd.packadd "rustaceanvim" 2 | -------------------------------------------------------------------------------- /mason/stylua.vim: -------------------------------------------------------------------------------- 1 | function! s:format() 2 | let save_pos = getcurpos() 3 | silent %!stylua - 4 | if v:shell_error 5 | echoerr "Stylua formatting failed: " . v:shell_error 6 | silent undo 7 | endif 8 | silent call setpos(".", save_pos) 9 | endfunction 10 | 11 | augroup StyluaFormat 12 | autocmd! 13 | autocmd FileType lua nnoremap p call format() 14 | augroup END 15 | -------------------------------------------------------------------------------- /mason/telescope.nvim.lua: -------------------------------------------------------------------------------- 1 | local deferred = defer(function() 2 | vim.cmd.packadd("plenary.nvim") 3 | vim.cmd.packadd("telescope.nvim") 4 | vim.cmd.packadd("telescope-fzf-native.nvim") 5 | 6 | local actions = require("telescope.actions") 7 | local layout_actions = require("telescope.actions.layout") 8 | 9 | require("telescope").setup({ 10 | defaults = { 11 | prompt_prefix = "  ", 12 | selection_caret = " ", 13 | selection_strategy = "reset", 14 | vimgrep_arguments = { 15 | "rg", 16 | "--color=never", 17 | "--no-heading", 18 | "--with-filename", 19 | "--line-number", 20 | "--column", 21 | "--smart-case", 22 | "--hidden", 23 | "--glob=!.git/", 24 | }, 25 | sorting_strategy = "descending", 26 | layout_strategy = "flex", 27 | layout_config = { 28 | flex = { 29 | flip_columns = 161, -- half 27" monitor, scientifically calculated 30 | }, 31 | horizontal = { 32 | preview_width = 0.4, 33 | }, 34 | vertical = { 35 | preview_cutoff = 43, -- height of 13" monitor, scentifically measured 36 | preview_height = 0.4, 37 | }, 38 | }, 39 | path_display = { truncate = 3 }, 40 | color_devicons = true, 41 | winblend = 5, 42 | set_env = { ["COLORTERM"] = "truecolor" }, 43 | border = {}, 44 | borderchars = { " ", " ", " ", " ", " ", " ", " ", " " }, 45 | mappings = { 46 | i = { 47 | [""] = function() 48 | vim.api.nvim_input("") 49 | end, 50 | [""] = actions.move_selection_next, 51 | [""] = actions.move_selection_previous, 52 | [""] = actions.cycle_history_prev, 53 | [""] = actions.cycle_history_next, 54 | [""] = layout_actions.toggle_preview, 55 | [""] = actions.smart_send_to_qflist + actions.open_qflist, 56 | [""] = actions.select_horizontal, 57 | [""] = actions.close, 58 | [""] = actions.toggle_selection + actions.move_selection_next, 59 | [""] = actions.toggle_selection + actions.move_selection_previous, 60 | }, 61 | }, 62 | }, 63 | extensions = { 64 | project = { 65 | hidden_files = false, 66 | }, 67 | fzf = { 68 | fuzzy = true, 69 | override_generic_sorter = true, 70 | override_file_sorter = true, 71 | case_mode = "smart_case", 72 | }, 73 | }, 74 | }) 75 | 76 | require("telescope").load_extension("fzf") 77 | end) 78 | 79 | local builtin = deferred.require("telescope.builtin") 80 | 81 | local function grep(opts) 82 | opts = opts or {} 83 | local search = vim.fn.input("Grep >") 84 | if search ~= "" then 85 | builtin.grep_string({ 86 | cwd = opts.cwd, 87 | only_sort_text = true, 88 | search = search, 89 | use_regex = true, 90 | disable_coordinates = true, 91 | layout_strategy = "vertical", 92 | layout_config = { 93 | prompt_position = "top", 94 | mirror = true, 95 | preview_cutoff = 0, 96 | preview_height = 0.2, 97 | }, 98 | }) 99 | else 100 | builtin.live_grep({ 101 | cwd = opts.cwd, 102 | layout_strategy = "vertical", 103 | layout_config = { 104 | prompt_position = "top", 105 | mirror = true, 106 | preview_cutoff = 0, 107 | preview_height = 0.2, 108 | }, 109 | }) 110 | end 111 | end 112 | 113 | deferred.keymap("n", "p", builtin.git_files) 114 | deferred.keymap("n", "r", builtin.resume) 115 | deferred.keymap("n", "f", builtin.find_files) 116 | deferred.keymap("n", ".f", function() 117 | builtin.find_files({ cwd = vim.fn.expand("%:p:h") }) 118 | end) 119 | deferred.keymap("n", "q", grep) 120 | deferred.keymap("n", "", grep) 121 | deferred.keymap("n", ".q", function() 122 | grep({ cwd = vim.fn.expand("%:p:h") }) 123 | end) 124 | deferred.keymap("n", "b", builtin.buffers) 125 | deferred.keymap("n", "h", builtin.oldfiles) 126 | deferred.keymap("n", "s", function() 127 | builtin.git_status({ 128 | layout_strategy = "flex", 129 | layout_config = { 130 | flex = { 131 | flip_columns = 161, -- half 27" monitor, scientifically calculated 132 | }, 133 | horizontal = { 134 | preview_cutoff = 0, 135 | preview_width = 0.6, 136 | }, 137 | vertical = { 138 | preview_cutoff = 0, 139 | preview_height = 0.65, 140 | }, 141 | }, 142 | }) 143 | end) 144 | -------------------------------------------------------------------------------- /mason/typescript-tools.nvim.lua: -------------------------------------------------------------------------------- 1 | vim.cmd.packadd "plenary.nvim" 2 | vim.cmd.packadd "typescript-tools.nvim" 3 | 4 | require("typescript-tools").setup { 5 | use_native_lsp_config = true, 6 | settings = { 7 | expose_as_code_action = "all" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /mason/vim-fugitive.vim: -------------------------------------------------------------------------------- 1 | packadd vim-fugitive 2 | -------------------------------------------------------------------------------- /mason/vim-sleuth.vim: -------------------------------------------------------------------------------- 1 | packadd vim-sleuth 2 | -------------------------------------------------------------------------------- /mason/vim-surround.vim: -------------------------------------------------------------------------------- 1 | packadd vim-surround 2 | -------------------------------------------------------------------------------- /mason/vim-unimpaired.vim: -------------------------------------------------------------------------------- 1 | packadd vim-unimpaired 2 | 3 | nmap 9 ] 4 | nmap 8 [ 5 | nmap 9a ]a 6 | nmap 8a [a 7 | nmap 9A ]A 8 | nmap 8A [A 9 | nmap 9q ]q 10 | nmap 8q [q 11 | nmap 9Q ]Q 12 | nmap 8Q [Q 13 | nmap 9n ]n 14 | nmap 8n [n 15 | xmap 9n ]n 16 | xmap 8n [n 17 | nmap 9f ]f 18 | nmap 8f [f 19 | 20 | nmap [e== 21 | nmap ]e== 22 | vmap [egv=gv 23 | vmap ]egv=gv 24 | -------------------------------------------------------------------------------- /pack/vendor/opt/mason.nvim.1.patch: -------------------------------------------------------------------------------- 1 | From 1dd4ea761398148906e1bf45d88923ed96fdbd8f Mon Sep 17 00:00:00 2001 2 | From: William Boman 3 | Date: Sun, 26 Jan 2025 07:00:51 +0100 4 | Subject: [PATCH] stuff 5 | 6 | --- 7 | lua/mason-core/fs.lua | 6 ++ 8 | lua/mason-core/installer/context.lua | 12 +++ 9 | lua/mason-core/installer/init.lua | 14 +++ 10 | .../registry/providers/github/archive.lua | 87 +++++++++++++++++++ 11 | .../registry/providers/github/init.lua | 14 ++- 12 | lua/mason-core/package/init.lua | 8 ++ 13 | lua/mason/ui/components/main/package_list.lua | 28 ++++++ 14 | lua/mason/ui/instance.lua | 14 +++ 15 | 8 files changed, 180 insertions(+), 3 deletions(-) 16 | create mode 100644 lua/mason-core/installer/registry/providers/github/archive.lua 17 | 18 | diff --git a/lua/mason-core/fs.lua b/lua/mason-core/fs.lua 19 | index 203c96d7..9da7f63e 100644 20 | --- a/lua/mason-core/fs.lua 21 | +++ b/lua/mason-core/fs.lua 22 | @@ -54,6 +54,12 @@ local function make_module(uv) 23 | end 24 | end 25 | 26 | + ---@param path string 27 | + function M.rmdir(path) 28 | + log.debug("fs: rmdir", path) 29 | + uv.fs_rmdir(path) 30 | + end 31 | + 32 | ---@param path string 33 | function M.unlink(path) 34 | log.debug("fs: unlink", path) 35 | diff --git a/lua/mason-core/installer/context.lua b/lua/mason-core/installer/context.lua 36 | index 7637209f..f3f4f6ec 100644 37 | --- a/lua/mason-core/installer/context.lua 38 | +++ b/lua/mason-core/installer/context.lua 39 | @@ -111,6 +111,18 @@ function ContextualFs:rename(old_path, new_path) 40 | return fs.async.rename(path.concat { self.cwd:get(), old_path }, path.concat { self.cwd:get(), new_path }) 41 | end 42 | 43 | +---@async 44 | +---@param dir_path? string 45 | +function ContextualFs:readdir(dir_path) 46 | + return fs.async.readdir(path.concat { self.cwd:get(), dir_path }) 47 | +end 48 | + 49 | +---@async 50 | +---@param dir_path string 51 | +function ContextualFs:rmdir(dir_path) 52 | + return fs.async.rmdir(path.concat { self.cwd:get(), dir_path }) 53 | +end 54 | + 55 | ---@async 56 | ---@param dir_path string 57 | function ContextualFs:mkdir(dir_path) 58 | diff --git a/lua/mason-core/installer/init.lua b/lua/mason-core/installer/init.lua 59 | index 994ab847..293fc27a 100644 60 | --- a/lua/mason-core/installer/init.lua 61 | +++ b/lua/mason-core/installer/init.lua 62 | @@ -204,6 +204,20 @@ function M.execute(handle, opts) 63 | -- 4. link package 64 | try(linker.link(context)) 65 | 66 | + -- 4.1 write lspconfig 67 | + local lspconfig = _.path({ "lsp", "config" }, context.package.spec) 68 | + if lspconfig then 69 | + a.scheduler() 70 | + local lspconfig_dir = vim.fn.expand "$MASON/share/mason/lspconfig" 71 | + local lspconfig_file = path.concat { lspconfig_dir, ("%s.json"):format(context.package.name) } 72 | + if not fs.async.dir_exists(lspconfig_dir) then 73 | + fs.async.mkdirp(lspconfig_dir) 74 | + elseif fs.async.file_exists(lspconfig_file) then 75 | + fs.async.unlink(lspconfig_file) 76 | + end 77 | + fs.async.write_file(lspconfig_file, vim.json.encode(lspconfig)) 78 | + end 79 | + 80 | -- 5. build & write receipt 81 | ---@type InstallReceipt 82 | local receipt = try(build_receipt(context)) 83 | diff --git a/lua/mason-core/installer/registry/providers/github/archive.lua b/lua/mason-core/installer/registry/providers/github/archive.lua 84 | new file mode 100644 85 | index 00000000..9dd5d9df 86 | --- /dev/null 87 | +++ b/lua/mason-core/installer/registry/providers/github/archive.lua 88 | @@ -0,0 +1,87 @@ 89 | +local Result = require "mason-core.result" 90 | +local _ = require "mason-core.functional" 91 | +local a = require "mason-core.async" 92 | +local common = require "mason-core.installer.managers.common" 93 | +local expr = require "mason-core.installer.registry.expr" 94 | +local path = require "mason-core.path" 95 | +local providers = require "mason-core.providers" 96 | +local settings = require "mason.settings" 97 | +local util = require "mason-core.installer.registry.util" 98 | + 99 | +---@class GitHubArchive 100 | +---@field type '"zipball"' | '"tarball"' 101 | + 102 | +---@class GitHubArchiveSource : RegistryPackageSource 103 | +---@field archive GitHubArchive 104 | + 105 | +local M = {} 106 | + 107 | +---@param source GitHubArchiveSource 108 | +---@param purl Purl 109 | +---@param opts PackageInstallOpts 110 | +function M.parse(source, purl, opts) 111 | + return Result.try(function(try) 112 | + local expr_ctx = { version = purl.version } 113 | + local archive = try(util.coalesce_by_target(try(expr.tbl_interpolate(source.archive, expr_ctx)), opts)) 114 | + 115 | + ---@class ParsedGitHubArchiveSource : ParsedPackageSource 116 | + local parsed_source = { 117 | + archive = archive, 118 | + ---@type DownloadItem[] 119 | + downloads = { 120 | + { 121 | + download_url = ("https://api.github.com/repos/%s/%s/%s/%s"):format( 122 | + purl.namespace, 123 | + purl.name, 124 | + source.archive.type, 125 | + purl.version 126 | + ), 127 | + out_file = source.archive.type == "zipball" and "plugin.zip" or "plugin.tar", 128 | + }, 129 | + }, 130 | + owner = purl.namespace, 131 | + repo = purl.name, 132 | + } 133 | + return parsed_source 134 | + end) 135 | +end 136 | + 137 | +---@async 138 | +---@param ctx InstallContext 139 | +---@param source ParsedGitHubArchiveSource 140 | +function M.install(ctx, source) 141 | + return Result.try(function(try) 142 | + try(common.download_files(ctx, source.downloads)) 143 | + 144 | + local archive_dir_pattern = ("%s-%s"):format(source.owner, source.repo) 145 | + 146 | + -- Hoist all files inside the unpacked archive directory to the current working directory 147 | + local archive_dir = _.compose( 148 | + _.find_first(_.all_pass { 149 | + _.compose( 150 | + _.starts_with(archive_dir_pattern), 151 | + _.to_lower, -- since we are using purl components we need to follow the spec which lowercases namespace and name 152 | + _.prop "name" 153 | + ), 154 | + _.prop_satisfies(_.equals "directory", "type"), 155 | + }) 156 | + )(ctx.fs:readdir()) 157 | + if archive_dir == nil then 158 | + return Result.failure( 159 | + ("Failed to locate unpacked archive directory. Looked for directory starting with: %s"):format(archive_dir_pattern) 160 | + ) 161 | + end 162 | + for _, entry in ipairs(ctx.fs:readdir(archive_dir.name)) do 163 | + ctx.fs:rename(path.concat { archive_dir.name, entry.name }, entry.name) 164 | + end 165 | + ctx.fs:rmdir(archive_dir.name) 166 | + end) 167 | +end 168 | + 169 | +---@async 170 | +---@param purl Purl 171 | +function M.get_versions(purl) 172 | + return providers.github.get_all_tags(("%s/%s"):format(purl.namespace, purl.name)) 173 | +end 174 | + 175 | +return M 176 | diff --git a/lua/mason-core/installer/registry/providers/github/init.lua b/lua/mason-core/installer/registry/providers/github/init.lua 177 | index 0d68f3a5..708accae 100644 178 | --- a/lua/mason-core/installer/registry/providers/github/init.lua 179 | +++ b/lua/mason-core/installer/registry/providers/github/init.lua 180 | @@ -2,7 +2,7 @@ local Result = require "mason-core.result" 181 | 182 | local M = {} 183 | 184 | ----@param source GitHubReleaseSource | GitHubBuildSource 185 | +---@param source GitHubReleaseSource | GitHubBuildSource | GitHubArchiveSource 186 | ---@param purl Purl 187 | ---@param opts PackageInstallOpts 188 | function M.parse(source, purl, opts) 189 | @@ -12,6 +12,9 @@ function M.parse(source, purl, opts) 190 | elseif source.build then 191 | source = source --[[@as GitHubBuildSource]] 192 | return require("mason-core.installer.registry.providers.github.build").parse(source, purl, opts) 193 | + elseif source.archive then 194 | + source = source --[[@as GitHubArchiveSource]] 195 | + return require("mason-core.installer.registry.providers.github.archive").parse(source, purl, opts) 196 | else 197 | return Result.failure "Unknown source type." 198 | end 199 | @@ -19,7 +22,7 @@ end 200 | 201 | ---@async 202 | ---@param ctx InstallContext 203 | ----@param source ParsedGitHubReleaseSource | ParsedGitHubBuildSource 204 | +---@param source ParsedGitHubReleaseSource | ParsedGitHubBuildSource | ParsedGitHubArchiveSource 205 | function M.install(ctx, source, purl) 206 | if source.asset then 207 | source = source--[[@as ParsedGitHubReleaseSource]] 208 | @@ -27,6 +30,9 @@ function M.install(ctx, source, purl) 209 | elseif source.build then 210 | source = source--[[@as ParsedGitHubBuildSource]] 211 | return require("mason-core.installer.registry.providers.github.build").install(ctx, source) 212 | + elseif source.archive then 213 | + source = source--[[@as ParsedGitHubArchiveSource]] 214 | + return require("mason-core.installer.registry.providers.github.archive").install(ctx, source) 215 | else 216 | return Result.failure "Unknown source type." 217 | end 218 | @@ -34,13 +40,15 @@ end 219 | 220 | ---@async 221 | ---@param purl Purl 222 | ----@param source GitHubReleaseSource | GitHubBuildSource 223 | +---@param source GitHubReleaseSource | GitHubBuildSource | GitHubArchiveSource 224 | function M.get_versions(purl, source) 225 | if source.asset then 226 | return require("mason-core.installer.registry.providers.github.release").get_versions(purl) 227 | elseif source.build then 228 | -- We can't yet reliably determine the true source (release, tag, commit, etc.) for "build" sources. 229 | return Result.failure "Unimplemented." 230 | + elseif source.archive then 231 | + return require("mason-core.installer.registry.providers.github.archive").get_versions(purl) 232 | else 233 | return Result.failure "Unknown source type." 234 | end 235 | diff --git a/lua/mason-core/package/init.lua b/lua/mason-core/package/init.lua 236 | index 57f4868d..4c8598a1 100644 237 | --- a/lua/mason-core/package/init.lua 238 | +++ b/lua/mason-core/package/init.lua 239 | @@ -310,6 +310,14 @@ function Package:get_lsp_settings_schema() 240 | return Optional.empty() 241 | end 242 | 243 | +function Package:get_default_lsp_config() 244 | + local config_file = path.share_prefix(path.concat { "mason", "lspconfig", ("%s.json"):format(self.name) }) 245 | + if fs.sync.file_exists(config_file) then 246 | + return Result.pcall(vim.json.decode, fs.sync.read_file(config_file)):ok() 247 | + end 248 | + return Optional.empty() 249 | +end 250 | + 251 | ---@return boolean 252 | function Package:is_registry_spec() 253 | return is_registry_spec(self.spec) 254 | diff --git a/lua/mason/ui/components/main/package_list.lua b/lua/mason/ui/components/main/package_list.lua 255 | index 455a8196..649fdb17 100644 256 | --- a/lua/mason/ui/components/main/package_list.lua 257 | +++ b/lua/mason/ui/components/main/package_list.lua 258 | @@ -114,6 +114,34 @@ local function ExpandedPackageInfo(state, pkg, is_installed) 259 | end), 260 | } 261 | end), 262 | + Ui.When(pkg_state.lspconfig ~= nil, function() 263 | + local has_expanded = pkg_state.is_lspconfig_expanded 264 | + return Ui.Node { 265 | + Ui.EmptyLine(), 266 | + Ui.HlTextNode { 267 | + { 268 | + p.Bold(("%s Default LSP client settings"):format(has_expanded and "↓" or "→")), 269 | + p.Comment((" (press enter to %s)"):format(has_expanded and "collapse" or "expand")), 270 | + }, 271 | + }, 272 | + Ui.Keybind( 273 | + settings.current.ui.keymaps.toggle_package_expand, 274 | + "TOGGLE_DEFAULT_LSP_CONFIG", 275 | + { package = pkg } 276 | + ), 277 | + Ui.When(has_expanded, function() 278 | + return Ui.CascadingStyleNode({ "INDENT" }, { 279 | + Ui.HlTextNode( 280 | + p.muted "This is a read-only overview of the default client settings." 281 | + ), 282 | + Ui.EmptyLine(), 283 | + Ui.HlTextNode( 284 | + p.none(vim.json.encode(pkg_state.lspconfig)) 285 | + ) 286 | + }) 287 | + end), 288 | + } 289 | + end), 290 | Ui.EmptyLine(), 291 | }) 292 | end 293 | diff --git a/lua/mason/ui/instance.lua b/lua/mason/ui/instance.lua 294 | index c8f7856b..00ab0c1e 100644 295 | --- a/lua/mason/ui/instance.lua 296 | +++ b/lua/mason/ui/instance.lua 297 | @@ -50,6 +50,8 @@ end 298 | ---@field latest_spawn string? 299 | ---@field linked_executables table? 300 | ---@field lsp_settings_schema table? 301 | +---@field lspconfig table? 302 | +---@field is_lspconfig_expanded boolean 303 | ---@field new_version NewPackageVersion? 304 | ---@field short_tailed_output string? 305 | ---@field tailed_output string[] 306 | @@ -220,6 +222,8 @@ local function create_initial_package_state() 307 | latest_spawn = nil, 308 | linked_executables = nil, 309 | lsp_settings_schema = nil, 310 | + lspconfig = nil, 311 | + is_lspconfig_expanded = false, 312 | new_version = nil, 313 | short_tailed_output = nil, 314 | tailed_output = {}, 315 | @@ -305,6 +309,7 @@ local function hydrate_detailed_package_state(pkg) 316 | state.packages.states[pkg.name].expanded_json_schema_keys["lsp"] = state.packages.states[pkg.name].expanded_json_schema_keys["lsp"] 317 | or {} 318 | state.packages.states[pkg.name].lsp_settings_schema = pkg:get_lsp_settings_schema():or_else(nil) 319 | + state.packages.states[pkg.name].lspconfig = pkg:get_default_lsp_config():or_else(nil) 320 | end) 321 | 322 | pkg:get_installed_version(function(success, version_or_err) 323 | @@ -552,6 +557,14 @@ local function toggle_json_schema_keys(event) 324 | end) 325 | end 326 | 327 | +local function toggle_default_lsp_config(event) 328 | + local package = event.payload.package 329 | + mutate_state(function(state) 330 | + state.packages.states[package.name].is_lspconfig_expanded = 331 | + not state.packages.states[package.name].is_lspconfig_expanded 332 | + end) 333 | +end 334 | + 335 | local function filter() 336 | vim.ui.select(_.sort_by(_.identity, _.keys(Package.Lang)), { 337 | prompt = "Select language:", 338 | @@ -619,6 +632,7 @@ local effects = { 339 | ["TOGGLE_INSTALL_LOG"] = toggle_install_log, 340 | ["TOGGLE_JSON_SCHEMA"] = toggle_json_schema, 341 | ["TOGGLE_JSON_SCHEMA_KEY"] = toggle_json_schema_keys, 342 | + ["TOGGLE_DEFAULT_LSP_CONFIG"] = toggle_default_lsp_config, 343 | ["UNINSTALL_PACKAGE"] = uninstall_package, 344 | ["UPDATE_ALL_PACKAGES"] = update_all_packages, 345 | } 346 | -- 347 | 2.47.1.windows.2 348 | 349 | -------------------------------------------------------------------------------- /packages/aerial.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: aerial.nvim 3 | description: | 4 | Neovim plugin for a code outline window 5 | homepage: https://github.com/stevearc/aerial.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/stevearc/aerial.nvim@3284a2cb858ba009c79da87d5e010ccee3c99c4d 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/aerial.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/dressing.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: dressing.nvim 3 | description: | 4 | Neovim plugin to improve the default vim.ui interfaces 5 | homepage: https://github.com/stevearc/dressing.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/stevearc/dressing.nvim@56ef6a969a4990d938c5fed40c370f65e125fc97 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/dressing.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/gitsigns.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: gitsigns.nvim 3 | description: | 4 | Git integration for buffers 5 | homepage: https://github.com/lewis6991/gitsigns.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/lewis6991/gitsigns.nvim@d8918f06624dd53b9a82bd0e29c31bcfd541b40d 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/gitsigns.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/glance.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: glance.nvim 3 | description: | 4 | Peek preview window for LSP locations in Neovim 5 | homepage: https://github.com/DNLHC/glance.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/DNLHC/glance.nvim@1a08824835d7582457b67acbe23ca33487912a5e 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/glance.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/kanagawa.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kanagawa.nvim 3 | description: | 4 | NeoVim dark colorscheme inspired by the colors of the famous painting by Katsushika Hokusai. 5 | homepage: https://github.com/rebelot/kanagawa.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/rebelot/kanagawa.nvim@988082eb00b845e4afbcaa4fd8e903da8a3ab3b9 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/kanagawa.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/leap.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: leap.nvim 3 | description: | 4 | Neovim's answer to the mouse 🦘 5 | homepage: https://github.com/ggandor/leap.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/ggandor/leap.nvim@be8e6eee2dabc68ce810ddf2e800c14bfda09fee 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/leap.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/oil.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: oil.nvim 3 | description: | 4 | Neovim file explorer: edit your filesystem like a buffer 5 | homepage: https://github.com/stevearc/oil.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-tags 13 | id: pkg:github/stevearc/oil.nvim@v2.14.0 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/oil.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/plenary.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: plenary.nvim 3 | description: | 4 | plenary: full; complete; entire; absolute; unqualified. All the lua functions I don't want to write twice. 5 | homepage: https://github.com/nvim-lua/plenary.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/nvim-lua/plenary.nvim@3707cdb1e43f5cea73afb6037e6494e7ce847a66 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/plenary.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/readline.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: readline.nvim 3 | homepage: https://git.redwill.se/williamboman/readline.nvim 4 | description: Readline motions and deletions in Neovim. 5 | languages: [] 6 | categories: [] 7 | licenses: 8 | - proprietary 9 | 10 | source: 11 | id: pkg:generic/williamboman/readline.nvim@v1.0.0 12 | download: 13 | files: 14 | plugin.zip: https://git.redwill.se/williamboman/readline.nvim/-/archive/{{ version }}/readline.nvim-{{ version }}.zip 15 | artifact: readline.nvim-{{version}}/ 16 | 17 | opt: 18 | pack/mason/opt/readline.nvim/: "{{source.download.artifact}}" 19 | -------------------------------------------------------------------------------- /packages/ripgrep/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ripgrep 3 | homepage: https://github.com/BurntSushi/ripgrep 4 | description: ripgrep recursively searches directories for a regex pattern while respecting your gitignore 5 | languages: [] 6 | categories: [] 7 | licenses: 8 | - MIT 9 | 10 | source: 11 | id: pkg:github/BurntSushi/ripgrep@14.1.1 12 | asset: 13 | - target: darwin_arm64 14 | file: ripgrep-{{ version }}-aarch64-apple-darwin.tar.gz 15 | bin: ripgrep-{{ version }}-aarch64-apple-darwin/rg 16 | - target: linux_x64 17 | file: ripgrep-{{ version }}-x86_64-unknown-linux-musl.tar.gz 18 | bin: ripgrep-{{ version }}-x86_64-unknown-linux-musl/rg 19 | - target: win_x64 20 | file: ripgrep-{{ version }}-i686-pc-windows-msvc.zip 21 | bin: ripgrep-{{ version }}-i686-pc-windows-msvc/rg.exe 22 | 23 | bin: 24 | rg: "{{source.asset.bin}}" 25 | -------------------------------------------------------------------------------- /packages/rustaceanvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: rustaceanvim 3 | description: | 4 | 🦀 Supercharge your Rust experience in Neovim! A heavily modified fork of rust-tools.nvim 5 | homepage: https://github.com/mrcjkb/rustaceanvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - GPL-2.0 10 | 11 | source: 12 | # renovate:datasource=github-tags 13 | id: pkg:github/mrcjkb/rustaceanvim@v5.24.4 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/rustaceanvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/telescope-fzf-native.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: telescope-fzf-native.nvim 3 | homepage: https://github.com/nvim-telescope/telescope-fzf-native.nvim 4 | description: Find, Filter, Preview, Pick. All lua, all the time. 5 | languages: [] 6 | categories: [] 7 | licenses: 8 | - MIT 9 | 10 | source: 11 | # renovate:datasource=github-refs 12 | id: pkg:github/nvim-telescope/telescope-fzf-native.nvim@dae2eac9d91464448b584c7949a31df8faefec56 13 | build: 14 | run: | 15 | cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release 16 | cmake --build build --config Release 17 | 18 | opt: 19 | pack/mason/opt/telescope-fzf-native.nvim/: "./" 20 | -------------------------------------------------------------------------------- /packages/telescope.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: telescope.nvim 3 | description: | 4 | Find, Filter, Preview, Pick. All lua, all the time. 5 | homepage: https://github.com/nvim-telescope/telescope.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/nvim-telescope/telescope.nvim@415af52339215926d705cccc08145f3782c4d132 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/telescope.nvim/: "./" 19 | -------------------------------------------------------------------------------- /packages/typescript-tools.nvim/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: typescript-tools.nvim 3 | description: | 4 | ⚡ TypeScript integration NeoVim deserves ⚡ 5 | homepage: https://github.com/pmizio/typescript-tools.nvim 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - MIT 10 | 11 | source: 12 | id: pkg:github/williamboman/typescript-tools.nvim@feat%2Fnative-lsp-config 13 | archive: 14 | type: zipball 15 | 16 | opt: 17 | pack/mason/opt/typescript-tools.nvim/: "./" 18 | -------------------------------------------------------------------------------- /packages/vim-fugitive/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: vim-fugitive 3 | description: | 4 | fugitive.vim: A Git wrapper so awesome, it should be illegal 5 | homepage: https://github.com/tpope/vim-fugitive 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - proprietary 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/tpope/vim-fugitive@d74a7cff4cfcf84f83cc7eccfa365488f3bbabc2 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/vim-fugitive/: "./" 19 | -------------------------------------------------------------------------------- /packages/vim-sleuth/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: vim-sleuth 3 | description: | 4 | sleuth.vim: Heuristically set buffer options 5 | homepage: https://github.com/tpope/vim-sleuth 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - proprietary 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/tpope/vim-sleuth@be69bff86754b1aa5adcbb527d7fcd1635a84080 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/vim-sleuth/: "./" 19 | -------------------------------------------------------------------------------- /packages/vim-surround/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: vim-surround 3 | description: | 4 | surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease 5 | homepage: https://github.com/tpope/vim-surround 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - proprietary 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/tpope/vim-surround@3d188ed2113431cf8dac77be61b842acb64433d9 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/vim-surround/: "./" 19 | -------------------------------------------------------------------------------- /packages/vim-unimpaired/package.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: vim-unimpaired 3 | description: | 4 | unimpaired.vim: Pairs of handy bracket mappings 5 | homepage: https://github.com/tpope/vim-unimpaired 6 | languages: [] 7 | categories: [] 8 | licenses: 9 | - proprietary 10 | 11 | source: 12 | # renovate:datasource=github-refs 13 | id: pkg:github/tpope/vim-unimpaired@6d44a6dc2ec34607c41ec78acf81657248580bf1 14 | archive: 15 | type: zipball 16 | 17 | opt: 18 | pack/mason/opt/vim-unimpaired/: "./" 19 | -------------------------------------------------------------------------------- /plugin/colors.vim: -------------------------------------------------------------------------------- 1 | autocmd TextYankPost * silent! lua vim.hl.on_yank { higroup='Visual', timeout=300 } 2 | -------------------------------------------------------------------------------- /plugin/diagnostics.lua: -------------------------------------------------------------------------------- 1 | vim.diagnostic.config { 2 | signs = false, 3 | severity_sort = true, 4 | virtual_text = true, 5 | } 6 | -------------------------------------------------------------------------------- /plugin/keymaps.vim: -------------------------------------------------------------------------------- 1 | nnoremap : 2 | vnoremap : 3 | nnoremap :nohl 4 | 5 | function! s:quickfix_toggle() 6 | for winnr in range(1, winnr('$')) 7 | if getwinvar(winnr, '&syntax') == 'qf' 8 | cclose 9 | return 10 | endif 11 | endfor 12 | copen 13 | endfunction 14 | 15 | " Windows 16 | nnoremap c call quickfix_toggle() 17 | 18 | " Buffers 19 | nnoremap 20 | nnoremap bd 21 | 22 | " Diagnostics 23 | nnoremap 9d lua vim.diagnostic.jump { count = 1, float = true } 24 | nnoremap 8d lua vim.diagnostic.jump { count = -1, float = true } 25 | nnoremap 9e lua vim.diagnostic.jump { count = 1, severity = vim.diagnostic.severity.ERROR, float = true } 26 | nnoremap 8e lua vim.diagnostic.jump { count = -1, severity = vim.diagnostic.severity.ERROR, float = true } 27 | nnoremap 9. lua vim.diagnostic.open_float() 28 | 29 | tnoremap 30 | tnoremap  31 | 32 | function! s:terminal_history() 33 | startinsert 34 | call feedkeys("\") 35 | endfunction 36 | autocmd TermOpen * nnoremap call terminal_history() 37 | -------------------------------------------------------------------------------- /plugin/lsp/config.lua: -------------------------------------------------------------------------------- 1 | vim.lsp.config("lua-language-server", { 2 | settings = { 3 | Lua = { 4 | format = { 5 | enable = false, 6 | }, 7 | hint = { 8 | enable = true, 9 | arrayIndex = "Disable", -- "Enable", "Auto", "Disable" 10 | await = true, 11 | paramName = "All", -- "All", "Literal", "Disable" 12 | paramType = true, 13 | semicolon = "Disable", -- "All", "SameLine", "Disable" 14 | setType = true, 15 | }, 16 | diagnostics = { 17 | globals = { "P" }, 18 | }, 19 | runtime = { 20 | version = "LuaJIT" 21 | }, 22 | workspace = { 23 | checkThirdParty = false, 24 | }, 25 | }, 26 | }, 27 | }) 28 | -------------------------------------------------------------------------------- /plugin/lsp/keymaps.lua: -------------------------------------------------------------------------------- 1 | local function buf_set_keymaps(bufnr) 2 | local function buf_set_keymap(mode, lhs, rhs) 3 | vim.keymap.set(mode, lhs, rhs, { nowait = true, buffer = bufnr, silent = true }) 4 | end 5 | 6 | if vim.fn.mapcheck("p", "n") == "" then 7 | buf_set_keymap("n", "p", vim.lsp.buf.format) 8 | end 9 | 10 | -- Code actions 11 | buf_set_keymap("n", "r", vim.lsp.buf.rename) 12 | buf_set_keymap("n", "f", vim.lsp.buf.code_action) 13 | -- buf_set_keymap("n", "l", find_and_run_codelens) 14 | 15 | -- Movement 16 | buf_set_keymap("n", "gD", "Glance type_definitions") 17 | buf_set_keymap("n", "gd", "Glance definitions") 18 | buf_set_keymap("n", "gr", "Glance references") 19 | buf_set_keymap("n", "gqr", vim.lsp.buf.references) 20 | buf_set_keymap("n", "gbr", function() 21 | require("glance").open("references", { 22 | hooks = { 23 | before_open = function(results, open, jump) 24 | local uri = vim.uri_from_bufnr(0) 25 | results = vim.tbl_filter(function(location) 26 | return (location.uri or location.target_uri) == uri 27 | end, results) 28 | 29 | if #results == 1 then 30 | local target_uri = results[1].uri or results[1].targetUri 31 | 32 | if target_uri == uri then 33 | jump(results[1]) 34 | else 35 | open(results) 36 | end 37 | else 38 | open(results) 39 | end 40 | end, 41 | }, 42 | }) 43 | end) 44 | buf_set_keymap("n", "gI", "Glance implementations") 45 | 46 | -- Docs 47 | -- buf_set_keymap("n", "", vim.lsp.buf.signature_help) 48 | -- buf_set_keymap("i", "", vim.lsp.buf.signature_help) 49 | 50 | -- buf_set_keymap("n", "ws", w(telescope_lsp.workspace_symbols)) 51 | -- buf_set_keymap("n", "wd", w(telescope_lsp.workspace_diagnostics)) 52 | end 53 | 54 | vim.api.nvim_create_autocmd("LspAttach", { 55 | callback = function(args) 56 | local bufnr = args.buf 57 | local client = vim.lsp.get_client_by_id(args.data.client_id) 58 | 59 | if client.server_capabilities.completionProvider then 60 | vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc" 61 | end 62 | if client.server_capabilities.definitionProvider then 63 | vim.bo[bufnr].tagfunc = "v:lua.vim.lsp.tagfunc" 64 | end 65 | 66 | buf_set_keymaps(bufnr) 67 | end, 68 | }) 69 | -------------------------------------------------------------------------------- /plugin/opt.vim: -------------------------------------------------------------------------------- 1 | let g:mapleader="," 2 | 3 | set title 4 | set clipboard=unnamedplus 5 | 6 | " Buffers 7 | set completeopt=menu,menuone,noselect 8 | set cursorline 9 | set expandtab 10 | set number 11 | set relativenumber 12 | set shiftwidth=4 13 | set textwidth=120 14 | set noswapfile 15 | 16 | " Windows 17 | set splitbelow 18 | set splitright 19 | -------------------------------------------------------------------------------- /plugin/terminal.lua: -------------------------------------------------------------------------------- 1 | local api = vim.api 2 | local filter = vim.tbl_filter 3 | 4 | local function get_buf_var(bufnr, var) 5 | local ok, value = pcall(api.nvim_buf_get_var, bufnr, var) 6 | if ok then 7 | return value 8 | end 9 | end 10 | 11 | local function get_win_var(winnr, var) 12 | local ok, value = pcall(api.nvim_win_get_var, winnr, var) 13 | if ok then 14 | return value 15 | end 16 | end 17 | 18 | local function find_first(predicate, list) 19 | for _, item in ipairs(list) do 20 | if predicate(item) then 21 | return item 22 | end 23 | end 24 | end 25 | 26 | local function open_terminal(winnr, terminal_id) 27 | local terminal_buffer = find_first(function(bufnr) 28 | local ok, value = pcall(api.nvim_buf_get_var, bufnr, "terminal_id") 29 | return value == terminal_id 30 | end, api.nvim_list_bufs()) 31 | 32 | if terminal_buffer then 33 | api.nvim_win_set_buf(winnr, terminal_buffer) 34 | else 35 | vim.cmd.term() 36 | vim.b.terminal_id = terminal_id 37 | end 38 | vim.w.terminal_id = terminal_id 39 | vim.wo.statusline = "term #" .. terminal_id .. " | \239\147\147 %{b:term_title}" 40 | vim.wo.winfixbuf = true 41 | vim.wo.winhighlight = "Normal:TermNormal" 42 | end 43 | 44 | vim.keymap.set("n", "t", function() 45 | local original_terminal_id = vim.v.count 46 | local terminal_id = original_terminal_id 47 | if terminal_id == nil or terminal_id == 0 then 48 | terminal_id = 1 49 | end 50 | local tabpage = api.nvim_get_current_tabpage() 51 | local tabpage_windows = api.nvim_tabpage_list_wins(tabpage) 52 | local open_terminal_windows = filter(function(winnr) 53 | return get_win_var(winnr, "terminal_id") ~= nil 54 | end, tabpage_windows) 55 | 56 | if #open_terminal_windows > 0 then 57 | local open_terminal_window = find_first(function(winnr) 58 | return get_win_var(winnr, "terminal_id") == terminal_id 59 | end, open_terminal_windows) 60 | if open_terminal_window then 61 | api.nvim_win_close(open_terminal_window, true) 62 | else 63 | -- Close the only visible terminal window if the terminal that is being toggled is the default one (i.e. 64 | -- doesn't have v:count). 65 | if #open_terminal_windows == 1 and original_terminal_id == 0 then 66 | api.nvim_win_close(open_terminal_windows[1], true) 67 | else 68 | vim.fn.win_gotoid(open_terminal_windows[#open_terminal_windows]) 69 | vim.cmd.vsp() 70 | open_terminal(api.nvim_get_current_win(), terminal_id) 71 | end 72 | end 73 | else 74 | vim.fn.win_gotoid(tabpage_windows[#tabpage_windows]) 75 | vim.cmd.sp() 76 | vim.cmd.wincmd("J") 77 | open_terminal(api.nvim_get_current_win(), terminal_id) 78 | end 79 | end) 80 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["github>mason-org/registry-renovate-config"] 3 | } 4 | -------------------------------------------------------------------------------- /syntax/log.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Generic log file 3 | " Maintainer: MTDL9 4 | " Latest Revision: 2020-08-23 5 | 6 | if exists('b:current_syntax') 7 | finish 8 | endif 9 | 10 | let s:cpo_save = &cpoptions 11 | set cpoptions&vim 12 | 13 | 14 | " Operators 15 | "--------------------------------------------------------------------------- 16 | syn match logOperator display '[;,\?\:\.\<=\>\~\/\@\!$\%&\+\-\|\^(){}\*#]' 17 | syn match logBrackets display '[\[\]]' 18 | syn match logEmptyLines display '-\{3,}' 19 | syn match logEmptyLines display '\*\{3,}' 20 | syn match logEmptyLines display '=\{3,}' 21 | syn match logEmptyLines display '- - ' 22 | 23 | 24 | " Constants 25 | "--------------------------------------------------------------------------- 26 | syn match logNumber '\<-\?\d\+\>' 27 | syn match logHexNumber '\<0[xX]\x\+\>' 28 | syn match logHexNumber '\<\d\x\+\>' 29 | syn match logBinaryNumber '\<0[bB][01]\+\>' 30 | syn match logFloatNumber '\<\d.\d\+[eE]\?\>' 31 | 32 | syn keyword logBoolean TRUE FALSE True False true false 33 | syn keyword logNull NULL Null null 34 | 35 | syn region logString start=/"/ end=/"/ end=/$/ skip=/\\./ 36 | " Quoted strings, but no match on quotes like "don't", "plurals' elements" 37 | syn region logString start=/'\(s \|t \| \w\)\@!/ end=/'/ end=/$/ end=/s / skip=/\\./ 38 | 39 | 40 | " Dates and Times 41 | "--------------------------------------------------------------------------- 42 | " Matches 2018-03-12T or 12/03/2018 or 12/Mar/2018 43 | syn match logDate '\d\{2,4}[-\/]\(\d\{2}\|Jan\|Feb\|Mar\|Apr\|May\|Jun\|Jul\|Aug\|Sep\|Oct\|Nov\|Dec\)[-\/]\d\{2,4}T\?' 44 | " Matches 8 digit numbers at start of line starting with 20 45 | syn match logDate '^20\d\{6}' 46 | " Matches Fri Jan 09 or Feb 11 or Apr 3 or Sun 3 47 | syn keyword logDate Mon Tue Wed Thu Fri Sat Sun Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec nextgroup=logDateDay 48 | syn match logDateDay '\s\{1,2}\d\{1,2}' contained 49 | 50 | " Matches 12:09:38 or 00:03:38.129Z or 01:32:12.102938 +0700 51 | syn match logTime '\d\{2}:\d\{2}:\d\{2}\(\.\d\{2,6}\)\?\(\s\?[-+]\d\{2,4}\|Z\)\?\>' nextgroup=logTimeZone,logSysColumns skipwhite 52 | 53 | " Follows logTime, matches UTC or PDT 2019 or 2019 EDT 54 | syn match logTimeZone '[A-Z]\{2,5}\>\( \d\{4}\)\?' contained 55 | syn match logTimeZone '\d\{4} [A-Z]\{2,5}\>' contained 56 | 57 | 58 | " Entities 59 | "--------------------------------------------------------------------------- 60 | syn match logUrl 'http[s]\?:\/\/[^\n|,; '"]\+' 61 | syn match logDomain /\v(^|\s)(\w|-)+(\.(\w|-)+)+\s/ 62 | syn match logUUID '\w\{8}-\w\{4}-\w\{4}-\w\{4}-\w\{12}' 63 | syn match logMD5 '\<[a-z0-9]\{32}\>' 64 | syn match logIPV4 '\<\d\{1,3}\(\.\d\{1,3}\)\{3}\>' 65 | syn match logIPV6 '\<\x\{1,4}\(:\x\{1,4}\)\{7}\>' 66 | syn match logMacAddress '\<\x\{2}\(:\x\{2}\)\{5}' 67 | syn match logFilePath '\<\w:\\[^\n|,; ()'"\]{}]\+' 68 | syn match logFilePath '[^a-zA-Z0-9"']\@<=\/\w[^\n|,; ()'"\]{}]\+' 69 | 70 | 71 | " Syslog Columns 72 | "--------------------------------------------------------------------------- 73 | " Syslog hostname, program and process number columns 74 | syn match logSysColumns '\w\(\w\|\.\|-\)\+ \(\w\|\.\|-\)\+\(\[\d\+\]\)\?:' contains=logOperator,logSysProcess contained 75 | syn match logSysProcess '\(\w\|\.\|-\)\+\(\[\d\+\]\)\?:' contains=logOperator,logNumber,logBrackets contained 76 | 77 | 78 | " XML Tags 79 | "--------------------------------------------------------------------------- 80 | " Simplified matches, not accurate with the spec to avoid false positives 81 | syn match logXmlHeader // contains=logString,logXmlAttribute,logXmlNamespace 82 | syn match logXmlDoctype /]*>/ contains=logString,logXmlAttribute,logXmlNamespace 83 | syn match logXmlTag /<\/\?\(\(\w\|-\)\+:\)\?\(\w\|-\)\+\(\(\n\|\s\)\+\(\(\w\|-\)\+:\)\?\(\w\|-\)\+\(="[^"]*"\|='[^']*'\)\?\)*\s*\/\?>/ contains=logString,logXmlAttribute,logXmlNamespace 84 | syn match logXmlAttribute contained "\w\+=" contains=logOperator 85 | syn match logXmlAttribute contained "\(\n\|\s\)\(\(\w\|-\)\+:\)\?\(\w\|-\)\+\(=\)\?" contains=logXmlNamespace,logOperator 86 | syn match logXmlNamespace contained "\(\w\|-\)\+:" contains=logOperator 87 | syn region logXmlComment start=// 88 | syn match logXmlCData // 89 | syn match logXmlEntity /&#\?\w\+;/ 90 | 91 | 92 | " Levels 93 | "--------------------------------------------------------------------------- 94 | syn keyword logLevelEmergency EMERGENCY EMERG 95 | syn keyword logLevelAlert ALERT 96 | syn keyword logLevelCritical CRITICAL CRIT FATAL 97 | syn keyword logLevelError ERROR ERR FAILURE SEVERE 98 | syn keyword logLevelWarning WARNING WARN 99 | syn keyword logLevelNotice NOTICE 100 | syn keyword logLevelInfo INFO 101 | syn keyword logLevelDebug DEBUG FINE 102 | syn keyword logLevelTrace TRACE FINER FINEST 103 | 104 | 105 | " Highlight links 106 | "--------------------------------------------------------------------------- 107 | hi def link logNumber Number 108 | hi def link logHexNumber Number 109 | hi def link logBinaryNumber Number 110 | hi def link logFloatNumber Float 111 | hi def link logBoolean Boolean 112 | hi def link logNull Constant 113 | hi def link logString String 114 | 115 | hi def link logDate Identifier 116 | hi def link logDateDay Identifier 117 | hi def link logTime Function 118 | hi def link logTimeZone Identifier 119 | 120 | hi def link logUrl Underlined 121 | hi def link logDomain Label 122 | hi def link logUUID Label 123 | hi def link logMD5 Label 124 | hi def link logIPV4 Label 125 | hi def link logIPV6 ErrorMsg 126 | hi def link logMacAddress Label 127 | hi def link logFilePath Conditional 128 | 129 | hi def link logSysColumns Conditional 130 | hi def link logSysProcess Include 131 | 132 | hi def link logXmlHeader Function 133 | hi def link logXmlDoctype Function 134 | hi def link logXmlTag Identifier 135 | hi def link logXmlAttribute Type 136 | hi def link logXmlNamespace Include 137 | hi def link logXmlComment Comment 138 | hi def link logXmlCData String 139 | hi def link logXmlEntity Special 140 | 141 | hi def link logOperator Operator 142 | hi def link logBrackets Comment 143 | hi def link logEmptyLines Comment 144 | 145 | hi def link logLevelEmergency ErrorMsg 146 | hi def link logLevelAlert ErrorMsg 147 | hi def link logLevelCritical ErrorMsg 148 | hi def link logLevelError ErrorMsg 149 | hi def link logLevelWarning WarningMsg 150 | hi def link logLevelNotice Character 151 | hi def link logLevelInfo Repeat 152 | hi def link logLevelDebug Debug 153 | hi def link logLevelTrace Comment 154 | 155 | 156 | 157 | let b:current_syntax = 'log' 158 | 159 | let &cpoptions = s:cpo_save 160 | unlet s:cpo_save 161 | --------------------------------------------------------------------------------