summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-10 23:07:28 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-10 23:07:28 +0200
commit511efe89ed084bc922ae142d32e08427859198f4 (patch)
treefef9294b6056b6cf972ea5e689f70da8184fafae /.config
parent64e2e90abdca04743558e3baf42a6b714b440bd0 (diff)
nvim: Completely rewrite my configuration
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/.gitignore8
-rw-r--r--.config/nvim/after/ftdetect/c.lua6
-rw-r--r--.config/nvim/after/ftdetect/c.vim1
-rw-r--r--.config/nvim/after/ftdetect/nroff.lua6
-rw-r--r--.config/nvim/after/ftdetect/nroff.vim1
-rw-r--r--.config/nvim/after/ftplugin/c.lua15
-rw-r--r--.config/nvim/after/ftplugin/css.lua3
-rw-r--r--.config/nvim/after/ftplugin/ebnf.lua3
-rw-r--r--.config/nvim/after/ftplugin/gitcommit.lua2
-rw-r--r--.config/nvim/after/ftplugin/gitrebase.lua6
-rw-r--r--.config/nvim/after/ftplugin/go.lua3
-rw-r--r--.config/nvim/after/ftplugin/gsp.lua3
-rw-r--r--.config/nvim/after/ftplugin/help.lua8
-rw-r--r--.config/nvim/after/ftplugin/html.lua3
l---------.config/nvim/after/ftplugin/htmldjango.lua1
-rw-r--r--.config/nvim/after/ftplugin/lex.lua3
-rw-r--r--.config/nvim/after/ftplugin/lua.lua3
-rw-r--r--.config/nvim/after/ftplugin/mail.lua7
-rw-r--r--.config/nvim/after/ftplugin/make.lua3
-rw-r--r--.config/nvim/after/ftplugin/markdown.lua4
-rw-r--r--.config/nvim/after/ftplugin/nroff.lua2
-rw-r--r--.config/nvim/after/ftplugin/python.lua3
-rw-r--r--.config/nvim/after/ftplugin/query.lua2
-rw-r--r--.config/nvim/after/ftplugin/rust.lua2
-rw-r--r--.config/nvim/after/plugin/colors.lua14
-rw-r--r--.config/nvim/after/plugin/comment.lua1
-rw-r--r--.config/nvim/after/plugin/emmet.lua1
-rw-r--r--.config/nvim/after/plugin/fugitive.lua1
-rw-r--r--.config/nvim/after/plugin/lsp.lua49
-rw-r--r--.config/nvim/after/plugin/nvim-cmp.lua32
-rw-r--r--.config/nvim/after/plugin/sort-motion.lua1
-rw-r--r--.config/nvim/after/plugin/surround.lua27
-rw-r--r--.config/nvim/after/plugin/treesitter-context.lua8
-rw-r--r--.config/nvim/after/plugin/treesitter.lua89
-rw-r--r--.config/nvim/after/plugin/undotree.lua1
-rw-r--r--.config/nvim/after/syntax/c.vim1
-rw-r--r--.config/nvim/after/syntax/diff.vim3
-rw-r--r--.config/nvim/after/syntax/yacc.vim5
-rw-r--r--.config/nvim/init.lua480
-rw-r--r--.config/nvim/lua/mango/init.lua3
-rw-r--r--.config/nvim/lua/mango/lib.lua36
-rw-r--r--.config/nvim/lua/mango/packer.lua59
-rw-r--r--.config/nvim/lua/mango/remap.lua54
-rw-r--r--.config/nvim/lua/mango/set.lua72
-rw-r--r--.config/nvim/lua/pipe.lua42
-rw-r--r--.config/nvim/lua/snippets.lua (renamed from .config/nvim/after/plugin/luasnip.lua)26
46 files changed, 566 insertions, 537 deletions
diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore
deleted file mode 100644
index 6412e7b..0000000
--- a/.config/nvim/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-/ftdetect/*
-!/ftdetect/gsp.vim
-/ftplugin
-/indent
-/plugin
-/syntax
-/queries
-.luarc.json
diff --git a/.config/nvim/after/ftdetect/c.lua b/.config/nvim/after/ftdetect/c.lua
new file mode 100644
index 0000000..a518a11
--- /dev/null
+++ b/.config/nvim/after/ftdetect/c.lua
@@ -0,0 +1,6 @@
+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
deleted file mode 100644
index 609b487..0000000
--- a/.config/nvim/after/ftdetect/c.vim
+++ /dev/null
@@ -1 +0,0 @@
-au BufRead,BufNewFile *.[ch] set ft=c
diff --git a/.config/nvim/after/ftdetect/nroff.lua b/.config/nvim/after/ftdetect/nroff.lua
new file mode 100644
index 0000000..592f620
--- /dev/null
+++ b/.config/nvim/after/ftdetect/nroff.lua
@@ -0,0 +1,6 @@
+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
deleted file mode 100644
index f1c3d67..0000000
--- a/.config/nvim/after/ftdetect/nroff.vim
+++ /dev/null
@@ -1 +0,0 @@
-au BufRead,BufNewFile *.[1-7] setf nroff
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', '<localleader>=', ":'<'>!clang-format -style=file -<CR>", {
+ desc = 'Format the current selection with Clang Format',
+})
+
+vim.keymap.set('n', 'K', function()
+ vim.cmd [[
+ execute "silent !man -Tpdf '" . expand('<cword>') . "' | 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
diff --git a/.config/nvim/after/plugin/colors.lua b/.config/nvim/after/plugin/colors.lua
deleted file mode 100644
index 779c60d..0000000
--- a/.config/nvim/after/plugin/colors.lua
+++ /dev/null
@@ -1,14 +0,0 @@
-local nohl = { bg = "surface" }
-
-require('rose-pine').setup {
- styles = {
- transparency = true,
- },
- highlight_groups = {
- Pmenu = nohl,
- StatusLine = nohl,
- StatusLineNC = nohl,
- },
-}
-
-vim.cmd.colorscheme('rose-pine')
diff --git a/.config/nvim/after/plugin/comment.lua b/.config/nvim/after/plugin/comment.lua
deleted file mode 100644
index 933d7b7..0000000
--- a/.config/nvim/after/plugin/comment.lua
+++ /dev/null
@@ -1 +0,0 @@
-require('Comment').setup {}
diff --git a/.config/nvim/after/plugin/emmet.lua b/.config/nvim/after/plugin/emmet.lua
deleted file mode 100644
index 56e67db..0000000
--- a/.config/nvim/after/plugin/emmet.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.g.user_emmet_install = false
diff --git a/.config/nvim/after/plugin/fugitive.lua b/.config/nvim/after/plugin/fugitive.lua
deleted file mode 100644
index 6e1b92d..0000000
--- a/.config/nvim/after/plugin/fugitive.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.keymap.set('n', '<leader>gs', vim.cmd.Git)
diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua
deleted file mode 100644
index e0684e2..0000000
--- a/.config/nvim/after/plugin/lsp.lua
+++ /dev/null
@@ -1,49 +0,0 @@
-local conf = require('lspconfig')
-
-conf.clangd.setup {
- cmd = {'clangd', '-header-insertion=never'}
-}
-conf.gopls.setup {}
-conf.rust_analyzer.setup {}
-conf.lua_ls.setup {
- settings = {
- Lua = {
- runtime = {
- version = 'LuaJIT',
- },
- diagnostics = {
- globals = {
- 'vim',
- 'require',
- },
- },
- workspace = {
- library = vim.api.nvim_get_runtime_file('', true),
- },
- telemetry = {
- enable = false,
- },
- },
- },
-}
-
-vim.api.nvim_create_autocmd('LspAttach', {
- group = vim.api.nvim_create_augroup('MangoLspConfig', {}),
- callback = function(ev)
- local function remap(mode, map, fn)
- vim.keymap.set(mode, map, fn, { buffer = ev.buf })
- end
-
- vim.diagnostic.disable()
- vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
- remap('n', 'K', vim.lsp.buf.hover)
- remap('n', 'gd', vim.lsp.buf.definition)
- remap('n', 'gi', vim.lsp.buf.implementation)
- remap('n', 'gr', vim.lsp.buf.rename)
- remap('n', 'gt', vim.lsp.buf.type_definition)
- remap('n', 'g=', function() vim.lsp.buf.format { async = true } end)
- remap('n', ']d', vim.diagnostic.goto_prev)
- remap('n', '[d', vim.diagnostic.goto_next)
- remap('n', '<leader>la', vim.lsp.buf.code_action)
- end,
-})
diff --git a/.config/nvim/after/plugin/nvim-cmp.lua b/.config/nvim/after/plugin/nvim-cmp.lua
deleted file mode 100644
index 399d5a3..0000000
--- a/.config/nvim/after/plugin/nvim-cmp.lua
+++ /dev/null
@@ -1,32 +0,0 @@
-local capabilities = require('cmp_nvim_lsp').default_capabilities()
-local cmp = require('cmp')
-local conf = require('lspconfig')
-local snip = require('luasnip')
-
-conf['clangd'].setup { capabilities = capabilities }
-conf['gopls'].setup { capabilities = capabilities }
-conf['lua_ls'].setup { capabilities = capabilities }
-conf['rust_analyzer'].setup { capabilities = capabilities }
-cmp.setup {
- snippet = {
- expand = function(args)
- snip.lsp_expand(args.body)
- end,
- },
- mapping = cmp.mapping.preset.insert({
- ['<C-k>'] = cmp.mapping.select_prev_item(),
- ['<C-j>'] = cmp.mapping.select_next_item(),
- ['<C-e>'] = cmp.mapping.abort(),
- ['<CR>'] = cmp.mapping.confirm({ select = true }),
- }),
- sources = cmp.config.sources({
- { name = 'nvim_lsp' },
- { name = 'path' },
- { name = 'luasnip' },
- }, {
- { name = 'buffer', length = 5 },
- }),
- experimental = {
- ghost_text = true,
- }
-}
diff --git a/.config/nvim/after/plugin/sort-motion.lua b/.config/nvim/after/plugin/sort-motion.lua
deleted file mode 100644
index d408de8..0000000
--- a/.config/nvim/after/plugin/sort-motion.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.g.sort_motion_flags = 'l'
diff --git a/.config/nvim/after/plugin/surround.lua b/.config/nvim/after/plugin/surround.lua
deleted file mode 100644
index 605b1eb..0000000
--- a/.config/nvim/after/plugin/surround.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-require('nvim-surround').setup {
- surrounds = {
- ['’'] = {
- add = { '‘', '’' },
- find = '‘[^‘’]*’',
- delete = '^(‘)().-(’)()$'
- },
-
- ['‘'] = {
- add = { '‘ ', ' ’' },
- find = '‘[^‘’]*’',
- delete = '^(‘ *)().-( *’)()$'
- },
-
- ['”'] = {
- add = { '“', '”' },
- find = '“[^“”]*”',
- delete = '^(“)().-(”)()$'
- },
-
- ['“'] = {
- add = { '“ ', ' ”' },
- find = '“[^“”]*”',
- delete = '^(“ *)().-( *”)()$'
- },
- }
-}
diff --git a/.config/nvim/after/plugin/treesitter-context.lua b/.config/nvim/after/plugin/treesitter-context.lua
deleted file mode 100644
index 27af4e8..0000000
--- a/.config/nvim/after/plugin/treesitter-context.lua
+++ /dev/null
@@ -1,8 +0,0 @@
-require('treesitter-context').setup {
- enable = true,
- max_lines = 2,
- multiline_threshold = 2,
- line_numbers = true,
- trim_scope = 'inner',
- mode = 'cursor',
-}
diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua
deleted file mode 100644
index e441371..0000000
--- a/.config/nvim/after/plugin/treesitter.lua
+++ /dev/null
@@ -1,89 +0,0 @@
-local config = require('nvim-treesitter.parsers').get_parser_configs()
-config.gsp = {
- install_info = {
- url = 'https://git.sr.ht/~mango/tree-sitter-gsp',
- files = {'src/parser.c'},
- },
- filetype = 'gsp',
-}
-
-require('nvim-treesitter.configs').setup {
- ensure_installed = {
- 'c',
- 'gsp',
- 'vim',
- 'vimdoc',
- },
-
- sync_install = false,
- auto_install = true,
-
- highlight = {
- enable = true,
- additional_vim_regex_highlighting = false,
- },
-
- incremental_selection = {
- enable = true,
- keymaps = {
- init_selection = '<C-Space>',
- node_incremental = '<C-Space>',
- node_decremental = '<C-s>',
- }
- },
-
- textobjects = {
- select = {
- enable = true,
- lookahead = true,
- keymaps = {
- ['ab'] = '@block.outer',
- ['ib'] = '@block.inner',
- ['ac'] = '@comment.outer',
- ['ic'] = '@comment.inner',
- ['af'] = '@function.outer',
- ['if'] = '@function.inner',
- ['an'] = '@node.outer',
- ['in'] = '@node.inner',
- ['at'] = '@text.outer',
- ['it'] = '@text.outer',
- },
- },
- move = {
- enable = true,
- set_jumps = true,
- goto_next_start = {
- [']c'] = '@comment.outer',
- [']f'] = '@function.outer',
- [']b'] = '@block.outer',
- [']n'] = '@node.outer',
- [']t'] = '@text.outer',
- },
- goto_next_end = {
- [']C'] = '@comment.outer',
- [']F'] = '@function.outer',
- [']B'] = '@block.outer',
- [']N'] = '@node.outer',
- [']T'] = '@text.outer',
- },
- goto_previous_start = {
- ['[c'] = '@comment.outer',
- ['[f'] = '@function.outer',
- ['[b'] = '@block.outer',
- ['[n'] = '@node.outer',
- ['[t'] = '@text.outer',
- },
- goto_previous_end = {
- ['[C'] = '@comment.outer',
- ['[F'] = '@function.outer',
- ['[B'] = '@block.outer',
- ['[N'] = '@node.outer',
- ['[T'] = '@text.outer',
- },
- },
- },
-
- indent = {
- enable = true,
- },
-}
diff --git a/.config/nvim/after/plugin/undotree.lua b/.config/nvim/after/plugin/undotree.lua
deleted file mode 100644
index a346462..0000000
--- a/.config/nvim/after/plugin/undotree.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)
diff --git a/.config/nvim/after/syntax/c.vim b/.config/nvim/after/syntax/c.vim
deleted file mode 100644
index a2c7c43..0000000
--- a/.config/nvim/after/syntax/c.vim
+++ /dev/null
@@ -1 +0,0 @@
-hi link @lsp.type.macro Macro
diff --git a/.config/nvim/after/syntax/diff.vim b/.config/nvim/after/syntax/diff.vim
deleted file mode 100644
index e086592..0000000
--- a/.config/nvim/after/syntax/diff.vim
+++ /dev/null
@@ -1,3 +0,0 @@
-hi link @text.diff.add DiffAdd
-hi link @text.diff.delete DiffDelete
-hi link @attribute diffLine
diff --git a/.config/nvim/after/syntax/yacc.vim b/.config/nvim/after/syntax/yacc.vim
deleted file mode 100644
index fe6603e..0000000
--- a/.config/nvim/after/syntax/yacc.vim
+++ /dev/null
@@ -1,5 +0,0 @@
-syn match yaccDefines '^%\(debug\|header\|output\)\>'
-syn match yaccKey '^\s*%\(nterm\|precedence\)\>' contained
-syn match yaccType '<[a-zA-Z_][a-zA-Z0-9_]*\s*\*>' contains=yaccBrkt contained
-syn match yaccString '"[^"]*"' contained
-syn match yaccVar '@\(\$\|\d\+\)' containedin=cParen,cPreProc,cMulti contained
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index dfea4db..a11639f 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -1 +1,479 @@
-require('mango')
+vim.g.have_nerd_font = false
+vim.g.mapleader = ' '
+vim.g.maplocalleader = ' '
+vim.g.netrw_banner = 0
+vim.g.netrw_bufsettings = 'noma nomod nu nobl nowrap ro'
+vim.g.netrw_list_hide = [[^\(\.\|\.\.\)/\?$,^__pycache__/\?,.*\.\(a\|o\|so\|pyc\)$]]
+
+-- NOTE: :help option-list
+vim.opt.backup = false
+vim.opt.breakindent = true
+vim.opt.cursorline = true
+vim.opt.expandtab = false
+vim.opt.exrc = true
+vim.opt.grepprg = 'rg --vimgrep -uu'
+vim.opt.hlsearch = true
+vim.opt.ignorecase = true
+vim.opt.inccommand = 'split'
+vim.opt.list = false
+vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
+vim.opt.matchpairs:append('<:>')
+vim.opt.matchpairs:append('‘:’')
+vim.opt.matchpairs:append('“:”')
+vim.opt.mouse = 'a'
+vim.opt.number = true
+vim.opt.relativenumber = true
+vim.opt.scrolloff = 8
+vim.opt.secure = true
+vim.opt.shiftwidth = 4
+vim.opt.showmode = false
+vim.opt.signcolumn = 'no'
+vim.opt.smartcase = true
+vim.opt.smartindent = true
+vim.opt.softtabstop = 4
+vim.opt.splitbelow = true
+vim.opt.splitright = true
+vim.opt.swapfile = false
+vim.opt.tabstop = 4
+vim.opt.undodir = os.getenv('XDG_STATE_HOME') .. '/nvim/undo'
+vim.opt.undofile = true
+
+function mk_scratch_buffer()
+ vim.cmd [[
+ if bufexists('scratch')
+ buffer scratch
+ else
+ noswapfile hide enew
+ setlocal buftype=nofile bufhidden=hide
+ file scratch
+ endif
+ ]]
+end
+
+vim.keymap.set('n', '<C-h>', '<C-w><C-h>',
+ { desc = 'Move focus to the left window' })
+vim.keymap.set('n', '<C-j>', '<C-w><C-j>',
+ { desc = 'Move focus to the lower window' })
+vim.keymap.set('n', '<C-k>', '<C-w><C-k>',
+ { desc = 'Move focus to the upper window' })
+vim.keymap.set('n', '<C-l>', '<C-w><C-l>',
+ { desc = 'Move focus to the right window' })
+vim.keymap.set('n', '<C-v>', 'V',
+ { desc = 'Enter visual-line mode' })
+vim.keymap.set('n', '<leader>h', function() vim.cmd 'split' end,
+ { desc = 'Open a [H]orizontal split' })
+vim.keymap.set('n', '<leader>v', function() vim.cmd 'vsplit' end,
+ { desc = 'Open a [V]ertical split' })
+vim.keymap.set('n', 'M', ':make<CR>',
+ { desc = 'Run the configured compiler' })
+vim.keymap.set('n', 'V', '<C-v>',
+ { desc = 'Enter visual-block mode' })
+vim.keymap.set('v', '<C-j>', ":m '>+1<CR>gv=gv",
+ { desc = 'Move a selection down a line' })
+vim.keymap.set('v', '<C-k>', ":m '<-2<CR>gv=gv",
+ { desc = 'Move a selection up a line' })
+vim.keymap.set({ 'n', 'o', 'x' }, '€', '$',
+ { desc = 'Go to end of the line' })
+vim.keymap.set('n', '<Esc>', '<Cmd>nohlsearch<CR>',
+ { desc = 'Disable highlighting of currently highlighted search matches' })
+vim.keymap.set('n', '<leader>t', function() vim.cmd.normal('"zx"zph') end,
+ { desc = '[T]ranspose the current and next characters' })
+vim.keymap.set('n', '<leader>T', function() vim.cmd.normal('"zX"zp') end,
+ { desc = '[T]ranspose the current and previous characters' })
+vim.keymap.set('n', '-', ':Ex<CR>',
+ { desc = 'Open Netrw' })
+
+vim.keymap.set('n', '<leader>k', function()
+ vim.cmd 'vsplit'
+ mk_scratch_buffer()
+end, { desc = 'Open the scratch buffer in a vertical split' })
+vim.keymap.set('n', '<leader>K', function()
+ vim.cmd 'split'
+ mk_scratch_buffer()
+end, { desc = 'Open the scratch buffer in a horizontal split' })
+
+-- Don’t move the cursor with various commands
+vim.keymap.set('n', 'J', 'mzJ`z')
+vim.keymap.set('n', '<C-d>', '<C-d>zz')
+vim.keymap.set('n', '<C-u>', '<C-u>zz')
+vim.keymap.set('n', 'n', 'nzzzv')
+vim.keymap.set('n', 'N', 'Nzzzv')
+
+vim.api.nvim_create_autocmd('BufEnter', {
+ desc = 'Disable auto-commenting',
+ group = vim.api.nvim_create_augroup('mango-no-autocomment', { clear = true }),
+ callback = function()
+ vim.opt.formatoptions:remove({ 'c', 'r', 'o' })
+ end,
+})
+
+vim.api.nvim_create_autocmd('TextYankPost', {
+ desc = 'Momentarily highlight yanked text',
+ group = vim.api.nvim_create_augroup('mango-highlight-yank', { clear = true }),
+ callback = function()
+ vim.highlight.on_yank()
+ end,
+})
+
+-- Weird way to make buffer auto-reverting work?
+vim.cmd [[
+ if !exists('g:CheckUpdateStarted')
+ let g:CheckUpdatedStarted = 1
+ call timer_start(1000, 'CheckUpdate', {'repeat': -1})
+ endif
+
+ function! CheckUpdate(_)
+ silent! checktime
+ endfunction
+]]
+
+-- Bootstrap Paq
+local paqpath = vim.fn.stdpath('data') .. '/site/pack/paqs/start/paq-nvim'
+if not vim.uv.fs_stat(paqpath) then
+ vim.fn.system({
+ 'git', 'clone', '--depth=1',
+ 'https://github.com/savq/paq-nvim.git',
+ paqpath
+ })
+end
+
+require 'paq' {
+ 'christoomey/vim-sort-motion',
+ 'echasnovski/mini.nvim',
+ 'folke/todo-comments.nvim',
+ 'folke/tokyonight.nvim',
+ 'hrsh7th/cmp-nvim-lsp',
+ 'hrsh7th/cmp-path',
+ 'hrsh7th/nvim-cmp',
+ 'https://git.sr.ht/~mango/tree-sitter-gsp',
+ 'kylechui/nvim-surround',
+ 'L3MON4D3/LuaSnip',
+ 'luckasRanarison/tree-sitter-hypr',
+ 'mattn/emmet-vim',
+ 'neovim/nvim-lspconfig',
+ 'nvim-lua/plenary.nvim',
+ 'nvim-telescope/telescope.nvim',
+ 'nvim-telescope/telescope-ui-select.nvim',
+ { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
+ 'nvim-treesitter/nvim-treesitter-textobjects',
+ 'saadparwaiz1/cmp_luasnip',
+ 'savq/paq-nvim',
+ 'wellle/targets.vim',
+}
+
+-- emmet-vim
+vim.g.user_emmet_install = false
+
+-- vim-sort-motion
+vim.g.sort_motion_flags = 'l'
+
+-- tokyonight.nvim
+vim.cmd.colorscheme 'tokyonight-night'
+
+-- telescope.nvim
+local telescope = require 'telescope'
+local tsactions = require 'telescope.actions'
+local tsbuiltin = require 'telescope.builtin'
+local tsthemes = require 'telescope.themes'
+
+telescope.setup {
+ defaults = {
+ scroll_strategy = 'limit',
+ path_display = { 'filename_first' },
+ get_status_text = function(_) return '' end,
+ mappings = {
+ i = {
+ ['<Esc>'] = {
+ tsactions.close,
+ type = 'action',
+ opts = { nowait = true, silent = true },
+ },
+ ['<C-j>'] = {
+ tsactions.move_selection_next,
+ type = 'action',
+ opts = { nowait = true, silent = true },
+ },
+ ['<C-k>'] = {
+ tsactions.move_selection_previous,
+ type = 'action',
+ opts = { nowait = true, silent = true },
+ },
+ },
+ },
+ },
+ extensions = {
+ ['ui-select'] = { tsthemes.get_dropdown() },
+ }
+}
+
+pcall(telescope.load_exetension, 'fzf')
+pcall(telescope.load_exetension, 'ui-select')
+
+vim.keymap.set('n', '<leader>ff', tsbuiltin.find_files,
+ { desc = '[F]ind [F]iles' })
+vim.keymap.set('n', '<leader>fh', tsbuiltin.help_tags,
+ { desc = '[F]ind [H]elp' })
+vim.keymap.set('n', '<leader>fg', tsbuiltin.live_grep,
+ { desc = '[F]ind [G]rep' })
+vim.keymap.set('n', '<leader>/', function()
+ tsbuiltin.current_buffer_fuzzy_find(tsthemes.get_dropdown {
+ winblend = 10,
+ previewer = false,
+ })
+end, { desc = 'Fuzzily search in current buffer' })
+
+-- todo-comments.nvim
+require('todo-comments').setup {
+ signs = false,
+ keywords = {
+ TODO = { color = 'info' },
+ NOTE = { color = 'hint' },
+ },
+ highlight = {
+ before = '',
+ keyword = 'fg',
+ after = '',
+ },
+}
+
+-- mini.nvim
+local statusline = require 'mini.statusline'
+statusline.setup { use_icons = false }
+statusline.section_location = function() return '%2l:%-2v' end
+
+-- nvim-treesitter
+local treeconfs = require('nvim-treesitter.parsers').get_parser_configs()
+treeconfs.gsp = {
+ install_info = {
+ url = 'https://git.sr.ht/~mango/tree-sitter-gsp',
+ files = { 'src/parser.c' },
+ },
+ filetype = 'gsp',
+}
+
+require('nvim-treesitter.install').prefer_git = true
+require('nvim-treesitter.configs').setup {
+ auto_install = true,
+ sync_install = true,
+
+ highlight = {
+ enable = true,
+ additional_vim_regex_highlighting = false,
+ },
+
+ incremental_selection = {
+ enable = true,
+ keymaps = {
+ init_selection = '<C-Space>',
+ node_incremental = '<C-Space>',
+ node_decremental = '<C-s>',
+ },
+ },
+
+ textobjects = {
+ select = {
+ enable = true,
+ lookahead = true,
+ keymaps = {
+ ['ab'] = '@block.outer',
+ ['ib'] = '@block.inner',
+ ['ac'] = '@comment.outer',
+ ['ic'] = '@comment.inner',
+ ['af'] = '@function.outer',
+ ['if'] = '@function.inner',
+ ['an'] = '@node.outer',
+ ['in'] = '@node.inner',
+ ['at'] = '@text.outer',
+ ['it'] = '@text.outer',
+ },
+ },
+ move = {
+ enable = true,
+ set_jumps = true,
+ goto_next_start = {
+ [']c'] = '@comment.outer',
+ [']f'] = '@function.outer',
+ [']b'] = '@block.outer',
+ [']n'] = '@node.outer',
+ [']t'] = '@text.outer',
+ },
+ goto_next_end = {
+ [']C'] = '@comment.outer',
+ [']F'] = '@function.outer',
+ [']B'] = '@block.outer',
+ [']N'] = '@node.outer',
+ [']T'] = '@text.outer',
+ },
+ goto_previous_start = {
+ ['[c'] = '@comment.outer',
+ ['[f'] = '@function.outer',
+ ['[b'] = '@block.outer',
+ ['[n'] = '@node.outer',
+ ['[t'] = '@text.outer',
+ },
+ goto_previous_end = {
+ ['[C'] = '@comment.outer',
+ ['[F'] = '@function.outer',
+ ['[B'] = '@block.outer',
+ ['[N'] = '@node.outer',
+ ['[T'] = '@text.outer',
+ },
+ },
+ },
+}
+
+-- nvim-surround
+require('nvim-surround').setup {
+ surrounds = {
+ ['’'] = {
+ add = { '‘', '’' },
+ find = '‘[^‘’]*’',
+ delete = '^(‘)().-(’)()$',
+ },
+
+ ['‘'] = {
+ add = { '‘ ', ' ’' },
+ find = '‘[^‘’]*’',
+ delete = '^(‘ *)().-( *’)()$',
+ },
+
+ ['”'] = {
+ add = { '“', '”' },
+ find = '“[^“”]*”',
+ delete = '^(“)().-(”)()$',
+ },
+
+ ['“'] = {
+ add = { '“ ', ' ”' },
+ find = '“[^“”]*”',
+ delete = '^(“ *)().-( *”)()$',
+ },
+ }
+}
+
+-- nvim-lspconfig
+local lsp = require 'lspconfig'
+local caps = require('cmp_nvim_lsp').default_capabilities()
+
+lsp.clangd.setup {
+ cmd = { 'clangd', '-header-insertion=never' },
+ capabilities = caps,
+}
+lsp.gopls.setup {
+ capabilities = caps,
+}
+lsp.rust_analyzer.setup {
+ capabilities = caps,
+}
+lsp.lua_ls.setup {
+ settings = {
+ Lua = {
+ runtime = {
+ version = 'LuaJIT',
+ },
+ diagnostics = {
+ globals = {
+ 'vim',
+ 'require',
+ },
+ },
+ workspace = {
+ library = vim.api.nvim_get_runtime_file('', true),
+ },
+ telemetry = {
+ enable = false,
+ },
+ },
+ },
+ capabilities = caps,
+}
+
+vim.api.nvim_create_autocmd('LspAttach', {
+ group = vim.api.nvim_create_augroup('mango-lsp-config', { clear = true }),
+ callback = function(ev)
+ local function remap(mode, map, fn)
+ vim.keymap.set(mode, map, fn, { buffer = ev.buf })
+ end
+
+ vim.diagnostic.disable()
+ vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
+ vim.keymap.set('n', 'gK', vim.lsp.buf.hover,
+ { buffer = ev.buf, desc = 'View symbol hover information' })
+ vim.keymap.set('n', 'gd', vim.lsp.buf.definition,
+ { buffer = ev.buf, desc = 'Goto [D]efinition' })
+ vim.keymap.set('n', 'gi', vim.lsp.buf.implementation,
+ { buffer = ev.buf, desc = 'Goto [I]mplementation' })
+ vim.keymap.set('n', 'gr', vim.lsp.buf.rename,
+ { buffer = ev.buf, desc = '[R]ename symbol' })
+ vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition,
+ { buffer = ev.buf, desc = 'Goto [T]ype definition' })
+ end,
+})
+
+-- nvim-cmp & luasnip
+local cmp = require 'cmp'
+local luasnip = require 'luasnip'
+
+luasnip.config.setup {
+ history = true,
+ updateevents = 'TextChanged,TextChangedI',
+}
+require 'snippets'
+
+cmp.setup {
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end,
+ },
+ completion = { completeopt = 'menu,menuone,noinsert' },
+ mapping = cmp.mapping.preset.insert {
+ ['<CR>'] = cmp.mapping.confirm { select = true },
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-p>'] = cmp.mapping.scroll_docs(-1),
+ ['<C-n>'] = cmp.mapping.scroll_docs(1),
+ ['<C-c>'] = cmp.mapping.abort(),
+ ['<C-j>'] = cmp.mapping.select_next_item({
+ behaviour = cmp.SelectBehavior.Select,
+ }),
+ ['<C-k>'] = cmp.mapping.select_prev_item({
+ behaviour = cmp.SelectBehavior.Select,
+ }),
+ ['<C-l>'] = cmp.mapping(function()
+ if luasnip.expand_or_locally_jumpable() then
+ luasnip.expand_or_jump()
+ end
+ end, {'i', 's'}),
+ ['<C-h>'] = cmp.mapping(function()
+ if luasnip.expand_or_locally_jumpable(-1) then
+ luasnip.expand_or_jump(-1)
+ end
+ end, {'i', 's'}),
+ },
+ sources = {
+ { name = 'nvim_lsp' },
+ { name = 'luasnip' },
+ { name = 'path' },
+ },
+ experimental = {
+ ghost_text = true,
+ },
+}
+-- cmp.event:on('confirm_done', function(ev)
+-- if ev.commit_character then
+-- return
+-- end
+--
+-- local types = require 'cmp.types'
+-- local kind = ev.entry:get_kind()
+--
+-- if
+-- kind == types.lsp.CompletionItemKind.Function or
+-- kind == types.lsp.CompletionItemKind.Method
+-- then
+-- local keys = vim.api.nvim_replace_termcodes('()<left>', true, false, true)
+-- vim.api.nvim_feedkeys(keys, 'i', false)
+-- end
+-- end)
+
+require('pipe')
diff --git a/.config/nvim/lua/mango/init.lua b/.config/nvim/lua/mango/init.lua
deleted file mode 100644
index 9e7f273..0000000
--- a/.config/nvim/lua/mango/init.lua
+++ /dev/null
@@ -1,3 +0,0 @@
-require('mango.packer')
-require('mango.remap')
-require('mango.set')
diff --git a/.config/nvim/lua/mango/lib.lua b/.config/nvim/lua/mango/lib.lua
deleted file mode 100644
index e062352..0000000
--- a/.config/nvim/lua/mango/lib.lua
+++ /dev/null
@@ -1,36 +0,0 @@
-local M = {}
-
-function M.set_tab_width(tw, localp)
- local opt = localp and vim.opt_local or vim.opt
-
- opt.tabstop = tw
- opt.softtabstop = tw
- opt.shiftwidth = tw
-end
-
-function M.remap(modes, from, to, opts)
- local ct = {}
-
- modes:gsub('.', function(c)
- table.insert(ct, c)
- end)
-
- vim.keymap.set(ct, from, to, opts or {
- noremap = true,
- silent = true,
- })
-end
-
-function M.scratch_buffer()
- vim.cmd [[
- if bufexists('scratch')
- buffer scratch
- else
- noswapfile hide enew
- setlocal buftype=nofile bufhidden=hide
- file scratch
- endif
- ]]
-end
-
-return M
diff --git a/.config/nvim/lua/mango/packer.lua b/.config/nvim/lua/mango/packer.lua
deleted file mode 100644
index 8b5c583..0000000
--- a/.config/nvim/lua/mango/packer.lua
+++ /dev/null
@@ -1,59 +0,0 @@
-vim.cmd.packadd('packer.nvim')
-
-return require('packer').startup(function(use)
- -- Package manager
- use 'wbthomason/packer.nvim'
-
- -- Colorscheme
- use {
- 'rose-pine/neovim',
- as = 'rose-pine',
- }
-
- -- More textobjects; more is more
- use 'wellle/targets.vim'
- use {
- 'nvim-treesitter/nvim-treesitter-textobjects',
- after = 'nvim-treesitter',
- requires = 'nvim-treesitter/nvim-treesitter',
- run = ':TSUpdate',
- }
-
- -- Efficiency improvements
- use 'kylechui/nvim-surround'
- use 'mattn/emmet-vim'
- use 'numToStr/Comment.nvim'
- use 'christoomey/vim-sort-motion'
-
- -- Git integration
- use 'tpope/vim-fugitive'
-
- -- Improvements to builtin functionality
- use 'mbbill/undotree'
- use 'tpope/vim-speeddating'
-
- -- Additional language support
- use 'Glench/Vim-Jinja2-Syntax'
- use 'https://git.sr.ht/~mango/tree-sitter-gsp'
- use 'luckasRanarison/tree-sitter-hypr'
-
- -- LSP support and completions
- use 'neovim/nvim-lspconfig'
- use {
- 'hrsh7th/nvim-cmp',
- requires = {
- -- Completion backends
- { 'hrsh7th/cmp-buffer' },
- { 'hrsh7th/cmp-nvim-lua' },
- { 'hrsh7th/cmp-nvim-lsp' },
- { 'hrsh7th/cmp-path' },
-
- -- Snippets
- { 'L3MON4D3/LuaSnip' },
- { 'saadparwaiz1/cmp_luasnip' },
- },
- }
-
- -- Function context
- use 'nvim-treesitter/nvim-treesitter-context'
-end)
diff --git a/.config/nvim/lua/mango/remap.lua b/.config/nvim/lua/mango/remap.lua
deleted file mode 100644
index a22632e..0000000
--- a/.config/nvim/lua/mango/remap.lua
+++ /dev/null
@@ -1,54 +0,0 @@
-local lib = require('mango.lib')
-local remap = lib.remap
-
-vim.g.mapleader = ' '
-
--- Make adjustments for my custom keyboard layout
-remap('nov', '€', '$')
-
--- Better frame navigation
-remap('n', '<C-h>', '<C-w>h')
-remap('n', '<C-j>', '<C-w>j')
-remap('n', '<C-k>', '<C-w>k')
-remap('n', '<C-l>', '<C-w>l')
-
--- I prefer visual-line mode on ‘V’
-remap('n', 'V', '<C-v>')
-remap('n', '<C-v>', 'V')
-
--- Move selections up and down
-remap('v', '<C-k>', ":m '<-2<CR>gv=gv")
-remap('v', '<C-j>', ":m '>+1<CR>gv=gv")
-
--- Don’t move cursor with various commands
-remap('n', 'J', 'mzJ`z')
-remap('n', '<C-d>', '<C-d>zz')
-remap('n', '<C-u>', '<C-u>zz')
-remap('n', 'n', 'nzzzv')
-remap('n', 'N', 'Nzzzv')
-
--- Compile code quickly
-remap('n', 'M', ':make<CR>')
-
--- Transpose characters; for some reason it has a noticable delay if I just give
--- a string instead of lambda functions
-remap('n', '<leader>t', function() vim.cmd.normal('"zx"zp') end)
-remap('n', '<leader>T', function() vim.cmd.normal('"zX"zp') end)
-
--- Open netrw quickly
-remap('n', '-', ':Ex<CR>')
-
--- Open netrw in a vertical- or horizontal split. The split is made manually
--- instead of by using :Vexplore or :Sexplore so that it’s made on the right or
--- bottom instead of the left or top
-remap('n', '–', ':vsplit | Ex<CR>')
-remap('n', 'g–', ':split | Ex<CR>')
-
-remap('n', '<leader>s', function()
- vim.cmd('vsplit')
- lib.scratch_buffer()
-end)
-remap('n', '<leader>S', function()
- vim.cmd('split')
- lib.scratch_buffer()
-end)
diff --git a/.config/nvim/lua/mango/set.lua b/.config/nvim/lua/mango/set.lua
deleted file mode 100644
index 6b92625..0000000
--- a/.config/nvim/lua/mango/set.lua
+++ /dev/null
@@ -1,72 +0,0 @@
-local lib = require('mango.lib')
-local api = vim.api
-
-local o = vim.opt
-local g = vim.g
-
-local augroup = api.nvim_create_augroup('Mango', { clear = true })
-
-o.nu = true
-o.relativenumber = true
-o.signcolumn = 'no'
-o.colorcolumn = '81'
-
-o.exrc = true
-o.secure = true
-
-g.guifont = { 'Iosevka Smooth Term', ':h16' }
-
-lib.set_tab_width(4)
-o.expandtab = false
-o.smartindent = true
-
-o.wrap = false
-
-o.swapfile = false
-o.backup = false
-o.undodir = os.getenv('XDG_STATE_HOME') .. '/nvim/undo'
-o.undofile = true
-
-o.hlsearch = true
-o.incsearch = true
-
-o.termguicolors = true
-
-o.scrolloff = 8
-
-o.isfname:append('@-@')
-
-o.splitright = true
-o.splitbelow = true
-
--- Better settings for netrw
-g.netrw_banner = 0
-g.netrw_bufsettings = 'noma nomod nu nobl nowrap ro' -- Enable line-numbers
-g.netrw_list_hide = [[^\(\.\|\.\.\)/\?$,^__pycache__/\?,.*\.\(o\|pyc\)$]]
-
-vim.cmd [[ set grepprg=rg\ --vimgrep ]]
-
--- Disable auto commenting
-api.nvim_create_autocmd('BufEnter', {
- callback = function()
- o.formatoptions:remove({ 'c', 'r', 'o' })
- end,
- group = augroup,
-})
-
--- Make buffer auto-reverting work… somehow
-vim.cmd([[
- if !exists('g:CheckUpdateStarted')
- let g:CheckUpdateStarted = 1
- call timer_start(1000, 'CheckUpdate', {'repeat': -1})
- endif
-
- function! CheckUpdate(_)
- silent! checktime
- endfunction
-]])
-
--- Allow for jumping between these pairs with %
-o.matchpairs:append('<:>')
-o.matchpairs:append('‘:’')
-o.matchpairs:append('“:”')
diff --git a/.config/nvim/lua/pipe.lua b/.config/nvim/lua/pipe.lua
new file mode 100644
index 0000000..f09a030
--- /dev/null
+++ b/.config/nvim/lua/pipe.lua
@@ -0,0 +1,42 @@
+function pipe_visual()
+ pipe_internal({'<', '>'}, vim.fn.visualmode() ~= 'v')
+end
+
+function pipe_normal(arg)
+ pipe_internal({'[', ']'}, arg == 'line')
+end
+
+function pipe_internal(marks, linesp)
+ local mode = vim.fn.visualmode()
+
+ local sr, sc = unpack(vim.api.nvim_buf_get_mark(0, marks[1]))
+ local er, ec = unpack(vim.api.nvim_buf_get_mark(0, marks[2]))
+
+ local lines = linesp
+ and vim.api.nvim_buf_get_lines(0, sr - 1, er, true)
+ or vim.api.nvim_buf_get_text(0, sr - 1, sc, er - 1, ec + 1, {})
+
+ local ok, cmd = pcall(vim.fn.input, {
+ prompt = '… | ',
+ cancelreturn = vim.NIL,
+ })
+
+ if not ok or cmd == vim.NIL then
+ return
+ end
+
+ local out = vim.fn.systemlist(cmd, lines)
+ if linesp then
+ vim.api.nvim_buf_set_lines(0, sr - 1, er, true, out)
+ else
+ vim.api.nvim_buf_set_text(0, sr - 1, sc, er - 1, ec + 1, out)
+ end
+end
+
+vim.keymap.set('n', '<Plug>PipeNormal', ':set opfunc=v:lua.pipe_normal<CR>g@',
+ { silent = true })
+vim.keymap.set('x', '<Plug>PipeVisual', ':<C-u>lua pipe_visual()<CR>',
+ { silent = true })
+
+vim.keymap.set('n', '|', '<Plug>PipeNormal')
+vim.keymap.set('x', '|', '<Plug>PipeVisual')
diff --git a/.config/nvim/after/plugin/luasnip.lua b/.config/nvim/lua/snippets.lua
index 5486aab..db46bf4 100644
--- a/.config/nvim/after/plugin/luasnip.lua
+++ b/.config/nvim/lua/snippets.lua
@@ -17,11 +17,6 @@ local function same(index)
end, { index })
end
-ls.config.set_config {
- history = true,
- updateevents = 'TextChanged,TextChangedI',
-}
-
ls.add_snippets('lua', {
s('req', fmt([[local {} = require('{}')]], {
f(function(name)
@@ -179,24 +174,3 @@ ls.add_snippets('c', {
)
),
})
-
-vim.keymap.set({ 'i', 's' }, '<C-l>', function()
- if ls.expand_or_jumpable() then
- ls.expand_or_jump()
- end
-end)
-vim.keymap.set('i', '<C-h>', function()
- if ls.jumpable(-1) then
- ls.jump(-1)
- end
-end)
-vim.keymap.set('i', '<C-k>', function()
- if ls.choice_active() then
- ls.change_choice(-1)
- end
-end)
-vim.keymap.set('i', '<C-j>', function()
- if ls.choice_active() then
- ls.change_choice(1)
- end
-end)