]> git.sthu.org Git - vimconf.git/commitdiff
plugins: Switch to mini.snippets
authorStefan Huber <shuber@sthu.org>
Sun, 9 Mar 2025 10:24:17 +0000 (11:24 +0100)
committerStefan Huber <shuber@sthu.org>
Sun, 9 Mar 2025 10:24:17 +0000 (11:24 +0100)
keymaps.vim
plugins-midi.vim.example
snippets/gitcommit.json [new file with mode: 0644]
snippets/latex.json [new file with mode: 0644]
snippets/mail.json [new file with mode: 0644]

index f7d029e57c08e13d254b723cbf1ce2a94a93e763..f63b0110c1181dc3431ec2d9919d10f4a9e885c3 100644 (file)
@@ -30,10 +30,6 @@ nnoremap <F4> :lua MiniMap.toggle()<cr>
 nmap <s-PageDown> :bn<CR>
 nmap <s-PageUp>   :bp<CR>
 
-imap <C-k>     <Plug>(neosnippet_expand_or_jump)
-smap <C-k>     <Plug>(neosnippet_expand_or_jump)
-xmap <C-k>     <Plug>(neosnippet_expand_target)
-
 
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Some filetype-specific settings
index 0ca76e6679282b0c6a9ba5d524bf5e0338f31203..3f55552c6d7325316332d27cd887fd291c9eee57 100644 (file)
@@ -26,8 +26,7 @@ Plug 'habamax/vim-asciidoctor', {'for': 'asciidoc'}
 
 Plug 'tpope/vim-ragtag'
 
-Plug 'Shougo/neosnippet.vim'
-Plug 'Shougo/neosnippet-snippets'
+Plug 'rafamadriz/friendly-snippets'
 
 Plug 'tpope/vim-speeddating'
 Plug 'mattn/calendar-vim'
@@ -67,6 +66,21 @@ function PluginsConfigMidi()
 
     if has('nvim')
         lua <<EOF
+
+            local latex_patterns = { 'latex/**/*.json', '**/latex.json' }
+            local lang_patterns = { tex = latex_patterns, plaintex = latex_patterns }
+            local gen_loader = require('mini.snippets').gen_loader
+            require('mini.snippets').setup({
+              snippets = {
+                -- Load custom file with global snippets first (adjust for Windows)
+                gen_loader.from_file('~/.config/nvim/snippets/global.json'),
+
+                -- Load snippets based on current language by reading files from
+                -- "snippets/" subdirectories from 'runtimepath' directories.
+                gen_loader.from_lang({ lang_patterns = lang_patterns }),
+              },
+            })
+
             local wilder = require('wilder')
             wilder.setup({modes = {':', '/', '?'}})
 
