]> git.sthu.org Git - vimconf.git/commitdiff
plugins: Use lua-based keymaps with descriptions master
authorStefan Huber <shuber@sthu.org>
Fri, 18 Apr 2025 20:46:25 +0000 (22:46 +0200)
committerStefan Huber <shuber@sthu.org>
Fri, 18 Apr 2025 20:46:25 +0000 (22:46 +0200)
27 files changed:
.gitignore
README.md
after/syntax/json.vim [new file with mode: 0644]
autoload/plug.vim
ftdetect/dis.vim [new file with mode: 0644]
ftplugin/dis.vim [new file with mode: 0644]
gvimrc
init-local.vim.example [deleted file]
init.vim
install.sh
keymaps.vim
macros.vim
neosnippets/gitcommit.snip
neosnippets/tex.snip
plugins-full.vim.example [new file with mode: 0644]
plugins-local.vim.example
plugins-midi.vim.example [new file with mode: 0644]
plugins-mini.vim [new file with mode: 0644]
plugins.vim [deleted file]
plugsetup.vim
snippets/gitcommit.json [new file with mode: 0644]
snippets/latex/beamer.json [new file with mode: 0644]
snippets/latex/exam.json [new file with mode: 0644]
snippets/latex/tikz.json [new file with mode: 0644]
snippets/mail.json [new file with mode: 0644]
syntax/dis.vim [new file with mode: 0644]
vimspector-config/vimspector.json [new file with mode: 0644]

index 2bff0b32cb643002e7ce4af37d65522cccdbf917..005ee09d06d18e015ffae473f0479751e63e7200 100644 (file)
@@ -1,5 +1,12 @@
-plugged
+*.swp
+.netrwhist
 init-local.vim
 keymaps-local.vim
 macros-local.vim
+neosnippets/mail.snip
+plug-snapshot-*
+plugged
 plugins-local.vim
+spell/
+tags
+vimspector-config/gadgets
index fef6bdc6e1e4949479ea09aaa4f26d019099c101..6f6760be81db5543bfab38cb907606ff83335ff4 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,12 +1,5 @@
 # A modular vim configuration
 
-This is my personal vim configuration that is partly inspired by
-[SpaceVim](https://spacevim.org/). It is compatible to vim, gvim (8.0+) and
-neovim (0.2+). The configuration is split up into multiple files such that
-personal customization is separated from boilerplate code.
-
-![A demo screenshot](https://www.sthu.org/code/codesnippets/img/vimconf-start-plugin.png)
-
 
 <div class="hideonwebsite">
 This repository is a replication of the repository <a
@@ -15,6 +8,37 @@ href="https://www.sthu.org/code/codesnippets/vimconf.html">website</a> gives
 further details and more screenshots.
 </div>
 
+
+This is my personal vim configuration. The [git
+repo](https://git.sthu.org/?p=vimconf.git;a=summary) of this configuration is
+under constant flux, however, it should be compatible with (g)vim (8.0+) and
+neovim (0.2+), yet some features are only available with newer versions.
+
+![A demo screenshot](https://www.sthu.org/code/codesnippets/img/vimconf-startify.png)
+
+
+## Flavors on different machines
+
+I would like to use this configuration on a large variety of machines with
+different needs. To accommodate for this, the configuration is split up into
+multiple files and a different set of plugins is used:
+
+- In any case, the plugin set in `plugins-mini.vim` is loaded.
+- Furthermore, `plugins-midi.vim`, `plugins-full.vim` and `plugins-local.vim`
+  are loaded if present. They are provided as `plugins-xxx.vim.example` and you
+  can create a symlink `plugins-xxx.vim` to have them loaded. (In case of
+  `plugins-local.vim` you will probably provide a machine-dedicated version
+  rather than symlinking the example file.)
+
+Similar to `plugins-local.vim`, also the following files are sourced if
+existent:
+
+  - `macros-local.vim`
+  - `keymaps-local.vim`
+  - `init-local.vim`
+
+Example files are shipped with the repository.
+
 ## Installation
 
 ### Requirements
@@ -57,20 +81,6 @@ This install script creates backups of existing configuration files (e.g.,
 `~/.vimrc`) and then creates symlinks to configuration files in `~/.vim`.
 
 
-## Specialization for local machines
-
-I personally would like to have the same vim configuration on all my user
-accounts. Still, on certain machines I would like to personalize and specialize
-the configuration. The following files are sourced if existent:
-
-  - plugins-local.vim
-  - macros-local.vim
-  - keymaps-local.vim
-  - init-local.vim
-
-Example files are shipped with the repository.
-
-
 ## Terminal color settings
 
 For consistent background colors you may change the background colors of your
diff --git a/after/syntax/json.vim b/after/syntax/json.vim
new file mode 100644 (file)
index 0000000..6db6a82
--- /dev/null
@@ -0,0 +1,4 @@
+syn region jsonComment start="/\*" end="\*/"
+syn region jsonComment start="//" end="$"
+hi link jsonCommentError Comment
+hi link jsonComment Comment
index 2b89b5a642c5e68aacec2434a6b04a75091f0aca..56e7ff1d90e29a6b36f9ea8ead0fb8a06876ce16 100644 (file)
@@ -1,67 +1,36 @@
 " vim-plug: Vim plugin manager
 " ============================
 "
-" Download plug.vim and put it in ~/.vim/autoload
+" 1. Download plug.vim and put it in 'autoload' directory
 "
+"   # Vim
 "   curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
 "     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
 "
-" Edit your .vimrc
+"   # Neovim
+"   sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
+"     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
 "
-"   call plug#begin('~/.vim/plugged')
+" 2. Add a vim-plug section to your ~/.vimrc (or ~/.config/nvim/init.vim for Neovim)
 "
-"   " Make sure you use single quotes
+"   call plug#begin()
 "
-"   " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
-"   Plug 'junegunn/vim-easy-align'
+"   " List your plugins here
+"   Plug 'tpope/vim-sensible'
 "
-"   " Any valid git URL is allowed
-"   Plug 'https://github.com/junegunn/vim-github-dashboard.git'
-"
-"   " Multiple Plug commands can be written in a single line using | separators
-"   Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
-"
-"   " On-demand loading
-"   Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
-"   Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
-"
-"   " Using a non-default branch
-"   Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
-"
-"   " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
-"   Plug 'fatih/vim-go', { 'tag': '*' }
-"
-"   " Plugin options
-"   Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
-"
-"   " Plugin outside ~/.vim/plugged with post-update hook
-"   Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
-"
-"   " Unmanaged plugin (manually installed and updated)
-"   Plug '~/my-prototype-plugin'
-"
-"   " Initialize plugin system
 "   call plug#end()
 "
-" Then reload .vimrc and :PlugInstall to install plugins.
-"
-" Plug options:
+" 3. Reload the file or restart Vim, then you can,
 "
-"| Option                  | Description                                      |
-"| ----------------------- | ------------------------------------------------ |
-"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use       |
-"| `rtp`                   | Subdirectory that contains Vim plugin            |
-"| `dir`                   | Custom directory for the plugin                  |
-"| `as`                    | Use different name for the plugin                |
-"| `do`                    | Post-update hook (string or funcref)             |
-"| `on`                    | On-demand loading: Commands or `<Plug>`-mappings |
-"| `for`                   | On-demand loading: File types                    |
-"| `frozen`                | Do not update unless explicitly specified        |
+"     :PlugInstall to install plugins
+"     :PlugUpdate  to update plugins
+"     :PlugDiff    to review the changes from the last update
+"     :PlugClean   to remove plugins no longer in the list
 "
-" More information: https://github.com/junegunn/vim-plug
+" For more information, see https://github.com/junegunn/vim-plug
 "
 "
-" Copyright (c) 2017 Junegunn Choi
+" Copyright (c) 2024 Junegunn Choi
 "
 " MIT License
 "
@@ -116,6 +85,10 @@ let s:TYPE = {
 let s:loaded = get(s:, 'loaded', {})
 let s:triggers = get(s:, 'triggers', {})
 
+function! s:is_powershell(shell)
+  return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
+endfunction
+
 function! s:isabsolute(dir) abort
   return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
 endfunction
@@ -234,10 +207,11 @@ endfunction
 
 function! plug#begin(...)
   if a:0 > 0
-    let s:plug_home_org = a:1
     let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
   elseif exists('g:plug_home')
     let home = s:path(g:plug_home)
+  elseif has('nvim')
+    let home = stdpath('data') . '/plugged'
   elseif !empty(&rtp)
     let home = s:path(split(&rtp, ',')[0]) . '/plugged'
   else
@@ -263,7 +237,7 @@ function! s:define_commands()
   endif
   if has('win32')
   \ && &shellslash
-  \ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
+  \ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell))
     return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
   endif
   if !has('nvim')
@@ -346,7 +320,7 @@ function! plug#end()
   endif
   let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
 
-  if exists('g:did_load_filetypes')
+  if get(g:, 'did_load_filetypes', 0)
     filetype off
   endif
   for name in g:plugs_order
@@ -385,6 +359,9 @@ function! plug#end()
       if !empty(types)
         augroup filetypedetect
         call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim')
+        if has('nvim-0.5.0')
+          call s:source(s:rtp(plug), 'ftdetect/**/*.lua', 'after/ftdetect/**/*.lua')
+        endif
         augroup END
       endif
       for type in types
@@ -401,7 +378,7 @@ function! plug#end()
 
   for [map, names] in items(lod.map)
     for [mode, map_prefix, key_prefix] in
-          \ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
+          \ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
       execute printf(
       \ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
       \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
@@ -432,6 +409,9 @@ endfunction
 
 function! s:load_plugin(spec)
   call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
+  if has('nvim-0.5.0')
+    call s:source(s:rtp(a:spec), 'plugin/**/*.lua', 'after/plugin/**/*.lua')
+  endif
 endfunction
 
 function! s:reload_plugins()
@@ -503,7 +483,7 @@ if s:is_win
     let batchfile = s:plug_tempname().'.bat'
     call writefile(s:wrap_cmds(a:cmd), batchfile)
     let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
-    if &shell =~# 'powershell\(\.exe\)\?$'
+    if s:is_powershell(&shell)
       let cmd = '& ' . cmd
     endif
     return [batchfile, cmd]
@@ -649,6 +629,9 @@ function! s:lod(names, types, ...)
     let rtp = s:rtp(g:plugs[name])
     for dir in a:types
       call s:source(rtp, dir.'/**/*.vim')
+      if has('nvim-0.5.0')  " see neovim#14686
+        call s:source(rtp, dir.'/**/*.lua')
+      endif
     endfor
     if a:0
       if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
@@ -863,7 +846,7 @@ function! s:lastline(msg)
 endfunction
 
 function! s:new_window()
-  execute get(g:, 'plug_window', 'vertical topleft new')
+  execute get(g:, 'plug_window', '-tabnew')
 endfunction
 
 function! s:plug_window_exists()
@@ -984,7 +967,7 @@ function! s:chsh(swap)
     set shell=sh
   endif
   if a:swap
-    if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
+    if s:is_powershell(&shell)
       let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
     elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
       set shellredir=>%s\ 2>&1
@@ -1025,6 +1008,11 @@ function! s:is_updated(dir)
 endfunction
 
 function! s:do(pull, force, todo)
+  if has('nvim')
+    " Reset &rtp to invalidate Neovim cache of loaded Lua modules
+    " See https://github.com/junegunn/vim-plug/pull/1157#issuecomment-1809226110
+    let &rtp = &rtp
+  endif
   for [name, spec] in items(a:todo)
     if !isdirectory(spec.dir)
       continue
@@ -1086,12 +1074,14 @@ endfunction
 function! s:checkout(spec)
   let sha = a:spec.commit
   let output = s:git_revision(a:spec.dir)
+  let error = 0
   if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
     let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
     let output = s:system(
           \ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
+    let error = v:shell_error
   endif
-  return output
+  return [output, error]
 endfunction
 
 function! s:finish(pull)
@@ -1152,7 +1142,7 @@ function! s:update_impl(pull, force, args) abort
   let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
                   \ remove(args, -1) : get(g:, 'plug_threads', 16)
 
-  let managed = filter(copy(g:plugs), 's:is_managed(v:key)')
+  let managed = filter(deepcopy(g:plugs), 's:is_managed(v:key)')
   let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') :
                          \ filter(managed, 'index(args, v:key) >= 0')
 
@@ -1204,7 +1194,8 @@ function! s:update_impl(pull, force, args) abort
   normal! 2G
   silent! redraw
 
-  let s:clone_opt = []
+  " Set remote name, overriding a possible user git config's clone.defaultRemoteName
+  let s:clone_opt = ['--origin', 'origin']
   if get(g:, 'plug_shallow', 1)
     call extend(s:clone_opt, ['--depth', '1'])
     if s:git_version_requirement(1, 7, 10)
@@ -1285,9 +1276,11 @@ function! s:update_finish()
       if !pos
         continue
       endif
+      let out = ''
+      let error = 0
       if has_key(spec, 'commit')
         call s:log4(name, 'Checking out '.spec.commit)
-        let out = s:checkout(spec)
+        let [out, error] = s:checkout(spec)
       elseif has_key(spec, 'tag')
         let tag = spec.tag
         if tag =~ '\*'
@@ -1300,19 +1293,16 @@ function! s:update_finish()
         endif
         call s:log4(name, 'Checking out '.tag)
         let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
-      else
-        let branch = s:git_origin_branch(spec)
-        call s:log4(name, 'Merging origin/'.s:esc(branch))
-        let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1'
-              \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)
+        let error = v:shell_error
       endif
-      if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
+      if !error && filereadable(spec.dir.'/.gitmodules') &&
             \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
         call s:log4(name, 'Updating submodules. This may take a while.')
         let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir)
+        let error = v:shell_error
       endif
       let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
-      if v:shell_error
+      if error
         call add(s:update.errors, name)
         call s:regress_bar()
         silent execute pos 'd _'
@@ -1375,7 +1365,9 @@ function! s:job_out_cb(self, data) abort
   if !self.running || self.tick % len(s:jobs) == 0
     let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-')
     let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
-    call s:log(bullet, self.name, result)
+    if len(result)
+      call s:log(bullet, self.name, result)
+    endif
   endif
 endfunction
 
@@ -1399,16 +1391,17 @@ function! s:nvim_cb(job_id, data, event) dict abort
     \ s:job_cb('s:job_exit_cb', self, 0, a:data)
 endfunction
 
-function! s:spawn(name, cmd, opts)
-  let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
-            \ 'new': get(a:opts, 'new', 0) }
+function! s:spawn(name, spec, queue, opts)
+  let job = { 'name': a:name, 'spec': a:spec, 'running': 1, 'error': 0, 'lines': [''],
+            \ 'new': get(a:opts, 'new', 0), 'queue': copy(a:queue) }
+  let Item = remove(job.queue, 0)
+  let argv = type(Item) == s:TYPE.funcref ? call(Item, [a:spec]) : Item
   let s:jobs[a:name] = job
 
   if s:nvim
     if has_key(a:opts, 'dir')
       let job.cwd = a:opts.dir
     endif
-    let argv = a:cmd
     call extend(job, {
     \ 'on_stdout': function('s:nvim_cb'),
     \ 'on_stderr': function('s:nvim_cb'),
@@ -1424,7 +1417,7 @@ function! s:spawn(name, cmd, opts)
             \ 'Invalid arguments (or job table is full)']
     endif
   elseif s:vim8
-    let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"script": 0})'))
+    let cmd = join(map(copy(argv), 'plug#shellescape(v:val, {"script": 0})'))
     if has_key(a:opts, 'dir')
       let cmd = s:with_cd(cmd, a:opts.dir, 0)
     endif
@@ -1444,27 +1437,34 @@ function! s:spawn(name, cmd, opts)
       let job.lines   = ['Failed to start job']
     endif
   else
-    let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]))
+    let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [argv, a:opts.dir] : [argv]))
     let job.error = v:shell_error != 0
     let job.running = 0
   endif
 endfunction
 
 function! s:reap(name)
