diff --git a/nvim/init.lua b/nvim/init.lua index b5fecb2..1b79ed2 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -7,8 +7,8 @@ require("plugins") -- Config for Nord, which I usually use -- vim.g.nord_italic = false -- vim.g.nord_bold = false -vim.opt.background = "dark" -vim.cmd [[colorscheme everforest]] +vim.opt.background = "light" +--vim.opt.background = "dark" -- Formatting and vim config vim.opt.expandtab = true @@ -28,32 +28,19 @@ vim.opt.wrap = false vim.opt.lcs = vim.opt.lcs + "space:ยท" vim.opt.list = true vim.opt.textwidth = 88 - --- LuaLine Config - ---local noirbuddy_lualine = require("noirbuddy.plugins.lualine") - -require("lualine").setup { - options = { - icons_enabled = true, - theme = "auto" - --theme = noirbuddy_lualine.theme - }, - --sections = noirbuddy_lualine.sections, - --inactive_sections = noirbuddy_lualine.inactive_sections, -} +vim.cmd [[ colorscheme alabaster ]] -- Force OSC-52 vim.g.clipboard = { - name = 'OSC 52', - copy = { - ['+'] = require('vim.ui.clipboard.osc52').copy('+'), - ['*'] = require('vim.ui.clipboard.osc52').copy('*'), - }, - paste = { - ['+'] = require('vim.ui.clipboard.osc52').paste('+'), - ['*'] = require('vim.ui.clipboard.osc52').paste('*'), - }, + name = 'OSC 52', + copy = { + ['+'] = require('vim.ui.clipboard.osc52').copy('+'), + ['*'] = require('vim.ui.clipboard.osc52').copy('*'), + }, + paste = { + ['+'] = require('vim.ui.clipboard.osc52').paste('+'), + ['*'] = require('vim.ui.clipboard.osc52').paste('*'), + }, } -- CTags @@ -64,25 +51,25 @@ vim.opt.tags = vim.opt.tags + vim.fn.expand("~/.local/tmp/ctags") + -- Gerbil Scheme local set_gerbil = function() - vim.g["conjure#client#scheme#stdio#command"] = "gxi" - vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "%d*> " - vim.g["conjure#client#scheme#stdio#value_prefix_pattern"] = false + vim.g["conjure#client#scheme#stdio#command"] = "gxi" + vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "%d*> " + vim.g["conjure#client#scheme#stdio#value_prefix_pattern"] = false end set_gerbil() vim.api.nvim_create_user_command("ConjureGerbil", set_gerbil, {}) -- Chibi-scheme local set_chibi = function() - vim.g["conjure#client#scheme#stdio#command"] = "chibi-scheme -R" - vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "=> $?" - vim.g["conjure#client#scheme#stdio#value_prefix_pattern"] = true + vim.g["conjure#client#scheme#stdio#command"] = "chibi-scheme -R" + vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "=> $?" + vim.g["conjure#client#scheme#stdio#value_prefix_pattern"] = true end vim.api.nvim_create_user_command("ConjureChibi", set_chibi, {}) -- Chicken Scheme local set_chicken = function() - vim.g["conjure#client#scheme#stdio#command"] = "csi -quiet -:c" - vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "\n-#;%d-> " - vim.g["conjure#client#scheme#stdio#value_prefix_pattern"] = true + vim.g["conjure#client#scheme#stdio#command"] = "csi -quiet -:c" + vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "\n-#;%d-> " + vim.g["conjure#client#scheme#stdio#value_prefix_pattern"] = true end vim.api.nvim_create_user_command("ConjureChicken", set_chicken, {}) @@ -90,6 +77,8 @@ vim.api.nvim_create_user_command("ConjureChicken", set_chicken, {}) local keymap = vim.keymap.set local noremap = { noremap = true } local silentnoremap = { noremap = true, silent = true } +--Toggle background +keymap("n", "bg", function() if vim.o.background == "light" then vim.o.background = "dark" else vim.o.background = "light" end end, noremap) -- Easier breaking from edit modes keymap("n", ";;", "", noremap) keymap("v", ";;", "", noremap) @@ -155,15 +144,15 @@ keymap("n", "g", "Neogit", silentnoremap) -- Autoformat! vim.api.nvim_create_user_command("Format", function(args) - local range = nil - if args.count ~= -1 then - local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] - range = { - start = { args.line1, 0 }, - ["end"] = { args.line2, end_line:len() }, - } - end - require("conform").format({ async = true, lsp_format = "fallback", range = range }) + local range = nil + if args.count ~= -1 then + local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] + range = { + start = { args.line1, 0 }, + ["end"] = { args.line2, end_line:len() }, + } + end + require("conform").format({ async = true, lsp_format = "fallback", range = range }) end, { range = true }) keymap("n", "", "Format", silentnoremap) @@ -175,3 +164,7 @@ vim.g.python3_host_prog = vim.fn.expand("~/.envs/nvim/bin/python3") -- ######################## -- LSP require("lsp") + +if vim.uv.fs_stat(vim.fn.stdpath("config") .. "/lua/local.lua") then + require("local") +end diff --git a/nvim/lua/ambient.lua b/nvim/lua/ambient.lua new file mode 100644 index 0000000..2ae7a26 --- /dev/null +++ b/nvim/lua/ambient.lua @@ -0,0 +1,8 @@ +function setup() + return require("codecompanion.adapters").extend("openai_compatible", { + env = { + url = "http://34.46.152.76", + chat_url = "/run-auction" + } + }) +end diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua index b085cfa..a838199 100644 --- a/nvim/lua/lsp.lua +++ b/nvim/lua/lsp.lua @@ -1,141 +1,89 @@ -local nvim_lsp = require("lspconfig") local capabilities = require('cmp_nvim_lsp').default_capabilities() -- ######################## -- #### Set up LSPs #### -- ######################## -local util = require("lspconfig.util") - --- Rust --- Python LSP -nvim_lsp.pylsp.setup({ - -- cmd = {"/home/noah/.envs/nvim/bin/pylsp"}, - root_dir = function(fname) - local root_files = { - "pants.toml", "pyproject.toml", "setup.py", "setup.cfg", "Pipfile" - } - return util.find_git_ancestor(fname) or - util.root_pattern(unpack(root_files))(fname) - end +vim.lsp.config("*", { + capabilities = capabilities }) -nvim_lsp.lua_ls.setup { - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT" - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" } - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true) - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { enable = false } - } - } -} - -nvim_lsp.janet_lsp.setup { - cmd = { - "janet", - "-i", - "/home/noah/repos/janet-lsp/build/janet-lsp.jimage", - "--stdio", - } -} --- LSPs that just use default config -local simple_lsps = { - --"htmx", - "nil_ls", "bzl", "buf_ls", "crystalline", "dockerls", - "erlangls", "elixirls", "fortls", "gleam", "gopls", "hls", "jsonls", - "vimls", "asm_lsp", "ccls", "pyright", -- ruff", idk if this is wrong? - "ruff", "clojure_lsp", "guile_ls", - -- Of course the Java-based ones are verbose af - "kotlin_language_server", "java_language_server", "jsonls", "pest_ls", - "ocamllsp", "reason_ls", "racket_langserver", "rust_analyzer", - "scheme_langserver", "sqls", "thriftls", "tinymist", "vhdl_ls", "yamlls", - "zls", "ts_ls", "eslint", "metals", "futhark_lsp", "roc_ls", - -- disabled because it's broken - -- "scheme_langserver", +local servers = { + "pylsp", "lua_ls", "janet_lsp", + --"htmx", + "nil_ls", "bzl", "buf_ls", "crystalline", "dockerls", + "erlangls", "elixirls", "fortls", "gleam", "gopls", "hls", "jsonls", + "vimls", "asm_lsp", "ccls", "pyright", + "ruff", "clojure_lsp", "guile_ls", + -- Of course the Java-based ones are verbose af + "kotlin_language_server", "java_language_server", "jsonls", "pest_ls", + "ocamllsp", "reason_ls", "racket_langserver", "rust_analyzer", + "scheme_langserver", "sqls", "thriftls", "tinymist", "vhdl_ls", "yamlls", + "zls", "ts_ls", "eslint", "metals", "futhark_lsp", "roc_ls", "sourcekit" + -- disabled because it's broken + -- "scheme_langserver", } --- #simple_lsps is the length of the table when treated as a list... funky! -for _, v in pairs(simple_lsps) do - nvim_lsp[v].setup { - capabilities = capabilities - } -end - -nvim_lsp.fennel_ls.setup({ - capabilities = capabilities, - root_dir = nvim_lsp.util.root_pattern(".git", "fnl") -}) +vim.lsp.enable(servers) --- Whenever an LSP is attached to a buffer local on_attach = function(ev) - -- Enable completion triggered by - vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' - local opts = { noremap = true, silent = true, buffer = ev.buf } - local protocol = require("vim.lsp.protocol") - -- Mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) - vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) - vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) - vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) - vim.keymap.set("n", "wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, opts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) - vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) - vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) - vim.keymap.set("n", "f", - function() vim.lsp.buf.format { async = true } end, opts) - vim.keymap.set("n", "s", vim.lsp.buf.workspace_symbol, opts) + local opts = { noremap = true, silent = true, buffer = ev.buf } + local protocol = require("vim.lsp.protocol") + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) + vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) + vim.keymap.set("n", "f", + function() vim.lsp.buf.format { async = true } end, opts) + vim.keymap.set("n", "s", vim.lsp.buf.workspace_symbol, opts) - -- require'completion'.on_attach(client, bufnr) - protocol.CompletionItemKind = { - "๎˜’", -- Text - "โ‹™", -- Method - "๐‘“", -- Function - "๏ž”", -- Constructor - "๎ž›", -- Field - "๎ž›", -- Variable - "๏ƒจ", -- Class - "๏ฐฎ", -- Interface - "๏ฃ–", -- Module - "๎˜ค", -- Property - "๏‘ต", -- Unit - "๏ขŸ", -- Value - "๏ƒŠ", -- Enum - "๏ Š", -- Keyword - "๏ฌŒ", -- Snippet - "๎ˆซ", -- Color - "๏…›", -- File - "๏š", -- Reference - "๏„•", -- Folder - "๏…", -- EnumMember - "๎ˆฌ", -- Constant - "๏ƒŠ", -- Struct - "๏ƒง", -- Event - "๏ฌฆ", -- Operator - "๎˜Ž" -- TypeParameter - } + -- require'completion'.on_attach(client, bufnr) + protocol.CompletionItemKind = { + "๎˜’", -- Text + "โ‹™", -- Method + "๐‘“", -- Function + "๏ž”", -- Constructor + "๎ž›", -- Field + "๎ž›", -- Variable + "๏ƒจ", -- Class + "๏ฐฎ", -- Interface + "๏ฃ–", -- Module + "๎˜ค", -- Property + "๏‘ต", -- Unit + "๏ขŸ", -- Value + "๏ƒŠ", -- Enum + "๏ Š", -- Keyword + "๏ฌŒ", -- Snippet + "๎ˆซ", -- Color + "๏…›", -- File + "๏š", -- Reference + "๏„•", -- Folder + "๏…", -- EnumMember + "๎ˆฌ", -- Constant + "๏ƒŠ", -- Struct + "๏ƒง", -- Event + "๏ฌฆ", -- Operator + "๎˜Ž" -- TypeParameter + } end vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('UserLspConfig', {}), - callback = on_attach + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = on_attach }) diff --git a/nvim/lua/lsp/fennel_ls.lua b/nvim/lua/lsp/fennel_ls.lua new file mode 100644 index 0000000..ec47434 --- /dev/null +++ b/nvim/lua/lsp/fennel_ls.lua @@ -0,0 +1,3 @@ +return { + root_markers = {".git", "fnl"}, +} diff --git a/nvim/lua/lsp/janet_lsp.lua b/nvim/lua/lsp/janet_lsp.lua new file mode 100644 index 0000000..c3f4b56 --- /dev/null +++ b/nvim/lua/lsp/janet_lsp.lua @@ -0,0 +1,8 @@ +return { + cmd = { + "janet", + "-i", + "/home/noah/repos/janet-lsp/jpm_tree/lib/janet-lsp.jimage", + "--stdio", + } +} diff --git a/nvim/lua/lsp/lua_ls.lua b/nvim/lua/lsp/lua_ls.lua new file mode 100644 index 0000000..fa9700a --- /dev/null +++ b/nvim/lua/lsp/lua_ls.lua @@ -0,0 +1,20 @@ +return { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT" + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim", "vis" } + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true) + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { enable = false } + } + } +} diff --git a/nvim/lua/lsp/pylsp.lua b/nvim/lua/lsp/pylsp.lua new file mode 100644 index 0000000..c69f32e --- /dev/null +++ b/nvim/lua/lsp/pylsp.lua @@ -0,0 +1,5 @@ +return { + -- cmd = {"/home/noah/.envs/nvim/bin/pylsp"}, + cmd = "basedpyright", + root_markers = { "pants.toml", "pyproject.toml", "setup.py", "setup.cfg", "Pipfile" }, +} diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 7281c66..136cffb 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -15,17 +15,19 @@ local lazy_bootstrap = ensure_lazy() if lazy_bootstrap then print("Bootstrapped lazy.nvim") end require("lazy").setup({ - install = { colorscheme = { "everforest" } }, + install = { colorscheme = { "alabaster" } }, checker = { enabled = false }, spec = { -- Color themes - { "shaunsingh/nord.nvim", priority = 1000, lazy = true }, - { "shaunsingh/moonlight.nvim", priority = 1000, lazy = true }, - { "folke/tokyonight.nvim", priority = 1000, lazy = true }, - { "cranberry-clockworks/coal.nvim", priority = 1000, lazy = true }, - { "hardselius/warlock", priority = 1000, lazy = true }, - { "sontungexpt/witch", priority = 1000, lazy = true, config = true }, - { "catppuccin/nvim", priority = 1000, name = "catppuccin", lazy = true }, + { "shaunsingh/nord.nvim", priority = 1000, lazy = true }, + { "shaunsingh/moonlight.nvim", priority = 1000, lazy = true }, + { "folke/tokyonight.nvim", priority = 1000, lazy = true }, + { "cranberry-clockworks/coal.nvim", priority = 1000, lazy = true }, + { "hardselius/warlock", priority = 1000, lazy = true }, + { "sontungexpt/witch", priority = 1000, lazy = true, config = true }, + { "rose-pine/neovim", priority = 1000, lazy = true }, + { "catppuccin/nvim", name = "catppuccin", priority = 1000, lazy = true }, + { "p00f/alabaster.nvim", priority = 1000, lazy = true }, { "neanias/everforest-nvim", version = false, @@ -39,9 +41,24 @@ require("lazy").setup({ 'jesseleite/nvim-noirbuddy', dependencies = { 'tjdevries/colorbuddy.nvim', + 'nvim-lualine/lualine.nvim' }, lazy = true, priority = 1000, + config = function(_, opts) + -- configure lualine + require('noirbuddy').setup(opts) + local noirbuddy_lualine = require("noirbuddy.plugins.lualine") + require("lualine").setup { + options = { + icons_enabled = true, + --theme = "auto" + theme = noirbuddy_lualine.theme + }, + sections = noirbuddy_lualine.sections, + inactive_sections = noirbuddy_lualine.inactive_sections, + } + end, opts = { -- All of your `setup(opts)` will go here preset = "oxide", @@ -51,7 +68,7 @@ require("lazy").setup({ }, }, { - "plan9-for-vimspace/acme-colors", lazy = true, priority = 1000 + "plan9-for-vimspace/acme-colors" }, -- Completion { @@ -69,6 +86,7 @@ require("lazy").setup({ }, -- nvim lsp plugins { "neovim/nvim-lspconfig", + config = false }, -- LSP Goodness { @@ -152,28 +170,12 @@ require("lazy").setup({ }, { "nvim-lualine/lualine.nvim", - config = function(_spec, _opt) - local noirbuddy_lualine = require("noirbuddy.plugins.lualine") - require("lualine").setup { - options = { - icons_enabled = true, - -- when not using noirbuddy, uncomment this - --theme = "auto" - theme = noirbuddy_lualine.theme - }, - sections = noirbuddy_lualine.sections, - inactive_sections = noirbuddy_lualine.inactive_sections, - } - end, - dependencies = { "nvim-tree/nvim-web-devicons", "jesseleite/nvim-noirbuddy" } + config = true, + dependencies = { "nvim-tree/nvim-web-devicons" } }, -- Fuzzy finding stuff - "junegunn/fzf.vim", - --{ - -- dir = "~/.fzf", - -- build = function() vim.fn["fzf#install"](0) end, - -- dependencies = { "junegunn/fzf.vim" } - --}, + --"junegunn/fzf.vim", + "ibhagwan/fzf-lua", -- A lua + nvim stdlib sort of thing { "nvim-lua/plenary.nvim", lazy = true, }, -- Telescope, find anything fast @@ -238,27 +240,26 @@ require("lazy").setup({ ft = { "hy", "scheme", "scm", "clojure", "fennel", "janet", "lisp", "python", "lua" }, lazy = true, config = function() - vim.g.parinfer_comment_chars = { ";" } + --vim.g.parinfer_comment_chars = { ";" } vim.g.parinfer_force_balance = true end }, -- )))))) -- This one gives me vim-sexp like structural editing { "julienvincent/nvim-paredit", - opts = { - indent = { - enabled = true, - }, - }, + config = function() + local paredit = require('nvim-paredit') + paredit.setup({ + indent = { + enabled = true, + }, + filetypes = { "clojure", "fennel", "janet" }, + }) + end, lazy = true, - ft = { "scheme", "scm", "clojure", "fennel", "janet", "lisp" } + ft = { "hy", "scheme", "scm", "clojure", "fennel", "janet", "lisp", "python", "lua" } }, - --{ - -- "hiphish/rainbow-delimiters.nvim", - -- priority = 1050, - - -- ft = { "scheme", "scm", "lisp", "fennel", "clojure", "lua", "janet" }, - --}, + --{ "hiphish/rainbow-delimiters.nvim", priority = 1050, }, -- Conjure, lisp is magical { "Olical/conjure", @@ -326,14 +327,32 @@ require("lazy").setup({ cmd = { "Lf" }, dependencies = { "voldikss/vim-floaterm" } }, - -- SuperMaven, another AI coding tool + { "imsnif/kdl.vim", lazy = true, ft = "kdl" }, + { "catgoose/nvim-colorizer.lua", lazy = true, ft = { "css", "html", "toml", "conf" } }, + { "github/copilot.vim", lazy = true, cmd = { "Copilot" } }, { - "supermaven-inc/supermaven-nvim", - opts = { keymaps = { accept_suggestion = "" } }, - lazy = true, - cmd = "SupermavenStart" + "cshuaimin/ssr.nvim", + config = function() + local ssr = require("ssr") + ssr.setup { + border = "rounded", + min_width = 50, + min_height = 5, + max_width = 120, + max_height = 25, + adjust_window = true, + keymaps = { + close = "q", + next_match = "n", + prev_match = "N", + replace_confirm = "", + replace_all = "", + }, + } + vim.keymap.set({ "n", "x" }, "sr", function() ssr.open() end) + end }, - { "imsnif/kdl.vim", lazy = true, ft = "kdl" }, - { "weakish/rcshell.vim", lazy = true, ft = "rcshell" }, + { "lewis6991/gitsigns.nvim", config = true }, + } }) diff --git a/nvim/syntax/infsh.vim b/nvim/syntax/infsh.vim new file mode 100644 index 0000000..8efe52d --- /dev/null +++ b/nvim/syntax/infsh.vim @@ -0,0 +1,133 @@ +" Vim syntax file +" Language: OS Inferno sh +" Maintainer: Alex Efros +" URL: http://powerman.name/download/vim/syntax/infsh.vim +" Version: 1.10 +" Last Change: 2012-12-09 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + + +syn cluster infshTOP contains=infshError +" usual typo +syn match infshError +"+ + +syn cluster infshTOP add=infshSubst,infshCmdOut,infshBlock +" substitution command +syn region infshSubst matchgroup=infshSubstDelimiter keepend extend start="\$["#]\?{\w\@=" end="}" contains=@infshTOP,@NoSpell +syn match infshSubstName contained "\(\$["#]\?{\)\@<=\w\+" containedin=infshSubst +" get command output +syn region infshCmdOut matchgroup=infshCmdOutDelimiter keepend extend start="[`"]{" end="}" contains=@infshTOP,@NoSpell +" command block +syn region infshBlock matchgroup=infshDelimiter keepend extend start="{" end="}" contains=@infshTOP,@NoSpell + +syn cluster infshTOP add=infshDelimiter,infshRedir,infshConditional,infshOperator,infshPatternClass,infshPattern +" top-level delimiters +syn match infshDelimiter "[;&()]" +syn match infshRedir "[|<>]\(\[\d\+\(=\d\+\)\?\]\)\?" +syn match infshConditional "&&\|||" +syn match infshOperator "\(:=\|=\|\^\)" +syn region infshPatternClass matchgroup=infshPattern keepend extend oneline start="\[^\?" end="\]" contains=infshPatternInClass +syn match infshPatternInClass contained "\(\[^\?\)\@^|}]\@=" +syn match infshError "\$["#]\?\((\s*)\)\@=" +syn match infshError "\$["#]\?\(''[^']\@=\)\@=" +syn match infshError "\$["#]\?\([`]{\@!\)\@=" +syn match infshError "\$["#]\(["]{\@!\)\@=" +syn match infshError "\$["#][#]\@=" + +syn cluster infshTOP add=infshStr,infshComment,infshShebang +" quoted string +syn region infshStr matchgroup=infshStrQ keepend extend start="'" skip="''" end="'" contains=infshStrQQ +syn match infshStrQQ contained "''" +" comment +syn match infshComment "#.*" contains=infshTodo,@Spell extend +syn keyword infshTodo contained TODO TBD FIXME XXX NOTE BUG WARNING DEBUG OPTIMIZATION WORKAROUND +" shebang +syn match infshShebang "^#!/dis/sh\(\.dis\)\?\(\s\+-[nlvx]\+\)*\s*$" contains=infshOpts +syn match infshOpts contained "-[nlvx]\+" + +syn cluster infshTOP add=infshStatement,infshConditional,infshRepeat,infshOperator,infshKeyword,infshException,infshPctlType +" keywords +syn keyword infshStatement fn subfn +syn keyword infshConditional and or if +syn keyword infshRepeat apply getlines for in while +syn keyword infshOperator run builtin exit load unload +syn keyword infshOperator no pctl status +syn match infshOperator "[@!~]" +syn keyword infshKeyword flag loaded whatis +syn keyword infshException raise rescue +syn keyword infshPctlType newfd forkfd newns forkns newpgrp nodevs + + +if version >= 508 || !exists("did_infsh_syn_inits") + if version < 508 + let did_infsh_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink infshSubstDelimiter Identifier + HiLink infshSubstName Operator + + HiLink infshCmdOutDelimiter Include + + HiLink infshDelimiter Delimiter + HiLink infshRedir Type + HiLink infshConditional Conditional + HiLink infshOperator Operator + HiLink infshPattern SpecialChar + HiLink infshPatternInClass SpecialChar + + HiLink infshVar Identifier + HiLink infshSpecVar Special + + HiLink infshError Error + + HiLink infshStr String + HiLink infshStrQ String + HiLink infshStrQQ SpecialChar + + HiLink infshComment Comment + HiLink infshTodo Todo + HiLink infshShebang Comment + HiLink infshOpts PreProc + + HiLink infshStatement Statement + HiLink infshConditional Conditional + HiLink infshRepeat Repeat + HiLink infshOperator Operator + HiLink infshKeyword Keyword + HiLink infshException Exception + HiLink infshPctlType Type + + delcommand HiLink +endif + +let b:current_syntax = "infsh" diff --git a/nvim/syntax/mkfile.vim b/nvim/syntax/mkfile.vim new file mode 100644 index 0000000..4441599 --- /dev/null +++ b/nvim/syntax/mkfile.vim @@ -0,0 +1,97 @@ +" Vim syntax file +" Language: mkfile (used by OS Inferno mk(1)) +" Maintainer: Alex Efros +" URL: http://powerman.name/download/vim/syntax/mkfile.vim +" Version: 1.10 +" Last Change: 2012-12-09 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + + +syn include @ShOs syntax/sh.vim +unlet b:current_syntax +syn include @ShInferno syntax/infsh.vim +unlet b:current_syntax + + +syn match mkfileComment "\\\@= 508 || !exists("did_mkfile_syn_inits") + if version < 508 + let did_mkfile_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink mkfileError Error + HiLink mkfileComment Comment + HiLink mkfileTodo Todo + HiLink mkfileEscaped Special + + HiLink mkfileDelimiter Operator + HiLink mkfileNextLine Special + + HiLink mkfileVarValue Identifier + HiLink mkfileVarSubst String + HiLink mkfileVarDelimiter Delimiter + + HiLink mkfileVar Identifier + HiLink mkfileVarAttr Type + + HiLink mkfileTargets Function + HiLink mkfileTargetAttr Type + + delcommand HiLink +endif + +let b:current_syntax = "mkfile"