From 511efe89ed084bc922ae142d32e08427859198f4 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 10 Jun 2024 23:07:28 +0200 Subject: nvim: Completely rewrite my configuration --- .config/nvim/after/ftplugin/c.lua | 15 +++++++++++++-- .config/nvim/after/ftplugin/css.lua | 3 --- .config/nvim/after/ftplugin/ebnf.lua | 3 +-- .config/nvim/after/ftplugin/gitcommit.lua | 2 +- .config/nvim/after/ftplugin/gitrebase.lua | 6 +++--- .config/nvim/after/ftplugin/go.lua | 3 --- .config/nvim/after/ftplugin/gsp.lua | 3 --- .config/nvim/after/ftplugin/help.lua | 8 ++++++++ .config/nvim/after/ftplugin/html.lua | 3 --- .config/nvim/after/ftplugin/htmldjango.lua | 1 - .config/nvim/after/ftplugin/lex.lua | 3 --- .config/nvim/after/ftplugin/lua.lua | 3 --- .config/nvim/after/ftplugin/mail.lua | 7 ++----- .config/nvim/after/ftplugin/make.lua | 3 --- .config/nvim/after/ftplugin/markdown.lua | 4 ++-- .config/nvim/after/ftplugin/nroff.lua | 2 +- .config/nvim/after/ftplugin/python.lua | 3 +-- .config/nvim/after/ftplugin/query.lua | 2 +- .config/nvim/after/ftplugin/rust.lua | 2 -- 19 files changed, 33 insertions(+), 43 deletions(-) delete mode 100644 .config/nvim/after/ftplugin/css.lua delete mode 100644 .config/nvim/after/ftplugin/go.lua delete mode 100644 .config/nvim/after/ftplugin/gsp.lua create mode 100644 .config/nvim/after/ftplugin/help.lua delete mode 100644 .config/nvim/after/ftplugin/html.lua delete mode 120000 .config/nvim/after/ftplugin/htmldjango.lua delete mode 100644 .config/nvim/after/ftplugin/lex.lua delete mode 100644 .config/nvim/after/ftplugin/lua.lua delete mode 100644 .config/nvim/after/ftplugin/make.lua delete mode 100644 .config/nvim/after/ftplugin/rust.lua (limited to '.config/nvim/after/ftplugin') diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua index 7f8d336..6058e31 100644 --- a/.config/nvim/after/ftplugin/c.lua +++ b/.config/nvim/after/ftplugin/c.lua @@ -1,3 +1,14 @@ -local lib = require('mango.lib') +vim.bo.commentstring = '/* %s */' -lib.set_tab_width(4, true) +vim.keymap.set('v', '=', ":'<'>!clang-format -style=file -", { + desc = 'Format the current selection with Clang Format', +}) + +vim.keymap.set('n', 'K', function() + 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/css.lua b/.config/nvim/after/ftplugin/css.lua deleted file mode 100644 index 01efc8f..0000000 --- a/.config/nvim/after/ftplugin/css.lua +++ /dev/null @@ -1,3 +0,0 @@ -local lib = require('mango.lib') - -lib.set_tab_width(8, true) diff --git a/.config/nvim/after/ftplugin/ebnf.lua b/.config/nvim/after/ftplugin/ebnf.lua index b1bb817..264b539 100644 --- a/.config/nvim/after/ftplugin/ebnf.lua +++ b/.config/nvim/after/ftplugin/ebnf.lua @@ -1,2 +1 @@ -require('Comment.ft').ebnf = { '(*%s*)', '(*%s*)' } -vim.bo.commentstring = '(*%s*)' +vim.bo.commentstring = '(* %s *)' diff --git a/.config/nvim/after/ftplugin/gitcommit.lua b/.config/nvim/after/ftplugin/gitcommit.lua index 9aa3038..21934e4 100644 --- a/.config/nvim/after/ftplugin/gitcommit.lua +++ b/.config/nvim/after/ftplugin/gitcommit.lua @@ -1 +1 @@ -vim.opt_local.expandtab = true +vim.bo.expandtab = true diff --git a/.config/nvim/after/ftplugin/gitrebase.lua b/.config/nvim/after/ftplugin/gitrebase.lua index 948ee30..00ee21a 100644 --- a/.config/nvim/after/ftplugin/gitrebase.lua +++ b/.config/nvim/after/ftplugin/gitrebase.lua @@ -1,6 +1,5 @@ -local ts_utils = require('nvim-treesitter.ts_utils') - local function map(lhs, rhs) + local ts_utils = require('nvim-treesitter.ts_utils') vim.keymap.set('n', lhs, function() local node = ts_utils.get_node_at_cursor() if node == nil then @@ -22,7 +21,8 @@ local function map(lhs, rhs) }) end +map('d', 'drop') +map('f', 'fixup') map('p', 'pick') map('r', 'reword') map('s', 'squash') -map('f', 'fixup') diff --git a/.config/nvim/after/ftplugin/go.lua b/.config/nvim/after/ftplugin/go.lua deleted file mode 100644 index 7f8d336..0000000 --- a/.config/nvim/after/ftplugin/go.lua +++ /dev/null @@ -1,3 +0,0 @@ -local lib = require('mango.lib') - -lib.set_tab_width(4, true) diff --git a/.config/nvim/after/ftplugin/gsp.lua b/.config/nvim/after/ftplugin/gsp.lua deleted file mode 100644 index 50a85a4..0000000 --- a/.config/nvim/after/ftplugin/gsp.lua +++ /dev/null @@ -1,3 +0,0 @@ -local lib = require('mango.lib') - -lib.set_tab_width(2, true) diff --git a/.config/nvim/after/ftplugin/help.lua b/.config/nvim/after/ftplugin/help.lua new file mode 100644 index 0000000..0b15270 --- /dev/null +++ b/.config/nvim/after/ftplugin/help.lua @@ -0,0 +1,8 @@ +vim.api.nvim_create_autocmd('BufWinEnter', { + desc = 'Open (neo)vim help pages in a vertical split', + group = vim.api.nvim_create_augroup('mango-vert-help', { clear = true }), + buffer = 0, + callback = function() + vim.cmd.wincmd 'L' + end, +}) diff --git a/.config/nvim/after/ftplugin/html.lua b/.config/nvim/after/ftplugin/html.lua deleted file mode 100644 index 50a85a4..0000000 --- a/.config/nvim/after/ftplugin/html.lua +++ /dev/null @@ -1,3 +0,0 @@ -local lib = require('mango.lib') - -lib.set_tab_width(2, true) diff --git a/.config/nvim/after/ftplugin/htmldjango.lua b/.config/nvim/after/ftplugin/htmldjango.lua deleted file mode 120000 index d805bec..0000000 --- a/.config/nvim/after/ftplugin/htmldjango.lua +++ /dev/null @@ -1 +0,0 @@ -html.lua \ No newline at end of file diff --git a/.config/nvim/after/ftplugin/lex.lua b/.config/nvim/after/ftplugin/lex.lua deleted file mode 100644 index 7f8d336..0000000 --- a/.config/nvim/after/ftplugin/lex.lua +++ /dev/null @@ -1,3 +0,0 @@ -local lib = require('mango.lib') - -lib.set_tab_width(4, true) diff --git a/.config/nvim/after/ftplugin/lua.lua b/.config/nvim/after/ftplugin/lua.lua deleted file mode 100644 index 7f8d336..0000000 --- a/.config/nvim/after/ftplugin/lua.lua +++ /dev/null @@ -1,3 +0,0 @@ -local lib = require('mango.lib') - -lib.set_tab_width(4, true) diff --git a/.config/nvim/after/ftplugin/mail.lua b/.config/nvim/after/ftplugin/mail.lua index 599950a..72f99e9 100644 --- a/.config/nvim/after/ftplugin/mail.lua +++ b/.config/nvim/after/ftplugin/mail.lua @@ -1,5 +1,2 @@ -local lib = require('mango.lib') - -lib.set_tab_width(2, true) -vim.opt_local.expandtab = true -vim.opt_local.textwidth = 73 +vim.bo.expandtab = true +vim.bo.textwidth = 73 diff --git a/.config/nvim/after/ftplugin/make.lua b/.config/nvim/after/ftplugin/make.lua deleted file mode 100644 index 01efc8f..0000000 --- a/.config/nvim/after/ftplugin/make.lua +++ /dev/null @@ -1,3 +0,0 @@ -local lib = require('mango.lib') - -lib.set_tab_width(8, true) diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua index 1b0dfd2..3469231 100644 --- a/.config/nvim/after/ftplugin/markdown.lua +++ b/.config/nvim/after/ftplugin/markdown.lua @@ -1,2 +1,2 @@ -vim.opt_local.textwidth = 80 -vim.opt_local.expandtab = true +vim.bo.expandtab = true +vim.bo.textwidth = 80 diff --git a/.config/nvim/after/ftplugin/nroff.lua b/.config/nvim/after/ftplugin/nroff.lua index 484a35d..1532c29 100644 --- a/.config/nvim/after/ftplugin/nroff.lua +++ b/.config/nvim/after/ftplugin/nroff.lua @@ -1 +1 @@ -vim.opt_local.textwidth = 73 +vim.bo.textwidth = 73 diff --git a/.config/nvim/after/ftplugin/python.lua b/.config/nvim/after/ftplugin/python.lua index a97fe2e..c37615b 100644 --- a/.config/nvim/after/ftplugin/python.lua +++ b/.config/nvim/after/ftplugin/python.lua @@ -1,2 +1 @@ -vim.opt_local.textwidth = 100 -vim.opt_local.expandtab = false +vim.bo.expandtab = false diff --git a/.config/nvim/after/ftplugin/query.lua b/.config/nvim/after/ftplugin/query.lua index 9aa3038..21934e4 100644 --- a/.config/nvim/after/ftplugin/query.lua +++ b/.config/nvim/after/ftplugin/query.lua @@ -1 +1 @@ -vim.opt_local.expandtab = true +vim.bo.expandtab = true diff --git a/.config/nvim/after/ftplugin/rust.lua b/.config/nvim/after/ftplugin/rust.lua deleted file mode 100644 index a97fe2e..0000000 --- a/.config/nvim/after/ftplugin/rust.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.opt_local.textwidth = 100 -vim.opt_local.expandtab = false -- cgit v1.2.3