-  let job = s:jobs[a:name]
+  let job = remove(s:jobs, a:name)
   if job.error
     call add(s:update.errors, a:name)
   elseif get(job, 'new', 0)
     let s:update.new[a:name] = 1
   endif
-  let s:update.bar .= job.error ? 'x' : '='
 
-  let bullet = job.error ? 'x' : '-'
+  let more = len(get(job, 'queue', []))
+  let bullet = job.error ? 'x' : more ? (job.new ? '+' : '*') : '-'
   let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
-  call s:log(bullet, a:name, empty(result) ? 'OK' : result)
-  call s:bar()
+  if len(result)
+    call s:log(bullet, a:name, result)
+  endif
 
-  call remove(s:jobs, a:name)
+  if !job.error && more
+    let job.spec.queue = job.queue
+    let s:update.todo[a:name] = job.spec
+  else
+    let s:update.bar .= job.error ? 'x' : '='
+    call s:bar()
+  endif
 endfunction
 
 function! s:bar()
@@ -1517,6 +1517,16 @@ function! s:update_vim()
   call s:tick()
 endfunction
 
+function! s:checkout_command(spec)
+  let a:spec.branch = s:git_origin_branch(a:spec)
+  return ['git', 'checkout', '-q', a:spec.branch, '--']
+endfunction
+
+function! s:merge_command(spec)
+  let a:spec.branch = s:git_origin_branch(a:spec)
+  return ['git', 'merge', '--ff-only', 'origin/'.a:spec.branch]
+endfunction
+
 function! s:tick()
   let pull = s:update.pull
   let prog = s:progress_opt(s:nvim || s:vim8)
@@ -1531,13 +1541,18 @@ while 1 " Without TCO, Vim stack is bound to explode
 
   let name = keys(s:update.todo)[0]
   let spec = remove(s:update.todo, name)
-  let new  = empty(globpath(spec.dir, '.git', 1))
+  let queue = get(spec, 'queue', [])
+  let new = empty(globpath(spec.dir, '.git', 1))
 
-  call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
-  redraw
+  if empty(queue)
+    call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
+    redraw
+  endif
 
   let has_tag = has_key(spec, 'tag')
-  if !new
+  if len(queue)
+    call s:spawn(name, spec, queue, { 'dir': spec.dir })
+  elseif !new
     let [error, _] = s:git_validate(spec, 0)
     if empty(error)
       if pull
@@ -1548,7 +1563,11 @@ while 1 " Without TCO, Vim stack is bound to explode
         if !empty(prog)
           call add(cmd, prog)
         endif
-        call s:spawn(name, cmd, { 'dir': spec.dir })
+        let queue = [cmd, split('git remote set-head origin -a')]
+        if !has_tag && !has_key(spec, 'commit')
+          call extend(queue, [function('s:checkout_command'), function('s:merge_command')])
+        endif
+        call s:spawn(name, spec, queue, { 'dir': spec.dir })
       else
         let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
       endif
@@ -1563,7 +1582,7 @@ while 1 " Without TCO, Vim stack is bound to explode
     if !empty(prog)
       call add(cmd, prog)
     endif
-    call s:spawn(name, extend(cmd, [spec.uri, s:trim(spec.dir)]), { 'new': 1 })
+    call s:spawn(name, spec, [extend(cmd, [spec.uri, s:trim(spec.dir)]), function('s:checkout_command'), function('s:merge_command')], { 'new': 1 })
   endif
 
   if !s:jobs[name].running
@@ -2225,7 +2244,7 @@ function! plug#shellescape(arg, ...)
   let script = get(opts, 'script', 1)
   if shell =~# 'cmd\(\.exe\)\?$'
     return s:shellesc_cmd(a:arg, script)
-  elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
+  elseif s:is_powershell(shell)
     return s:shellesc_ps1(a:arg)
   endif
   return s:shellesc_sh(a:arg)
@@ -2277,7 +2296,7 @@ function! s:system(cmd, ...)
         return system(a:cmd)
       endif
       let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
-      if &shell =~# 'powershell\(\.exe\)\?$'
+      if s:is_powershell(&shell)
         let cmd = '& ' . cmd
       endif
     else
@@ -2339,18 +2358,21 @@ function! s:git_validate(spec, check_branch)
               \ current_branch, origin_branch)
       endif
       if empty(err)
-        let [ahead, behind] = split(s:lastline(s:system([
-        \ 'git', 'rev-list', '--count', '--left-right',
-        \ printf('HEAD...origin/%s', origin_branch)
-        \ ], a:spec.dir)), '\t')
-        if !v:shell_error && ahead
-          if behind
+        let ahead_behind = split(s:lastline(s:system([
+          \ 'git', 'rev-list', '--count', '--left-right',
+          \ printf('HEAD...origin/%s', origin_branch)
+          \ ], a:spec.dir)), '\t')
+        if v:shell_error || len(ahead_behind) != 2
+          let err = "Failed to compare with the origin. The default branch might have changed.\nPlugClean required."
+        else
+          let [ahead, behind] = ahead_behind
+          if ahead && behind
             " Only mention PlugClean if diverged, otherwise it's likely to be
             " pushable (and probably not that messed up).
             let err = printf(
                   \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
                   \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind)
-          else
+          elseif ahead
             let err = printf("Ahead of origin/%s by %d commit(s).\n"
                   \ .'Cannot update until local changes are pushed.',
                   \ origin_branch, ahead)
@@ -2382,7 +2404,7 @@ function! s:clean(force)
   let errs = {}
   let [cnt, total] = [0, len(g:plugs)]
   for [name, spec] in items(g:plugs)
-    if !s:is_managed(name)
+    if !s:is_managed(name) || get(spec, 'frozen', 0)
       call add(dirs, spec.dir)
     else
       let [err, clean] = s:git_validate(spec, 1)
@@ -2614,26 +2636,34 @@ function! s:preview_commit()
 
   let sha = matchstr(getline('.'), '^  \X*\zs[0-9a-f]\{7,9}')
   if empty(sha)
