From 3b209dc0f967e469207beea7d6478ebe1e075c76 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 18 Aug 2024 15:23:47 +0200 Subject: nvim: Prefer *.vim to *.lua --- .config/nvim/after/ftdetect/aerc.lua | 24 ------------------------ .config/nvim/after/ftdetect/aerc.vim | 18 ++++++++++++++++++ .config/nvim/after/ftdetect/c.lua | 6 ------ .config/nvim/after/ftdetect/c.vim | 1 + .config/nvim/after/ftdetect/llvm.lua | 6 ------ .config/nvim/after/ftdetect/llvm.vim | 1 + .config/nvim/after/ftdetect/nroff.lua | 6 ------ .config/nvim/after/ftdetect/nroff.vim | 1 + .config/nvim/after/ftdetect/oryx.lua | 6 ------ .config/nvim/after/ftdetect/oryx.vim | 1 + .config/nvim/after/ftdetect/xcompose.lua | 6 ------ .config/nvim/after/ftdetect/xcompose.vim | 1 + .config/nvim/after/ftplugin/c.lua | 23 ----------------------- .config/nvim/after/ftplugin/c.vim | 16 ++++++++++++++++ .config/nvim/after/ftplugin/ebnf.lua | 1 - .config/nvim/after/ftplugin/ebnf.vim | 1 + .config/nvim/after/ftplugin/gitcommit.lua | 1 - .config/nvim/after/ftplugin/gitcommit.vim | 1 + .config/nvim/after/ftplugin/json.lua | 1 - .config/nvim/after/ftplugin/json.vim | 1 + .config/nvim/after/ftplugin/mail.lua | 2 -- .config/nvim/after/ftplugin/mail.vim | 1 + .config/nvim/after/ftplugin/markdown.lua | 2 -- .config/nvim/after/ftplugin/markdown.vim | 1 + .config/nvim/after/ftplugin/nroff.lua | 1 - .config/nvim/after/ftplugin/nroff.vim | 1 + .config/nvim/after/ftplugin/oryx.lua | 1 - .config/nvim/after/ftplugin/oryx.vim | 1 + .config/nvim/after/ftplugin/python.lua | 1 - .config/nvim/after/ftplugin/python.vim | 1 + .config/nvim/after/ftplugin/query.lua | 1 - .config/nvim/after/ftplugin/query.vim | 1 + .config/nvim/after/ftplugin/yuck.lua | 1 - .config/nvim/after/ftplugin/yuck.vim | 1 + .config/nvim/after/queries/bash/injections.scm | 11 ----------- .config/nvim/after/queries/sh/injections.scm | 11 +++++++++++ 36 files changed, 60 insertions(+), 100 deletions(-) delete mode 100644 .config/nvim/after/ftdetect/aerc.lua create mode 100644 .config/nvim/after/ftdetect/aerc.vim delete mode 100644 .config/nvim/after/ftdetect/c.lua create mode 100644 .config/nvim/after/ftdetect/c.vim delete mode 100644 .config/nvim/after/ftdetect/llvm.lua create mode 100644 .config/nvim/after/ftdetect/llvm.vim delete mode 100644 .config/nvim/after/ftdetect/nroff.lua create mode 100644 .config/nvim/after/ftdetect/nroff.vim delete mode 100644 .config/nvim/after/ftdetect/oryx.lua create mode 100644 .config/nvim/after/ftdetect/oryx.vim delete mode 100644 .config/nvim/after/ftdetect/xcompose.lua create mode 100644 .config/nvim/after/ftdetect/xcompose.vim delete mode 100644 .config/nvim/after/ftplugin/c.lua create mode 100644 .config/nvim/after/ftplugin/c.vim delete mode 100644 .config/nvim/after/ftplugin/ebnf.lua create mode 100644 .config/nvim/after/ftplugin/ebnf.vim delete mode 100644 .config/nvim/after/ftplugin/gitcommit.lua create mode 100644 .config/nvim/after/ftplugin/gitcommit.vim delete mode 100644 .config/nvim/after/ftplugin/json.lua create mode 100644 .config/nvim/after/ftplugin/json.vim delete mode 100644 .config/nvim/after/ftplugin/mail.lua create mode 100644 .config/nvim/after/ftplugin/mail.vim delete mode 100644 .config/nvim/after/ftplugin/markdown.lua create mode 100644 .config/nvim/after/ftplugin/markdown.vim delete mode 100644 .config/nvim/after/ftplugin/nroff.lua create mode 100644 .config/nvim/after/ftplugin/nroff.vim delete mode 100644 .config/nvim/after/ftplugin/oryx.lua create mode 100644 .config/nvim/after/ftplugin/oryx.vim delete mode 100644 .config/nvim/after/ftplugin/python.lua create mode 100644 .config/nvim/after/ftplugin/python.vim delete mode 100644 .config/nvim/after/ftplugin/query.lua create mode 100644 .config/nvim/after/ftplugin/query.vim delete mode 100644 .config/nvim/after/ftplugin/yuck.lua create mode 100644 .config/nvim/after/ftplugin/yuck.vim delete mode 100644 .config/nvim/after/queries/bash/injections.scm create mode 100644 .config/nvim/after/queries/sh/injections.scm diff --git a/.config/nvim/after/ftdetect/aerc.lua b/.config/nvim/after/ftdetect/aerc.lua deleted file mode 100644 index c430e33..0000000 --- a/.config/nvim/after/ftdetect/aerc.lua +++ /dev/null @@ -1,24 +0,0 @@ -local confhome = vim.fn.getenv('XDG_CONFIG_HOME') -confhome = confhome == vim.NIL and '~/.config/aerc/' or confhome .. '/aerc/' - -vim.api.nvim_create_autocmd({'BufRead', 'BufNewFile'}, { - pattern = { - confhome .. '*.conf', - confhome .. 'stylesets/*', - '/usr/share/aerc/*.conf', - '/usr/share/aerc/stylesets/*', - }, - callback = function() - vim.bo.filetype = 'ini' - end, -}) - -vim.api.nvim_create_autocmd({'BufRead', 'BufNewFile'}, { - pattern = { - confhome .. 'templates/*', - '/usr/share/aerc/templates/*', - }, - callback = function() - vim.bo.filetype = 'gotmpl' - end, -}) diff --git a/.config/nvim/after/ftdetect/aerc.vim b/.config/nvim/after/ftdetect/aerc.vim new file mode 100644 index 0000000..cdd4812 --- /dev/null +++ b/.config/nvim/after/ftdetect/aerc.vim @@ -0,0 +1,18 @@ +let s:cfg = getenv('XDG_CONFIG_HOME') +if s:cfg == v:null + let s:cfg = '~/.config/aerc/' +else + let s:cfg .= '/aerc/' +endif + +let s:ipaths + \ = s:cfg . '*.conf,' + \ . s:cfg . 'stylesets/*,' + \ . '/usr/share/aerc/*.conf,' + \ . '/usr/share/aerc/stylesets/*' +let s:gpaths + \ = s:cfg . 'templates/*,' + \ . '/usr/share/aerc/templates/*' + +execute 'autocmd BufRead,BufNewFile ' . s:ipaths . ' setfiletype ini' +execute 'autocmd BufRead,BufNewFile ' . s:gpaths . ' setfiletype gotmpl' diff --git a/.config/nvim/after/ftdetect/c.lua b/.config/nvim/after/ftdetect/c.lua deleted file mode 100644 index a518a11..0000000 --- a/.config/nvim/after/ftdetect/c.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.api.nvim_create_autocmd({'BufRead', 'BufNewFile'}, { - pattern = '*.[ch]', - callback = function() - vim.bo.filetype = 'c' - end, -}) diff --git a/.config/nvim/after/ftdetect/c.vim b/.config/nvim/after/ftdetect/c.vim new file mode 100644 index 0000000..4d22e22 --- /dev/null +++ b/.config/nvim/after/ftdetect/c.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.[ch] setfiletype c diff --git a/.config/nvim/after/ftdetect/llvm.lua b/.config/nvim/after/ftdetect/llvm.lua deleted file mode 100644 index 6313b3d..0000000 --- a/.config/nvim/after/ftdetect/llvm.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.api.nvim_create_autocmd({'BufRead', 'BufNewFile'}, { - pattern = '*.ll', - callback = function() - vim.bo.filetype = 'llvm' - end, -}) diff --git a/.config/nvim/after/ftdetect/llvm.vim b/.config/nvim/after/ftdetect/llvm.vim new file mode 100644 index 0000000..421fdd3 --- /dev/null +++ b/.config/nvim/after/ftdetect/llvm.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.ll setfiletype llvm diff --git a/.config/nvim/after/ftdetect/nroff.lua b/.config/nvim/after/ftdetect/nroff.lua deleted file mode 100644 index 592f620..0000000 --- a/.config/nvim/after/ftdetect/nroff.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.api.nvim_create_autocmd({'BufRead', 'BufNewFile'}, { - pattern = '*.[1-7]', - callback = function() - vim.bo.filetype = 'nroff' - end, -}) diff --git a/.config/nvim/after/ftdetect/nroff.vim b/.config/nvim/after/ftdetect/nroff.vim new file mode 100644 index 0000000..b56fb38 --- /dev/null +++ b/.config/nvim/after/ftdetect/nroff.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.[1-7] setfiletype nroff diff --git a/.config/nvim/after/ftdetect/oryx.lua b/.config/nvim/after/ftdetect/oryx.lua deleted file mode 100644 index c3647c5..0000000 --- a/.config/nvim/after/ftdetect/oryx.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.api.nvim_create_autocmd({'BufRead', 'BufNewFile'}, { - pattern = '*.yx', - callback = function() - vim.bo.filetype = 'oryx' - end, -}) diff --git a/.config/nvim/after/ftdetect/oryx.vim b/.config/nvim/after/ftdetect/oryx.vim new file mode 100644 index 0000000..520281d --- /dev/null +++ b/.config/nvim/after/ftdetect/oryx.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.yx setfiletype oryx diff --git a/.config/nvim/after/ftdetect/xcompose.lua b/.config/nvim/after/ftdetect/xcompose.lua deleted file mode 100644 index 81e6c4a..0000000 --- a/.config/nvim/after/ftdetect/xcompose.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.api.nvim_create_autocmd({'BufRead', 'BufNewFile'}, { - pattern = 'xcompose', - callback = function() - vim.bo.filetype = 'xcompose' - end -}) diff --git a/.config/nvim/after/ftdetect/xcompose.vim b/.config/nvim/after/ftdetect/xcompose.vim new file mode 100644 index 0000000..16a56b7 --- /dev/null +++ b/.config/nvim/after/ftdetect/xcompose.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile xcompose setfiletype xcompose diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua deleted file mode 100644 index c65969c..0000000 --- a/.config/nvim/after/ftplugin/c.lua +++ /dev/null @@ -1,23 +0,0 @@ -vim.bo.commentstring = '// %s' - -vim.keymap.set('x', '=', ":'<'>!clang-format -style=file", { - desc = 'Format the current selection with Clang Format', -}) - -vim.keymap.set('n', 'K', function() - local w = vim.fn.expand('') - local proc = vim.system({'man', w}):wait() - if proc.code == 16 then - print('No manual for ‘' .. w .. '’ found') - return - elseif proc.code ~= 0 then - print('An error occured') - return - end - vim.cmd [[ - execute "silent !man -Tpdf '" . expand('') . "' | zathura - &" - ]] -end, { - buffer = 0, - desc = 'View the manual page for the word under the cursor', -}) diff --git a/.config/nvim/after/ftplugin/c.vim b/.config/nvim/after/ftplugin/c.vim new file mode 100644 index 0000000..40ecaf8 --- /dev/null +++ b/.config/nvim/after/ftplugin/c.vim @@ -0,0 +1,16 @@ +setlocal commentstring=//\ %s + +function! s:ManpageAtPoint() + let l:w = expand('') + call system(['env', 'MANSECT=3,2,3p', 'man', l:w]) + if v:shell_error == 0 + execute "silent !MANSECT=3,2,3p man -Tpdf '" . l:w . "' | zathura - &" + elseif v:shell_error == 16 + echomsg 'No manual for ‘' . l:w . '’ found' + else + echomsg 'An error occured running ‘man’' + endif +endfunction + +xnoremap q !clang-format -style=file +nnoremap K :call ManpageAtPoint() diff --git a/.config/nvim/after/ftplugin/ebnf.lua b/.config/nvim/after/ftplugin/ebnf.lua deleted file mode 100644 index 264b539..0000000 --- a/.config/nvim/after/ftplugin/ebnf.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.commentstring = '(* %s *)' diff --git a/.config/nvim/after/ftplugin/ebnf.vim b/.config/nvim/after/ftplugin/ebnf.vim new file mode 100644 index 0000000..ac1a448 --- /dev/null +++ b/.config/nvim/after/ftplugin/ebnf.vim @@ -0,0 +1 @@ +setlocal commentstring=(*\ %s\ *) diff --git a/.config/nvim/after/ftplugin/gitcommit.lua b/.config/nvim/after/ftplugin/gitcommit.lua deleted file mode 100644 index 21934e4..0000000 --- a/.config/nvim/after/ftplugin/gitcommit.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.expandtab = true diff --git a/.config/nvim/after/ftplugin/gitcommit.vim b/.config/nvim/after/ftplugin/gitcommit.vim new file mode 100644 index 0000000..5245bdc --- /dev/null +++ b/.config/nvim/after/ftplugin/gitcommit.vim @@ -0,0 +1 @@ +setlocal expandtab diff --git a/.config/nvim/after/ftplugin/json.lua b/.config/nvim/after/ftplugin/json.lua deleted file mode 100644 index 1e6245d..0000000 --- a/.config/nvim/after/ftplugin/json.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.formatprg = 'jq --tab' diff --git a/.config/nvim/after/ftplugin/json.vim b/.config/nvim/after/ftplugin/json.vim new file mode 100644 index 0000000..09100bf --- /dev/null +++ b/.config/nvim/after/ftplugin/json.vim @@ -0,0 +1 @@ +setlocal formatprg=jq\ --tab diff --git a/.config/nvim/after/ftplugin/mail.lua b/.config/nvim/after/ftplugin/mail.lua deleted file mode 100644 index 72f99e9..0000000 --- a/.config/nvim/after/ftplugin/mail.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.bo.expandtab = true -vim.bo.textwidth = 73 diff --git a/.config/nvim/after/ftplugin/mail.vim b/.config/nvim/after/ftplugin/mail.vim new file mode 100644 index 0000000..5969086 --- /dev/null +++ b/.config/nvim/after/ftplugin/mail.vim @@ -0,0 +1 @@ +setlocal expandtab textwidth=73 diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua deleted file mode 100644 index 72f99e9..0000000 --- a/.config/nvim/after/ftplugin/markdown.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.bo.expandtab = true -vim.bo.textwidth = 73 diff --git a/.config/nvim/after/ftplugin/markdown.vim b/.config/nvim/after/ftplugin/markdown.vim new file mode 100644 index 0000000..5969086 --- /dev/null +++ b/.config/nvim/after/ftplugin/markdown.vim @@ -0,0 +1 @@ +setlocal expandtab textwidth=73 diff --git a/.config/nvim/after/ftplugin/nroff.lua b/.config/nvim/after/ftplugin/nroff.lua deleted file mode 100644 index 1532c29..0000000 --- a/.config/nvim/after/ftplugin/nroff.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.textwidth = 73 diff --git a/.config/nvim/after/ftplugin/nroff.vim b/.config/nvim/after/ftplugin/nroff.vim new file mode 100644 index 0000000..63c4b9b --- /dev/null +++ b/.config/nvim/after/ftplugin/nroff.vim @@ -0,0 +1 @@ +setlocal textwidth=73 diff --git a/.config/nvim/after/ftplugin/oryx.lua b/.config/nvim/after/ftplugin/oryx.lua deleted file mode 100644 index 984111a..0000000 --- a/.config/nvim/after/ftplugin/oryx.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.commentstring = '/* %s */' diff --git a/.config/nvim/after/ftplugin/oryx.vim b/.config/nvim/after/ftplugin/oryx.vim new file mode 100644 index 0000000..f059cc8 --- /dev/null +++ b/.config/nvim/after/ftplugin/oryx.vim @@ -0,0 +1 @@ +setlocal commentstring=/*\ %s\ */ diff --git a/.config/nvim/after/ftplugin/python.lua b/.config/nvim/after/ftplugin/python.lua deleted file mode 100644 index c37615b..0000000 --- a/.config/nvim/after/ftplugin/python.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.expandtab = false diff --git a/.config/nvim/after/ftplugin/python.vim b/.config/nvim/after/ftplugin/python.vim new file mode 100644 index 0000000..bbd8967 --- /dev/null +++ b/.config/nvim/after/ftplugin/python.vim @@ -0,0 +1 @@ +setlocal noexpandtab diff --git a/.config/nvim/after/ftplugin/query.lua b/.config/nvim/after/ftplugin/query.lua deleted file mode 100644 index 21934e4..0000000 --- a/.config/nvim/after/ftplugin/query.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.expandtab = true diff --git a/.config/nvim/after/ftplugin/query.vim b/.config/nvim/after/ftplugin/query.vim new file mode 100644 index 0000000..8c3b996 --- /dev/null +++ b/.config/nvim/after/ftplugin/query.vim @@ -0,0 +1 @@ +setlocal autoindent expandtab lisp diff --git a/.config/nvim/after/ftplugin/yuck.lua b/.config/nvim/after/ftplugin/yuck.lua deleted file mode 100644 index ee8cd37..0000000 --- a/.config/nvim/after/ftplugin/yuck.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.commentstring = '; %s' diff --git a/.config/nvim/after/ftplugin/yuck.vim b/.config/nvim/after/ftplugin/yuck.vim new file mode 100644 index 0000000..a13b726 --- /dev/null +++ b/.config/nvim/after/ftplugin/yuck.vim @@ -0,0 +1 @@ +setlocal commentstring=;\ %s diff --git a/.config/nvim/after/queries/bash/injections.scm b/.config/nvim/after/queries/bash/injections.scm deleted file mode 100644 index d2bd607..0000000 --- a/.config/nvim/after/queries/bash/injections.scm +++ /dev/null @@ -1,11 +0,0 @@ -;; extends - -(command - name: (command_name) @injection.language - argument: (raw_string) @injection.content) - -((command - name: (command_name) @_name - argument: (raw_string) @injection.content) - (#eq? @_name "gawk") - (#set! injection.language "awk")) diff --git a/.config/nvim/after/queries/sh/injections.scm b/.config/nvim/after/queries/sh/injections.scm new file mode 100644 index 0000000..3e11149 --- /dev/null +++ b/.config/nvim/after/queries/sh/injections.scm @@ -0,0 +1,11 @@ +;; extends + +(command + name: (command_name) @injection.language + argument: (raw_string) @injection.content) + +((command + name: (command_name (word)) @_name + argument: (raw_string) @injection.content) + (#eq? @_name "gawk") + (#set! injection.language "awk")) -- cgit v1.2.3