From 26694e09e8f5bf2262737312e7ad217118db20de Mon Sep 17 00:00:00 2001 From: joott Date: Wed, 30 Jul 2025 15:53:29 -0400 Subject: switching to yadm --- .config/nvim/after/plugin/lsp.lua | 58 ++++ .config/nvim/after/plugin/luasnip.lua | 10 + .config/nvim/after/plugin/mini.lua | 24 ++ .config/nvim/after/plugin/neopywal.lua | 338 ++++++++++++++++++++ .config/nvim/after/plugin/nvim-cmp.lua | 74 +++++ .config/nvim/after/plugin/toggleterm.lua | 47 +++ .config/nvim/after/plugin/treesitter.lua | 21 ++ .config/nvim/after/plugin/vimtex.lua | 8 + .config/nvim/init.lua | 4 + .config/nvim/lazy-lock.json | 31 ++ .config/nvim/lua/commands.lua | 28 ++ .config/nvim/lua/keymaps.lua | 96 ++++++ .config/nvim/lua/luasnip-helpers.lua | 41 +++ .config/nvim/lua/luasnip-nodes.lua | 31 ++ .config/nvim/lua/options.lua | 35 +++ .config/nvim/lua/plugins.lua | 97 ++++++ .config/nvim/snips/tex/chunks.lua | 220 +++++++++++++ .config/nvim/snips/tex/electromagnetism.lua | 9 + .config/nvim/snips/tex/expressions.lua | 242 +++++++++++++++ .config/nvim/snips/tex/symbols.lua | 458 ++++++++++++++++++++++++++++ 20 files changed, 1872 insertions(+) create mode 100644 .config/nvim/after/plugin/lsp.lua create mode 100644 .config/nvim/after/plugin/luasnip.lua create mode 100644 .config/nvim/after/plugin/mini.lua create mode 100644 .config/nvim/after/plugin/neopywal.lua create mode 100644 .config/nvim/after/plugin/nvim-cmp.lua create mode 100644 .config/nvim/after/plugin/toggleterm.lua create mode 100644 .config/nvim/after/plugin/treesitter.lua create mode 100644 .config/nvim/after/plugin/vimtex.lua create mode 100644 .config/nvim/init.lua create mode 100644 .config/nvim/lazy-lock.json create mode 100644 .config/nvim/lua/commands.lua create mode 100644 .config/nvim/lua/keymaps.lua create mode 100644 .config/nvim/lua/luasnip-helpers.lua create mode 100644 .config/nvim/lua/luasnip-nodes.lua create mode 100644 .config/nvim/lua/options.lua create mode 100644 .config/nvim/lua/plugins.lua create mode 100644 .config/nvim/snips/tex/chunks.lua create mode 100644 .config/nvim/snips/tex/electromagnetism.lua create mode 100644 .config/nvim/snips/tex/expressions.lua create mode 100644 .config/nvim/snips/tex/symbols.lua (limited to '.config/nvim') diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..ed2c940 --- /dev/null +++ b/.config/nvim/after/plugin/lsp.lua @@ -0,0 +1,58 @@ +local lspconfig = require('lspconfig') +local lsp_defaults = lspconfig.util.default_config + +lsp_defaults.capabilities = vim.tbl_deep_extend( + 'force', + lsp_defaults.capabilities, + require('cmp_nvim_lsp').default_capabilities() +) + +vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + -- Enable completion triggered by + vim.api.nvim_buf_set_option(event.buf, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local bufopts = { noremap=true, silent=true, buffer=event.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) + end +}) + +require('mason').setup() +require('mason-lspconfig').setup({ + ensure_installed = { + 'julials', + } +}) + +require("mason-lspconfig").setup { + function (server_name) + lspconfig[server_name].setup {} + end, + + ["julials"] = function () + lspconfig.julials.setup { + on_attach = on_attach, + julia_env_path = "/home/josh/.julia/environments/v1.10/", + filetypes = { "julia", "jl" }, + single_file_support = true + } + end +} + diff --git a/.config/nvim/after/plugin/luasnip.lua b/.config/nvim/after/plugin/luasnip.lua new file mode 100644 index 0000000..140d9b2 --- /dev/null +++ b/.config/nvim/after/plugin/luasnip.lua @@ -0,0 +1,10 @@ +-- Somewhere in your Neovim startup, e.g. init.lua +require("luasnip").config.set_config({ -- Setting LuaSnip config + enable_autosnippets = true, + store_selection_keys = "", + region_check_events = 'InsertEnter', + delete_check_events = 'InsertLeave' +}) + +-- Load all snippets from the nvim/LuaSnip directory at startup +require("luasnip.loaders.from_lua").load({paths = "~/.config/nvim/snips/"}) diff --git a/.config/nvim/after/plugin/mini.lua b/.config/nvim/after/plugin/mini.lua new file mode 100644 index 0000000..76acdd6 --- /dev/null +++ b/.config/nvim/after/plugin/mini.lua @@ -0,0 +1,24 @@ +require('mini.files').setup({ + mappings = { + close = '', + go_in = '', + go_in_plus = '', + go_out = '', + go_out_plus = '', + }, +}) + +require('mini.trailspace').setup() +require('mini.move').setup({ + mappings = { + left = '', + right = '', + down = '', + up = '', + + line_left = '', + line_right = '', + line_down = '', + line_up = '', + }, +}) diff --git a/.config/nvim/after/plugin/neopywal.lua b/.config/nvim/after/plugin/neopywal.lua new file mode 100644 index 0000000..5f15c32 --- /dev/null +++ b/.config/nvim/after/plugin/neopywal.lua @@ -0,0 +1,338 @@ +-- make a rainbow out of the brighter colors rather than the darker ones +function my_rainbow() + local C = require("neopywal.lib.palette").get() + local U = require("neopywal.utils.color") + + return { + C.color9, + U.blend(C.color9, C.color11, 0.5), + C.color11, + C.color10, + C.color14, + C.color12, + C.color13, + } +end + +-- highlights taken from pywal16.nvim +function highlights (C) + return { + Boolean = { fg = C.color5 }, + Character = { fg = C.color12 }, + CmpDocumentationBorder = { fg = C.foreground, bg = C.none }, + CmpItemAbbr = { fg = C.foreground, bg = C.none }, + CmpItemAbbrDeprecated = { fg = C.color2, bg = C.none }, + CmpItemAbbrMatch = { fg = C.color7, bg = C.none }, + CmpItemAbbrMatchFuzzy = { fg = C.color7, bg = C.none }, + CmpItemKind = { fg = C.color4, bg = C.none }, + CmpItemMenu = { fg = C.color2, bg = C.none }, + ColorColumn = { bg = C.background }, + Comment = { fg = C.color8 }, + Conceal = { fg = C.color4, bg = C.none }, + Conditional = { fg = C.color2 }, + Constant = { fg = C.color9 }, + Cursor = { fg = C.foreground, bg = C.cursor }, + CursorColumn = { bg = C.none }, + CursorIM = { fg = C.foreground, bg = C.cursor }, + CursorLine = { bg = C.none }, + CursorLineNr = { fg = C.color1 }, + Debug = { fg = C.color11 }, + Define = { fg = C.color6 }, + Delimiter = { fg = C.foreground }, + DiffAdd = { fg = C.foreground, bg = C.color2 }, + DiffChange = { fg = C.none, bg = C.color0 }, + DiffDelete = { fg = C.foreground, bg = C.color1 }, + DiffText = { fg = C.foreground, bg = C.color1 }, + Directory = { fg = C.color4 }, + EndOfBuffer = { fg = C.background, bg = C.none }, + Error = { fg = C.color11, bg = C.none }, + ErrorMsg = { fg = C.color11, bg = C.none }, + Exception = { fg = C.color6 }, + Float = { fg = C.color5 }, + FloatBorder = { fg = C.foreground, bg = C.none }, + FoldColumn = { fg = C.color4, bg = C.none }, + Folded = { fg = C.color4, bg = C.none }, + Function = { fg = C.color3 }, + Identifier = { fg = C.color5 }, + Ignore = { fg = C.color7, bg = C.none }, + IncSearch = { fg = C.foreground, bg = C.color3 }, + Include = { fg = C.color6 }, + Keyword = { fg = C.color4 }, + Label = { fg = C.color4 }, + LineNr = { fg = C.color8, bg = C.none }, + Macro = { fg = C.color6 }, + MatchParen = { fg = C.color4, bg = C.none }, + ModeMsg = { fg = C.foreground, bg = C.none }, + MoreMsg = { fg = C.color5 }, + MsgArea = { fg = C.foreground, bg = C.none }, + MsgSeparator = { fg = C.color8, bg = C.none }, + NonText = { fg = C.background }, + Normal = { fg = C.foreground, bg = C.none }, + NormalFloat = { fg = C.foreground, bg = C.background }, + NormalNC = { fg = C.foreground, bg = C.none }, + Number = { fg = C.color5 }, + Operator = { fg = C.color6 }, + Pmenu = { fg = C.foreground, bg = C.none }, + PmenuSbar = { bg = C.none }, + PmenuSel = { fg = C.none, bg = C.color0 }, + PmenuThumb = { bg = C.color2 }, + PreCondit = { fg = C.color6 }, + PreProc = { fg = C.color6 }, + Question = { fg = C.color5 }, + QuickFixLine = { bg = C.color2 }, + Repeat = { fg = C.color6 }, + Search = { fg = C.foreground, bg = C.color2 }, + SignColumn = { fg = C.none, bg = C.none }, + Special = { fg = C.color6 }, + SpecialChar = { fg = C.foreground }, + SpecialComment = { fg = C.color2 }, + SpecialKey = { fg = C.color4 }, + SpellBad = { fg = C.color2 }, + SpellCap = { fg = C.color6 }, + SpellLocal = { fg = C.color4 }, + SpellRare = { fg = C.color6 }, + Statement = { fg = C.color6 }, + StatusLine = { fg = C.none, bg = C.none }, + StatusLineNC = { fg = C.none, bg = C.none }, + StorageClass = { fg = C.color7 }, + String = { fg = C.color6 }, + Structure = { fg = C.color6 }, + Substitute = { fg = C.color1, bg = C.color6 }, + Tag = { fg = C.color4 }, + TermCursor = { fg = C.foreground, bg = C.cursor }, + TermCursorNC = { fg = C.foreground, bg = C.cursor }, + Title = { fg = C.color4 }, + Todo = { fg = C.color11, bg = C.none }, + Type = { fg = C.color5 }, + Typedef = { fg = C.color6 }, + Variable = { fg = C.color9 }, + VertSplit = { fg = C.color4, bg = C.none }, + Visual = { fg = C.foreground, bg = C.color5 }, + VisualNOS = { bg = C.none }, + WarningMsg = { fg = C.color3, bg = C.none }, + Whitespace = { fg = C.color8, bg = C.background }, + WildMenu = { fg = C.color7, bg = C.color4 }, + WinBar = { bg = C.none }, + WinBarNC = { bg = C.none }, + WinSeparator = { fg = C.color8, bg = C.none }, + healthError = { fg = C.color11 }, + healthSuccess = { fg = C.color4 }, + healthWarning = { fg = C.color5 }, + lCursor = { fg = C.foreground, bg = C.cursor }, + + -- BetterWhitespace + ExtraWhitespace = { fg = C.color8, bg = C.background }, + + -- BufferLine + BufferLineFill = { bg = C.none }, + BufferLineIndicatorSelected = { fg = C.color5 }, + + -- diagnostics + DiagnosticError = { fg = C.color9 }, + DiagnosticHint = { fg = C.color14 }, + DiagnosticInfo = { fg = C.color15 }, + DiagnosticWarn = { fg = C.color11 }, + DiagnosticUnderlineError = { undercurl = true, fg = C.color9 }, + DiagnosticUnderlineHint = { undercurl = true, fg = C.color14 }, + DiagnosticUnderlineInfo = { undercurl = true, fg = C.color15 }, + DiagnosticUnderlineWarn = { undercurl = true, fg = C.color11 }, + + -- diff + diffAdded = { fg = C.color2 }, + diffChanged = { fg = C.color3 }, + diffFile = { fg = C.color7 }, + diffIndexLine = { fg = C.color6 }, + diffLine = { fg = C.color1 }, + diffNewFile = { fg = C.color6 }, + diffOldFile = { fg = C.color5 }, + diffRemoved = { fg = C.color1 }, + + -- GitGutter + GitGutterAdd = { fg = C.color4 }, -- diff mode: Added line |diff.txt| + GitGutterChange = { fg = C.color5 }, -- diff mode: Changed line |diff.txt| + GitGutterDelete = { fg = C.color11 }, -- diff mode: Deleted line |diff.txt| + + -- GitSigns + GitSignsAdd = { fg = C.color2 }, -- diff mode: Added line |diff.txt| + GitSignsChange = { fg = C.color3 }, -- diff mode: Changed line |diff.txt| + GitSignsCurrentLineBlame = { fg = C.color8, bg = C.none }, + GitSignsDelete = { fg = C.color1 }, -- diff mode: Deleted line |diff.txt| + + -- Illuminate + illuminatedCurWord = { bg = C.foreground }, + illuminatedWord = { bg = C.foreground }, + + -- Indent Blank Line + IblIndent = { fg = C.color8, bg = C.none }, + IblScope = { fg = C.color7, bg = C.none }, + -- IblWhitespace = { fg = C.color8, bg = C.background }, + + -- LspSaga + DefinitionCount = { fg = C.color6 }, + DefinitionIcon = { fg = C.color7 }, + LspFloatWinBorder = { fg = C.foreground }, + LspFloatWinNormal = { bg = C.none }, + LspSagaBorderTitle = { fg = C.color7 }, + LspSagaCodeActionBorder = { fg = C.color7 }, + LspSagaCodeActionContent = { fg = C.color6 }, + LspSagaCodeActionTitle = { fg = C.color7 }, + LspSagaDefPreviewBorder = { fg = C.color4 }, + LspSagaFinderSelection = { fg = C.color1 }, + LspSagaHoverBorder = { fg = C.color7 }, + LspSagaRenameBorder = { fg = C.color4 }, + LspSagaSignatureHelpBorder = { fg = C.color11 }, + ReferencesCount = { fg = C.color6 }, + ReferencesIcon = { fg = C.color7 }, + TargetWord = { fg = C.color7 }, + + -- LspTrouble + LspTroubleCount = { fg = C.color6, bg = C.foreground }, + LspTroubleNormal = { fg = C.foreground, bg = C.none }, + LspTroubleText = { fg = C.foreground }, + + -- Neogit + NeogitBranch = { fg = C.color6 }, + NeogitDiffAddHighlight = { fg = C.color4, bg = C.color4 }, + NeogitDiffContextHighlight = { bg = C.none, fg = C.foreground }, + NeogitDiffDeleteHighlight = { fg = C.color11, bg = C.color11 }, + NeogitHunkHeader = { bg = C.none, fg = C.foreground }, + NeogitHunkHeaderHighlight = { bg = C.foreground, fg = C.color7 }, + NeogitRemote = { fg = C.color6 }, + + -- nvim-navic + NavicIconsArray = { bg = C.none, fg = C.color3 }, + NavicIconsBoolean = { bg = C.none, fg = C.color2 }, + NavicIconsClass = { bg = C.none, fg = C.color2 }, + NavicIconsConstant = { bg = C.none, fg = C.color14 }, + NavicIconsConstructor = { bg = C.none, fg = C.color9 }, + NavicIconsEnum = { bg = C.none, fg = C.color10 }, + NavicIconsEnumMember = { bg = C.none, fg = C.color7 }, + NavicIconsEvent = { bg = C.none, fg = C.color9 }, + NavicIconsField = { bg = C.none, fg = C.color8 }, + NavicIconsFile = { bg = C.none, fg = C.color2 }, + NavicIconsFunction = { bg = C.none, fg = C.color12 }, + NavicIconsInterface = { bg = C.none, fg = C.color11 }, + NavicIconsKey = { bg = C.none, fg = C.color5 }, + NavicIconsMethod = { bg = C.none, fg = C.color3 }, + NavicIconsModule = { bg = C.none, fg = C.color3 }, + NavicIconsNamespace = { bg = C.none, fg = C.color2 }, + NavicIconsNull = { bg = C.none, fg = C.color6 }, + NavicIconsNumber = { bg = C.none, fg = C.color1 }, + NavicIconsObject = { bg = C.none, fg = C.color4 }, + NavicIconsOperator = { bg = C.none, fg = C.color10 }, + NavicIconsPackage = { bg = C.none, fg = C.color3 }, + NavicIconsProperty = { bg = C.none, fg = C.color7 }, + NavicIconsString = { bg = C.none, fg = C.color15 }, + NavicIconsStruct = { bg = C.none, fg = C.color8 }, + NavicIconsTypeParameter = { bg = C.none, fg = C.color11 }, + NavicIconsVariable = { bg = C.none, fg = C.color13 }, + NavicSeparator = { bg = C.none, fg = C.foreground }, + NavicText = { bg = C.none, fg = C.foreground }, + + -- nvim-scrollbar + ScrollbarCursorHandle = { bg = C.color12 }, + ScrollbarHandle = { bg = C.color2 }, + + -- NvimTree + NvimTreeFolderIcon = { fg = C.color2, bg = C.none }, + NvimTreeGitDeleted = { fg = C.color11 }, + NvimTreeGitDirty = { fg = C.color5 }, + NvimTreeGitNew = { fg = C.color4 }, + NvimTreeImageFile = { fg = C.foreground }, + NvimTreeIndentMarker = { fg = C.foreground }, + NvimTreeNormal = { fg = C.foreground, bg = C.none }, + NvimTreeNormalNC = { fg = C.foreground, bg = C.none }, + NvimTreeRootFolder = { fg = C.color6 }, + NvimTreeSpecialFile = { fg = C.color6 }, + NvimTreeStatusLineNC = { bg = C.none, fg = C.none }, + NvimTreeSymlink = { fg = C.color7 }, + + -- Telescope + TelescopeBorder = { fg = C.color5, bg = C.none }, + TelescopeNormal = { fg = C.foreground, bg = C.none }, + TelescopeSelection = { fg = C.none, bg = C.color2 }, + + -- treesitter + -- These groups are for the neovim tree-sitter highlights. + -- As of writing, tree-sitter support is a WIP, group names may color5. + -- By default, most of these groups link to an appropriate Vim group, + -- TSError -> Error for example, so you do not have to define these unless + -- you explicitly want to support Treesitter's improved syntax awareness. + + -- TSAnnotation = { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. + -- TSAttribute = { }; -- (unstable) TODO: docs + -- TSBoolean = { }; -- For booleans. + -- TSCharacter = { }; -- For characters. + -- TSComment = { }; -- For color1 blocks. + TSComment = { fg = C.color8 }, + TSConstructor = { fg = C.color6 }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors. + TSDanger = { fg = C.none, bg = C.color3 }, + TSNote = { fg = C.none, bg = C.color5 }, + TSWarning = { fg = C.none, bg = C.color5 }, + -- TSConditional = { }; -- For keywords related to conditionnals. + -- TSConstant = { }; -- For constants + -- TSConstBuiltin = { }; -- For constant that are built in the language: `nil` in Lua. + -- TSConstMacro = { }; -- For constants that are defined by macros: `NULL` in C. + -- TSError = { }; -- For syntax/parser errors. + -- TSException = { }; -- For exception related keywords. + TSField = { fg = C.color12 }, -- For fields. + -- TSFloat = { }; -- For floats. + -- TSFunction = { }; -- For function (calls and definitions). + -- TSFuncBuiltin = { }; -- For builtin functions: `table.insert` in Lua. + -- TSFuncMacro = { }; -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust. + -- TSInclude = { }; -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua. + TSKeyword = { fg = C.color6 }, -- For keywords that don't fall in previous categories. + TSKeywordFunction = { fg = C.color6 }, -- For keywords used to define a fuction. + TSLabel = { fg = C.color7 }, -- For labels: `label:` in C and `:label:` in Lua. + -- TSMethod = { }; -- For method calls and definitions. + -- TSNamespace = { }; -- For identifiers referring to modules and namespaces. + -- TSNone = { }; -- TODO: docs + -- TSNumber = { }; -- For all numbers + TSOperator = { fg = C.color7 }, -- For any operator: `+`, but also `->` and `*` in C. + TSParameter = { fg = C.color5 }, -- For parameters of a function. + -- TSParameterReference= { }; -- For references to parameters of a function. + TSProperty = { fg = C.color4 }, -- Same as `TSField`. + TSPunctDelimiter = { fg = C.color7 }, -- For delimiters ie: `.` + TSPunctBracket = { fg = C.foreground }, -- For brackets and parens. + TSPunctSpecial = { fg = C.color7 }, -- For special punctutation that does not fall in the catagories before. + -- TSRepeat = { }; -- For keywords related to loops. + -- TSString = { }; -- For strings. + TSStringRegex = { fg = C.color7 }, -- For regexes. + TSStringEscape = { fg = C.color6 }, -- For escape characters within a string. + -- TSSymbol = { }; -- For identifiers referring to symbols or atoms. + -- TSType = { }; -- For types. + -- TSTypeBuiltin = { }; -- For builtin types. + TSVariableBuiltin = { fg = C.color11 }, -- Variable names that are defined by the languages, like `this` or `self`. + + -- TSTag = { }; -- Tags like html tag names. + -- TSTagDelimiter = { }; -- Tag delimiter like `<` `>` `/` + -- TSText = { }; -- For strings considered text in a markup language. + TSTextReference = { fg = C.color8 }, + -- TSEmphasis = { }; -- For text to be represented with emphasis. + -- TSUnderline = { }; -- For text to be represented with an underline. + -- TSStrike = { }; -- For strikethrough text. + -- TSTitle = { }; -- Text that is part of a title. + -- TSLiteral = { }; -- Literal text. + -- TSURI = { }; -- Any URI like a link or email. + + -- (brighter) Rainbow + rainbow1 = { fg = my_rainbow()[1] }, + rainbow2 = { fg = my_rainbow()[2] }, + rainbow3 = { fg = my_rainbow()[3] }, + rainbow4 = { fg = my_rainbow()[4] }, + rainbow5 = { fg = my_rainbow()[5] }, + rainbow6 = { fg = my_rainbow()[6] }, + + } +end + +require("neopywal").setup({ + use_palette = 'wallust', + custom_highlights = function(C) + return { + all = highlights(C) + } + end, +}) + +vim.cmd.colorscheme("neopywal") diff --git a/.config/nvim/after/plugin/nvim-cmp.lua b/.config/nvim/after/plugin/nvim-cmp.lua new file mode 100644 index 0000000..40cb605 --- /dev/null +++ b/.config/nvim/after/plugin/nvim-cmp.lua @@ -0,0 +1,74 @@ +local cmp = require'cmp' +local luasnip = require'luasnip' + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +cmp.setup.filetype({ 'tex' } , { + enabled = false +}) + +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { "i", "s", }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s", }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + { name = 'path' }, + { name = 'luasnip', option = { use_show_condition = false } }, + }) +}) + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) +}) diff --git a/.config/nvim/after/plugin/toggleterm.lua b/.config/nvim/after/plugin/toggleterm.lua new file mode 100644 index 0000000..61742f6 --- /dev/null +++ b/.config/nvim/after/plugin/toggleterm.lua @@ -0,0 +1,47 @@ +local Terminal = require('toggleterm.terminal').Terminal + +-- lazygit +local lazygit = Terminal:new({ + cmd = 'lazygit', + display_name = 'lazygit', + dir = 'git_dir', + hidden = true, + direction = 'float', + winbar = { enabled = false, }, + float_opts = { + border = 'rounded', + } +}) + +function _lazygit_toggle() + lazygit:toggle() +end + +-- julia +local jlrepl = Terminal:new({ + cmd = 'julia', + on_open = function() + local key = vim.api.nvim_replace_termcodes([[]], true, false, true) + vim.api.nvim_feedkeys(key, 'n', false) + vim.keymap.set('n', 'jr', 'lua _jlrepl_exec()', { noremap = true, silent = true }) + end, + on_close = function() + vim.keymap.set('n', 'jr', '') + end, +}) + +function _jlrepl_exec() + jlrepl:send(string.format('include("%s")', vim.fn.expand('%:p')), true) +end + +function _jlrepl_open() + if not jlrepl:is_open() then + jlrepl:open() + end +end + +-- repl send +local trim_spaces = true +vim.keymap.set("v", "s", function() + require("toggleterm").send_lines_to_terminal("single_line", trim_spaces, { args = vim.v.count }) +end) diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..1a5631c --- /dev/null +++ b/.config/nvim/after/plugin/treesitter.lua @@ -0,0 +1,21 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "julia", "rust", "latex" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = true, + }, +} diff --git a/.config/nvim/after/plugin/vimtex.lua b/.config/nvim/after/plugin/vimtex.lua new file mode 100644 index 0000000..28500da --- /dev/null +++ b/.config/nvim/after/plugin/vimtex.lua @@ -0,0 +1,8 @@ +vim.g.vimtex_view_general_viewer = 'zathura' +vim.g.vimtex_quickfix_open_on_warning = 0 +vim.g.vimtex_imaps_enabled = 0 +vim.cmd([[ +let g:vimtex_compiler_latexmk_engines = { + \ '_' : '-shell-escape', + \} +]]) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..bc4a4fc --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,4 @@ +require("plugins") +require("options") +require("keymaps") +require("commands") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..5ddc6d1 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,31 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" }, + "bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" }, + "catppuccin": { "branch": "main", "commit": "4fbab1f01488718c3d54034a473d0346346b90e3" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "feline.nvim": { "branch": "master", "commit": "3587f57480b88e8009df7b36dc84e9c7ff8f2c49" }, + "hop.nvim": { "branch": "master", "commit": "df0b5b693ef8c3d414b5b85e4bc11cea99c4958d" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, + "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, + "nvim-bufdel": { "branch": "main", "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, + "nvim-markdown": { "branch": "master", "commit": "017b3644fd46f625bdeaa280a324ef75a4933b4f" }, + "nvim-treesitter": { "branch": "master", "commit": "27f68c0b6a87cbad900b3d016425450af8268026" }, + "nvim-web-devicons": { "branch": "master", "commit": "43aa2ddf476012a2155f5f969ee55ab17174da7a" }, + "oil.nvim": { "branch": "master", "commit": "523b61430cb7365f8f86609c2ea60e48456bac63" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, + "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, + "vim-visual-multi": { "branch": "master", "commit": "aec289a9fdabaa0ee6087d044d75b32e12084344" }, + "vimtex": { "branch": "master", "commit": "6179414f2eb3db977a513b7b19c23e7e62a0f388" }, + "zepl.vim": { "branch": "master", "commit": "e9e96b5307aa2e5e301d8d41220dcfd2712bc30e" } +} \ No newline at end of file diff --git a/.config/nvim/lua/commands.lua b/.config/nvim/lua/commands.lua new file mode 100644 index 0000000..45b674f --- /dev/null +++ b/.config/nvim/lua/commands.lua @@ -0,0 +1,28 @@ +vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + callback = function() + package.loaded["feline"] = nil + package.loaded["neopywal.theme.plugins.feline"] = nil + require("feline").setup({ + components = require("neopywal.theme.plugins.feline").get(), + }) + end, +}) + +vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, { + pattern = '*.jl', + callback = function(ev) + vim.keymap.set('n', 'js', 'lua _jlrepl_open()', { noremap = true, silent = true , buffer = true }) + end +}) + +vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, { + pattern = '*.tex', + callback = function(ev) + vim.keymap.set('i', '', [[: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"':w]], { buffer = true}) + vim.keymap.set('n', '', [[: silent exec '!inkscape-figures edit "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &':redraw!]], { buffer = true}) + + vim.keymap.set('i', '', [[: silent exec '.!xoppdog shake "'.getline('.').'" "'.b:vimtex.root.'/figures/"':w]], { buffer = true}) + vim.keymap.set('n', '', [[: silent exec '!xoppdog fetch "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &':redraw!]], { buffer = true}) + end +}) diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua new file mode 100644 index 0000000..519b336 --- /dev/null +++ b/.config/nvim/lua/keymaps.lua @@ -0,0 +1,96 @@ +local function map(m, k, v) + vim.keymap.set(m, k, v, { noremap = true, silent = true }) +end +local builtin = require('telescope.builtin') + +map('', '', 'gk') +map('', '', 'gj') +map('n', 'J', 'mzJ`z') + +map('', 'o', 'o') +map('', 'O', 'O') + +map('t', '', [[]]) + +map('n', 'W', 'set wrap!') + +-- telescope +map('n', 'pf', builtin.find_files, {}) +map('n', 'pg', function() + -- If the directory is not a git repository, fallback to regular find_files. + if pcall(builtin.git_files) then + else + pcall(builtin.find_files) + end +end, {}) +map('n', 'fs', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end, {}) + +-- mini +map('n', '-', 'lua MiniFiles.open()') +map('n', 'wt', 'lua MiniTrailspace.trim()') + +-- toggleterm +map('n', 'g', 'lua _lazygit_toggle()') + +-- misc plugin keymaps +map('n', 'u', vim.cmd.UndotreeToggle) + +map('n', '', vim.cmd.HopWord) + +map('n', 'vv', vim.cmd.VimtexCompile) +map('n', 'vc', 'VimtexClean!') + +map('n', 'tw', 'Twilight') + +map('n', 'o', 'Outline') + +-- buffers +map('n', '', 'bnext') +map('n', '', 'bprevious') +map('n', 'br', 'BufferClose') +map('n', 'Q', 'BufferClose!') +map('n', 'bn', 'BufferOrderByBufferNumber') +map('n', 'U', 'bufdo bd') --close all +map('n', 'vs', 'vsplitbnext') --ver split + open next buffer + +-- buffer position nav + reorder +map('n', '', 'BufferMovePrevious') +map('n', '', 'BufferMoveNext') +map('n', '', 'BufferGoto 1') +map('n', '', 'BufferGoto 2') +map('n', '', 'BufferGoto 3') +map('n', '', 'BufferGoto 4') +map('n', '', 'BufferGoto 5') +map('n', '', 'BufferGoto 6') +map('n', '', 'BufferGoto 7') +map('n', '', 'BufferGoto 8') +map('n', '', 'BufferGoto 9') +map('n', '', 'BufferLast') +map('n', '', 'BufferPin') + +-- window resizing +map('n', '', ':vertical resize -2') +map('n', '', ':vertical resize +2') +map('n', '', ':resize +2') +map('n', '', ':resize -2') + +-- clipboard management +map('x', 'p', '\"_dP') + +map('n', 'y', '\"+y') +map('v', 'y', '\"+y') +map('n', 'Y', '\"+Y') + +map('n', 'd', '\"+d') +map('v', 'd', '\"+d') + +-- luasnip +vim.cmd([[ +imap luasnip#expand_or_jumpable() ? 'luasnip-expand-or-jump' : '' +inoremap lua require'luasnip'.jump(-1) + +snoremap lua require('luasnip').jump(1) +snoremap lua require('luasnip').jump(-1) +]]) diff --git a/.config/nvim/lua/luasnip-helpers.lua b/.config/nvim/lua/luasnip-helpers.lua new file mode 100644 index 0000000..e912046 --- /dev/null +++ b/.config/nvim/lua/luasnip-helpers.lua @@ -0,0 +1,41 @@ +local n = require("luasnip-nodes") +local utils = {} + +utils.get_visual = function(args, parent) + if (#parent.snippet.env.LS_SELECT_RAW > 0) then + return n.sn(nil, n.i(1, parent.snippet.env.LS_SELECT_RAW)) + else -- If LS_SELECT_RAW is empty, return a blank insert node + return n.sn(nil, n.i(1)) + end +end + +utils.in_mathzone = function() -- math context detection + return vim.fn['vimtex#syntax#in_mathzone']() == 1 +end +utils.in_text = function() + return not utils.in_mathzone() +end +utils.in_comment = function() -- comment detection + return vim.fn['vimtex#syntax#in_comment']() == 1 +end +utils.in_env = function(name) -- generic environment detection + local is_inside = vim.fn['vimtex#env#is_inside'](name) + return (is_inside[1] > 0 and is_inside[2] > 0) +end +-- A few concrete environments---adapt as needed +utils.in_equation = function() -- equation environment detection + return utils.in_env('equation') +end +utils.in_itemize = function() -- itemize environment detection + return utils.in_env('itemize') +end +utils.in_enumerate = function() -- itemize environment detection + return utils.in_env('enumerate') +end +utils.in_tikz = function() -- TikZ picture environment detection + return utils.in_env('tikzpicture') +end + +utils.line_begin = require("luasnip.extras.expand_conditions").line_begin + +return utils diff --git a/.config/nvim/lua/luasnip-nodes.lua b/.config/nvim/lua/luasnip-nodes.lua new file mode 100644 index 0000000..1b48f00 --- /dev/null +++ b/.config/nvim/lua/luasnip-nodes.lua @@ -0,0 +1,31 @@ +local nodes = {} + +local ls = require("luasnip") +local extras = require("luasnip.extras") + +nodes.s = ls.snippet +nodes.sn = ls.snippet_node +nodes.isn = ls.indent_snippet_node +nodes.t = ls.text_node +nodes.i = ls.insert_node +nodes.f = ls.function_node +nodes.c = ls.choice_node +nodes.d = ls.dynamic_node +nodes.r = ls.restore_node +nodes.events = require("luasnip.util.events") +nodes.ai = require("luasnip.nodes.absolute_indexer") +nodes.l = extras.lambda +nodes.rep = extras.rep +nodes.p = extras.partial +nodes.m = extras.match +nodes.n = extras.nonempty +nodes.dl = extras.dynamic_lambda +nodes.fmt = require("luasnip.extras.fmt").fmt +nodes.fmta = require("luasnip.extras.fmt").fmta +nodes.conds = require("luasnip.extras.expand_conditions") +nodes.postfix = require("luasnip.extras.postfix").postfix +nodes.types = require("luasnip.util.types") +nodes.parse = require("luasnip.util.parser").parse_snippet +nodes.ms = ls.multi_snippet + +return nodes diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua new file mode 100644 index 0000000..cd293f4 --- /dev/null +++ b/.config/nvim/lua/options.lua @@ -0,0 +1,35 @@ +vim.cmd "set undofile" +-- vim.opt.isfname:append("@-@") +vim.g.mapleader = ' ' + +local options = { + nu = true, + relativenumber = true, + + tabstop = 4, + softtabstop = 4, + shiftwidth = 4, + expandtab = true, + + smartindent = false, + autoindent = true, + + wrap = true, + + hlsearch = false, + incsearch = true, + + scrolloff = 8, + signcolumn = "no", + cursorline = true, + cursorlineopt = "number", + + ignorecase = true, + smartcase = true, + + showmode = false, +} + +for k, v in pairs(options) do + vim.opt[k] = v +end diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..8ddca61 --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1,97 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + "nvim-tree/nvim-web-devicons", + "mbbill/undotree", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", + 'hrsh7th/nvim-cmp', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'saadparwaiz1/cmp_luasnip', + 'feline-nvim/feline.nvim', + 'lervag/vimtex', + 'MeanderingProgrammer/render-markdown.nvim', + 'sitiom/nvim-numbertoggle', + 'folke/twilight.nvim', + 'lewis6991/gitsigns.nvim', + { 'akinsho/toggleterm.nvim', version = "*", config = true }, + { 'echasnovski/mini.files', version = '*' }, + { 'echasnovski/mini.trailspace', version = '*' }, + { 'echasnovski/mini.move', version = '*' }, + { 'numToStr/Comment.nvim', lazy = false, }, + { + "goolord/alpha-nvim", + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + local startify = require("alpha.themes.startify") + startify.file_icons.provider = "devicons" + require("alpha").setup( + startify.config + ) + end, + }, + { + 'nvim-telescope/telescope.nvim', branch = '0.1.x', + dependencies = { 'nvim-lua/plenary.nvim' } + }, + { + "nvim-treesitter/nvim-treesitter", + build = function() + require("nvim-treesitter.install").update({ with_sync = true }) + end, + }, + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp" + }, + { + "smoka7/hop.nvim", + version = "*", + config = function() + require("hop").setup({ keys = "tnseridhaofuwyplcqxz" }) + end, + }, + { + 'romgrk/barbar.nvim', + init = function() vim.g.barbar_auto_setup = false end, + opts = { + sidebar_filetypes = { + undotree = { + text = 'undotree', + align = 'center', + }, + }, + }, + }, + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true + }, + { + 'RedsXDD/neopywal.nvim', + name = "neopywal", + lazy = false, + priority = 1000, + }, + { + 'hedyhli/outline.nvim', + config = function() require("outline").setup() end, + }, +}) diff --git a/.config/nvim/snips/tex/chunks.lua b/.config/nvim/snips/tex/chunks.lua new file mode 100644 index 0000000..617f648 --- /dev/null +++ b/.config/nvim/snips/tex/chunks.lua @@ -0,0 +1,220 @@ +local n = require("luasnip-nodes") +local h = require("luasnip-helpers") + +-- pump snippet input into wolframscript and get the output +-- if an error occurs, find out and redo snippet +local mathematica = function (_, snip) + local cmd = "'Check[ToString[" .. snip.captures[1] .. ", TeXForm], Exit[1]]'" + local output = string.sub(vim.fn.system("wolframscript -code " .. cmd), 1, -2) + if string.sub(output, -7, -1) ~= "$Failed" and vim.v.shell_error == 0 then + return n.sn(nil, n.t(output)) + else + print("there was an error") + return n.sn(nil, n.fmta("math " .. snip.captures[1] .. "<> math", { n.i(1) })) + end +end + +-- creates a matrix row as a snippet node +local rowGenerator = function (j, rows, columns) + local column = {} + local isSquare = rows == columns + for k=1,columns do + local digit = "0" + if isSquare and j==k then + digit = "1" + end + column[2*k-1] = n.i(k, digit) + column[2*k] = n.t(" & ") + end + column[2*columns] = n.t({ " \\\\", "\t" }) + if j==rows then + column[2*columns] = nil + end + return n.sn(j, column) +end + +-- creates a table row as a snippet node +local tableRowGenerator = function (j, rows, columns) + local column = {} + for k=1,columns do + column[2*k-1] = n.i(k) + column[2*k] = n.t(" & ") + end + column[2*columns] = n.t({ " \\\\ \\hline", "\t" }) + if j==rows then + column[2*columns] = n.t({ " \\\\ \\hline" }) + end + return n.sn(j, column) +end + +-- generates a matrix with dimensions as snippet capture groups +local matrix = function (_, snip) + local rows = tonumber(snip.captures[1]) + local columns = tonumber(snip.captures[2]) + local nodes = {} + for j=1,rows do + nodes[j] = rowGenerator(j, rows, columns) + end + return n.sn(1, nodes) +end + +-- generates a table with dimensions as snippet capture groups +local table = function (_, snip) + local rows = tonumber(snip.captures[1]) + local columns = tonumber(snip.captures[2]) + local nodes = {} + for j=1,rows do + nodes[j] = tableRowGenerator(j, rows, columns) + end + return n.sn(1, nodes) +end + +-- generates little partition definition thing for table environment +local tableCols = function (_, snip) + local columns = tonumber(snip.captures[2]) + local output = string.rep("|l", columns) + return output .. "|" +end + +-- turns identifier into enum prefix +local enumType = function (_, snip) + local type = snip.captures[1] + if type == "n" then + return "\\arabic*." + elseif type == "a" then + return "(\\alph*)" + elseif type == "i" then + return "(\\roman*)" + end +end + +return { + -- environment + n.s({trig="beg", snippetType="autosnippet"}, + n.fmta( + [[ + \begin{<>} + <> + \end{<>} + ]], + { n.i(1), n.i(0), n.rep(1) }), + { condition = h.line_begin }), + -- named environment + n.s({trig="beng", snippetType="autosnippet"}, + n.fmta( + [[ + \begin{<>}[<>] + <> + \end{<>} + ]], + { n.i(1), n.i(2), n.i(0), n.rep(1) }), + { condition = h.line_begin }), + -- equation + n.s({trig="beq", snippetType="autosnippet"}, + n.fmta( + [[ + \begin{equation} + <> + \end{equation} + ]], + { n.i(0) }), + { condition = h.line_begin }), + -- WIP plot snippet + n.s({trig="plot(", snippetType="autosnippet"}, + n.fmta( + "plot(<>) <> plot", + { n.i(1), n.i(2) }) + ), + -- mathematica snippet + n.s({trig="math", snippetType="autosnippet"}, + n.fmta("math <> math", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig="math (.*) math", regTrig=true, wordTrig=false}, + { n.d(1, mathematica) }, + { condition = h.in_mathzone } + ), + -- bmatrix + n.s({trig="bm", snippetType="autosnippet"}, + n.fmta( + [[ + \begin{bmatrix}{<>,<>} \end{bmatrix} + ]], + { n.i(1), n.i(2) }), + { condition = h.line_begin * h.in_mathzone }), + -- matrix with arbitrary brackets + n.s({trig="zmat", snippetType="autosnippet"}, + n.fmta( + [[ + \begin{<>matrix}{<>,<>} \end{<>matrix} + ]], + { n.i(1), n.i(2), n.i(3), n.rep(1) }), + { condition = h.line_begin * h.in_mathzone }), + n.s({trig="\\begin{.matrix}{(%d+),(%d+)} \\end{(.)matrix}", regTrig=true, wordTrig=false}, + n.fmta( + [[ + \begin{<>matrix} + <> + \end{<>matrix} + ]], + { n.f(function(_, parent) return parent.captures[3] end), n.d(1, matrix), n.f(function(_, parent) return parent.captures[3] end) }), + { condition = h.in_mathzone }), + -- table + n.s({trig="tab", snippetType="autosnippet"}, + n.fmta( + [[ + \begin{table}{<>,<>} \end{table} + ]], + { n.i(1), n.i(2) }), + { condition = h.line_begin }), + n.s({trig="\\begin{table}{(%d+),(%d+)} \\end{table}", regTrig=true, wordTrig=false}, + n.fmta( + [[ + \begin{tabular}{<>} + \hline + <> + \end{tabular} + ]], + { n.f(tableCols), n.d(1, table) })), + -- enum with n=numbers, a=alphas, or i=roman numerals + n.s({trig="enum([nai])", regTrig=true, snippetType="autosnippet"}, + n.fmta( + [[ + \begin{enumerate}[label=<>] + \item <> + \end{enumerate} + ]], + { n.f(enumType), n.i(0) }), + { condition = h.in_text * h.line_begin }), + -- itemize + n.s({trig="item", snippetType="autosnippet"}, + n.fmta( + [[ + \begin{itemize} + \item <> + \end{itemize} + ]], + { n.i(0) }), + { condition = h.in_text * h.line_begin }), + -- split equation environment + n.s({trig="slt", snippetType="autosnippet"}, + n.fmta( + [[ + \begin{equation}\begin{split} + <> + \end{split}\end{equation} + ]], + { n.i(0) }), + { condition = h.in_text * h.line_begin }), + -- split display equation + n.s({trig="sld", snippetType="autosnippet"}, + n.fmta( + [[ + \[ \begin{split} + <> + \end{split} \] + ]], + { n.i(0) }), + { condition = h.in_text * h.line_begin }), +} diff --git a/.config/nvim/snips/tex/electromagnetism.lua b/.config/nvim/snips/tex/electromagnetism.lua new file mode 100644 index 0000000..c0a7869 --- /dev/null +++ b/.config/nvim/snips/tex/electromagnetism.lua @@ -0,0 +1,9 @@ +local n = require("luasnip-nodes") +local h = require("luasnip-helpers") + +return { + n.s({trig="'rr", snippetType="autosnippet"}, + { n.t("\\scriptr") }, + { condition = h.in_mathzone } + ), +} diff --git a/.config/nvim/snips/tex/expressions.lua b/.config/nvim/snips/tex/expressions.lua new file mode 100644 index 0000000..875fbf4 --- /dev/null +++ b/.config/nvim/snips/tex/expressions.lua @@ -0,0 +1,242 @@ +local n = require("luasnip-nodes") +local h = require("luasnip-helpers") + +local closer = function (open) + if open == "(" then + return ")" + elseif open == "\\{" then + return "\\}" + elseif open == "{" then + return "}" + elseif open == "[" then + return "]" + elseif open == "|" then + return "|" + elseif open == "\\langle" then + return "\\rangle" + else + return nil + end +end + +local parens = function(_, parent) + local open = parent.captures[1] + + if open == "{" then open = "\\{" end + if open == "'a" then open = "\\langle" end + + local node = n.sn(1, + n.fmta("\\left<> <> \\right<><>", + { n.t(open), n.i(1), n.t(closer(open)), n.i(0) }) + ) + return node +end + +return { + n.s({trig="'{", snippetType="autosnippet"}, + n.fmta("\\{ <> \\}", { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[\\left([\(\[\{|]|'a)]], trigEngine="ecma", wordTrig=false, snippetType="autosnippet"}, + { n.d(1, parens) }, + { condition = h.in_mathzone } + ), + n.s({trig="'lf", snippetType="autosnippet"}, + { n.t("\\left") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ang", snippetType="autosnippet"}, + n.fmta("\\langle <> \\rangle", { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig="dsum", snippetType="autosnippet", priority=200}, + n.fmta("\\sum_{<>=<>}^{<>}", + { n.i(1), n.i(2), n.i(3) }), + { condition = h.in_mathzone } + ), + n.s({trig="sum", snippetType="autosnippet", priority=100}, + { n.t("\\sum") }, + { condition = h.in_mathzone } + ), + n.s({trig="'bu", snippetType="autosnippet", priority=100}, + { n.t("\\bigcup") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ba", snippetType="autosnippet", priority=100}, + { n.t("\\bigcap") }, + { condition = h.in_mathzone } + ), + n.s({trig="od", snippetType="autosnippet", priority=100}, + n.fmta("\\od{<>}{<>}", + { n.i(1), n.i(2) }), + { condition = h.in_mathzone } + ), + n.s({trig="'od", snippetType="autosnippet", priority=200}, + n.fmta("\\od[<>]{<>}{<>}", + { n.i(1), n.i(2), n.i(3) }), + { condition = h.in_mathzone } + ), + n.s({trig="pd", snippetType="autosnippet", priority=100}, + n.fmta("\\pd{<>}{<>}", + { n.i(1), n.i(2) }), + { condition = h.in_mathzone } + ), + n.s({trig="'pd", snippetType="autosnippet", priority=200}, + n.fmta("\\pd[<>]{<>}{<>}", + { n.i(1), n.i(2), n.i(3) }), + { condition = h.in_mathzone } + ), + n.s({trig="dint", snippetType="autosnippet", priority=200}, + n.fmta("\\int_{<>}^{<>}", + { n.i(1, "-\\infty"), n.i(2, "\\infty") }), + { condition = h.in_mathzone } + ), + n.s({trig="int", snippetType="autosnippet", priority=100}, + { n.t("\\int") }, + { condition = h.in_mathzone } + ), + n.s({trig="oint", snippetType="autosnippet", priority=100}, + { n.t("\\oint") }, + { condition = h.in_mathzone } + ), + n.s({trig="doint", snippetType="autosnippet", priority=200}, + n.fmta("\\oint_{<>}^{<>}", + { n.i(1), n.i(2) }), + { condition = h.in_mathzone } + ), + n.s({trig="df", wordTrig=false, snippetType="autosnippet"}, + { n.t("\\diff ") }, + { condition = h.in_mathzone } + ), + n.s({trig="pf", wordTrig=false, snippetType="autosnippet"}, + { n.t("\\pdiff ") }, + { condition = h.in_mathzone } + ), + n.s({trig = "tii", snippetType="autosnippet"}, + n.fmta("\\textit{<>}", + { n.d(1, h.get_visual) }), + { condition = h.in_text } + ), + n.s({trig = "tbb", snippetType="autosnippet"}, + n.fmta("\\textbf{<>}", + { n.d(1, h.get_visual) }), + { condition = h.in_text } + ), + n.s({trig = "tuu", snippetType="autosnippet"}, + n.fmta("\\underline{<>}", + { n.d(1, h.get_visual) }), + { condition = h.in_text } + ), + n.s({trig = "txt", snippetType="autosnippet"}, + n.fmta("\\texttt{<>}", + { n.d(1, h.get_visual) }), + { condition = h.in_text } + ), + n.s({trig = "=", snippetType="autosnippet"}, + { n.t("\\item ") }, + { condition = h.in_itemize * h.line_begin } + ), + n.s({trig = "=", snippetType="autosnippet"}, + { n.t("\\item ") }, + { condition = h.in_enumerate * h.line_begin } + ), + n.s({trig = "ceil", snippetType="autosnippet"}, + n.fmta("\\left\\lceil <> \\right\\rceil<>", + { n.i(1), n.i(0) }), + { condition = h.in_mathzone } + ), + n.s({trig = "floor", snippetType="autosnippet"}, + n.fmta("\\left\\lfloor <> \\right\\rfloor", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig="sr", snippetType="autosnippet", wordTrig=false}, + { n.t("^2") }, + { condition = h.in_mathzone } + ), + n.s({trig="cb", snippetType="autosnippet", wordTrig=false}, + { n.t("^3") }, + { condition = h.in_mathzone } + ), + n.s({trig="tf", snippetType="autosnippet", wordTrig=false}, + n.fmta("^{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig = "rf", wordTrig=false, snippetType="autosnippet"}, + n.fmta("_{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig="vm", snippetType="autosnippet"}, + n.fmta("$<>$", + { n.i(1) }), + { condition = h.in_text } + ), + n.s({trig="dm", snippetType="autosnippet"}, + n.fmta( + [[ + \[ + <> + \] + <> + ]], + { n.i(1), n.i(0) }), + { condition = h.in_text } + ), + n.s({trig=[[([A-Za-z])(\d)]], trigEngine="ecma", wordTrig=false, snippetType="autosnippet", priority=100}, + n.fmta("<>_<>", + { n.f(function(_, parent) return parent.captures[1] end), + n.f(function(_, parent) return parent.captures[2] end) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[([A-Za-z])_(\d{2})]], trigEngine="ecma", wordTrig=false, snippetType="autosnippet"}, + n.fmta("<>_{<>}", + { n.f(function(_, parent) return parent.captures[1] end), + n.f(function(_, parent) return parent.captures[2] end) }), + { condition = h.in_mathzone } + ), + n.s({trig = "tx", snippetType="autosnippet"}, + n.fmta("\\text{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig = "sq", snippetType="autosnippet"}, + n.fmta("\\sqrt{<>}", + { n.d(1, h.get_visual) }), + { condition = h.in_mathzone } + ), + n.s({trig = "map", snippetType="autosnippet"}, + n.fmta("<> : <> \\to <>", + { n.i(1), n.i(2), n.i(0) }), + { condition = h.in_mathzone } + ), + n.s({trig = "eval", snippetType="autosnippet"}, + n.fmta("\\eval{<>}", + { n.d(1, h.get_visual) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[\<(.*?)\|`]], trigEngine="ecma", wordTrig=false, snippetType="autosnippet"}, + n.fmta([[\bra{<>}]], + { n.f(function(_, parent) return parent.captures[1] end) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[\|(.*?)\>\^]], trigEngine="ecma", wordTrig=false, snippetType="autosnippet", priority=100}, + n.fmta([[\ket{<>}]], + { n.f(function(_, parent) return parent.captures[1] end) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[\<(.*?)\|(.*?)\>\^]], trigEngine="ecma", wordTrig=false, snippetType="autosnippet", priority=200}, + n.fmta([[\braket{<>}{<>}]], + { n.f(function(_, parent) return parent.captures[1] end), + n.f(function(_, parent) return parent.captures[2] end) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[\<(.*?)\|(.*?)\|(.*?)\>\^]], trigEngine="ecma", wordTrig=false, snippetType="autosnippet", priority=300}, + n.fmta([[\bra{<>}<>\ket{<>}]], + { n.f(function(_, parent) return parent.captures[1] end), + n.f(function(_, parent) return parent.captures[2] end), + n.f(function(_, parent) return parent.captures[3] end) }), + { condition = h.in_mathzone } + ), +} diff --git a/.config/nvim/snips/tex/symbols.lua b/.config/nvim/snips/tex/symbols.lua new file mode 100644 index 0000000..118c807 --- /dev/null +++ b/.config/nvim/snips/tex/symbols.lua @@ -0,0 +1,458 @@ +local n = require("luasnip-nodes") +local h = require("luasnip-helpers") + +return { + n.s({trig="//", snippetType="autosnippet"}, + n.fmta("\\frac{<>}{<>}", + { n.i(1), n.i(2), }), + { condition = h.in_mathzone } + ), + n.s({trig="oo", snippetType="autosnippet"}, + { n.t("\\infty") }, + { condition = h.in_mathzone } + ), + n.s ({trig="sin", snippetType="autosnippet"}, + { n.t("\\sin") }, + { condition = h.in_mathzone } + ), + n.s ({trig="cos", snippetType="autosnippet"}, + { n.t("\\cos") }, + { condition = h.in_mathzone } + ), + n.s ({trig="tan", snippetType="autosnippet"}, + { n.t("\\tan") }, + { condition = h.in_mathzone } + ), + n.s ({trig="csc", snippetType="autosnippet"}, + { n.t("\\csc") }, + { condition = h.in_mathzone } + ), + n.s ({trig="sec", snippetType="autosnippet"}, + { n.t("\\sec") }, + { condition = h.in_mathzone } + ), + n.s ({trig="cot", snippetType="autosnippet"}, + { n.t("\\cot") }, + { condition = h.in_mathzone } + ), + n.s ({trig="ln", snippetType="autosnippet"}, + { n.t("\\ln") }, + { condition = h.in_mathzone } + ), + n.s({trig="inn", snippetType="autosnippet"}, + { n.t("\\in") }, + { condition = h.in_mathzone } + ), + n.s({trig="=>", snippetType="autosnippet"}, + { n.t("\\implies") }, + { condition = h.in_mathzone } + ), + n.s({trig="=<", snippetType="autosnippet"}, + { n.t("\\impliedby ") }, + { condition = h.in_mathzone } + ), + n.s({trig="iff", snippetType="autosnippet"}, + { n.t("\\iff") }, + { condition = h.in_mathzone } + ), + n.s({trig="NN", snippetType="autosnippet"}, + { n.t("\\N") } + ), + n.s({trig="RR", snippetType="autosnippet"}, + { n.t("\\R") } + ), + n.s({trig="ZZ", snippetType="autosnippet"}, + { n.t("\\Z") } + ), + n.s({trig="OO", snippetType="autosnippet"}, + { n.t("\\emptyset") } + ), + n.s({trig="QQ", snippetType="autosnippet"}, + { n.t("\\Q") } + ), + n.s({trig="CC", snippetType="autosnippet"}, + { n.t("\\C") } + ), + n.s({trig="EE", snippetType="autosnippet"}, + { n.t("\\exists") }, + { condition = h.in_mathzone } + ), + n.s({trig="AA", snippetType="autosnippet"}, + { n.t("\\forall") }, + { condition = h.in_mathzone } + ), + n.s({trig="<=", snippetType="autosnippet"}, + { n.t("\\le") }, + { condition = h.in_mathzone } + ), + n.s({trig=">=", snippetType="autosnippet"}, + { n.t("\\ge") }, + { condition = h.in_mathzone } + ), + n.s({trig="<<", snippetType="autosnippet"}, + { n.t("\\ll") }, + { condition = h.in_mathzone } + ), + n.s({trig=">>", snippetType="autosnippet"}, + { n.t("\\gg") }, + { condition = h.in_mathzone } + ), + n.s({trig="!=", snippetType="autosnippet"}, + { n.t("\\neq") }, + { condition = h.in_mathzone } + ), + n.s({trig="->", snippetType="autosnippet", priority=100}, + { n.t("\\to") }, + { condition = h.in_mathzone } + ), + n.s({trig="<->", snippetType="autosnippet", priority=200}, + { n.t("\\leftrightarrow") }, + { condition = h.in_mathzone } + ), + n.s({trig="^^", snippetType="autosnippet"}, + { n.t("\\uparrow") }, + { condition = h.in_mathzone } + ), + n.s({trig="vv", snippetType="autosnippet"}, + { n.t("\\downarrow") }, + { condition = h.in_mathzone } + ), + n.s({trig="!>", snippetType="autosnippet"}, + { n.t("\\mapsto") }, + { condition = h.in_mathzone } + ), + n.s({trig="stm", snippetType="autosnippet"}, + { n.t("\\setminus") }, + { condition = h.in_mathzone } + ), + n.s({trig="||", snippetType="autosnippet"}, + { n.t("\\mid") }, + { condition = h.in_mathzone } + ), + n.s({trig="**", snippetType="autosnippet"}, + { n.t("\\cdot") }, + { condition = h.in_mathzone } + ), + n.s({trig="xx", snippetType="autosnippet"}, + { n.t("\\times") }, + { condition = h.in_mathzone } + ), + n.s({trig="cc", snippetType="autosnippet"}, + { n.t("\\subseteq") }, + { condition = h.in_mathzone } + ), + n.s({trig="cq", snippetType="autosnippet"}, + { n.t("\\subset") }, + { condition = h.in_mathzone } + ), + n.s({trig="qq", snippetType="autosnippet"}, + { n.t("\\supseteq") }, + { condition = h.in_mathzone } + ), + n.s({trig="qc", snippetType="autosnippet"}, + { n.t("\\supset") }, + { condition = h.in_mathzone } + ), + n.s({trig="Nn", snippetType="autosnippet"}, + { n.t("\\cap") }, + { condition = h.in_mathzone } + ), + n.s({trig="UU", snippetType="autosnippet"}, + { n.t("\\cup") }, + { condition = h.in_mathzone } + ), + n.s({trig="uU", snippetType="autosnippet"}, + { n.t("\\sqcup") }, + { condition = h.in_mathzone } + ), + n.s({trig="bar", snippetType="autosnippet", priority=100}, + n.fmta("\\bar{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[((\\[a-zA-Z]+)|[A-Za-z0-9])bar]], trigEngine="ecma", wordTrig=false, snippetType="autosnippet", priority=200}, + n.fmta("\\bar{<>}", + { n.f(function(_, parent) return parent.captures[1] end) }), + { condition = h.in_mathzone } + ), + + n.s({trig="hat", snippetType="autosnippet", priority=100}, + n.fmta("\\hat{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[(\\[a-zA-Z]+|[A-Za-z0-9]|\\[a-z]+\{\\?[A-Za-z0-9]+\})hat]], + wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=200}, + n.fmta("\\hat{<>}", + { n.f(function(_, parent) return parent.captures[1] end) }), + { condition = h.in_mathzone } + ), + + n.s({trig=[[!\?|\?!]], trigEngine="ecma", snippetType="autosnippet", priority=100}, + n.fmta("\\vec{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[(\\[a-zA-Z]+|[A-Za-z0-9]|\\[a-z]+\{\\?[A-Za-z0-9]+\})(!\?|\?!)]], + wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=200}, + n.fmta("\\vec{<>}", + { n.f(function(_, parent) return parent.captures[1] end) }), + { condition = h.in_mathzone } + ), + + n.s({trig="t(o+)t", regTrig=true, snippetType="autosnippet", priority=100}, + n.fmta("\\<>ot{<>}", + { n.f(function(_, parent) return string.rep("d", string.len(parent.captures[1])) end), + n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[(\\[a-zA-Z]+|[A-Za-z0-9]|\\[a-z]+\{\\?[A-Za-z0-9]+\})t(o+)t]], + wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=200}, + n.fmta("\\<>ot{<>}", + { n.f(function(_, parent) return string.rep("d", string.len(parent.captures[2])) end), + n.f(function(_, parent) return parent.captures[1] end) }), + { condition = h.in_mathzone } + ), + + n.s({trig="'ti", regTrig=true, snippetType="autosnippet", priority=100}, + n.fmta("\\tilde{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig=[[(\\[a-zA-Z]+|[A-Za-z0-9]|\\[a-z]+\{\\?[A-Za-z0-9]+\})'ti]], + wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=200}, + n.fmta("\\tilde{<>}", + { n.f(function(_, parent) return parent.captures[1] end) }), + { condition = h.in_mathzone } + ), + + n.s({trig=[[([a-zA-Z])(:#|#:)]], wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=200}, + n.fmta("\\mathcal{<>}", + { n.f(function(_, parent) return string.upper(parent.captures[1]) end) }), + { condition = h.in_mathzone } + ), + n.s({trig="(:#|#:)", wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=100}, + n.fmta("\\mathcal{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + + n.s({trig=[[([a-zA-Z])(@#|#@)]], wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=200}, + n.fmta("\\mathbb{<>}", + { n.f(function(_, parent) return string.upper(parent.captures[1]) end) }), + { condition = h.in_mathzone } + ), + n.s({trig="1(@#|#@)", wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=200}, + { n.t("\\1") }, + { condition = h.in_mathzone } + ), + n.s({trig="(@#|#@)", wordTrig=false, trigEngine="ecma", snippetType="autosnippet", priority=100}, + n.fmta("\\mathbb{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig="mfr", wordTrig=false, trigEngine="ecma", snippetType="autosnippet"}, + n.fmta("\\mathfrak{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig="mrm", wordTrig=false, trigEngine="ecma", snippetType="autosnippet"}, + n.fmta("\\mathrm{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig="msf", wordTrig=false, trigEngine="ecma", snippetType="autosnippet"}, + n.fmta("\\mathsf{<>}", + { n.i(1) }), + { condition = h.in_mathzone } + ), + n.s({trig="'kk", snippetType="autosnippet"}, + { n.t("\\mathbb{k}") }, + { condition = h.in_mathzone } + ), + + n.s({trig="'hb", snippetType="autosnippet"}, + { n.t("\\hbar") }, + { condition = h.in_mathzone } + ), + n.s({trig="'pi", snippetType="autosnippet"}, + { n.t("\\pi") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ph", snippetType="autosnippet"}, + { n.t("\\phi") }, + { condition = h.in_mathzone } + ), + n.s({trig="'Ph", snippetType="autosnippet"}, + { n.t("\\Phi") }, + { condition = h.in_mathzone } + ), + n.s({trig="'vp", snippetType="autosnippet"}, + { n.t("\\varphi") }, + { condition = h.in_mathzone } + ), + n.s({trig="'th", snippetType="autosnippet"}, + { n.t("\\theta") }, + { condition = h.in_mathzone } + ), + n.s({trig="'Th", snippetType="autosnippet"}, + { n.t("\\Theta") }, + { condition = h.in_mathzone } + ), + n.s({trig="'Om", snippetType="autosnippet"}, + { n.t("\\Omega") }, + { condition = h.in_mathzone } + ), + n.s({trig="'om", snippetType="autosnippet"}, + { n.t("\\omega") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ep", snippetType="autosnippet"}, + { n.t("\\epsilon") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ta", snippetType="autosnippet"}, + { n.t("\\tau") }, + { condition = h.in_mathzone } + ), + n.s({trig="'rh", snippetType="autosnippet"}, + { n.t("\\rho") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ch", snippetType="autosnippet"}, + { n.t("\\chi") }, + { condition = h.in_mathzone } + ), + n.s({trig="'na", snippetType="autosnippet"}, + { n.t("\\nabla") }, + { condition = h.in_mathzone } + ), + n.s({trig="del", snippetType="autosnippet"}, + { n.t("\\Del") }, + { condition = h.in_mathzone } + ), + n.s({trig="==", snippetType="autosnippet"}, + { n.t("\\equiv") }, + { condition = h.in_mathzone } + ), + n.s({trig="~~", snippetType="autosnippet"}, + { n.t("\\approx") }, + { condition = h.in_mathzone } + ), + n.s({trig="=~", snippetType="autosnippet"}, + { n.t("\\cong") }, + { condition = h.in_mathzone } + ), + n.s({trig="'de", snippetType="autosnippet"}, + { n.t("\\delta") }, + { condition = h.in_mathzone } + ), + n.s({trig="'De", snippetType="autosnippet"}, + { n.t("\\Delta") }, + { condition = h.in_mathzone } + ), + n.s({trig="'nu", snippetType="autosnippet"}, + { n.t("\\nu") }, + { condition = h.in_mathzone } + ), + n.s({trig="'mu", snippetType="autosnippet"}, + { n.t("\\mu") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ps", snippetType="autosnippet"}, + { n.t("\\psi") }, + { condition = h.in_mathzone } + ), + n.s({trig="'Ps", snippetType="autosnippet"}, + { n.t("\\Psi") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ve", snippetType="autosnippet"}, + { n.t("\\varepsilon") }, + { condition = h.in_mathzone } + ), + n.s({trig="'al", snippetType="autosnippet"}, + { n.t("\\alpha") }, + { condition = h.in_mathzone } + ), + n.s({trig="'be", snippetType="autosnippet"}, + { n.t("\\beta") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ga", snippetType="autosnippet"}, + { n.t("\\gamma") }, + { condition = h.in_mathzone } + ), + n.s({trig="'Ga", snippetType="autosnippet"}, + { n.t("\\Gamma") }, + { condition = h.in_mathzone } + ), + n.s({trig="'la", snippetType="autosnippet"}, + { n.t("\\lambda") }, + { condition = h.in_mathzone } + ), + n.s({trig="'La", snippetType="autosnippet"}, + { n.t("\\Lambda") }, + { condition = h.in_mathzone } + ), + n.s({trig="'el", snippetType="autosnippet"}, + { n.t("\\ell") }, + { condition = h.in_mathzone } + ), + n.s({trig="'si", snippetType="autosnippet"}, + { n.t("\\sigma") }, + { condition = h.in_mathzone } + ), + n.s({trig="'Si", snippetType="autosnippet"}, + { n.t("\\Sigma") }, + { condition = h.in_mathzone } + ), + n.s({trig="'xi", snippetType="autosnippet"}, + { n.t("\\xi") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ka", snippetType="autosnippet"}, + { n.t("\\kappa") }, + { condition = h.in_mathzone } + ), + n.s({trig="'ci", snippetType="autosnippet"}, + { n.t("\\circ") }, + { condition = h.in_mathzone } + ), + n.s({trig="'dg", snippetType="autosnippet", wordTrig=false}, + { n.t("^{\\circ}") }, + { condition = h.in_mathzone } + ), + n.s({trig="'da", snippetType="autosnippet", wordTrig=false}, + { n.t("^{\\dag}") }, + { condition = h.in_mathzone } + ), + n.s({trig="oxx", snippetType="autosnippet"}, + { n.t("\\otimes") }, + { condition = h.in_mathzone } + ), + n.s({trig="opp", snippetType="autosnippet"}, + { n.t("\\oplus") }, + { condition = h.in_mathzone } + ), + n.s({trig="upp", snippetType="autosnippet"}, + { n.t("\\uplus") }, + { condition = h.in_mathzone } + ), + n.s({trig="pm", snippetType="autosnippet"}, + { n.t("\\pm") }, + { condition = h.in_mathzone } + ), + n.s({trig="<|", snippetType="autosnippet"}, + { n.t("\\lhd") }, + { condition = h.in_mathzone } + ), + n.s({trig="|>", snippetType="autosnippet"}, + { n.t("\\rhd") }, + { condition = h.in_mathzone } + ), + n.s({trig=",,", snippetType="autosnippet", wordTrig = false}, + { n.t("\\,") }, + { condition = h.in_mathzone } + ), +} -- cgit v1.3