-    return
+    let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$')
+    if empty(name)
+      return
+    endif
+    let title = 'HEAD@{1}..'
+    let command = 'git diff --no-color HEAD@{1}'
+  else
+    let title = sha
+    let command = 'git show --no-color --pretty=medium '.sha
+    let name = s:find_name(line('.'))
   endif
 
-  let name = s:find_name(line('.'))
   if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
     return
   endif
 
-  if exists('g:plug_pwindow') && !s:is_preview_window_open()
-    execute g:plug_pwindow
-    execute 'e' sha
+  if !s:is_preview_window_open()
+    execute get(g:, 'plug_pwindow', 'vertical rightbelow new')
+    execute 'e' title
   else
-    execute 'pedit' sha
+    execute 'pedit' title
     wincmd P
   endif
-  setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
+  setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable
   let batchfile = ''
   try
     let [sh, shellcmdflag, shrd] = s:chsh(1)
-    let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
+    let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command
     if s:is_win
       let [batchfile, cmd] = s:batchfile(cmd)
     endif
@@ -2759,9 +2789,9 @@ function! s:snapshot(force, ...) abort
   1
   let anchor = line('$') - 3
   let names = sort(keys(filter(copy(g:plugs),
-        \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
+        \'has_key(v:val, "uri") && isdirectory(v:val.dir)')))
   for name in reverse(names)
-    let sha = s:git_revision(g:plugs[name].dir)
+    let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir)
     if !empty(sha)
       call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
       redraw
diff --git a/ftdetect/dis.vim b/ftdetect/dis.vim
new file mode 100644 (file)
index 0000000..1d3f669
--- /dev/null
@@ -0,0 +1 @@
+au BufRead,BufNewFile *.dis* set filetype=dis
diff --git a/ftplugin/dis.vim b/ftplugin/dis.vim
new file mode 100644 (file)
index 0000000..0ae4f60
--- /dev/null
@@ -0,0 +1,6 @@
+if exists("b:did_ftplugin")
+    finish
+endif
+let b:did_ftplugin=1
+
+set ts=4
diff --git a/gvimrc b/gvimrc
index 1956f8b839b5797d0d1fe6fd3ccf08829cfcbec0..3782ff88eb6a3e6e3cca3ed71234751e1d79b84a 100644 (file)
--- a/gvimrc
+++ b/gvimrc
@@ -1,6 +1,6 @@
 set columns=100
 set lines=53
 
-set guifont=Hack\ NF\ 9,Hack\ 9,Liberation\ Mono\ for\ Powerline\ 10,DejaVu\ Sans\ Mono\ 10,Monospace\ 10
+set guifont=JetBrainsMono\ NF\ 9,Hack\ NF\ 9,Hack\ 9,DejaVu\ Sans\ Mono\ 10,Monospace\ 10
 
 set mousehide
diff --git a/init-local.vim.example b/init-local.vim.example
deleted file mode 100644 (file)
index 155438e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-" Do not show diagnostic window of vim-clang
-let g:clang_diagsopt = ''
-
-let g:ConqueTerm_StartMessages = 0
-
-" Reduce load on memory by updating one plugin at a time
-"let g:plug_threads = 1
-
-" Configuration for youcompleteme, if not using vim-clang.
-"let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
-"let g:ycm_confirm_extra_conf = 0
-"let g:ycm_min_num_of_chars_for_completion = 2
-"let g:ycm_collect_identifiers_from_tags_files = 1
-"let g:ycm_autoclose_preview_window_after_completion = 1
-"let g:ycm_key_list_select_completion = ['<Down>']
-"nnoremap <buffer> <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
-"let g:ycm_filetype_whitelist = { 'c' : 1, 'cpp' : 1, 'cs' : 1, 'objc' : 1, 'java' : 1, 'python' : 1 }
-
-" Some terminals, like konsole, cause weired symbols (e.g., q) printed due to
-" broken cursor-shape termcodes.
-if has('nvim')
-    set guicursor=
-    " Workaround some broken plugins which set guicursor indiscriminately.
-    au OptionSet guicursor noautocmd set guicursor=
-end
-
-" vim:ft=vim
index 86f93b3da6befc9866c02fbf7e6f6bb0299d5f6b..a80a4e8c128df20d534e816d7678546ae039db2d 100644 (file)
--- a/init.vim
+++ b/init.vim
@@ -16,6 +16,13 @@ set fillchars=vert:│,fold:\
 set listchars=tab:»­,trail:·,eol:$
 set virtualedit=block
 
+set linebreak
+
+" Use filetype.lua and do not use filetype.vim for >=neovim-0.7.2
+" Attention: Requires migration of ftdetect/ scripts
+" let g:do_filetype_lua = 1
+" let g:did_load_filetypes = 0
+
 filetype plugin indent on
 
 set tabstop=4
@@ -35,113 +42,32 @@ set foldlevelstart=20
 set colorcolumn=+1
 set mouse=a
 set wildmenu
-set wildmode=longest,list:full
+" set wildmode=longest,list:full
+" set wildmode=list:full
+set wildoptions=pum
+set showcmd
 
 set tabpagemax=100
 
-syntax on
-
-" Load some macros
-runtime macros.vim
-
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Some global plugin settings
-
-" Disable devicons on linux terminal
-if $TERM == 'linux'
-    let g:enable_plugin_devicons=0
-" Enable loading of devicons on all others
-else
-    let g:enable_plugin_devicons=1
+if has('nvim-0.7')
+  set laststatus=3
 endif
 
-runtime plugsetup.vim
-
-let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
-
-" Some preferences for indent detection
-let g:detectindent_min_indent = 2
-let g:detectindent_max_indent = 4
-let g:detectindent_preferred_indent = 4
-
-" Attention: Must be run after plugsetup.vim
-" Trailing whitespace
-highlight default link BadWhitespace SpellCap
-
-" Setup BadWhitespace syntax match expressions.
-function SetBadWhitespaceSyntax()
-  " Do not expose bad whitespace in help buffers or for man pages. Or, more
-  " generally, if we open the file readonly.
-  "if &ft != "help" && &ft != "man"
-  if !&readonly
-    " Make trailing whitespace be flagged as bad.
-    syn match BadWhitespace /\s\+$/ containedin=ALL
-    " Make space before tab be flagged as bad and vice versa
-    syn match BadWhitespace / \+\t/ containedin=ALL
-    syn match BadWhitespace /\t \+/ containedin=ALL
-  endif
-endfunction
-
-" Make trailing whitespace be flagged as bad.
-au BufRead,BufNewFile * call SetBadWhitespaceSyntax()
-
-let g:airline_powerline_fonts=1
-let g:airline#extensions#tabline#enabled=1
-let g:airline#extensions#branch#enabled=1
-
-let g:gruvbox_contrast_light='hard'
-let g:gruvbox_contrast_dark='hard'
-set bg=dark
-
-if &term =~ 'linux'
-    let g:gruvbox_termcolors=16
-else
-    " Setting termguicolors has two implications:
-    " - Breaks colors for some versions of mosh, but not if tmux is used on top of
-    "   mosh. See https://github.com/mobile-shell/mosh/issues/928
-    set termguicolors
-    let g:gruvbox_italic = 1
+if has('nvim-0.11')
+  lua<<EOF
+    vim.diagnostic.config({
+        -- virtual_text = true,
+        -- virtual_lines = true,
+        virtual_lines = { current_line = true},
+      })
+EOF
 endif
-colorscheme gruvbox
-
-" let NERDTreeWinPos="right"
-let NERDTreeHijackNetrw=0
-let NERDTreeWinSize=22
-let NERDTreeQuitOnOpen=1
-"au VimEnter * if !argc() | Startify | NERDTree | wincmd w
-
-let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck']
-let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck']
-
-" Taken from neomake
-if OnBattery()
-  call neomake#configure#automake('w')
-else
-  call neomake#configure#automake('nw', 1000)
-endif
-
-let g:clang_compilation_database = '.'
 
-" Speedup deoplete startup time, see deoplete FAQ
-let g:python3_host_prog = '/usr/bin/python3'
-" deoplete requires huge startuptime. Delay loading upon first InsertEnter.
-let g:deoplete#enable_at_startup = 0
-call deoplete#custom#option({
-                            \ 'smart_case' : v:true,
-                            \ 'auto_refresh_delay' : 100,
-                            \ })
-au InsertEnter * call deoplete#enable()
-
-"augroup pencil
-  "au!
-  "au FileType markdown,mkd call pencil#init()
-  "au FileType text         call pencil#init()
-  "au FileType mail         call pencil#init()
-  "au FileType tex          call pencil#init()
-"augroup END
+syntax on
 
-let g:vim_markdown_frontmatter=1
-let g:vim_markdown_math=1
+runtime macros.vim
+runtime keymaps.vim
+runtime plugsetup.vim
 
 
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -151,7 +77,7 @@ au FileType text,markdown,asciidoc,mail,gitcommit,mediawiki,vimwiki,tex setlocal
 au FileType text,markdown,asciidoc,mail,gitcommit,mediawiki,vimwiki setlocal formatoptions+=n
 au Filetype mail setlocal formatoptions+=o
 " Add | for block quotation, such that gq respects it
-au Filetype mail setlocal comments+=n:\|,
+au Filetype mail setlocal comments+=n:\|
 
 au Filetype go setlocal shiftwidth=8 tabstop=8 noexpandtab
 au Filetype tex setlocal shiftwidth=2 tabstop=2
@@ -165,152 +91,19 @@ au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
 " Line wrap crippled with numbers shown
 au Filetype man setlocal nonumber
 
-" Minimum indenting for source code
-au FileType java,cpp,c,cs let g:detectindent_min_indent = 4
-" Consider using localvimrc config file or editorconfig instead
-"au BufReadPost *.java :DetectIndent
-
-au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
-au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
-
-au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
-au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
 
 au FileType cpp,c packadd termdebug
 