diff --git a/snippets/gitcommit.json b/snippets/gitcommit.json
new file mode 100644 (file)
index 0000000..a2d9da1
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "reported by": {
+               "prefix": "rep",
+        "body": ["Reported-by: ${1:name} <${2:email}>", "$0"]
+       },
+       "tested by": {
+               "prefix": "tested",
+        "body": ["Tested-by: ${1:name} <${2:email}>", "$0"]
+       },
+       "acked by": {
+               "prefix": "ack",
+        "body": ["Acked-by: ${1:name} <${2:email}>", "$0"]
+       },
+       "mail sthu": {
+               "prefix": "sthu",
+        "body": "Stefan Huber <shuber@sthu.org>"
+       },
+       "mail fhs": {
+               "prefix": "fhs",
+        "body": "Stefan Huber <stefan.huber@fh-salzburg.ac.at>"
+       }
+}
diff --git a/snippets/latex.json b/snippets/latex.json
new file mode 100644 (file)
index 0000000..c7f868a
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "only": {
+               "prefix": "only",
+               "body": "\\only<${1}>{\n\t${0:${TM_SELECTED_TEXT}}\n}",
+               "description": "\\only wrap"
+       },
+    "exercise": {
+               "prefix": "EX",
+        "body": "\\begin{exercise}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{exercise}",
+        "description": "exercise environment"
+    },
+    "choices": {
+               "prefix": "choices",
+        "body": "\\begin{choices}\n\t${0:${TM_SELECTED_TEXT}}\n\\end{choices}",
+        "description": "exercise environment"
+    },
+    "inputtikz": {
+               "prefix": "ITIKZ",
+        "body": "\\begin{figure}[${1:htbp}]\n\t\\centering\n\t\\inputtikz{${0:${TM_SELECTED_TEXT}}}\n\t\\caption{${2:<caption>}}\\label{${3:<label>}}\n\\end{figure}",
+        "description": "figure with \\inputtikz"
+    }
+}
diff --git a/snippets/mail.json b/snippets/mail.json
new file mode 100644 (file)
index 0000000..7e49336
--- /dev/null
@@ -0,0 +1,50 @@
+{
+       "mfg": {
+               "prefix": "mfg",
+        "body": "Mit freundlichen Grüßen,\nStefan Huber"
+       },
+       "mbg": {
+               "prefix": "mbg",
+        "body": "Mit besten Grüßen,\nStefan Huber"
+       },
+       "lg": {
+               "prefix": "lg",
+        "body": "Liebe Grüße,\nStefan Huber"
+       },
+       "sg": {
+               "prefix": "sg",
+        "body": "Schöne Grüße,\nStefan Huber"
+       },
+       "hdl": {
+               "prefix": "hdl",
+        "body": "Hab dich lieb,\nStefan Huber"
+       },
+       "kind regards": {
+               "prefix": "kr",
+        "body": "Kind regards\nStefan Huber"
+       },
+       "best regards": {
+               "prefix": "br",
+        "body": "Best regards\nStefan Huber"
+       },
+       "best": {
+               "prefix": "best",
+        "body": "Best\nStefan Huber"
+       },
+       "mail sthu": {
+               "prefix": "sthu",
+        "body": "Stefan Huber <shuber@sthu.org>"
+       },
+       "mail fhs": {
+               "prefix": "fhs",
+        "body": "Stefan Huber <stefan.huber@fh-salzburg.ac.at>"
+       },
+    "signature fhs": {
+        "prefix": "sigfhs",
+        "body": "$0\n-- \nFH-Prof. DI Dr. Stefan Huber, MSc\n\nHead of Research\nDepartment for Information Technologies and Digitalisation | ITD\n\nHead of the Josef Ressel Center for\nIntelligent and Secure Industrial Automation | JRC ISIA\n\n\nFachhochschule Salzburg GmbH\nSalzburg University of Applied Sciences\n\nUrstein Süd 1, 5412 Puch/Salzburg, Austria\n\nCampus Kuchl: Markt 136a, 5431 Kuchl\nGerichtsstand Salzburg, FN166054y\n\n\nRoom 419                            www.fh-salzburg.ac.at\nT +43 50 2211-1324                  www.instagram.com/fhsalzburg\nstefan.huber@fh-salzburg.ac.at      www.facebook.com/fhsalzburg\n                                    www.youtube.com/fhsalzburg\n                                    www.linkedin.com/school/fhsalzburg\n\nPGP fingerprint: 70DF CCD3 8612 499C D3CA  B2F8 8F1B 1A17 C006 790E"
+       },
+    "signature sbg": {
+        "prefix": "sigsbg",
+               "body": "$0\n-- \n------------------------------------------------------------------------\nDr. Stefan Huber                         phone: +43 664 4563812\nweb:  https://www.sthu.org             address: Steinerstraße 7 / Z7\nmail: shuber@sthu.org                           A-5020 Salzburg\n\nPGP fingerprint: 70DF CCD3 8612 499C D3CA  B2F8 8F1B 1A17 C006 790E\n------------------------------------------------------------------------"
+       }
+}