Skip to content

Commit

Permalink
Add snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
Jendker committed Sep 24, 2024
1 parent 0230431 commit c8be00c
Show file tree
Hide file tree
Showing 8 changed files with 401 additions and 15 deletions.
12 changes: 12 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@ add "$SCRIPT_DIR/.tmux.conf" "$HOME/.tmux.conf"

# .wezterm
add "$SCRIPT_DIR/.wezterm.lua" "$HOME/.wezterm.lua"

# snippets
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
vscode_snippets_path="$HOME/.config/Code/User/snippets"
elif [[ "$OSTYPE" == "darwin"* ]]; then
vscode_snippets_path="$HOME/Library/Application Support/Code/User/snippets"
else
echo "OS type unknown. Exiting."
exit 1
fi
mkdir -p "$(dirname "${vscode_snippets_path}")"
add "$SCRIPT_DIR/nvim/snippets" "${vscode_snippets_path}"
28 changes: 13 additions & 15 deletions nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,30 @@
"copilot.lua": { "branch": "master", "commit": "1a237cf50372830a61d92b0adf00d3b23882e0e1" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" },
"dropbar.nvim": { "branch": "master", "commit": "6156e07759fd8c7cbf764414f583aa7e47470368" },
"dropbar.nvim": { "branch": "master", "commit": "b7b0cd2670cfab298afc955f2531206218736766" },
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" },
"fugitive-gitlab.vim": { "branch": "master", "commit": "838d3a110836f511be099002ce1a71493c042615" },
"gitignore.nvim": { "branch": "master", "commit": "2455191ec94da8ed222806a4fe3aa358eac1e558" },
"gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" },
"glance.nvim": { "branch": "master", "commit": "cdf1ec8136cfbdf73edbe1163097223c763a84b7" },
"gv.vim": { "branch": "master", "commit": "b6bb6664e2c95aa584059f195eb3a9f3cb133994" },
"hererocks": { "branch": "master", "commit": "8bd2fcfdd65cfa7535ce39ea372a63b0bdb8e528" },
"highlight-undo.nvim": { "branch": "main", "commit": "1ea1c79372d7d93c88fd97543880927b7635e3d2" },
"image.nvim": { "branch": "master", "commit": "4007cddc4cfc1b5ddd49744a38362e7b0432b3a0" },
"incline.nvim": { "branch": "main", "commit": "16fc9c073e3ea4175b66ad94375df6d73fc114c0" },
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
"kanagawa.nvim": { "branch": "master", "commit": "f491b0fe68fffbece7030181073dfe51f45cda81" },
"last-color.nvim": { "branch": "main", "commit": "4086c5810bbe35b4184502f190e8d1ba910180cd" },
"lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" },
"lsp-zero.nvim": { "branch": "v4.x", "commit": "297c3422c27369409276897410d47e4ccb9a8c81" },
"lsp-zero.nvim": { "branch": "v4.x", "commit": "b8411704591ae8e1501f1b9b31c801c09927baac" },
"lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"magick": { "branch": "master", "commit": "6971fa700c4d392130492a3925344b51c7cc54aa" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neoconf.nvim": { "branch": "main", "commit": "ec16c0234108542b54d83967b85350bcb7b07b8d" },
"neoconf.nvim": { "branch": "main", "commit": "c5516054f2342e6fe4d3befd56249d02d5eeb380" },
"neoscroll.nvim": { "branch": "master", "commit": "4e0428a41c6ec191df543fc95349f6e1c598e53f" },
"nvim-autopairs": { "branch": "master", "commit": "f158dcb865c36f72c92358f87787dab2c272eaf3" },
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
Expand All @@ -54,25 +52,25 @@
"nvim-dap-virtual-text": { "branch": "master", "commit": "3497eb39bf413a57ab5b7e7e2e192683e462148c" },
"nvim-early-retirement": { "branch": "main", "commit": "2c36a5671b9d8f0d9e11b77c5a55de802bc45e34" },
"nvim-fundo": { "branch": "main", "commit": "ac9c9372c4bf677721e24f144ef29d3a05c2b589" },
"nvim-lint": { "branch": "master", "commit": "99cab0b885aaa2f59736c047d23e9a7835d4f9a9" },
"nvim-lspconfig": { "branch": "master", "commit": "eb36e0185ad4b92b0999fb698428f2966334d2c1" },
"nvim-lint": { "branch": "master", "commit": "968a35d54b3a4c1ce66609cf80b14d4ae44fe77f" },
"nvim-lspconfig": { "branch": "master", "commit": "dd329912c8d446240584a2dbcd3802af3a19105a" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-scrollview": { "branch": "main", "commit": "401c0498689dcaa54b2e7483d823e33cdc051e72" },
"nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-treesitter": { "branch": "master", "commit": "3c6af36794b26e1bcac3f126b43e0f646154725d" },
"nvim-treesitter": { "branch": "master", "commit": "6511cd984ab4b21e28f83af488f38dc89c3b0586" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" },
"nvim-web-devicons": { "branch": "master", "commit": "9154484705968658e9aab2b894d1b2a64bf9f83d" },
"nvim-web-devicons": { "branch": "master", "commit": "26220156aafb198b2de6a4cf80c1b120a3768da0" },
"oil.nvim": { "branch": "master", "commit": "1360be5fda9c67338331abfcd80de2afbb395bcd" },
"onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
"outline.nvim": { "branch": "main", "commit": "41e7b88a2b0baa90619af5ec8af462fcb442db65" },
"outline.nvim": { "branch": "main", "commit": "6c44527837ff7ac1cd054dc365a721e881020a2e" },
"overseer.nvim": { "branch": "master", "commit": "a2734d90c514eea27c4759c9f502adbcdfbce485" },
"persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" },
"persistent-breakpoints.nvim": { "branch": "main", "commit": "4b199b1dcfd136cac8b0fa9c8dbbdeb81463f7a9" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"quicker.nvim": { "branch": "master", "commit": "183041a46d6c908eefb1c23ea02cce9c8f41256e" },
"render-markdown.nvim": { "branch": "main", "commit": "5ff191f0c7457ede2fd30ecf76ab16c65118b4ee" },
"render-markdown.nvim": { "branch": "main", "commit": "0986638b381a4b01eb108bb946f3a67a9eb3d0ec" },
"spaceless.nvim": { "branch": "main", "commit": "8d46bc098dba18d4e19bce89bf19aab5007ef767" },
"stickybuf.nvim": { "branch": "master", "commit": "183b9569bef78f44b17c078214f7d731f19cbefe" },
"substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
Expand All @@ -87,7 +85,7 @@
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
"treesj": { "branch": "main", "commit": "0d81326b5afd36babe7dd480aabbb0b05f33e688" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" },
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
"vim-bookmarks": { "branch": "master", "commit": "9cc5fa7ecc23b052bd524d07c85356c64b92aeef" },
"vim-commentary": { "branch": "master", "commit": "c4b8f52cbb7142ec239494e5a2c4a512f92c4d07" },
"vim-cool": { "branch": "master", "commit": "662e7b11064cbeedad17c45d2fe926e78d3cd0b6" },
Expand All @@ -96,12 +94,12 @@
"vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" },
"vim-matchup": { "branch": "master", "commit": "1975afe63198ab6a0dff7200919828e5cd4330b9" },
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
"vim-sleuth": { "branch": "master", "commit": "cd9d382e33bb817abe7f10cdc3a606bf1d491d75" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"vim-textobj-entire": { "branch": "master", "commit": "64a856c9dff3425ed8a863b9ec0a21dbaee6fb3a" },
"vim-textobj-line": { "branch": "master", "commit": "1a6780d29adcf7e464e8ddbcd0be0a9df1a37339" },
"vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" },
"vim-textobj-variable-segment": { "branch": "main", "commit": "12e07590db6c90586ae5b750d6123c0779f6b35b" },
"vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" },
"virtcolumn.nvim": { "branch": "main", "commit": "4d385b4aa42aa3af6fa2cb8527462fa4badbd163" },
"which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" }
"which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" }
}
1 change: 1 addition & 0 deletions nvim/lua/config_plugins/lsp-zero.lua
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ vim.keymap.set("n", "<leader>tv", "<cmd>VirtualTextToggle<CR>", { desc = "[t]ogg
local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
require('luasnip.loaders.from_vscode').lazy_load() -- for snippets
require('luasnip.loaders.from_vscode').lazy_load({ paths = { vim.uv.os_homedir() .. "/.config/nvim/snippets" } }) -- for snippets
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
Expand Down
36 changes: 36 additions & 0 deletions nvim/snippets/global.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"filename": {
"prefix": ["fn"],
"body": ["$TM_FILENAME_BASE"]
},
"filenameWithExtension": {
"prefix": ["fnn"],
"body": ["$TM_FILENAME"]
},
"shrug": {
"prefix": ["shrug"],
"body": ["¯\\\\_(ツ)_/¯"]
},
"ellipsis": {
"prefix": ["..."],
"body": ["…"]
},
"lorem ipsum": {
"prefix": ["lorem"],
"body": [
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eget ipsum vel dui rhoncus ullamcorper at mattis turpis. Pellentesque finibus lacinia purus vel pellentesque. Vivamus sed metus varius purus gravida placerat in nec ex. Maecenas sagittis, lorem sit amet dictum sodales, leo mi rutrum erat, vel pretium tortor mi et metus. Vivamus eu orci consectetur, elementum neque quis, dapibus odio. Curabitur laoreet gravida ante, vel porttitor ante efficitur vitae. Fusce mattis diam in nisl efficitur, et auctor risus iaculis. Pellentesque sagittis mollis egestas."
]
},
"{ }": {
"prefix": "{",
"body": ["{", " $1", "}"]
},
"[ ]": {
"prefix": "[",
"body": ["[", " $1", "]"]
},
"( )": {
"prefix": "(",
"body": ["(", " $1", ")"]
}
}
10 changes: 10 additions & 0 deletions nvim/snippets/markdown.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"table": {
"prefix": "table",
"body": ["| $1 | $2 |", "| --- | --- |", "| $3 | $4 |"]
},
"codeblock": {
"prefix": "code",
"body": ["```$1", "$0", "```"]
}
}
22 changes: 22 additions & 0 deletions nvim/snippets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"contributes": {
"snippets": [
{
"language": "all",
"path": "global.code-snippets"
},
{
"language": "sh",
"path": "shellscript.json"
},
{
"language": "markdown",
"path": "markdown.json"
},
{
"language": "python",
"path": "python.json"
}
]
}
}
Loading

0 comments on commit c8be00c

Please sign in to comment.