-augroup autofoldcolumn
-  au!
-  au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
-augroup END
 
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Some plugin-specific settings
-
-let g:localvimrc_persistent = 1
-
-let g:fastfold_minlines = 0
-
-au FileType markdown call RagtagInit()
-
-let g:detectspelllang_langs = {}
-let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
-au FileType mail let g:VimMailSpellLangs=['de', 'en']
-
-:let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
-      \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
-      \ ['CANCELED(c)']]
-
-let g:vimwiki_list = [{'path': '~/.vimwiki/',
-      \ 'template_path': '~/.vim/vimwiki/templates',
-      \ 'template_default': 'default',
-      \ 'template_ext': '.html'}]
-let g:vimwiki_global_ext = 0
-
-" Java completion
-au FileType java setlocal omnifunc=javacomplete#Complete
-au FileType java JCEnable
-
-let g:VimMailContactsProvider=['khard']
-let g:VimMailContactsCommands={
-    \'khard':
-    \{ 'query' : "khard email --parsable --search-in-source-files",
-        \'sync': "/bin/true"}
-  \}
-
-let g:vimtex_fold_enabled = 1
-let g:vimtex_fold_levelmarker = '➜'
-
-" The denite settings are largely stolen from spacevim
-let s:denite_options = {
-      \ 'default' : {
-      \ 'winheight' : 15,
-      \ 'mode' : 'insert',
-      \ 'start_filter' : 1,
-      \ 'quit' : 1,
-      \ 'highlight_matched_char' : 'MoreMsg',
-      \ 'highlight_matched_range' : 'MoreMsg',
-      \ 'direction': 'rightbelow',
-      \ }}
-
-augroup spacevim_layer_denite
-  autocmd!
-  autocmd FileType denite call s:denite_my_settings()
-augroup END
-
-function! s:denite_my_settings() abort
-  nnoremap <silent><buffer><expr> i
-        \ denite#do_map('open_filter_buffer')
-  nnoremap <silent><buffer><expr> '
-        \ denite#do_map('toggle_select').'j'
-  nnoremap <silent><buffer><expr> q
-        \ denite#do_map('quit')
-  nnoremap <silent><buffer><expr> <C-t>
-        \ denite#do_map('do_action', 'tabopen')
-  nnoremap <silent><buffer><expr> <C-v>
-        \ denite#do_map('do_action', 'vsplit')
-  nnoremap <silent><buffer><expr> <C-s>
-        \ denite#do_map('do_action', 'split')
-  nnoremap <silent><buffer><expr> <CR>
-        \ denite#do_map('do_action')
-  nnoremap <silent><buffer><expr> p
-        \ denite#do_map('do_action', 'preview')
-  nnoremap <silent><buffer><Tab> j
-  nnoremap <silent><buffer><S-Tab> k
-endfunction
-
-" FIND and GREP COMMANDS
-if executable('rg')
-  " Ripgrep command on grep source
-  call denite#custom#var('grep', 'command', ['rg'])
-  call denite#custom#var('grep', 'default_opts',
-        \ ['--vimgrep', '--no-heading'])
-  call denite#custom#var('grep', 'recursive_opts', [])
-  call denite#custom#var('grep', 'pattern_opt', ['--regexp'])
-  call denite#custom#var('grep', 'separator', ['--'])
-  call denite#custom#var('grep', 'final_opts', [])
-endif
+" General settings
 
-let s:insert_mode_mappings = [
-      \ ['jk', '<denite:enter_mode:normal>', 'noremap'],
-      \ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
-      \ ['<C-j>', '<denite:move_to_next_line>', 'noremap'],
-      \ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
-      \ ['<C-k>', '<denite:move_to_previous_line>', 'noremap'],
-      \ ['<C-t>', '<denite:do_action:tabopen>', 'noremap'],
-      \ ['<C-v>', '<denite:do_action:vsplit>', 'noremap'],
-      \ ['<C-s>', '<denite:do_action:split>', 'noremap'],
-      \ ['<Esc>', '<denite:enter_mode:normal>', 'noremap'],
-      \ ['<C-N>', '<denite:assign_next_matched_text>', 'noremap'],
-      \ ['<C-P>', '<denite:assign_previous_matched_text>', 'noremap'],
-      \ ['<Up>', '<denite:assign_previous_text>', 'noremap'],
-      \ ['<Down>', '<denite:assign_next_text>', 'noremap'],
-      \ ['<C-Y>', '<denite:redraw>', 'noremap'],
-      \ ]
-
-let s:normal_mode_mappings = [
-      \ ["'", '<denite:toggle_select_down>', 'noremap'],
-      \ ['<C-n>', '<denite:jump_to_next_source>', 'noremap'],
-      \ ['<C-p>', '<denite:jump_to_previous_source>', 'noremap'],
-      \ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
-      \ ['<C-j>', '<denite:move_to_next_line>', 'noremap'],
-      \ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
-      \ ['<C-k>', '<denite:move_to_previous_line>', 'noremap'],
-      \ ['gg', '<denite:move_to_first_line>', 'noremap'],
-      \ ['<C-t>', '<denite:do_action:tabopen>', 'noremap'],
-      \ ['<C-v>', '<denite:do_action:vsplit>', 'noremap'],
-      \ ['<C-s>', '<denite:do_action:split>', 'noremap'],
-      \ ['q', '<denite:quit>', 'noremap'],
-      \ ['r', '<denite:redraw>', 'noremap'],
-      \ ]
 
 " termdebug split windows
 let g:termdebug_wide = 1
 let termdebugger = $HOME . '/.vim/gdb.sh'
 
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-runtime keymaps.vim
 
 if filereadable($HOME . '/.vim/init-local.vim')
   source ~/.vim/init-local.vim
index d50c6d9b8a46f5601b239f5c698c2eb517f05ea5..4d7ec01a2aa14f7bd5d17983f7484120ad82a59a 100755 (executable)
@@ -51,6 +51,7 @@ check_requirements()
     check_prog curl
     check_prog git
     check_vim +python3
+    check_vim +lua
     check_py3 neovim
     check_font "Hack NF"
 }
@@ -83,7 +84,7 @@ start the plugin provided colorscheme is not available yet.
 
 Add this line to your shell configuration, e.g., ~/.profile, to
 use vim as man pager:
-  export MANPAGER=\"view -c MANPAGER -\"
+  export MANPAGER=\"vi -c ASMANPAGER -\"
 EOF
 }
 
index 883b3e00eac93e837ba1a748edc13dc61c7fdee3..f63b0110c1181dc3431ec2d9919d10f4a9e885c3 100644 (file)
@@ -1,62 +1,67 @@
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Global settings
 
-nnoremap <C-p> :Denite file/rec<cr>
-nnoremap <space>/ :Denite grep:.<cr>
-nnoremap <space>s :Denite buffer<cr>
+if has('clipboard')
+    " Use + or * registers
+    if has('unnamedplus')
+        set clipboard+=unnamedplus
+    else
+        set clipboard+=unnamed
+    endif
+
+    " Ordinary ctrl+{c,x,v} using system clipboard register +. We use autocmd to
+    " override plugin keymaps.
+    "autocmd VimEnter * vnoremap <C-c> "+y
+    "autocmd VimEnter * vnoremap <C-x> "+x
+    " Is performed by S+Ins
+    "autocmd VimEnter * nnoremap <C-v> "+p
+    "autocmd VimEnter * inoremap <C-v> <c-r>+
+endif
+
+" ctrl+d as EOF exits shells and the like. Add a keymap for the same here.
+nnoremap <C-d> :q<cr>
 
 nnoremap <C-space> pumvisible() ? "\<c-n>" : "\<tab>"
 
-nnoremap <F2> :NERDTreeToggle<cr>
+nnoremap <F2> :lua MiniFiles.open()<cr>
 nnoremap <F3> :TagbarToggle<cr>
+nnoremap <F4> :lua MiniMap.toggle()<cr>
 
 nmap <s-PageDown> :bn<CR>
 nmap <s-PageUp>   :bp<CR>
 
-map <a-c> <plug>NERDCommenterToggle
-
-imap <C-k>     <Plug>(neosnippet_expand_or_jump)
-smap <C-k>     <Plug>(neosnippet_expand_or_jump)
-xmap <C-k>     <Plug>(neosnippet_expand_target)
-
-" Start interactive EasyAlign in visual mode (e.g. vipga)
-vmap <Enter> <Plug>(EasyAlign)
-" Start interactive EasyAlign for a motion/text object (e.g. gaip)
-nmap ga <Plug>(EasyAlign)
-
 
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Some filetype-specific settings
 
 au Filetype gnuplot map <buffer> <F5> :call OpenIn("gnuplot -persist") <CR>
 
-au Filetype c,cpp,objc map <buffer> <F11> :vsplit<CR>:FSRight<CR>
-au Filetype c,cpp,objc map <buffer> <S-F11> :FSHere<CR>
+" Performs a vertial split and a FSHere. For a header file the split is
+" performed to the left, for an implementation file to the right.
+function FSvsplit()
+    " We split to the right on header files
+    if match(expand('%:e'), 'h.*') >= 0
+        execute ':leftabove vsplit'
+    else
+        execute ':rightbelow vsplit'
+    endif
+
+    execute ':FSHere'
+endfunction
+
+au Filetype c,cpp,objc map <buffer> <F12> :call FSvsplit()<CR>
+" Terminal-based vi report S-F12 as F24
+au Filetype c,cpp,objc map <buffer> <S-F12> :FSHere<CR>
+au Filetype c,cpp,objc map <buffer> <F24> :FSHere<CR>
 
 au Filetype markdown map <buffer> <F5> :call RunMarkdown()<CR>
-au Filetype asciidoc map <buffer> <F5> :call RunAsciidoc()<CR>
-
-" See https://github.com/artur-shaik/vim-Javacomplete2
-" <C-j>ji <leader>ji
-au FileType java nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
-au FileType java imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
-" <C-j>ii <leader>jii
-au FileType java nmap <F5> <Plug>(JavaComplete-Imports-Add)
-au FileType java imap <F5> <Plug>(JavaComplete-Imports-Add)
-" <C-j>I <leader>jI
-au FileType java nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
-au FileType java imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
-" <C-j>R <leader>jR
-au FileType java nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
-au FileType java imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
+au Filetype asciidoc,asciidoctor map <buffer> <F5> :call RunAsciidoc()<CR>
 
 
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Some plugin-specific settings
 
 
-
-
 if filereadable($HOME . '/.vim/keymaps-local.vim')
   source ~/.vim/keymaps-local.vim
 endif
index b33bf4da65992365e37c3886d23716cc993d43ce..1da3dae9c56080df7f1cdc01545f006bef4759ac 100644 (file)
@@ -78,9 +78,12 @@ endfunction
 
 
 function InsertIncludeGuardsWithoutEndif()
-  let gatename = substitute(expand("%:t"), "\\.", "_", "g") . '_' . strpart(system('pwgen -c 16 1'), 0, 16)
-  execute "normal! i#ifndef " . gatename
-  execute "normal!   o#define " . gatename
+  " Build name of guard: Take filename, replace some chars by _ and
+  " prepend a random sequence to make guard robust against file name
+  " collisions.
+  let guardname = substitute(expand("%:t"), "[\\.-]", "_", "g") . '_' . strpart(system('pwgen -c 16 1'), 0, 16)
+  execute "normal! i#ifndef " . guardname
+  execute "normal! o#define " . guardname
 endfunction
 
 
@@ -109,6 +112,15 @@ endfunction
 
 function RunAsciidoctor()
   execute ":!asciidoctor " . @%
+  if executable("asciidoctor-pdf")
+    execute ":!asciidoctor-pdf " . @%
+  elseif executable("asciidoctor")
+    execute ":!asciidoctor " . @%
+  endif
+endfunction
+
+function RunAsciidoctorPdf()
+  execute ":!asciidoctor-pdf " . @%
 endfunction
 
 
@@ -126,7 +138,9 @@ endfunction
 
 
 function RunAsciidoc()
