summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
authorottjk <joshott16@gmail.com>2023-12-30 19:23:04 -0500
committerottjk <joshott16@gmail.com>2023-12-30 19:23:04 -0500
commited46f1c5e82709417085b1a3b7708b209c5f4bfe (patch)
treed7eb3f2b4b00e75e5f10199e1cbff959c355b312 /nvim
downloaddotfiles-ed46f1c5e82709417085b1a3b7708b209c5f4bfe.tar.gz
dotfiles-ed46f1c5e82709417085b1a3b7708b209c5f4bfe.zip
initial commit
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.nextcloudsync.log0
-rw-r--r--nvim/.sync_bdd2e5b09f19.dbbin0 -> 225280 bytes
-rw-r--r--nvim/.sync_bdd2e5b09f19.db-shmbin0 -> 32768 bytes
-rw-r--r--nvim/.sync_bdd2e5b09f19.db-walbin0 -> 4152992 bytes
-rw-r--r--nvim/after/plugin/bufdel.lua3
-rw-r--r--nvim/after/plugin/bufferline.lua22
-rw-r--r--nvim/after/plugin/lsp.lua58
-rw-r--r--nvim/after/plugin/luasnip.lua10
-rw-r--r--nvim/after/plugin/markdown-preview.lua6
-rw-r--r--nvim/after/plugin/nvim-cmp.lua74
-rw-r--r--nvim/after/plugin/nvim-markdown.lua9
-rw-r--r--nvim/after/plugin/oil.lua48
-rw-r--r--nvim/after/plugin/treesitter.lua21
-rw-r--r--nvim/after/plugin/vimtex.lua14
-rw-r--r--nvim/ftplugin/md.lua5
-rw-r--r--nvim/init.lua5
-rw-r--r--nvim/lazy-lock.json31
-rw-r--r--nvim/lua/colorscheme.lua18
-rw-r--r--nvim/lua/commands.lua10
-rw-r--r--nvim/lua/keymaps.lua85
-rw-r--r--nvim/lua/luasnip-helpers.lua41
-rw-r--r--nvim/lua/luasnip-nodes.lua31
-rw-r--r--nvim/lua/options.lua26
-rw-r--r--nvim/lua/plugins.lua74
-rw-r--r--nvim/snips/tex/chunks.lua210
-rw-r--r--nvim/snips/tex/electromagnetism.lua9
-rw-r--r--nvim/snips/tex/expressions.lua211
-rw-r--r--nvim/snips/tex/symbols.lua353
28 files changed, 1374 insertions, 0 deletions
diff --git a/nvim/.nextcloudsync.log b/nvim/.nextcloudsync.log
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/nvim/.nextcloudsync.log
diff --git a/nvim/.sync_bdd2e5b09f19.db b/nvim/.sync_bdd2e5b09f19.db
new file mode 100644
index 0000000..b574f1f
--- /dev/null
+++ b/nvim/.sync_bdd2e5b09f19.db
Binary files differ
diff --git a/nvim/.sync_bdd2e5b09f19.db-shm b/nvim/.sync_bdd2e5b09f19.db-shm
new file mode 100644
index 0000000..5220237
--- /dev/null
+++ b/nvim/.sync_bdd2e5b09f19.db-shm
Binary files differ
diff --git a/nvim/.sync_bdd2e5b09f19.db-wal b/nvim/.sync_bdd2e5b09f19.db-wal
new file mode 100644
index 0000000..628d756
--- /dev/null
+++ b/nvim/.sync_bdd2e5b09f19.db-wal
Binary files differ
diff --git a/nvim/after/plugin/bufdel.lua b/nvim/after/plugin/bufdel.lua
new file mode 100644
index 0000000..12d097f
--- /dev/null
+++ b/nvim/after/plugin/bufdel.lua
@@ -0,0 +1,3 @@
+require('bufdel').setup {
+ quit = false, -- quit Neovim when last buffer is closed
+}
diff --git a/nvim/after/plugin/bufferline.lua b/nvim/after/plugin/bufferline.lua
new file mode 100644
index 0000000..53db4f3
--- /dev/null
+++ b/nvim/after/plugin/bufferline.lua
@@ -0,0 +1,22 @@
+vim.cmd.colorscheme "catppuccin"
+vim.opt.termguicolors = true
+
+require("bufferline").setup({
+ options = {
+ offsets = {
+ {
+ filetype = "undotree",
+ text = "Undo Zone",
+ text_align = "center",
+ separator = true
+ }
+ },
+ show_buffer_icons = true, -- disable filetype icons for buffers
+ separator_style = "thick",
+ hover = {
+ enabled = true,
+ delay = 200,
+ reveal = {'close'}
+ },
+ }
+})
diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua
new file mode 100644
index 0000000..2db301b
--- /dev/null
+++ b/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 <c-x><c-o>
+ 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', '<C-k>', vim.lsp.buf.signature_help, bufopts)
+ vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
+ vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
+ vim.keymap.set('n', '<leader>wl', function()
+ print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+ end, bufopts)
+ vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
+ vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
+ vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
+ vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
+ vim.keymap.set('n', '<leader>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_handlers {
+ 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.9/",
+ filetypes = { "julia", "jl" },
+ single_file_support = true
+ }
+ end
+}
+
diff --git a/nvim/after/plugin/luasnip.lua b/nvim/after/plugin/luasnip.lua
new file mode 100644
index 0000000..140d9b2
--- /dev/null
+++ b/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 = "<Tab>",
+ 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/nvim/after/plugin/markdown-preview.lua b/nvim/after/plugin/markdown-preview.lua
new file mode 100644
index 0000000..65170e6
--- /dev/null
+++ b/nvim/after/plugin/markdown-preview.lua
@@ -0,0 +1,6 @@
+vim.cmd([[
+ function OpenMarkdownPreview (url)
+ execute "silent ! firefox --new-window " . a:url
+ endfunction
+ let g:mkdp_browserfunc = 'OpenMarkdownPreview'
+]])
diff --git a/nvim/after/plugin/nvim-cmp.lua b/nvim/after/plugin/nvim-cmp.lua
new file mode 100644
index 0000000..40cb605
--- /dev/null
+++ b/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({
+ ['<C-b>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-c>'] = cmp.mapping.abort(),
+ ['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
+ ["<Tab>"] = 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", }),
+ ["<S-Tab>"] = 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/nvim/after/plugin/nvim-markdown.lua b/nvim/after/plugin/nvim-markdown.lua
new file mode 100644
index 0000000..c11d7ca
--- /dev/null
+++ b/nvim/after/plugin/nvim-markdown.lua
@@ -0,0 +1,9 @@
+vim.g.vim_markdown_conceal = 2
+vim.g.vim_markdown_math = 1
+vim.g.vim_markdown_toc_autofit = 1
+
+local map = vim.keymap.set;
+local opts = { noremap = false, silent = true}
+
+map('', 'o', '<Plug>Markdown_NewLineBelow<Esc>', opts)
+map('', 'O', '<Plug>Markdown_NewLineAbove<Esc>', opts)
diff --git a/nvim/after/plugin/oil.lua b/nvim/after/plugin/oil.lua
new file mode 100644
index 0000000..f2a2c7d
--- /dev/null
+++ b/nvim/after/plugin/oil.lua
@@ -0,0 +1,48 @@
+require("oil").setup({
+ -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`)
+ -- Set to false if you still want to use netrw.
+ default_file_explorer = true,
+ -- Id is automatically added at the beginning, and name at the end
+ -- See :help oil-columns
+ columns = {
+ "icon",
+ -- "permissions",
+ -- "size",
+ -- "mtime",
+ },
+ -- Buffer-local options to use for oil buffers
+ buf_options = {
+ buflisted = false,
+ bufhidden = "hide",
+ },
+ -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash)
+ delete_to_trash = true,
+ -- Skip the confirmation popup for simple operations
+ skip_confirm_for_simple_edits = false,
+ -- Selecting a new/moved/renamed file or directory will prompt you to save changes first
+ prompt_save_on_select_new_entry = true,
+ -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap
+ -- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true })
+ -- Additionally, if it is a string that matches "actions.<name>",
+ -- it will use the mapping at require("oil.actions").<name>
+ -- Set to `false` to remove a keymap
+ -- See :help oil-actions for a list of all available actions
+ keymaps = {
+ ["g?"] = "actions.show_help",
+ ["<CR>"] = "actions.select",
+ ["<C-s>"] = "actions.select_vsplit",
+ ["<C-h>"] = "actions.select_split",
+ ["<C-t>"] = "actions.select_tab",
+ ["<C-p>"] = "actions.preview",
+ ["<C-c>"] = "actions.close",
+ ["<C-l>"] = "actions.refresh",
+ ["-"] = "actions.parent",
+ ["_"] = "actions.open_cwd",
+ ["`"] = "actions.cd",
+ ["~"] = "actions.tcd",
+ ["gs"] = "actions.change_sort",
+ ["g."] = "actions.toggle_hidden",
+ },
+ -- Set to false to disable all of the above keymaps
+ use_default_keymaps = true,
+})
diff --git a/nvim/after/plugin/treesitter.lua b/nvim/after/plugin/treesitter.lua
new file mode 100644
index 0000000..268e901
--- /dev/null
+++ b/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" },
+
+ -- 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/nvim/after/plugin/vimtex.lua b/nvim/after/plugin/vimtex.lua
new file mode 100644
index 0000000..c2b2276
--- /dev/null
+++ b/nvim/after/plugin/vimtex.lua
@@ -0,0 +1,14 @@
+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 = {
+ \ 'options' : [
+ \ '-verbose',
+ \ '-file-line-error',
+ \ '-synctex=1',
+ \ '-interaction=nonstopmode',
+ \ '-shell-escape',
+ \ ],
+ \}
+]])
diff --git a/nvim/ftplugin/md.lua b/nvim/ftplugin/md.lua
new file mode 100644
index 0000000..b90955c
--- /dev/null
+++ b/nvim/ftplugin/md.lua
@@ -0,0 +1,5 @@
+local map = vim.keymap.set;
+local opts = { noremap = false, silent = true}
+
+map('', 'o', '<Plug>Markdown_NewLineBelow<Esc>', opts)
+map('', 'O', '<Plug>Markdown_NewLineAbove<Esc>', opts)
diff --git a/nvim/init.lua b/nvim/init.lua
new file mode 100644
index 0000000..ed0fa45
--- /dev/null
+++ b/nvim/init.lua
@@ -0,0 +1,5 @@
+require("plugins")
+require("options")
+require("keymaps")
+require("commands")
+require("colorscheme")
diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json
new file mode 100644
index 0000000..5ddc6d1
--- /dev/null
+++ b/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/nvim/lua/colorscheme.lua b/nvim/lua/colorscheme.lua
new file mode 100644
index 0000000..86e8b42
--- /dev/null
+++ b/nvim/lua/colorscheme.lua
@@ -0,0 +1,18 @@
+require("catppuccin").setup({
+ flavour = "macchiato",
+ background = {
+ light = "latte",
+ dark = "macchiato",
+ },
+ custom_highlights = function (colors)
+ return {
+ CursorLineNr = { fg = colors.flamingo },
+ }
+ end,
+ integrations = {
+ cmp = true,
+ telescope = true,
+ },
+})
+
+vim.cmd.colorscheme "catppuccin"
diff --git a/nvim/lua/commands.lua b/nvim/lua/commands.lua
new file mode 100644
index 0000000..8714158
--- /dev/null
+++ b/nvim/lua/commands.lua
@@ -0,0 +1,10 @@
+vim.api.nvim_create_autocmd("ColorScheme", {
+ pattern = "*",
+ callback = function()
+ package.loaded["feline"] = nil
+ package.loaded["catppuccin.groups.integrations.feline"] = nil
+ require("feline").setup {
+ components = require("catppuccin.groups.integrations.feline").get(),
+ }
+ end,
+})
diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua
new file mode 100644
index 0000000..0b72932
--- /dev/null
+++ b/nvim/lua/keymaps.lua
@@ -0,0 +1,85 @@
+local map = vim.keymap.set;
+local builtin = require('telescope.builtin')
+local opts = { noremap = true, silent = true}
+
+map('', '<Up>', 'gk', opts)
+map('', '<Down>', 'gj', opts)
+map('n', 'J', 'mzJ`z', opts)
+
+map('', 'o', 'o<Esc>', opts)
+map('', 'O', 'O<Esc>', opts)
+
+map('i', '<C-Space>', '<Esc>', opts)
+map('v', '<C-Space>', '<Esc>', opts)
+map('t', '<C-Space>', '<C-\\><C-n>', opts)
+map('v', '<PageDown>', ":m '>+1<CR>gv=gv", opts)
+map('v', '<PageUp>', ":m '<-2<CR>gv=gv", opts)
+
+map('n', 'Q', '<nop>')
+
+--
+-- telescope
+--
+map('n', '<leader>pf', builtin.find_files, {})
+map('n', '<leader>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', '<leader>fs', function()
+ builtin.grep_string({ search = vim.fn.input("Grep > ") })
+end, {})
+--
+
+map("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
+map('n', '<leader>u', vim.cmd.UndotreeToggle)
+map('n', '<PageUp>', vim.cmd.BufferLineCycleNext)
+map('n', '<PageDown>', vim.cmd.BufferLineCyclePrev)
+map('n', '<leader>br', vim.cmd.BufDel)
+
+--
+-- window resizing
+--
+-- map('n', '<S-Left>', ':vertical resize -2<CR>', { silent = true })
+-- map('n', '<S-Right>', ':vertical resize +2<CR>', { silent = true })
+-- map('n', '<S-Up>', ':resize +2<CR>', { silent = true })
+-- map('n', '<S-Down>', ':resize -2<CR>', { silent = true })
+
+map('n', '<C-p>', ':MarkdownPreview<CR>', { silent = true })
+
+map('x', 'p', '\"_dP')
+
+map('n', '<leader>y', '\"+y')
+map('v', '<leader>y', '\"+y')
+map('n', '<leader>Y', '\"+Y')
+
+map('n', '<leader>d', '\"+d')
+map('v', '<leader>d', '\"+d')
+
+map('n', '<leader>js', ':vertical botright Repl julia<CR>')
+map('n', '<leader>jr', function()
+ vim.cmd.ReplSend(string.format('include("%s")', vim.fn.expand('%:p')))
+end)
+map('n', '<leader>j;', function()
+ vim.cmd.ReplSend(string.format('include("%s");', vim.fn.expand('%:p')))
+end)
+
+map('n', '<C-h>', vim.cmd.HopWord)
+
+map('n', '<leader>vv', vim.cmd.VimtexCompile)
+map('n', '<leader>vc', ':VimtexClean!<CR>')
+
+map('i', '<C-f>', [[<Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"'<CR><CR>:w<CR>]], opts)
+map('n', '<C-f>', [[: silent exec '!inkscape-figures edit "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &'<CR><CR>:redraw!<CR>]], opts)
+
+vim.cmd([[
+" press <Tab> to expand or jump in a snippet. These can also be mapped separately
+" via <Plug>luasnip-expand-snippet and <Plug>luasnip-jump-next.
+imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
+]])
+
+map('i', '<S-Tab>', [[<cmd>lua require'luasnip'.jump(-1)<Cr>]], opts)
+map('s', '<Tab>', [[<cmd>lua require('luasnip').jump(1)<Cr>]], opts)
+map('s', '<Tab>', [[<cmd>lua require('luasnip').jump(-1)<Cr>]], opts)
diff --git a/nvim/lua/luasnip-helpers.lua b/nvim/lua/luasnip-helpers.lua
new file mode 100644
index 0000000..e912046
--- /dev/null
+++ b/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/nvim/lua/luasnip-nodes.lua b/nvim/lua/luasnip-nodes.lua
new file mode 100644
index 0000000..1b48f00
--- /dev/null
+++ b/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/nvim/lua/options.lua b/nvim/lua/options.lua
new file mode 100644
index 0000000..b555069
--- /dev/null
+++ b/nvim/lua/options.lua
@@ -0,0 +1,26 @@
+vim.opt.nu = true
+vim.opt.relativenumber = true
+
+vim.opt.tabstop = 4
+vim.opt.softtabstop = 4
+vim.opt.shiftwidth = 4
+vim.opt.expandtab = true
+
+vim.opt.smartindent = true
+
+vim.opt.wrap = false
+
+vim.opt.hlsearch = false
+vim.opt.incsearch = true
+
+vim.opt.scrolloff = 8
+vim.opt.signcolumn = "no"
+vim.opt.cursorline = true
+vim.opt.cursorlineopt = "number"
+vim.opt.isfname:append("@-@")
+
+vim.cmd "set undofile"
+
+vim.g.mapleader = ' '
+
+vim.opt.guifont = "FiraCode:h10"
diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua
new file mode 100644
index 0000000..2fb9566
--- /dev/null
+++ b/nvim/lua/plugins.lua
@@ -0,0 +1,74 @@
+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",
+ "ojroques/nvim-bufdel",
+ "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',
+ 'tpope/vim-fugitive',
+ 'axvr/zepl.vim',
+ 'lervag/vimtex',
+ 'ixru/nvim-markdown',
+ 'mg979/vim-visual-multi',
+ 'stevearc/oil.nvim',
+ {
+ 'nvim-telescope/telescope.nvim', tag = '0.1.4',
+ dependencies = { 'nvim-lua/plenary.nvim' }
+ },
+ { "catppuccin/nvim", name = "catppuccin" },
+ {
+ 'akinsho/bufferline.nvim', version = "*",
+ dependencies = 'nvim-tree/nvim-web-devicons'
+ },
+ {
+ "nvim-treesitter/nvim-treesitter",
+ build = function()
+ require("nvim-treesitter.install").update({ with_sync = true })
+ end,
+ },
+ {
+ "L3MON4D3/LuaSnip",
+ version = "v2.*",
+ build = "make install_jsregexp"
+ },
+ {
+ 'numToStr/Comment.nvim',
+ opts = {
+ -- add any options here
+ },
+ lazy = false,
+ },
+ {
+ "iamcco/markdown-preview.nvim",
+ cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
+ ft = { "markdown" },
+ build = function() vim.fn["mkdp#util#install"]() end,
+ },
+ {
+ "smoka7/hop.nvim",
+ version = "*",
+ config = function()
+ require("hop").setup({ keys = "tnseridhaofuwyplcqxz" })
+ end,
+ },
+})
diff --git a/nvim/snips/tex/chunks.lua b/nvim/snips/tex/chunks.lua
new file mode 100644
index 0000000..a48242e
--- /dev/null
+++ b/nvim/snips/tex/chunks.lua
@@ -0,0 +1,210 @@
+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 })
+}
diff --git a/nvim/snips/tex/electromagnetism.lua b/nvim/snips/tex/electromagnetism.lua
new file mode 100644
index 0000000..cae57e6
--- /dev/null
+++ b/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/nvim/snips/tex/expressions.lua b/nvim/snips/tex/expressions.lua
new file mode 100644
index 0000000..2bb6d29
--- /dev/null
+++ b/nvim/snips/tex/expressions.lua
@@ -0,0 +1,211 @@
+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)) })
+ )
+ 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="od", snippetType="autosnippet"},
+ n.fmta("\\od[]{<>}{<>}",
+ { n.i(1), n.i(2) }),
+ { condition = h.in_mathzone }
+ ),
+ n.s({trig="oD", snippetType="autosnippet"},
+ n.fmta("\\od[<>]{<>}{<>}",
+ { n.i(1), n.i(2), n.i(3) }),
+ { condition = h.in_mathzone }
+ ),
+ n.s({trig="pd", snippetType="autosnippet"},
+ n.fmta("\\pd[]{<>}{<>} ",
+ { n.i(1), n.i(2) }),
+ { condition = h.in_mathzone }
+ ),
+ n.s({trig="pD", snippetType="autosnippet"},
+ 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 = "xb", snippetType="autosnippet"},
+ n.fmta("\\text{\\textbf{<>}}",
+ { n.d(1, h.get_visual) }),
+ { condition = h.in_mathzone }
+ ),
+ n.s({trig = "tuu", snippetType="autosnippet"},
+ n.fmta("\\underline{<>}",
+ { 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) }),
+ { 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 }
+ ),
+}
diff --git a/nvim/snips/tex/symbols.lua b/nvim/snips/tex/symbols.lua
new file mode 100644
index 0000000..d42c831
--- /dev/null
+++ b/nvim/snips/tex/symbols.lua
@@ -0,0 +1,353 @@
+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("\\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="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="bar", snippetType="autosnippet", priority=100},
+ n.fmta("\\overline{<>}",
+ { 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("\\overline{<>}",
+ { 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])hat]], trigEngine="ecma", wordTrig=false, 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])(!\?|\?!)]], trigEngine="ecma", wordTrig=false, 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="mcal", snippetType="autosnippet"},
+ n.fmta("\\mathcal{<>}",
+ { n.i(1) }),
+ { condition = h.in_mathzone }
+ ),
+ n.s({trig="mbb", snippetType="autosnippet"},
+ n.fmta("\\mathbb{<>}",
+ { n.i(1) }),
+ { 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="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="'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="'xi", snippetType="autosnippet"},
+ { n.t("\\xi") },
+ { 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="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="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 }
+ ),
+}