Skip to content

Commit 950ddeb

Browse files
committed
Changed snippets
1 parent 8d1ef97 commit 950ddeb

File tree

12 files changed

+2739
-23
lines changed

12 files changed

+2739
-23
lines changed

.gitignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

init.lua

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ require('lazy').setup({
271271
-- after the plugin has been loaded:
272272
-- config = function() ... end
273273

274-
{ -- Useful plugin to show you pending keybinds.
274+
{ -- Useful plugin to show you pending keybinds.
275275
'folke/which-key.nvim',
276276
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
277277
opts = {
@@ -314,7 +314,7 @@ require('lazy').setup({
314314

315315
-- Document existing key chains
316316
spec = {
317-
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
317+
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
318318
{ '<leader>d', group = '[D]ocument' },
319319
{ '<leader>r', group = '[R]ename' },
320320
{ '<leader>s', group = '[S]earch' },
@@ -354,7 +354,7 @@ require('lazy').setup({
354354
{ 'nvim-telescope/telescope-ui-select.nvim' },
355355

356356
-- Useful for getting pretty icons, but requires a Nerd Font.
357-
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
357+
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
358358
},
359359
config = function()
360360
-- Telescope is a fuzzy finder that comes with a lot of different things that
@@ -450,7 +450,7 @@ require('lazy').setup({
450450
},
451451
},
452452
},
453-
{ 'Bilal2453/luvit-meta', lazy = true },
453+
{ 'Bilal2453/luvit-meta', lazy = true },
454454
{
455455
-- Main LSP Configuration
456456
'neovim/nvim-lspconfig',
@@ -462,7 +462,7 @@ require('lazy').setup({
462462

463463
-- Useful status updates for LSP.
464464
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
465-
{ 'j-hui/fidget.nvim', opts = {} },
465+
{ 'j-hui/fidget.nvim', opts = {} },
466466

467467
-- Allows extra capabilities provided by nvim-cmp
468468
'hrsh7th/cmp-nvim-lsp',
@@ -738,12 +738,12 @@ require('lazy').setup({
738738
-- `friendly-snippets` contains a variety of premade snippets.
739739
-- See the README about individual language/framework/plugin snippets:
740740
-- https://github.com/rafamadriz/friendly-snippets
741-
-- {
742-
-- 'rafamadriz/friendly-snippets',
743-
-- config = function()
744-
-- require('luasnip.loaders.from_vscode').lazy_load()
745-
-- end,
746-
-- },
741+
{
742+
'rafamadriz/friendly-snippets',
743+
config = function()
744+
require('luasnip.loaders.from_vscode').lazy_load()
745+
end,
746+
},
747747
},
748748
},
749749
'saadparwaiz1/cmp_luasnip',
@@ -758,7 +758,7 @@ require('lazy').setup({
758758
-- See `:help cmp`
759759
local cmp = require 'cmp'
760760
local luasnip = require 'luasnip'
761-
luasnip.config.setup {}
761+
luasnip.config.setup ({ enable_autosnippets = true })
762762

763763
cmp.setup {
764764
snippet = {
@@ -845,7 +845,7 @@ require('lazy').setup({
845845
-- Load the colorscheme here.
846846
-- Like many other themes, this one has different styles, and you could load
847847
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
848-
vim.cmd.colorscheme 'tokyonight-night'
848+
vim.cmd.colorscheme 'tokyonight'
849849

850850
-- You can configure highlights by doing something like:
851851
vim.cmd.hi 'Comment gui=none'
@@ -903,10 +903,11 @@ require('lazy').setup({
903903
auto_install = true,
904904
highlight = {
905905
enable = true,
906+
disable = {"latex"},
906907
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
907908
-- If you are experiencing weird indenting issues, add the language to
908909
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
909-
additional_vim_regex_highlighting = { 'ruby' },
910+
additional_vim_regex_highlighting = { 'ruby', "latex","markdown" },
910911
},
911912
indent = { enable = true, disable = { 'ruby' } },
912913
},
@@ -938,7 +939,7 @@ require('lazy').setup({
938939
-- This is the easiest way to modularize your config.
939940
--
940941
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
941-
-- { import = 'custom.plugins' },
942+
{ import = 'custom.plugins' },
942943
--
943944
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
944945
-- Or use telescope!
@@ -968,3 +969,16 @@ require('lazy').setup({
968969

969970
-- The line beneath this is called `modeline`. See `:help modeline`
970971
-- vim: ts=2 sts=2 sw=2 et
972+
--
973+
require("luasnip.loaders.from_lua").load({paths = "/home/BogosBinted/.config/nvim-kickstart/lua/custom/plugins/Luasnip"})
974+
975+
-- Somewhere in your Neovim startup, e.g. init.lua
976+
require("luasnip").config.set_config({ -- Setting LuaSnip config
977+
978+
-- Enable autotriggered snippets
979+
enable_autosnippets = true,
980+
981+
-- Use Tab (or some other key if you prefer) to trigger visual selection
982+
store_selection_keys = "<Tab>",
983+
})
984+

lazy-lock.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" },
3+
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
4+
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
5+
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
6+
"conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" },
7+
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
8+
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
9+
"gitsigns.nvim": { "branch": "main", "commit": "9521fe8be39255b9abc6ec54e352bf04c410f5cf" },
10+
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
11+
"lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" },
12+
"luasnip-latex-snippets.nvim": { "branch": "main", "commit": "4b91f28d91979f61a3e8aef1cee5b7c7f2c7beb8" },
13+
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
14+
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
15+
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
16+
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
17+
"mini.nvim": { "branch": "main", "commit": "7b4d5d48b6b5a75009d63f8f3e4ef4819b7e8139" },
18+
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
19+
"nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" },
20+
"nvim-treesitter": { "branch": "master", "commit": "e1e3108cd23d7f967842261bd66126b6734d8907" },
21+
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
22+
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
23+
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
24+
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
25+
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
26+
"tokyonight.nvim": { "branch": "main", "commit": "9758827c3b380ba89da4a2212b6255d01afbcf08" },
27+
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
28+
"vimtex": { "branch": "master", "commit": "6ee92c7ed2cdc876f499bd5561a65d04dee10d1f" },
29+
"which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }
30+
}

lua/custom/plugins/Luasnip/all.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- Place this in ${HOME}/.config/nvim/LuaSnip/all.lua
2+
return {
3+
-- A snippet that expands the trigger "hi" into the string "Hello, world!".
4+
require("luasnip").snippet(
5+
{ trig = "hi" },
6+
{ t("Hello, world!") }
7+
),
8+
9+
-- To return multiple snippets, use one `return` statement per snippet file
10+
-- and return a table of Lua snippets.
11+
require("luasnip").snippet(
12+
{ trig = "foo" },
13+
{ t("Another snippet.") }
14+
),
15+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
return {
2+
-- Example: how to set snippet parameters
3+
require("luasnip").snippet(
4+
{ -- Table 1: snippet parameters
5+
trig="saucisse",
6+
dscr="An autotriggering snippet that expands 'hi' into 'Hello, world!'",
7+
regTrig=false,
8+
priority=100,
9+
snippetType="autosnippet"
10+
},
11+
{ -- Table 2: snippet nodes (don't worry about this for now---we'll cover nodes shortly)
12+
t("Hello, world!"), -- A single text node
13+
}
14+
-- Table 3, the advanced snippet options, is left blank.
15+
),
16+
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
local ls = require("luasnip")
2+
local s = ls.snippet
3+
local t = ls.text_node
4+
local i = ls.insert_node
5+
local f = ls.function_node
6+
local fmt = require("luasnip.extras.fmt").fmt
7+
8+
-- Add LaTeX snippets
9+
ls.add_snippets("tex", {
10+
-- LaTeX Template
11+
s("latex-template", fmt([[
12+
\documentclass[a4paper]{article}
13+
14+
\usepackage{amsmath}
15+
16+
\begin{document}
17+
{}
18+
\end{document}
19+
]], { i(0) })),
20+
21+
-- Implies
22+
s("=>", t("\\implies")),
23+
24+
-- Inline Math
25+
s("mk", fmt("${}$", { i(1) })),
26+
27+
-- Fraction with auto-expansion for a/b pattern
28+
s("////", fmt("\\frac{{{}}}{{{}}}", { i(1), i(2) })),
29+
s({ trig = "(%w+)/(%w+)", regTrig = true, wordTrig = false }, {
30+
f(function(_, snip) return "\\frac{" .. snip.captures[1] .. "}{" .. snip.captures[2] .. "}" end)
31+
}),
32+
33+
-- Not Equals
34+
s("!=", t("\\neq")),
35+
36+
-- Sum
37+
s("sum", fmt("\\sum_{{n={}}}^{{{}}} {}", { i(1, "1"), i(2, "\\infty"), i(3, "a_n z^n") })),
38+
39+
-- Taylor Series
40+
s("taylor", fmt("\\sum_{{{}={}}}^{{{}}} {} (x-a)^{}", { i(1, "k"), i(2, "0"), i(3, "\\infty"), i(4, "c_"), i(1) })),
41+
42+
-- Limit
43+
s("lim", fmt("\\lim_{{{} \\to {}}}", { i(1, "n"), i(2, "\\infty") })),
44+
45+
-- Greek Letters
46+
s("alpha", t("\\alpha")),
47+
s("beta", t("\\beta")),
48+
s("gamma", t("\\gamma")),
49+
s("delta", t("\\delta")),
50+
s("epsilon", t("\\epsilon")),
51+
s("zeta", t("\\zeta")),
52+
s("eta", t("\\eta")),
53+
s("theta", t("\\theta")),
54+
s("iota", t("\\iota")),
55+
s("kappa", t("\\kappa")),
56+
s("lambda", t("\\lambda")),
57+
s("mu", t("\\mu")),
58+
s("nu", t("\\nu")),
59+
s("xi", t("\\xi")),
60+
s("omicron", t("\\omicron")),
61+
s("pi", t("\\pi")),
62+
s("rho", t("\\rho")),
63+
s("sigma", t("\\sigma")),
64+
s("tau", t("\\tau")),
65+
s("upsilon", t("\\upsilon")),
66+
s("phi", t("\\phi")),
67+
s("chi", t("\\chi")),
68+
s("psi", t("\\psi")),
69+
s("omega", t("\\omega")),
70+
s("Alpha", t("\\Alpha")),
71+
s("Beta", t("\\Beta")),
72+
s("Gamma", t("\\Gamma")),
73+
s("Delta", t("\\Delta")),
74+
s("Epsilon", t("\\Epsilon")),
75+
s("Zeta", t("\\Zeta")),
76+
s("Eta", t("\\Eta")),
77+
s("Theta", t("\\Theta")),
78+
s("Iota", t("\\Iota")),
79+
s("Kappa", t("\\Kappa")),
80+
s("Lambda", t("\\Lambda")),
81+
s("Mu", t("\\Mu")),
82+
s("Nu", t("\\Nu")),
83+
s("Xi", t("\\Xi")),
84+
s("Omicron", t("\\Omicron")),
85+
s("Pi", t("\\Pi")),
86+
s("Rho", t("\\Rho")),
87+
s("Sigma", t("\\Sigma")),
88+
s("Tau", t("\\Tau")),
89+
s("Upsilon", t("\\Upsilon")),
90+
s("Phi", t("\\Phi")),
91+
s("Chi", t("\\Chi")),
92+
s("Psi", t("\\Psi")),
93+
s("Omega", t("\\Omega")),
94+
95+
-- Other Symbols
96+
s("ooo", t("\\infty")),
97+
s("prod", t("\\prod")),
98+
s("pm", t("\\pm")),
99+
s("mp", t("\\mp")),
100+
s("+-", t("\\pm")),
101+
s("-+", t("\\mp")),
102+
s("...", t("\\dots")),
103+
s("<->", t("\\leftrightarrow")),
104+
s("->", t("\\to")),
105+
s("!>", t("\\mapsto")),
106+
s("invs", t("^{-1}")),
107+
s("\\\\\\", t("\\setminus")),
108+
s("||", t("\\mid")),
109+
s("and", t("\\cap")),
110+
s("orr", t("\\cup")),
111+
s("inn", t("\\in")),
112+
s("notin", t("\\not\\in")),
113+
s("\\subset eq", t("\\subseteq")),
114+
s("eset", t("\\emptyset")),
115+
s("set", fmt("\\{{}}", { i(1) })),
116+
s("=>", t("\\implies")),
117+
s("=<", t("\\impliedby")),
118+
s("iff", t("\\iff")),
119+
s("exists", t("\\exists")),
120+
121+
-- Special Formatting
122+
s("mcal", fmt("\\mathcal{{{}}}", { i(1) })),
123+
s("mbb", fmt("\\mathbb{{{}}}", { i(1) })),
124+
s("ell", t("\\ell")),
125+
s("lll", t("\\ell")),
126+
s("LL", t("\\mathcal{L}")),
127+
s("HH", t("\\mathcal{H}")),
128+
s("CC", t("\\mathbb{C}")),
129+
s("RR", t("\\mathbb{R}")),
130+
s("ZZ", t("\\mathbb{Z}")),
131+
s("NN", t("\\mathbb{N}")),
132+
s("II", t("\\mathbb{1}")),
133+
134+
-- Miscellaneous Symbols
135+
s("del", t("\\nabla")),
136+
s("xx", t("\\times")),
137+
s("avg", fmt("\\langle {} \\rangle", { i(1) })),
138+
s("norm", fmt("\\lvert {} \\rvert", { i(1) })),
139+
s("ceil", fmt("\\lceil {} \\rceil", { i(1) })),
140+
s("floor", fmt("\\lfloor {} \\rfloor", { i(1) }))
141+
})
142+

0 commit comments

Comments
 (0)