-  if executable("asciidoctor")
+  if executable("asciidoctor-pdf")
+    call RunAsciidoctorPdf()
+  elseif executable("asciidoctor")
     call RunAsciidoctor()
   else
     echo "No asciidoc implementation found."
index ed9ffe37711e6a37e183c276e867473c489d3341..dc6106c957a686a748eda65d00503ee7476a446a 100644 (file)
@@ -17,3 +17,7 @@ options head
 snippet acked-by
 options head
        Acked-by: ${1:authorname <mail>}
+snippet Ste-sthu
+       Stefan Huber <shuber@sthu.org>
+snippet Ste-fhs
+       Stefan Huber <stefan.huber@fh-salzburg.ac.at>
index 177d4272fcb55ef2d68e9c406f343e140e4f768a..75b1547a599d5f3e5c285c427c6df90ce5bc0aba 100644 (file)
@@ -23,3 +23,13 @@ alias   \begin{choices} \choices
        \begin{choices}
                ${1:TARGET}
        \end{choices}
+
+
+snippet inputtikz
+abbr figure with \inputtikz
+       \begin{figure}[tbhp]
+               \centering
+               \inputtikz{${1:TARGET}}
+               \caption{${2:CAPTION}}
+               \label{fig:$1}
+       \end{figure}
diff --git a/plugins-full.vim.example b/plugins-full.vim.example
new file mode 100644 (file)
index 0000000..922d3e3
--- /dev/null
@@ -0,0 +1,473 @@
+" neovim-0.4 has troubles with nvim-treesitter
+if has('nvim-0.5')
+    " neovim-0.7 works until v0.8.0
+    if has('nvim-0.9')
+        Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
+    else
+        Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate', 'tag': 'v0.8.0'}
+    endif
+
+    Plug 'nvim-treesitter/nvim-treesitter-refactor', {'do': ':TSUpdate'}
+
+    Plug 'robitx/gp.nvim'
+
+    Plug 'vzze/calculator.nvim'
+endif
+
+if has('nvim-0.8')
+    Plug 'williamboman/mason.nvim'
+    Plug 'neovim/nvim-lspconfig'
+    Plug 'williamboman/mason-lspconfig.nvim'
+    Plug 'mfussenegger/nvim-lint'
+
+    if has('nvim-0.10')
+        Plug 'stevearc/conform.nvim'
+        Plug 'shuber2/mason-conform', {'branch': 'fix-autoinstall-registrywarning'}
+    else
+        Plug 'mhartington/formatter.nvim'
+    endif
+endif
+
+
+" Prevent slow foling update, e.g., for vimtex
+Plug 'Konfekt/FastFold'
+
+Plug 'gko/vim-coloresque'
+
+" replace by https://github.com/mfussenegger/nvim-dap
+" Plug 'puremourning/vimspector'
+if has('nvim-0.10')
+    Plug 'mfussenegger/nvim-dap'
+    Plug 'nvim-neotest/nvim-nio'
+    Plug 'rcarriga/nvim-dap-ui'
+endif
+
+Plug 'Konfekt/vim-DetectSpellLang', {'do': 'spell'}
+
+Plug 'joom/latex-unicoder.vim'
+Plug 'chrisbra/unicode.vim'
+
+Plug 'errael/splice9', {'on': 'Splice9Init'}
+
+" Costs a second startup time
+Plug 'dbeniamine/cheat.sh-vim', {'on': 'Cheat'}
+
+Plug 'sheerun/vim-polyglot'
+
+Plug 'github/copilot.vim', {'on': 'Copilot'}
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" FileType specific plugins
+
+" Java IDE:
+" https://sookocheff.com/post/vim/neovim-java-ide/
+
+Plug 'lervag/vimtex'
+
+Plug 'shuber2/vim-syntax-easychair2'
+
+Plug 'vimwiki/vimwiki'
+
+Plug 'jceb/vim-orgmode', {'for': ['org']}
+
+Plug 'https://gitlab.com/dbeniamine/vim-mail'
+
+Plug 'stevearc/vim-arduino'
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+function PluginsConfigFull()
+
+    if has('nvim-0.5')
+        lua <<EOF
+            require("nvim-treesitter.configs").setup({
+                -- one of "all"
+                ensure_installed = {
+                    "asm",
+                    "awk",
+                    "bash",
+                    "bibtex",
+                    "c",
+                    "c_sharp",
+                    "cmake",
+                    "comment",
+                    "commonlisp",
+                    "cpp",
+                    "css",
+                    "csv",
+                    "diff",
+                    "disassembly",
+                    "dockerfile",
+                    "dot",
+                    "doxygen",
+                    "dtd",
+                    "editorconfig",
+                    "fortran",
+                    "git_config",
+                    "git_rebase",
+                    "gitattributes",
+                    "gitcommit",
+                    "gitignore",
+                    "gnuplot",
+                    "go",
+                    "gpg",
+                    "haskell",
+                    "html",
+                    "http",
+                    "java",
+                    "javascript",
+                    "jq",
+                    "jsdoc",
+                    "json",
+                    "json5",
+                    "jsonc",
+                    -- "latex", -- requires tree-sitter-cli
+                    "llvm",
+                    "lua",
+                    "luadoc",
+                    "luap",
+                    "make",
+                    "markdown",
+                    "markdown_inline",
+                    "meson",
+                    "muttrc",
+                    "nasm",
+                    "ninja",
+                    "objdump",
+                    "ocaml",
+                    "passwd",
+                    "perl",
+                    "php",
+                    "printf",
+                    "python",
+                    "readline",
+                    "regex",
+                    "requirements",
+                    "robots",
+                    "rust",
+                    "scss",
+                    "sql",
+                    "ssh_config",
+                    "strace",
+                    "tmux",
+                    "udev",
+                    -- "unison", -- requires tree-sitter-cli
+                    "vim",
+                    "vimdoc",
+                    "xml",
+                    "yaml"},
+                -- List of parsers to ignore installing
+                ignore_install = {},
+                -- Modules and its options go here
+                highlight = { enable = true },
+                -- Indentation is still quite buggy, e.g., for multi-line C comments
+                -- or for comments right after a preproc definition.
+                -- indent = { enable = true },
+                textobjects = { enable = true },
+                incremental_selection = {
+                    enable = true,
+                    keymaps = {
+                        init_selection = "gnn",
+                        node_incremental = "grn",
+                        scope_incremental = "grc",
+                        node_decremental = "grm",
+                    },
+                },
+                refactor = {
+                    highlight_definitions = { enable = true },
+                    smart_rename = {
+                        enable = true,
+                        keymaps = { smart_rename = "grr" },
+                        },
+                    navigation = {
+                        enable = true,
+                        keymaps = {
+                            goto_definition = "gnd",
+                            list_definitions = "gnD",
+                            list_definitions_toc = "gO",
+                            goto_next_usage = "<a-*>",
+                            goto_previous_usage = "<a-#>",
+                        },
+                    },
+                },
+            })
+
+            require("gp").setup({
+                providers = {
+                    copilot = {
+                        endpoint = "https://api.githubcopilot.com/chat/completions",
+                        secret = {
+                            "bash",
+                            "-c",
+                            "cat ~/.config/github-copilot/apps.json | sed -e 's/.*oauth_token...//;s/\".*//'",
+                        },
+                    },
+                    googleai = {
+                        -- disable = true,
+                        endpoint = "https://generativelanguage.googleapis.com/v1beta/models/{{model}}:streamGenerateContent?key={{secret}}",
+                        secret = os.getenv("GOOGLEAI_API_KEY"),
+                    },
+                },
+                agents = {
+                    {
+                            provider = "copilot",
+                            name = "ChatCopilot",
+                            chat = true,
+                            command = false,
+                            -- string with model name or table with model name and parameters
+                            model = { model = "gpt-4o", temperature = 1.1, top_p = 1 },
+                            -- system prompt (use this to specify the persona/role of the AI)
+                            system_prompt = require("gp.defaults").chat_system_prompt,
+                    },
+                    {
+                            provider = "googleai",
+                            name = "ChatGemini",
+                            chat = true,
+                            command = false,
+                            -- string with model name or table with model name and parameters
+                            model = { model = "gemini-pro", temperature = 1.1, top_p = 1 },
+                            -- system prompt (use this to specify the persona/role of the AI)
+                            system_prompt = require("gp.defaults").chat_system_prompt,
+                    },
+
+                },
+            })
+
+            vim.api.nvim_create_user_command("Calculate", "lua require(\"calculator\").calculate()",
+                { ["range"] = 1, ["nargs"] = 0 })
+
+            vim.keymap.set('v', 'gC', ':Calculate<cr>', {desc="calculate"});
+EOF
+
+        set foldmethod=expr
+        set foldexpr=nvim_treesitter#foldexpr()
+    endif
+
+    if has('nvim-0.8')
+        lua <<EOF
+            require("mason").setup({
+                ui = {
+                    icons = {
+                        package_installed = "✓",
+                        package_pending = "➜",
+                        package_uninstalled = "✗"
+                    }
+                }
+            })
+            require("mason-lspconfig").setup({
+                ensure_installed = {
+                    -- Latest before switching to Java 18
+                    -- "java_language_server@94a684b3931661440a57738fb2ee23d579acc2ab",
+                    "bashls",
+                    "clangd",
+                    "cssls",
+                    "html",
+                    "jdtls",
+                    "jsonls",
+                    "lua_ls",
+                    "markdown_oxide",
+                    "pylsp",
+                    "texlab",
+                    "vimls",
+                }
+            })
+
+            require("mason-lspconfig").setup_handlers {
+                -- The first entry (without a key) will be the default handler
+                -- and will be called for each installed server that doesn't have
+                -- a dedicated handler.
+                function (server_name) -- default handler (optional)
+                    require("lspconfig")[server_name].setup {}
+                end,
+                -- Next, you can provide a dedicated handler for specific servers.
+                -- For example, a handler override for the `rust_analyzer`:
+                -- ["rust_analyzer"] = function ()
+                --     require("rust-tools").setup {}
+                -- end
+            }
+
+            -- Conform requires nvim-0.10
+            if vim.fn.has('nvim-0.10') == 1 then
+                require("mason-conform").setup({})
+                require("conform").setup({
+                  formatters_by_ft = {
+                    bib = { "bibtex-tidy"},
+                  },
+                })
+
+                -- https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md#format-command
+                vim.api.nvim_create_user_command("Format",
+                  function(args)
+                    local range = nil
+                    if args.count ~= -1 then
+                      local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
+                      range = {
+                          start = { args.line1, 0 },
+                          ["end"] = { args.line2, end_line:len() },
+                      }
+                    end
+                    require("conform").format({ async = true, lsp_format = "fallback", range = range })
+                  end,
+                  { range = true }
+                )
+            else
+                local formatter = require("formatter")
+
+                -- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
+                require("formatter").setup {
+                  -- Enable or disable logging
+                  logging = true,
+                  -- Set the log level
+                  log_level = vim.log.levels.WARN,
+                  -- All formatter configurations are opt-in
+                  filetype = {
+                    bib = {
+                      function()
+                        return {
+                          exe = "bibtex-tidy"
+                        }
+                        end
+                      },
+                    c = { require("formatter.filetypes.c").clangformat },
+                    cpp = { require("formatter.filetypes.cpp").clangformat },
+                    css = require('formatter.filetypes.css').prettier,
+                    html = require('formatter.filetypes.html').prettier,
+                    java = { require("formatter.filetypes.java").clangformat },
+                    javascript = require('formatter.filetypes.javascript').prettier,
+                    json = require('formatter.filetypes.json').jq,
+                    python = { require("formatter.filetypes.python").autopep8 },
+                    xml = { require("formatter.filetypes.xml").xmllint },
+                    lua = { require("formatter.filetypes.lua").stylua },
+
+                    -- Use the special "*" filetype for defining formatter configurations on
+                    -- any filetype
+                    ["*"] = {
+                      -- "formatter.filetypes.any" defines default configurations for any
+                      -- filetype
+                      require("formatter.filetypes.any").remove_trailing_whitespace
+                    }
+                  }
+                }
+            end
+
+            require('lint').linters_by_ft = {
+                gitcommit = {'gitlint',},
+                sh = {'shellcheck',}
+            }
+
+            vim.keymap.set('n', '<leader>f', ':Format<cr>', {noremap=true, desc="format"})
+            -- A gK mapping for hover. The default 'K' is already mapped to :Map
+            vim.keymap.set('n', 'gK', vim.lsp.buf.hover, {desc="hover"})
+EOF
+        au BufWritePost * lua require('lint').try_lint()
+    endif
+
+
+    if has('nvim-0.10')
+        lua <<EOF
+            -- See details here:
+            -- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#ccrust-via-gdb
+            local dap = require("dap")
+            dap.adapters.gdb = {
+              type = "executable",
+              command = "gdb",
+              args = { "--interpreter=dap", "--eval-command", "set print pretty on" }
+            }
+            dap.configurations.c = {
+              {
+                name = "Launch",
+                type = "gdb",
+                request = "launch",
+                program = function()
+                  return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
+                end,
+                cwd = "${workspaceFolder}",
+                stopAtBeginningOfMainSubprogram = false,
+              },
+              {
+                name = "Select and attach to process",
+                type = "gdb",
+                request = "attach",
+                program = function()
+                   return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
+                end,
+                pid = function()
+                   local name = vim.fn.input('Executable name (filter): ')
+                   return require("dap.utils").pick_process({ filter = name })
+                end,
+                cwd = '${workspaceFolder}'
+              },
+              {
+                name = 'Attach to gdbserver :1234',
+                type = 'gdb',
+                request = 'attach',
+                target = 'localhost:1234',
+                program = function()
+                   return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
+                end,
+                cwd = '${workspaceFolder}'
+              },
+            }
+
+            -- See details here:
+            -- https://github.com/rcarriga/nvim-dap-ui?tab=readme-ov-file#usage
+            require("dapui").setup()
+            local dap, dapui = require("dap"), require("dapui")
+            dap.listeners.before.attach.dapui_config = function()
+              dapui.open()
+            end
+            dap.listeners.before.launch.dapui_config = function()
+              dapui.open()
+            end
+            dap.listeners.before.event_terminated.dapui_config = function()
+              dapui.close()
+            end
+            dap.listeners.before.event_exited.dapui_config = function()
+              dapui.close()
+            end
+
+            -- https://www.johntobin.ie/blog/debugging_in_neovim_with_nvim-dap/
+            vim.keymap.set('n', '<leader>db', dap.toggle_breakpoint, {desc="toggle breakpoint"});
+            vim.keymap.set('n', '<leader>dc', dap.continue, {desc="continue debugging"});
+            vim.keymap.set('n', '<leader>dC', dap.run_to_cursor, {desc="run to cursor"});
+            vim.keymap.set('n', '<leader>dT', dap.terminate, {desc="terminate debugging"});
+            vim.keymap.set('n', '<leader>de', dapui.eval, {desc="evaluate"});
+EOF
+    endif
+
+    let g:fastfold_minlines = 0
+
+    let g:detectspelllang_langs = {}
+    let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT']
+
+
+    au FileType mail let g:VimMailSpellLangs=['de', 'en']
+    let g:VimMailContactsProvider=['khard']
+    let g:VimMailContactsCommands={
+                \'khard':
+                \{ 'query' : "khard email --parsable --search-in-source-files",
+                \'sync': "/bin/true"}
+                \}
+
+    let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'],
+                \ ['|', 'OBSOLETE(o)', 'WONT(n)'],
+                \ ['CANCELED(c)']]
+
+    let g:vimwiki_list = [{'path': '~/.vimwiki/',
+                \ 'template_path': '~/.vim/vimwiki/templates',
+                \ 'template_default': 'default',
+                \ 'template_ext': '.html'}]
+    let g:vimwiki_global_ext = 0
+
+    let g:vimtex_fold_enabled = 1
+    let g:vimtex_fold_levelmarker = '➜'
+    let g:vimtex_view_general_viewer = 'okular'
+    let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
+    let g:vimtex_view_use_temp_files = v:true
+    " let g:airline#extensions#vimtex#enabled = 1
+
+  let g:arduino_auto_baud = 1
+  let g:arduino_use_slime = 1
+endfunction
+
+" vim:ft=vim
index c0be0eaf6dda50b9efc1993aa418ce241f5f2fae..997b38783ad40fcfc98b3e4fe42bd1fe4af70231 100644 (file)
@@ -1,8 +1,18 @@
-Plug 'jamessan/vim-gnupg'
-
-" An alternative to youcompleteme (ycm)
-Plug 'justmao945/vim-clang', {'for': ['c', 'cpp', 'objc']}
-
 "Plug 'kien/tabman.vim'
 
 "Plug 'chikamichi/mediawiki.vim'
+
+function PluginsConfigLocal()
+    " Reduce load on memory by updating one plugin at a time
+    "let g:plug_threads = 1
+
+    " Some terminals, like konsole, cause weired symbols (e.g., q) printed due to
+    " broken cursor-shape termcodes.
+    "if has('nvim')
+        "set guicursor=
+        " Workaround some broken plugins which set guicursor indiscriminately.
+        "au OptionSet guicursor noautocmd set guicursor=
+    "end
+endfunction
+
+" vim:ft=vim
diff --git a/plugins-midi.vim.example b/plugins-midi.vim.example
new file mode 100644 (file)
index 0000000..68ea44d
--- /dev/null
@@ -0,0 +1,157 @@
+" Required for wilder and mason
+Plug 'ryanoasis/vim-devicons', Cond($TERM != 'linux')
+
+if has('nvim')
+  function! UpdateRemotePlugins(...)
+    " Needed to refresh runtime files
+    let &rtp=&rtp
+    UpdateRemotePlugins
+  endfunction
+
+  Plug 'romgrk/fzy-lua-native'
+  Plug 'gelguy/wilder.nvim', { 'do': function('UpdateRemotePlugins') }
+endif
+
+Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'}
+
+Plug 'jamessan/vim-gnupg'
+
+Plug 'embear/vim-localvimrc'
+
+Plug 'airblade/vim-rooter'
+
+Plug 'preservim/vim-markdown', {'for': 'markdown'}
+Plug 'lvht/tagbar-markdown', {'for': 'markdown'}
+Plug 'habamax/vim-asciidoctor', {'for': 'asciidoc'}
+
+Plug 'tpope/vim-ragtag'
+
+Plug 'rafamadriz/friendly-snippets'
+
+Plug 'tpope/vim-speeddating'
+Plug 'mattn/calendar-vim'
+
+Plug 'gentoo/gentoo-syntax'
+
+Plug 'vim-scripts/loremipsum', {'on': 'Loremipsum'}
+
+Plug 'jpalardy/vim-slime'
+
+if has('nvim-0.8')
+  Plug 'andrewferrier/wrapping.nvim'
+endif
+
+function PluginsConfigMidi()
+    let g:localvimrc_persistent = 1
+
+    let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
+
+    "augroup pencil
+      "au!
+      "au FileType markdown,mkd call pencil#init()
+      "au FileType text         call pencil#init()
+      "au FileType mail         call pencil#init()
+      "au FileType tex          call pencil#init()
+    "augroup END
+
+    let g:vim_markdown_frontmatter=1
+    let g:vim_markdown_math=1
+
+    au FileType markdown call RagtagInit()
+
+    " Allow for reflow of bullet paragraphs
+    let g:vim_markdown_auto_insert_bullets = 0
+
+    let g:calendar_monday = 1
+
+    if has('nvim')
+        lua <<EOF
+            local wilder = require('wilder')
+            wilder.setup({modes = {':', '/', '?'}})
+
+            wilder.set_option('pipeline', {
+              wilder.branch(
+                wilder.python_file_finder_pipeline({
+                  debounce = 100,
+                  file_command = function(ctx, arg)
+                    -- If search pattern contains "." also search of hidden
+                    -- files. Otherwise, do not.
+                    if string.find(arg, '.') ~= nil then
+                      return {'fd', '-tf', '-H'}
+                    else
+                      return {'fd', '-tf'}
+                    end
+                  end,
+                  dir_command = {'fd', '-td'},
+                }),
+                wilder.substitute_pipeline({
+                  debounce = 50,
+                  pipeline = wilder.python_search_pipeline({
+                    skip_cmdtype_check = 1,
+                    pattern = wilder.python_fuzzy_pattern({
+                      start_at_boundary = 0,
+                    }),
+                  }),
+                }),
+                wilder.cmdline_pipeline({
+                  debounce = 50,
+                  fuzzy = 2,
+                  fuzzy_filter = wilder.lua_fzy_filter(),
+                }),
+                {
+                  wilder.check(function(ctx, x) return x == '' end),
+                  wilder.history(),
+                },
+                wilder.python_search_pipeline({
+                  debounce = 50,
+                  pattern = wilder.python_fuzzy_pattern({
+                    start_at_boundary = 0,
+                  }),
+                })
+              ),
+            })
+
+            local highlighters = {
+              -- wilder.pcre2_highlighter(),
+              wilder.lua_fzy_highlighter(),
+            }
+
+            local popupmenu_renderer = wilder.popupmenu_renderer(
+              wilder.popupmenu_border_theme({
+                border = 'rounded',
+                ellipsis = '…',
+                empty_message = wilder.popupmenu_empty_message_with_spinner(),
+                highlighter = highlighters,
+                left = {
+                  ' ',
+                  wilder.popupmenu_devicons(),
+                  wilder.popupmenu_buffer_flags({
+                    flags = '%a-+',
+                  }),
+                },
+                right = {
+                  ' ',
+                  wilder.popupmenu_scrollbar(),
+                },
+              })
+            )
+
+            local wildmenu_renderer = wilder.wildmenu_renderer({
+              highlighter = highlighters,
+              separator = ' · ',
+              left = {' ', wilder.wildmenu_spinner(), ' '},
+              right = {' ', wilder.wildmenu_index()},
+            })
+
+            wilder.set_option('renderer', wilder.renderer_mux({
+              [':'] = popupmenu_renderer,
+              ['/'] = wildmenu_renderer,
+              substitute = wildmenu_renderer,
+            }))
+EOF
+    endif
+
+    let g:slime_target = "tmux"
+endfunction
+
+" vim:ft=vim
diff --git a/plugins-mini.vim b/plugins-mini.vim
new file mode 100644 (file)
index 0000000..8a16598
--- /dev/null
@@ -0,0 +1,224 @@
+function! Cond(cond, ...)
+    let opts = get(a:000, 0, {})
+    return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
+endfunction
+
+"Plug 'mhinz/vim-startify'
+Plug 'dstein64/vim-startuptime'
+
+" The original repo from gruvbox-community would not support treestitter and
+" semantic highlighting. But gruvbox.nvim requires nvim-0.8.
+if has('nvim-0.8')
+    Plug 'ellisonleao/gruvbox.nvim'
+else
+    Plug 'gruvbox-community/gruvbox'
+endif
+
+Plug 'benknoble/vim-auto-origami'
+
+" This plugin cannot be conditionally loaded, see github issue #18
+Plug 'derekwyatt/vim-fswitch' ", {'for': ['c', 'cpp', 'objc']}
+
+Plug 'thinca/vim-fontzoom'
+
+Plug 'lambdalisue/vim-manpager'
+
+" Make . more useful after a plugin map
+Plug 'tpope/vim-repeat'
+Plug 'flwyd/vim-conjoin'
+
+Plug 'nfnty/vim-nftables'
+
+if has('nvim-0.7')
+    " Comparison at https://github.com/Darazaki/indent-o-matic/issues/12
+    Plug 'nmac427/guess-indent.nvim'
+
+    Plug 'echasnovski/mini.nvim'", { 'branch': 'stable' }
+endif
+
+" mini.vim's status line requires nvim-0.8
+if !has('nvim-0.8')
+    Plug 'vim-airline/vim-airline'
+endif
+
+
+function PluginsConfigMini()
+
+    " Config of ellisonleao/gruvbox for neovim and gruvbox-community/gruvbox
+    " otherwise
+    if has('nvim-0.8')
+        lua <<EOF
+        -- Required before setting colorscheme to gruvbox
+        require("gruvbox").setup({
+            contrast = "hard",
+        })
+EOF
+    else
+        let g:gruvbox_contrast_light='hard'
+        let g:gruvbox_contrast_dark='hard'
+
+        if &term =~ 'linux'
+            let g:gruvbox_termcolors=16
+        else
+            " Setting termguicolors has two implications:
+            " - Breaks colors for some versions of mosh, but not if tmux is used on top of
+            "   mosh. See https://github.com/mobile-shell/mosh/issues/928
+            set termguicolors
+            let g:gruvbox_italic = 1
+        endif
+    endif
+    set background=dark
+    colorscheme gruvbox
+
+
+    augroup autofoldcolumn
+        au!
+        au CursorHold,BufWinEnter * AutoOrigamiFoldColumn
+    augroup END
+
+
+    let g:startify_files_number = 5
+    let g:startify_session_persistence = 1
+    let g:startify_lists = [
+                \ { 'type': 'dir',       'header': ['   Recent files'] },
+                \ { 'type': 'sessions',  'header': ['   Saved sessions'] },
+                \ ]
+
+    if has('nvim')
+        let verstr = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
+        let g:startify_custom_header = [
+                    \ '',
+                    \ '        ╻ ╻   ╻   ┏┳┓',
+                    \ '   NEO  ┃┏┛   ┃   ┃┃┃',
+                    \ '        ┗┛    ╹   ╹ ╹  ' . verstr,
+                    \ '',
+                    \ ]
+    else
+        let verstr = matchstr(execute('version'), 'IMproved \zs[^\n ]*')
+        let g:startify_custom_header = [
+                    \ '',
+                    \ '   ╻ ╻   ╻   ┏┳┓',
+                    \ '   ┃┏┛   ┃   ┃┃┃',
+                    \ '   ┗┛    ╹   ╹ ╹  ' . verstr,
+                    \ '',
+                    \ ]
+    endif
+
+    au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
+    au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
+    au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
+    au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
+
+    let g:mapleader = "\<Space>"
+    let g:maplocalleader = ','
+
+    if has('nvim-0.7')
+        lua <<EOF
+            require('guess-indent').setup {}
+
+            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 }),
+                },
+            })
+            MiniSnippets.start_lsp_server()
+
+            require('mini.align').setup()
+            require('mini.ai').setup()
+            require('mini.bracketed').setup()
+            require('mini.bufremove').setup()
+            require('mini.comment').setup()
+            require('mini.cursorword').setup()
+            require('mini.diff').setup()
+            require('mini.files').setup()
+            require('mini.fuzzy').setup()
+            require('mini.git').setup()
+            require('mini.icons').setup()
+            MiniIcons.tweak_lsp_kind()
+            require('mini.jump2d').setup()
+            require('mini.map').setup()
+            require('mini.move').setup()
+            require('mini.notify').setup()
+            require('mini.operators').setup()
+            require('mini.pick').setup()
+            require('mini.starter').setup()
+            require('mini.splitjoin').setup()
+            require('mini.surround').setup()
+            require('mini.tabline').setup()
+            require('mini.trailspace').setup()
+
+            require('mini.completion').setup()
+EOF
+    endif
+
+    " Use mini's statusline from nvim-0.8 on and fallback to airline
+    if has('nvim-0.8')
+        lua <<EOF
+            require('mini.sessions').setup()
+            require('mini.statusline').setup()
+EOF
+    else
+        let g:airline_powerline_fonts=1
+        let g:airline#extensions#tabline#enabled=1
+        let g:airline#extensions#branch#enabled=1
+    endif
+
+    if has('nvim-0.9')
+        lua <<EOF
+            local miniclue = require('mini.clue')
+            miniclue.setup({
+            triggers = {
+                -- Leader triggers
+                { mode = 'n', keys = '<Leader>' },
+                { mode = 'x', keys = '<Leader>' },
+
+                -- Built-in completion
+                { mode = 'i', keys = '<C-x>' },
+
+                -- `g` key
+                { mode = 'n', keys = 'g' },
+                { mode = 'x', keys = 'g' },
+
+                -- Marks
+                { mode = 'n', keys = "'" },
+                { mode = 'n', keys = '`' },
+                { mode = 'x', keys = "'" },
+                { mode = 'x', keys = '`' },
+
+                -- Registers
+                { mode = 'n', keys = '"' },
+                { mode = 'x', keys = '"' },
+                { mode = 'i', keys = '<C-r>' },
+                { mode = 'c', keys = '<C-r>' },
+
+                -- Window commands
+                { mode = 'n', keys = '<C-w>' },
+
+                -- `z` key
+                { mode = 'n', keys = 'z' },
+                { mode = 'x', keys = 'z' },
+                },
+
+            clues = {
+                -- Enhance this by adding descriptions for <Leader> mapping groups
+                miniclue.gen_clues.builtin_completion(),
+                miniclue.gen_clues.g(),
+                miniclue.gen_clues.marks(),
+                miniclue.gen_clues.registers(),
+                miniclue.gen_clues.windows(),
+                miniclue.gen_clues.z(),
+                },
+            })
+EOF
+    endif
+
+endfunction
+
diff --git a/plugins.vim b/plugins.vim
deleted file mode 100644 (file)
index a79fac1..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-function! Cond(cond, ...)
-  let opts = get(a:000, 0, {})
-  return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
-endfunction
-
-Plug 'mhinz/vim-startify'
-
-Plug 'editorconfig/editorconfig-vim'
-Plug 'embear/vim-localvimrc'
-
-Plug 'vim-airline/vim-airline'
-Plug 'gruvbox-community/gruvbox'
-
-Plug 'mhinz/vim-signify'
-Plug 'tpope/vim-fugitive'
-Plug 'airblade/vim-rooter'
-
-Plug 'benknoble/vim-auto-origami'
-" Prevent slow foling update, e.g., for vimtex
-Plug 'Konfekt/FastFold'
-
-Plug 'scrooloose/nerdcommenter'
-
-Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'}
-Plug 'Xuyuanp/nerdtree-git-plugin', {'on': 'NERDTreeToggle'}
-
-Plug 'ryanoasis/vim-devicons', Cond(g:enable_plugin_devicons)
-
-Plug 'neomake/neomake'
-Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'}
-
-Plug 'plasticboy/vim-markdown', {'for': 'markdown'}
-Plug 'lvht/tagbar-markdown', {'for': 'markdown'}
-Plug 'habamax/vim-asciidoctor', {'for': 'asciidoc'}
-
-Plug 'PProvost/vim-markdown-jekyll', {'for': 'markdown'}
-Plug 'tpope/vim-liquid', {'for': ['liquid', 'html', 'xml', 'markdown']}
-
-Plug 'cakebaker/scss-syntax.vim', {'for': 'scss'}
-Plug 'hail2u/vim-css3-syntax', {'for': ['scss', 'css']}
-Plug 'ap/vim-css-color', {'for': ['scss', 'css']}
-
-Plug 'tpope/vim-ragtag'
-
-Plug 'lervag/vimtex', {'for': 'tex'}
-
-if has('nvim')
-  Plug 'Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'}
-  Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' }
-else
-  Plug 'Shougo/deoplete.nvim'
-  Plug 'Shougo/denite.nvim'
-
-  Plug 'roxma/nvim-yarp'
-  Plug 'roxma/vim-hug-neovim-rpc'
-endif
-" java extension to deoplete
-Plug 'artur-shaik/vim-javacomplete2', {'for': 'java'}
-
-Plug 'Shougo/neosnippet.vim'
-Plug 'Shougo/neosnippet-snippets'
-
-Plug 'tpope/vim-speeddating'
-Plug 'jceb/vim-orgmode', {'for': ['org']}
-Plug 'vimwiki/vimwiki'
-Plug 'mattn/calendar-vim'
-
-Plug 'Konfekt/vim-DetectSpellLang', {'do': 'spell'}
-Plug 'roryokane/detectindent'
-
-Plug 'derekwyatt/vim-fswitch', {'for': ['c', 'cpp', 'objc']}
-Plug 'ludovicchabant/vim-gutentags', {'for': ['c', 'cpp', 'objc']}
-"Plug 'vim-scripts/Conque-GDB', {'for': ['c', 'cpp', 'objc']}
-
-Plug 'godlygeek/tabular'
-Plug 'junegunn/vim-easy-align'
-
-Plug 'thinca/vim-fontzoom'
-
-Plug 'vim-scripts/loremipsum', {'on': 'Loremipsum'}
-
-Plug 'lambdalisue/vim-manpager', {'on': 'MANPAGER'}
-
-Plug 'https://gitlab.com/dbeniamine/vim-mail'
-" Costs a second startup time
-Plug 'dbeniamine/cheat.sh-vim', {'on': 'Cheat'}
-
-Plug 'dstein64/vim-startuptime'
-
-" Make . more useful after a plugin map
-Plug 'tpope/vim-repeat'
-
-Plug 'flwyd/vim-conjoin'
-
-Plug 'sjl/splice.vim', {'on': 'SpliceInit'}
-
-Plug 'sheerun/vim-polyglot'
-
-if filereadable($HOME . '/.vim/plugins-local.vim')
-  source ~/.vim/plugins-local.vim
-endif
index ab7fa210c84997eda6a7f308e234c7cedcc17456..f34150d70a545c6f25f37ab89ec3e520ad9836d9 100644 (file)
@@ -6,13 +6,51 @@ if empty(glob('~/.vim/autoload/plug.vim'))
   autocmd VimEnter * PlugInstall --sync | source ~/.vim/init.vim
 endif
 
+
 call plug#begin('~/.vim/plugged')
-source ~/.vim/plugins.vim
+
+source ~/.vim/plugins-mini.vim
+
+" Load various conditinoal plugin sets
+
+if filereadable($HOME . '/.vim/plugins-midi.vim')
+    source ~/.vim/plugins-midi.vim
+endif
+
+if filereadable($HOME . '/.vim/plugins-full.vim')
+    source ~/.vim/plugins-full.vim
+endif
+
+if filereadable($HOME . '/.vim/plugins-local.vim')
+    source ~/.vim/plugins-local.vim
+endif
+
 call plug#end()
 
-"Automatically install missing plugins
-"https://github.com/junegunn/vim-plug/wiki/extra
-autocmd VimEnter *
-  \  if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
-  \|   PlugInstall --sync | q
-  \| endif
+
+" Call config functions of plugin sets
+
+call PluginsConfigMini()
+
+if filereadable($HOME . '/.vim/plugins-midi.vim')
+    call PluginsConfigMidi()
+endif
+
+if filereadable($HOME . '/.vim/plugins-full.vim')
+    call PluginsConfigFull()
+endif
+
+if filereadable($HOME . '/.vim/plugins-local.vim')
+    call PluginsConfigLocal()
+endif
+
+
+function s:PostConfig()
+    "Automatically install missing plugins
+    "https://github.com/junegunn/vim-plug/wiki/extra
+    if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
+        PlugInstall --sync | q
+    endif
+endfunction
+
+autocmd VimEnter * call s:PostConfig()
diff --git a/snippets/gitcommit.json b/snippets/gitcommit.json
new file mode 100644 (file)
index 0000000..0a351c0
--- /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/beamer.json b/snippets/latex/beamer.json
new file mode 100644 (file)
index 0000000..452e716
--- /dev/null
@@ -0,0 +1,25 @@
+{
+    "frame": {
+        "prefix": "frame",
+        "body": [
+            "\\begin{frame}{$1}",
+            "\t$0",
+            "\\end{frame}"
+        ],
+        "description": "beamer frame"
+    },
+    "only": {
+        "prefix": "only",
+        "body": "\\only<${1}>{\n\t${0:${TM_SELECTED_TEXT}}\n}",
+        "description": "\\only wrap"
+    },
+    "block": {
+        "prefix": "block",
+        "body": [
+            "\\begin{block}{$1}",
+            "\t$0",
+            "\\end{block}"
+        ],
+        "description": "beamer block"
+    }
+}
diff --git a/snippets/latex/exam.json b/snippets/latex/exam.json
new file mode 100644 (file)
index 0000000..8a63762
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "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"
+    }
+}
diff --git a/snippets/latex/tikz.json b/snippets/latex/tikz.json
new file mode 100644 (file)
index 0000000..13efe63
--- /dev/null
@@ -0,0 +1,7 @@
+{
+    "inputtikz": {
+        "prefix": "ITIKZ",
+        "body": "\\begin{figure}[${1:htbp}]\n\t\\centering\n\t\\inputtikz{${2}}\n\t\\caption{${3:<caption>}}\\label{${4:<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..932c158
--- /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"
+    },
+    "sg": {
+        "prefix": "sg",
+        "body": "Schöne Grüße,\nStefan Huber"
+    },
+    "hdl": {
+        "prefix": "hdl",
+        "body": "Hab dich lieb,\nStefan"
+    },
+    "kind regards": {
+        "prefix": "kr",
+        "body": "Kind regards\nStefan Huber"
+    },
+    "best regards": {
+        "prefix": "br",
+        "body": "Best regards\nStefan Huber"
+    },
+    "best": {
+        "prefix": "best",
+        "body": "Best\nStefan"
+    },
+    "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------------------------------------------------------------------------"
+    }
+}
diff --git a/syntax/dis.vim b/syntax/dis.vim
new file mode 100644 (file)
index 0000000..8da41dd
--- /dev/null
@@ -0,0 +1,119 @@
+" Vim syntax file
+" Language:     x86/x64 GNU Disassembler (objdump -d -Mintel)
+" Maintainer:   @shiracamus <shiracamus@gmail.com>
+" Last Change:  2013 Dec 30
+
+" For version 5.x: Clear all syntax items
+" For version 6.0 and later: Quit when a syntax file was already loaded
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+syn case ignore
+
+syn match disOffset     "[+-]"
+syn match disNumber     "[+-]\?\<0x[0-9a-f]\+\>" contains=disOffset
+syn match disNumber     "[+-]\?\<[0-9a-f]\+\>" contains=disOffset
+
+syn match disRegister   "\<[re]\?[abcd][xhl]\>"
+syn match disRegister   "\<[re]\?[sd]il\?\>"
+syn match disRegister   "\<[re]\?[sbi]pl\?\>"
+syn match disRegister   "\<r[0-9]\+[dwb]\?\>"
+syn match disRegister   "[^\t]\<[cdefgs]s\>"hs=s+1
+
+syn match disAt         "@"
+syn match disSection    " \.[a-z][a-z_\.-]*:"he=e-1
+syn match disSection    "@[a-z0-9_][a-z0-9_-]\+"hs=s+1 contains=disAt,disNumber
+
+" SH: Having a function name like "f" leads to labels like "<f>", which shall
+" not be matched as disNumber.
+"syn match disLabel      "<[a-z0-9_.][a-z0-9_.@+-]*>"hs=s+1,he=e-1 contains=disNumber,disSection
+syn match disLabel      "<[a-z0-9_.][a-z0-9_.@+-]*>"hs=s+1,he=e-1 contains=disSection
+syn match disHexDump    ":\t\([0-9a-f][0-9a-f][ \t]\)\+"hs=s+1
+
+syn match disError      "<internal disassembler error>"
+syn match disError      "(bad)"
+
+syn keyword disTodo     contained TODO
+
+syn region disComment   start="/\*" end="\*/" contains=disTodo
+syn match disComment    "[#;!|].*" contains=disLabel,disTodo
+syn match disStatement  "//.*" contains=cStatement
+
+syn match disSpecial    display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
+syn region disString    start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=disSpecial
+syn region disString    start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=disSpecial
+
+syn match disFormat     ": \+file format "
+syn match disTitle      "^[^ ]\+: \+file format .*$" contains=disFormat
+
+syn match disMacro      "FWORD"
+syn match disMacro      "QWORD"
+syn match disMacro      "DWORD"
+syn match disMacro      "BYTE"
+syn match disMacro      "PTR"
+
+syn match disData       ".word"
+syn match disData       ".short"
+syn match disData       ".byte"
+
+" Opecode matched disNumber
+syn match disOpecode    "\<add "
+syn match disOpecode    "\<adc "
+syn match disOpecode    "\<dec "
+syn match disOpecode    "\<fadd "
+
+syn case match
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_dis_syntax_inits")
+  if version < 508
+    let did_dis_syntax_inits = 1
+    command -nargs=+ HiLink hi link <args>
+  else
+    command -nargs=+ HiLink hi def link <args>
+  endif
+
+  " The default methods for highlighting.  Can be overridden later
+  " Comment
+  HiLink disComment     Comment
+  " Constant: String, Character, Number, Boolean, Float
+  HiLink disNumber      Number
+  HiLink disString      String
+  " Identifier: Function
+  HiLink disHexDump     Identifier
+  " Statement: Conditional, Repeat, Label, Operator, Keyword, Exception
+  HiLink disStatement  Statement
+  HiLink disLabel       Label
+  " PreProc: Include, Define, Macro, PreCondit
+  HiLink disData        Define
+  HiLink disMacro       Macro
+  " Type: StorageClass, Structure, Typedef
+  HiLink disRegister    StorageClass
+  HiLink disTitle       Typedef
+  " Special: SpecialChar, Tag, Delimiter, SpecialComment, Debug
+  HiLink disSpecial     SpecialChar
+  HiLink disSection     Special
+  " Underlined
+  " Ignore
+  " Error
+  HiLink disError       Error
+  " Todo
+  HiLink disTodo        Todo
+
+  delcommand HiLink
+endif
+
+let b:current_syntax = "dis"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: ts=8 sts=4 sw=2
diff --git a/vimspector-config/vimspector.json b/vimspector-config/vimspector.json
new file mode 100644 (file)
index 0000000..c6a761a
--- /dev/null
@@ -0,0 +1,63 @@
+// This is from a template. Modify for your needs.
+{
+    "configurations": {
+        "Launch": {
+            "default": true,
+            "adapter": "vscode-cpptools",
+            "filetypes": [ "cpp", "c", "objc", "rust" ],
+            "configuration": {
+                "request": "launch",
+                "MIMode": "gdb",
+                "program": "${fileBasenameNoExtension}",
+                "args": [ ],
+                "environment": [ ],
+                "externalConsole": true,
+                "setupCommands": [
+                    {
+                        "description": "Enable pretty-printing for gdb",
+                        "text": "-enable-pretty-printing",
+                        "ignoreFailures": true
+                    }
+                ]
+            }
+        },
+        "Attach": {
+            "adapter": "vscode-cpptools",
+            "filetypes": [ "cpp", "c", "objc", "rust" ],
+            "configuration": {
+                "request": "attach",
+                "MIMode": "gdb",
+                "program": "${fileBasenameNoExtension}",
+                "setupCommands": [
+                    {
+                        "description": "Enable pretty-printing for gdb",
+                        "text": "-enable-pretty-printing",
+                        "ignoreFailures": true
+                    }
+                ]
+            }
+        },
+        "Python: Attach To Vim": {
+            "adapter": "multi-session",
+            "filetypes": [ "python" ],
+            "variables": {
+                "port": "5678",
+                "host": "localhost"
+            },
+            "configuration": {
+                "request": "attach"
+            }
+        },
+        "Python: Run current script": {
+            "default": true,
+            "adapter": "debugpy",
+            "filetypes": [ "python" ],
+            "configuration": {
+                "request": "launch",
+                "program": "${file}",
+                "args": [ "*${args:--update-gadget-config}" ],
+                "justMyCode#json": "${justMyCode:true}"
+            }
+        }
+    }
+}