nvim: Restructure lua dir

Moved plugins into individual component module files which are
automatically required by lazy.nvim. Should make everything a tiny bit
more modular, or at least prepare the way for true modularity if I ever
have the time on my hands to ensure everything works with missing
modules.

Moved core settings into their own directory (`core`), and created a
`personal` folder which contains functions/plugins I wrote that do not
necessarily have to be their own imported plugin yet.

Finally, extended the utility functions a little, so we can detect if a
plugin exists and change e.g. key maps based on that (once again,
extending modularity a little more). Some simple attempts have been made
at that in the `mappings.lua` file, though it is nowhere near extensive
yet - most keymaps are still set regardless of plugin availability.

However, with this slimmer base to work off of, I feel more confident in
changing future things about this setup a little more ad-hoc without
having as many ripple repercussions as before.
This commit is contained in:
Marty Oehme 2023-06-15 15:45:21 +02:00
parent f343b1a76d
commit f33b4c9c37
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
38 changed files with 1221 additions and 908 deletions

View file

@ -0,0 +1,15 @@
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/desktop"
XDG_DOCUMENTS_DIR="$HOME/documents"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_MUSIC_DIR="$HOME/media/audio/music"
XDG_PICTURES_DIR="$HOME/pictures"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"

View file

@ -10,6 +10,7 @@ for _, source in ipairs({
"core.autocmds", "core.autocmds",
"core.mappings", "core.mappings",
"core.look", "core.look",
"personal",
}) do }) do
local status_ok, fault = pcall(require, source) local status_ok, fault = pcall(require, source)
if not status_ok then if not status_ok then

View file

@ -7,7 +7,7 @@
"cmp-beancount": { "branch": "main", "commit": "da154ea94d598e6649d6ad01efa0a8611eff460d" }, "cmp-beancount": { "branch": "main", "commit": "da154ea94d598e6649d6ad01efa0a8611eff460d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" }, "cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" },
"cmp-cmdline": { "branch": "main", "commit": "5af1bb7d722ef8a96658f01d6eb219c4cf746b32" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-digraphs": { "branch": "master", "commit": "5efc1f0078d7c5f3ea1c8e3aad04da3fd6e081a9" }, "cmp-digraphs": { "branch": "master", "commit": "5efc1f0078d7c5f3ea1c8e3aad04da3fd6e081a9" },
"cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" }, "cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
@ -24,36 +24,35 @@
"dressing.nvim": { "branch": "master", "commit": "f16d7586fcdd8b2e3850d0abb7e46f944125cc25" }, "dressing.nvim": { "branch": "master", "commit": "f16d7586fcdd8b2e3850d0abb7e46f944125cc25" },
"easyread.nvim": { "branch": "main", "commit": "0b07e315a4cd7d700c4a794bdddbec79fdc2628b" }, "easyread.nvim": { "branch": "main", "commit": "0b07e315a4cd7d700c4a794bdddbec79fdc2628b" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"friendly-snippets": { "branch": "main", "commit": "b471f5419155ce832eff71ad8920ea8cfbd54840" }, "friendly-snippets": { "branch": "main", "commit": "b3cd8d77feb7871d8b04bb45bcd8154120a796a1" },
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
"gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" }, "gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
"jupyter-kernel.nvim": { "branch": "main", "commit": "5b409598033884a3d819e2a3bcd1fe340bc8d783" }, "jupyter-kernel.nvim": { "branch": "main", "commit": "5b409598033884a3d819e2a3bcd1fe340bc8d783" },
"lazy.nvim": { "branch": "main", "commit": "f145e6f42a56306c5536e9efbfe41f7efbec285d" }, "lazy.nvim": { "branch": "main", "commit": "6b2311a46a3808e366bb251270f4cc04afb421ed" },
"lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" }, "lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
"lsp-zero.nvim": { "branch": "v2.x", "commit": "8fda9a849d6ab4196ecf129905764ddefdfb64b5" }, "lsp-setup.nvim": { "branch": "main", "commit": "4656a1882546b702b18a84f5de209a2f8aa43dee" },
"lsp_signature.nvim": { "branch": "master", "commit": "4665921ff8e30601c7c1328625b3abc1427a6143" }, "lsp_signature.nvim": { "branch": "master", "commit": "4665921ff8e30601c7c1328625b3abc1427a6143" },
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
"magma-nvim-goose": { "branch": "main", "commit": "5d916c39c1852e09fcd39eab174b8e5bbdb25f8f" }, "magma-nvim-goose": { "branch": "main", "commit": "d7931d773efcedc9c92337b8d500e32a3725fe26" },
"markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" }, "markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "5230617372e656d4a2e1e236e03bf7e7b4b97273" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "5230617372e656d4a2e1e236e03bf7e7b4b97273" },
"mason-null-ls.nvim": { "branch": "main", "commit": "cfbd83909cbc56e2f07cb3f8a03157e069c5c91c" }, "mason-null-ls.nvim": { "branch": "main", "commit": "cfbd83909cbc56e2f07cb3f8a03157e069c5c91c" },
"mason.nvim": { "branch": "main", "commit": "7d7efc738e08fc5bee822857db45cb6103f0b0c1" }, "mason.nvim": { "branch": "main", "commit": "4be1226f48bc2011024110f37b17f5ee468df58f" },
"mini.nvim": { "branch": "main", "commit": "889be69623395ad183ae6f3c21c8efe006350226" }, "mini.nvim": { "branch": "main", "commit": "296ebbbd3e5ba5e43f5125efe18ad76fe3b632cc" },
"nabla.nvim": { "branch": "master", "commit": "8c143ad2b3ab3b8ffbd51e238ccfcbd246452a7e" }, "nabla.nvim": { "branch": "master", "commit": "8c143ad2b3ab3b8ffbd51e238ccfcbd246452a7e" },
"neural": { "branch": "main", "commit": "155618730b87a67655bdde373ee27bfce8b07ac9" },
"nui.nvim": { "branch": "main", "commit": "7a524120a7a70761b5a65b602fd235a65cb005aa" },
"null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" }, "null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" },
"nvim-base16": { "branch": "master", "commit": "4f3aa29f49b38edb6db1c52cea57e64ce3de2373" }, "nvim-base16": { "branch": "master", "commit": "4f3aa29f49b38edb6db1c52cea57e64ce3de2373" },
"nvim-cmp": { "branch": "main", "commit": "fc0f694af1a742ada77e5b1c91ff405c746f4a26" }, "nvim-cmp": { "branch": "main", "commit": "b8c2a62b3bd3827aa059b43be3dd4b5c45037d65" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
"nvim-lspconfig": { "branch": "master", "commit": "458fa2ee2115c693ca48a04afa65f6de6b40a2db" }, "nvim-lspconfig": { "branch": "master", "commit": "295c646488d5baa63c6c4da68fe61171b9257375" },
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
"nvim-surround": { "branch": "main", "commit": "211eaad7c6d01ef4ac02cba9052b3082ec232101" }, "nvim-surround": { "branch": "main", "commit": "211eaad7c6d01ef4ac02cba9052b3082ec232101" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "95204ece0f2a54c89c4395295432f9aeedca7b5f" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "95204ece0f2a54c89c4395295432f9aeedca7b5f" },
"nvim-tree.lua": { "branch": "master", "commit": "f5d970d4506f385b29534252d8c15a782fa53034" }, "nvim-tree.lua": { "branch": "master", "commit": "f873625d0636889af4cd47a01e486beb865db205" },
"nvim-treesitter": { "branch": "master", "commit": "cc360a9beb1b30d172438f640e2c3450358c4086" }, "nvim-treesitter": { "branch": "master", "commit": "cc360a9beb1b30d172438f640e2c3450358c4086" },
"nvim-treesitter-context": { "branch": "master", "commit": "e2ea37627c0681421ccf4a3cf19d68bb958e1817" }, "nvim-treesitter-context": { "branch": "master", "commit": "efe87061af560847679fca93697991e474f049e2" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "b913508f503527ff540f7fe2dcf1bf1d1f259887" }, "nvim-treesitter-textsubjects": { "branch": "master", "commit": "b913508f503527ff540f7fe2dcf1bf1d1f259887" },
"nvim-ts-autotag": { "branch": "main", "commit": "e254b306fb81ed69049cce526e7906150d73e0d1" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" },
"nvim-ts-rainbow2": { "branch": "master", "commit": "c00d61ab7517530c49457ba49186776e6611a3e1" }, "nvim-ts-rainbow2": { "branch": "master", "commit": "c00d61ab7517530c49457ba49186776e6611a3e1" },
"nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" }, "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" },
@ -62,11 +61,10 @@
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" }, "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"quarto-nvim": { "branch": "main", "commit": "b299266c6287d74b60480fae348d629ec1dc02bb" }, "quarto-nvim": { "branch": "main", "commit": "b299266c6287d74b60480fae348d629ec1dc02bb" },
"significant.nvim": { "branch": "main", "commit": "5450e9d5917dc6aa9afb0fcbe32355799b8303fb" },
"smartcolumn.nvim": { "branch": "main", "commit": "0c572e3eae48874f25b74394a486f38cadb5c958" }, "smartcolumn.nvim": { "branch": "main", "commit": "0c572e3eae48874f25b74394a486f38cadb5c958" },
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
"telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, "telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" }, "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
"vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" }, "vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" },
"vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" }, "vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" },

View file

@ -1,37 +1,38 @@
-- Highlight whatever is being yanked -- Highlight whatever is being yanked
vim.api.nvim_create_autocmd({ "TextYankPost" }, { vim.api.nvim_create_autocmd({ "TextYankPost" }, {
command = 'silent! lua require"vim.highlight".on_yank{timeout=500}', command = 'silent! lua require"vim.highlight".on_yank{timeout=500}',
desc = "Highlight yanked text whenevery yanking something", desc = "Highlight yanked text whenevery yanking something",
group = vim.api.nvim_create_augroup("highlightyanks", { clear = true }), group = vim.api.nvim_create_augroup("highlightyanks", { clear = true }),
}) })
-- Special setting for editing gopass files - make sure nothing leaks outside the directories it is supposed to -- Special setting for editing gopass files - make sure nothing leaks outside the directories it is supposed to
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
pattern = { pattern = {
"/dev/shm/gopass.*", "/dev/shm/gopass.*",
"/dev/shm/pass.?*/?*.txt", "/dev/shm/pass.?*/?*.txt",
"$TMPDIR/pass.?*/?*.txt", "$TMPDIR/pass.?*/?*.txt",
"/tmp/pass.?*/?*.txt", "/tmp/pass.?*/?*.txt",
}, },
command = "setlocal noswapfile nobackup noundofile nowritebackup viminfo=", command = "setlocal noswapfile nobackup noundofile nowritebackup viminfo=",
desc = "Don't leak any information when editing potential password files", desc = "Don't leak any information when editing potential password files",
group = vim.api.nvim_create_augroup("passnoleak", { clear = true }), group = vim.api.nvim_create_augroup("passnoleak", { clear = true }),
}) })
-- fixing neovim opening up at same moment as alacritty (see https://github.com/neovim/neovim/issues/11330) -- fixing neovim opening up at same moment as alacritty (see https://github.com/neovim/neovim/issues/11330)
vim.api.nvim_create_autocmd({ "VimEnter" }, { vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function() callback = function()
local pid, WINCH = vim.fn.getpid(), vim.loop.constants.SIGWINCH local pid, WINCH = vim.fn.getpid(), vim.loop.constants.SIGWINCH
vim.defer_fn(function() vim.defer_fn(function()
vim.loop.kill(pid, WINCH) vim.loop.kill(pid, WINCH)
end, 20) end, 20)
end, end,
desc = "Fix neovim sizing issues if opening same time as alacritty", desc = "Fix neovim sizing issues if opening same time as alacritty",
group = vim.api.nvim_create_augroup("alacritty_fixsize", { clear = true }), group = vim.api.nvim_create_augroup("alacritty_fixsize", { clear = true }),
}) })
-- remove line numbers from terminal buffers -- remove line numbers from terminal buffers
vim.api.nvim_create_autocmd({ "TermOpen" }, { vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*", desc = "Hide buffer numbers for terminals",
command = "setlocal nonumber norelativenumber", pattern = "*",
command = "setlocal nonumber norelativenumber",
}) })

View file

@ -1,5 +1,6 @@
local map = vim.keymap.set local map = vim.keymap.set
local prefix = require("which-key").register local prefix = require("which-key").register
local is_available = require("util").is_available
-- The general ideas behind these mappings: -- The general ideas behind these mappings:
-- --
@ -102,8 +103,6 @@ map("n", "<leader>/", ":noh<cr>", { desc = "remove highlights" })
-- tmux setup) -- tmux setup)
map("n", "<leader>-", ":sp<cr>", { desc = "open horiz split" }) map("n", "<leader>-", ":sp<cr>", { desc = "open horiz split" })
map("n", "<leader>\\", ":vsp<cr>", { desc = "open vert split" }) map("n", "<leader>\\", ":vsp<cr>", { desc = "open vert split" })
-- 'open new buffer' with leader-t (opens new buffer containing current dir and switches to it)
map("n", "<leader>t", ":vsp | Vifm<cr>", { desc = "open buffer" })
-- open actual new tab with leader-T -- open actual new tab with leader-T
map("n", "<leader>T", ":tabedit | Vifm<cr>", { desc = "open tab" }) map("n", "<leader>T", ":tabedit | Vifm<cr>", { desc = "open tab" })
@ -251,8 +250,13 @@ map("v", "<localleader>nN", ":ZkNewFromContentSelection<cr>", { desc = "content
map("v", "<localleader>nf", ":ZkMatch<cr>", { desc = "find note from selection" }) map("v", "<localleader>nf", ":ZkMatch<cr>", { desc = "find note from selection" })
-- PLUGIN: toggleterm.nvim -- PLUGIN: toggleterm.nvim
-- create a lazygit window, set up in toggleterm settings -- create a lazygit or python window, set up in toggleterm settings
map("n", "<leader>G", ":Lazygit<cr>") -- TODO create ability to go into python environment when in poetry venv and/or euporie/jupyter notebook
if require("util").is_available("nvim-toggleterm.lua") then
map("n", "<leader>G", ":Lazygit<cr>")
map("n", "<leader>tg", ":Lazygit<cr>")
map("n", "<leader>tp", ":Pythonterm<cr>")
end
prefix({ ["<localleader>s"] = { name = "+set" } }) prefix({ ["<localleader>s"] = { name = "+set" } })
-- PLUGIN: wrapping.nvim -- PLUGIN: wrapping.nvim

View file

@ -1,321 +0,0 @@
local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex" }
return {
-- essential
{ "numToStr/Navigator.nvim", branch = "master", config = true }, -- allow seamless navigation between vim buffers and tmux/wezterm splits
{ "jeffkreeftmeijer/vim-numbertoggle", event = "BufEnter" }, -- toggles numbers to absolute for all buffers but the current which is relative
{ "ojroques/vim-oscyank", event = "VeryLazy" }, -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
{ "ggandor/lightspeed.nvim", event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak
{
"lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter
config = function()
require("plug._gitsigns")
end,
event = "BufRead",
},
{ "m4xshen/smartcolumn.nvim", config = true }, -- auto-hiding colorcolumn
-- files
{ "vifm/vifm.vim" }, -- integrate file manager
{
"nvim-tree/nvim-tree.lua", -- integrate file tree
config = true,
dependencies = { "nvim-tree/nvim-web-devicons", config = true },
cmd = "NvimTreeToggle",
}, -- colors
{
"RRethy/nvim-base16",
event = "BufWinEnter",
dependencies = { "rktjmp/fwatch.nvim" },
},
{
"NvChad/nvim-colorizer.lua", -- color hex, named colors in the correct preview scheme
config = function()
require("colorizer").setup({
user_default_options = { mode = "virtualtext" },
})
end,
event = "VeryLazy",
}, -- editing
{ "kylechui/nvim-surround", version = "*", config = true, event = "VeryLazy" }, -- surround things with other things using ys/cs/ds
{
"monaqa/dial.nvim", -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
config = function()
local augend = require("dial.augend")
require("dial.config").augends:register_group({
-- default augends used when no group name is specified
default = {
augend.integer.alias.decimal,
augend.integer.alias.hex,
augend.date.alias["%Y/%m/%d"],
augend.date.alias["%Y-%m-%d"],
augend.date.alias["%m/%d"],
augend.date.alias["%H:%M:%S"],
augend.date.alias["%H:%M"],
augend.constant.alias.de_weekday_full,
augend.constant.alias.de_weekday,
augend.constant.alias.bool,
augend.semver.alias.semver,
augend.constant.alias.Alpha,
augend.constant.alias.alpha,
augend.hexcolor.new({ case = "lower" }),
augend.constant.new({
elements = { "and", "or" },
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
cyclic = true, -- "or" is incremented into "and".
}),
augend.constant.new({
elements = { "&&", "||" },
word = false,
cyclic = true,
}),
},
})
end,
event = "VeryLazy",
},
{
"tommcdo/vim-exchange", -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
event = "VeryLazy",
},
{
"junegunn/vim-easy-align", -- Align tables and other alignable things
event = "VeryLazy",
},
{ "edKotinsky/Arduino.nvim", ft = "arduino", config = true }, -- statusline
{
"nvim-lualine/lualine.nvim",
requires = { "nvim-tree/nvim-web-devicons", config = true },
config = function()
require("plug._lualine")
end,
}, -- writing
{ "vim-pandoc/vim-criticmarkup", ft = writing_ft },
{
"jbyuki/nabla.nvim",
ft = writing_ft,
config = function()
require("nabla").enable_virt({ autogen = true, silent = true })
end,
},
{
"mickael-menu/zk-nvim",
config = function()
require("zk").setup({ picker = "telescope" })
end,
},
{
"andrewferrier/wrapping.nvim",
config = function()
require("wrapping").setup({
create_keymappings = false,
notify_on_switch = false,
})
end,
},
{
"quarto-dev/quarto-nvim",
dependencies = {
"jmbuhr/otter.nvim",
"neovim/nvim-lspconfig",
"vim-pandoc/vim-pandoc-syntax",
"hrsh7th/nvim-cmp",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("quarto").setup({
lspFeatures = {
enabled = true,
languages = { "r", "python", "julia" },
diagnostics = { enabled = true, triggers = { "BufWrite" } },
completion = { enabled = true },
},
})
end,
ft = "quarto",
},
{
"lkhphuc/jupyter-kernel.nvim",
config = true,
cmd = "JupyterAttach",
build = ":UpdateRemotePlugins",
keys = {
{
"<localleader>ck",
"<Cmd>JupyterInspect<CR>",
desc = "Inspect object in kernel",
},
},
},
{ "micarmst/vim-spellsync", event = "VeryLazy" }, -- personal dict improvements for git sync
{ "folke/zen-mode.nvim", config = true, event = "VeryLazy" }, -- provide distraction free writing
{ "folke/twilight.nvim", event = "VeryLazy" }, -- provide even distraction free-er writing (lowlight paragraphs)
{
"JellyApple102/easyread.nvim",
config = true,
ft = writing_ft,
cmd = "EasyreadToggle",
}, -- enable 'speed-reading' mode (bionic reading)
{ "marty-oehme/zettelkasten.nvim", ft = writing_ft, event = "VeryLazy" }, -- simple static markdown linking
{
"iamcco/markdown-preview.nvim", -- generate an auto-updating html preview for md files
build = function()
vim.fn["mkdp#util#install"]()
end,
ft = writing_ft,
}, -- languages
{ "euclidianAce/BetterLua.vim", ft = "lua" }, -- better syntax highlighting for lua
{ "aliou/bats.vim", ft = { "bash", "sh", "zsh", "bats" } }, -- enable syntax for bats shell-code testing library
-- REPL work
{
"WhiteBlackGoose/magma-nvim-goose",
build = ":UpdateRemotePlugins",
config = function()
vim.g.magma_image_provider = "kitty"
vim.g.magma_automatically_open_output = false
end,
},
{
"echasnovski/mini.nvim",
version = "*",
config = function()
require("plug._mini")
end,
},
{
"akinsho/nvim-toggleterm.lua", -- simpler, programmable and multiple terminal toggling for nvim
config = function()
require("plug._toggleterm")
end,
},
{
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end,
}, -- fuzzy matching
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/popup.nvim", "nvim-lua/plenary.nvim" },
config = function()
require("plug._telescope")
end,
},
{
"dense-analysis/neural",
dependencies = { "MunifTanjim/nui.nvim", "elpiloto/significant.nvim" },
config = function()
require("neural").setup({
source = { openai = { api_key = vim.env.OPENAI_API_KEY } },
})
end,
}, -- treesitter
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("plug._treesitter")
end,
event = "BufReadPre",
-- rainbow brackets using treesitter
-- show current cursor context at top of buffer
-- improves commenting plugin above by using ts
dependencies = {
"https://gitlab.com/HiPhish/nvim-ts-rainbow2.git",
{ "romgrk/nvim-treesitter-context", config = true },
"JoosepAlviste/nvim-ts-context-commentstring",
},
},
{ "nvim-treesitter/playground", cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
{
"RRethy/nvim-treesitter-textsubjects", -- allows using . and ; to target treesitter branches
config = function()
require("nvim-treesitter.configs").setup({
textsubjects = {
enable = true,
keymaps = {
["."] = "textsubjects-smart",
[";"] = "textsubjects-container-outer",
},
},
})
end,
event = "BufReadPre",
},
{
-- lsp
"VonHeikemen/lsp-zero.nvim",
dependencies = {
{ "neovim/nvim-lspconfig", branch = "master" },
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
{
"hrsh7th/nvim-cmp",
branch = "main",
dependencies = {
"andersevenrud/cmp-tmux",
"cbarrete/completion-vcard",
"f3fora/cmp-spell",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
"dmitmel/cmp-digraphs",
"jc-doyle/cmp-pandoc-references",
"kdheepak/cmp-latex-symbols",
"lukas-reineke/cmp-rg",
"crispgm/cmp-beancount",
"ray-x/cmp-treesitter",
"saadparwaiz1/cmp_luasnip",
},
},
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
-- { "lukas-reineke/lsp-format.nvim", config = true },
{ "j-hui/fidget.nvim", config = true }, -- loading animations for some LSP
{
"jay-babu/mason-null-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"williamboman/mason.nvim",
"jose-elias-alvarez/null-ls.nvim",
},
},
},
config = function()
require("plug._lsp")
end,
branch = "v2.x",
},
{ "simrat39/symbols-outline.nvim", config = true, event = "VeryLazy" }, -- vista-like outline view for code
{ "ray-x/lsp_signature.nvim", config = true }, -- UI improvements
{ "stevearc/dressing.nvim", config = true },
{
"rcarriga/nvim-notify",
config = function()
vim.notify = require("notify")
end,
},
-- { -- REQUIRES custom `yay -S --asdeps lua51-lyaml invocation` AND is suuper slow
-- "jghauser/papis.nvim",
-- after = { "telescope.nvim", "nvim-cmp" },
-- dependencies = {
-- "kkharji/sqlite.lua", "nvim-lua/plenary.nvim",
-- "MunifTanjim/nui.nvim", "nvim-treesitter/nvim-treesitter"
-- },
-- ft = writing_ft,
-- rocks = { "lyaml" },
-- config = function()
-- require('papis').setup({
-- papis_python = {
-- dir = "/home/marty/documents/library/academia",
-- info_name = "info.yaml",
-- notes_name = [[notes.qmd]]
-- }
-- })
-- end
-- }
}

View file

@ -83,6 +83,8 @@ local globals = {
mapleader = " ", mapleader = " ",
maplocalleader = ",", maplocalleader = ",",
tex_flavor = "latex", tex_flavor = "latex",
format_on_save = true, -- from personal toggle function
} }
for o, v in pairs(globals) do for o, v in pairs(globals) do

View file

@ -0,0 +1,33 @@
local function stop_formatting()
vim.api.nvim_del_augroup_by_name("LspFormat")
end
local function start_formatting()
for _, client in pairs(vim.lsp.get_active_clients()) do
require("lsp-setup.utils").format_on_save(client)
end
end
local function _toggle(opts)
if opts.args == "" then
vim.g.format_on_save = not vim.g.format_on_save
elseif opts.args == "on" or opts.args == "1" then
vim.g.format_on_save = true
elseif opts.args == "off" or opts.args == "0" then
vim.g.format_on_save = false
else
vim.notify("Please provide arguments 'on' or 'off' or non arguments to toggle.")
end
if vim.g.format_on_save == true then
start_formatting()
else
stop_formatting()
end
end
vim.api.nvim_create_user_command(
"FormatOnSave",
_toggle,
{ desc = "toggle automatically formatting on save", nargs = "?" }
)

View file

@ -0,0 +1 @@
require("personal.format_on_save_toggle")

View file

@ -1,11 +0,0 @@
local M = {}
function M.getCompletionItems(prefix)
-- define your total completion items
local items = vim.api.nvim_call_function("pandoc#completion#Complete", { 0, prefix })
return items
end
M.complete_item = { item = M.getCompletionItems }
return M

View file

@ -1,56 +0,0 @@
require("gitsigns").setup({
numhl = true,
signcolumn = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map("n", "]h", function()
if vim.wo.diff then
return "]h"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
map("n", "[h", function()
if vim.wo.diff then
return "[h"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })
-- Actions
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })
map("n", "<localleader>hu", gs.undo_stage_hunk, { desc = "undo stage hunk" })
map("n", "<localleader>hR", gs.reset_buffer, { desc = "reset buffer" })
map("n", "<localleader>hp", gs.preview_hunk, { desc = "preview hunk" })
map("n", "<localleader>hb", function()
gs.blame_line({ full = true })
end, { desc = "blame line" })
map("n", "<localleader>hB", gs.toggle_current_line_blame, { desc = "toggle blame" })
map("n", "<localleader>hd", gs.diffthis, { desc = "diffthis" })
map("n", "<localleader>hD", function()
gs.diffthis("~")
end, { desc = "diffbase" })
map("n", "<localleader>ht", gs.toggle_deleted, { desc = "toggle deleted" })
-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
map({ "o", "x" }, "ah", ":<C-U>Gitsigns select_hunk<CR>")
end,
})

View file

@ -1,329 +0,0 @@
local lsp = require("lsp-zero")
vim.diagnostic.config({ virtual_text = true })
vim.fn.sign_define("DiagnosticSignError", { text = "", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
lsp.ensure_installed({
"astro",
"arduino_language_server",
"bashls",
"beancount",
"clangd",
"dockerls",
"docker_compose_language_service",
"lua_ls",
"pyright",
"ruff_lsp",
"taplo",
"yamlls",
"tsserver",
"cssls",
"tailwindcss",
})
lsp.preset({ name = "recommended", set_lsp_keymaps = false })
lsp.on_attach(function(client, bufnr)
local map = vim.keymap.set
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" })
map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { buffer = bufnr, desc = "Next diagnostic" })
map(
"n",
"[e",
"<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Previous error" }
)
map(
"n",
"]e",
"<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Next error" }
)
local prefix = require("which-key").register
prefix({ ["<localleader>l"] = { name = "+lsp" } })
map("n", "<localleader>li", "<cmd>LspInfo<cr>", { buffer = bufnr, desc = "Lsp Info" })
map(
"n",
"<localleader>ld",
"<cmd>lua vim.diagnostic.open_float()<cr>",
{ buffer = bufnr, desc = "Line diagnostics" }
)
map("n", "<localleader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", { buffer = bufnr, desc = "Codeactions" })
map("n", "<localleader>ln", "<cmd>lua vim.lsp.buf.rename()<cr>", { buffer = bufnr, desc = "Rename element" })
if vim.fn.exists(":Telescope") then
map("n", "<localleader>lr", "<cmd>Telescope lsp_references()<cr>", { buffer = bufnr, desc = "References" })
map("n", "<localleader>lf", "<cmd>Telescope lsp_definitions<cr>", { buffer = bufnr, desc = "Definition" })
map(
"n",
"<localleader>lt",
"<cmd>Telescope lsp_type_definitions<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>Telescope lsp_implementations<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
else
map("n", "<localleader>lr", "<cmd>lua vim.lsp.buf.references()<cr>", { buffer = bufnr, desc = "References" })
map("n", "<localleader>lf", "<cmd>lua vim.lsp.buf.definition()<cr>", { buffer = bufnr, desc = "Definition" })
map(
"n",
"<localleader>lt",
"<cmd>lua vim.lsp.buf.type_definition()<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>lua vim.lsp.buf.implementation()<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
end
if client.server_capabilities.document_formatting then
map(
"n",
"<localleader>lf",
"<cmd>lua vim.lsp.buf.formatting()<CR>",
{ buffer = bufnr, desc = "Format document" }
)
end
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { buffer = bufnr, desc = "Hover definition" })
map("n", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", { buffer = bufnr, desc = "Declaration" })
map(
"n",
"<localleader>ls",
"<cmd>lua vim.lsp.buf.signature_help()<cr>",
{ buffer = bufnr, desc = "Signature help" }
)
end)
lsp.nvim_workspace()
-- ensure python virtualenv is determined automatically on lsp start
require("lspconfig").pyright.setup({
on_attach = function(client, _)
local python_path, msg = require("util.pyenv").get_path(client.config.root_dir)
vim.notify(string.format("%s\n%s", msg, python_path))
client.config.settings.python.pythonPath = python_path
end,
})
-- set up arduino with the help of arduino.nvim plugin
require("lspconfig").arduino_language_server.setup({
on_new_config = require("arduino").on_new_config,
})
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls())
-- map filetypes (rhs) to individual servers (lhs)
-- most will presumably use null_ls however
local format_servers = {
["null-ls"] = {
"astro",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"css",
"scss",
"less",
"html",
"json",
"jsonc",
"yaml",
"markdown",
"markdown.mdx",
"graphql",
"handlebars",
"python",
"sh",
"zsh",
"bash",
"lua",
"luau",
},
}
lsp.format_on_save({
format_opts = {
async = true,
},
servers = format_servers,
})
lsp.format_mapping("gq", {
format_opts = {
async = false,
},
servers = format_servers,
})
lsp.setup()
local null_ls = require("null-ls")
null_ls.setup({})
require("mason-null-ls").setup({
ensure_installed = { "black", "prettier", "shfmt", "eslint-lsp", "stylua", "jq" },
automatic_installation = false,
handlers = {
shfmt = function(_, _)
null_ls.register(null_ls.builtins.formatting.shfmt.with({
extra_filetypes = { "bash", "zsh" },
}))
end,
prettier = function(_, _)
null_ls.register(null_ls.builtins.formatting.prettier.with({
extra_filetypes = { "astro" },
}))
end,
eslint = function(_, _)
null_ls.register(null_ls.builtins.diagnostics.eslint.with({
extra_filetypes = { "astro" },
}))
null_ls.register(null_ls.builtins.code_actions.eslint.with({
extra_filetypes = { "astro" },
}))
end,
},
})
local luasnip = require("luasnip")
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local kind_icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
local cmp = require("cmp")
cmp.setup({
window = { documentation = cmp.config.window.bordered() },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "otter" },
{ name = "luasnip", keyword_length = 2 },
{ name = "pandoc_references" },
{ name = "nvim_lua" },
{
name = "beancount",
option = {
account = vim.env["HOME"] .. "/documents/records/budget/main.beancount", -- TODO implement dynamically
},
},
{ name = "calc" },
{ name = "path" },
{ name = "buffer", keyword_length = 3 },
{ name = "digraphs" },
{ name = "latex_symbols" },
{ name = "spell", keyword_length = 3 },
{ name = "tmux" }, -- { name = 'rg', keyword_length = 5 },
{ name = "vCard" },
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
})
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}), -- disable selection in cmd mode
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
-- Kind icons, removing kind text leaving only icon
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
-- Source
vim_item.menu = ({
buffer = "[Buf]",
calc = "[Cal]",
digraphs = "[Dig]",
latex_symbols = "[LaTeX]",
luasnip = "[Snip]",
nvim_lsp = "[Lsp]",
nvim_lua = "[Lua]",
pandoc_references = "[Bib]",
spell = "[Spl]",
vCard = "[vCrd]",
})[entry.source.name]
return vim_item
end,
},
})
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = { { name = "buffer" } },
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{ name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
}),
})

View file

@ -1,64 +0,0 @@
-- Setup up telescope fuzzy finding settings
--
-- Makes use of optionally installed external programs to work fully:
-- rg (ripgrep) for in-text searches
-- fd for quicker directory structure searches
-- lsp for a variety of lsp queries
require("telescope").setup({
defaults = {
vimgrep_arguments = {
"rg",
"--ignore-vcs",
"--hidden",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
generic_sorter = require("mini.fuzzy").get_telescope_sorter,
},
defaults = {
-- Appearance
prompt_prefix = "",
selection_caret = "󰳟 ",
color_devicons = true,
},
pickers = {
buffers = { theme = "ivy" },
oldfiles = { theme = "ivy" },
find_files = {
theme = "dropdown",
-- nice minimal picker design
borderchars = {
{ "", "", "", "", "", "", "", "" },
prompt = { "", "", " ", "", "", "", "", "" },
results = {
"",
"",
"",
"",
"",
"",
"",
"",
},
preview = {
"",
"",
"",
"",
"",
"",
"",
"",
},
},
width = 0.8,
previewer = false,
prompt_title = false,
},
},
})
require("telescope").load_extension("fzf")

View file

@ -1,18 +0,0 @@
require("toggleterm").setup({
open_mapping = [[<leader>=]],
insert_mappings = false, -- don't map the key in insert mode
})
local Terminal = require("toggleterm.terminal").Terminal
-- create a lazygit window with the lazygit command
local lazygit = Terminal:new({
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = { border = "curved" },
})
function _Lazygit_toggle()
lazygit:toggle()
end
vim.cmd([[command! Lazygit :lua _Lazygit_toggle()<cr>]])

View file

@ -1,21 +0,0 @@
local rainbow = require("ts-rainbow")
require("nvim-treesitter.configs").setup({
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "all",
highlight = { enable = true },
incremental_selection = { enable = true },
textobjects = { enable = true },
indent = { enable = true },
-- enable rainbow brackets, needs p00f/nvim-ts-rainbow
rainbow = {
enable = true,
strategy = { rainbow.strategy.global },
},
-- for improved commentstrings, needs corresponding plugin
context_commentstring = {
enable = true,
enable_autocmd = false, -- since we run it as a hook from the mini.comment plugin
},
})

View file

@ -0,0 +1,142 @@
local luasnip = require("luasnip")
local cmp = require("cmp")
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local kind_icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
cmp.setup({
window = { documentation = cmp.config.window.bordered() },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "otter" },
{ name = "luasnip", keyword_length = 2 },
{ name = "pandoc_references" },
{ name = "nvim_lua" },
{
name = "beancount",
option = {
account = vim.env["HOME"] .. "/documents/records/budget/main.beancount", -- TODO implement dynamically
},
},
{ name = "calc" },
{ name = "path" },
{ name = "buffer", keyword_length = 3 },
{ name = "digraphs" },
{ name = "latex_symbols" },
{ name = "spell", keyword_length = 3 },
{ name = "tmux" }, -- { name = 'rg', keyword_length = 5 },
{ name = "vCard" },
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
})
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}), -- disable selection in cmd mode
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
-- Kind icons, removing kind text leaving only icon
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
-- Source
vim_item.menu = ({
buffer = "[Buf]",
calc = "[Cal]",
digraphs = "[Dig]",
latex_symbols = "[LaTeX]",
luasnip = "[Snip]",
nvim_lsp = "[Lsp]",
nvim_lua = "[Lua]",
pandoc_references = "[Bib]",
spell = "[Spl]",
vCard = "[vCrd]",
})[entry.source.name]
return vim_item
end,
},
})
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = { { name = "buffer" } },
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{ name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
}),
})

View file

@ -0,0 +1,168 @@
vim.diagnostic.config({ virtual_text = true })
vim.fn.sign_define("DiagnosticSignError", { text = "", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
local lsp = require("lsp-setup")
local servers = {
ansiblels = {},
arduino_language_server = {},
astro = {},
bashls = {},
beancount = {},
clangd = {},
cssls = {},
docker_compose_language_service = {},
dockerls = {},
emmet_ls = {},
gopls = {},
julials = {},
lua_ls = {
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
-- enable when working on neovim stuff. Takes *long* to load
-- workspace = { library = vim.api.nvim_get_runtime_file("", true) },
telemetry = { enable = false },
},
},
},
marksman = {},
pyright = {},
ruff_lsp = {},
tailwindcss = {},
taplo = {},
texlab = {},
tsserver = {},
yamlls = {},
zk = {},
}
local function on_attach(client, bufnr)
local map = vim.keymap.set
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" })
map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { buffer = bufnr, desc = "Next diagnostic" })
map(
"n",
"[e",
"<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Previous error" }
)
map(
"n",
"]e",
"<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Next error" }
)
local prefix = require("which-key").register
prefix({ ["<localleader>l"] = { name = "+lsp" } })
map("n", "<localleader>li", "<cmd>LspInfo<cr>", { buffer = bufnr, desc = "Lsp Info" })
map(
"n",
"<localleader>ld",
"<cmd>lua vim.diagnostic.open_float()<cr>",
{ buffer = bufnr, desc = "Line diagnostics" }
)
map("n", "<localleader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", { buffer = bufnr, desc = "Codeactions" })
map("n", "<localleader>ln", "<cmd>lua vim.lsp.buf.rename()<cr>", { buffer = bufnr, desc = "Rename element" })
if vim.fn.exists(":Telescope") then
map("n", "<localleader>lr", "<cmd>Telescope lsp_references<cr>", { buffer = bufnr, desc = "References" })
map("n", "<localleader>lf", "<cmd>Telescope lsp_definitions<cr>", { buffer = bufnr, desc = "Definition" })
map(
"n",
"<localleader>lt",
"<cmd>Telescope lsp_type_definitions<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>Telescope lsp_implementations<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
else
map("n", "<localleader>lr", "<cmd>lua vim.lsp.buf.references()<cr>", { buffer = bufnr, desc = "References" })
map("n", "<localleader>lf", "<cmd>lua vim.lsp.buf.definition()<cr>", { buffer = bufnr, desc = "Definition" })
map(
"n",
"<localleader>lt",
"<cmd>lua vim.lsp.buf.type_definition()<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>lua vim.lsp.buf.implementation()<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
end
map("n", "<localleader>ll", "<cmd>lua vim.lsp.buf.format()<CR>", { buffer = bufnr, desc = "Format document" })
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { buffer = bufnr, desc = "Hover definition" })
map("n", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", { buffer = bufnr, desc = "Declaration" })
map(
"n",
"<localleader>ls",
"<cmd>lua vim.lsp.buf.signature_help()<cr>",
{ buffer = bufnr, desc = "Signature help" }
)
if vim.g.format_on_save then
require("lsp-setup.utils").format_on_save(client)
end
end
lsp.setup({
default_mappings = false,
servers = servers,
on_attach = on_attach,
inlay_hints = {
enabled = vim.fn.has("nvim-0.10") == true and true or false,
},
})
local lspconfig = require("lspconfig")
-- ensure python virtualenv is determined automatically on lsp start
lspconfig.pyright.setup({
on_attach = function(client, _)
local python_path, msg = require("util.pyenv").get_path(client.config.root_dir)
vim.notify(string.format("%s\n%s", msg, python_path))
client.config.settings.python.pythonPath = python_path
end,
})
-- set up arduino with the help of arduino.nvim plugin
if require("util").is_available("arduino") then
lspconfig.arduino_language_server.setup({
on_new_config = require("arduino").on_new_config,
})
end
local null_ls = require("null-ls")
null_ls.setup({})
require("mason-null-ls").setup({
ensure_installed = { "black", "prettier", "shfmt", "eslint-lsp", "stylua", "jq" },
automatic_installation = false,
handlers = {
shfmt = function(_, _)
null_ls.register(null_ls.builtins.formatting.shfmt.with({
extra_filetypes = { "bash", "zsh" },
}))
end,
prettier = function(_, _)
null_ls.register(null_ls.builtins.formatting.prettier.with({
extra_filetypes = { "astro" },
}))
end,
eslint = function(_, _)
null_ls.register(null_ls.builtins.diagnostics.eslint.with({
extra_filetypes = { "astro" },
}))
null_ls.register(null_ls.builtins.code_actions.eslint.with({
extra_filetypes = { "astro" },
}))
end,
},
})

View file

@ -14,7 +14,7 @@ require("mini.indentscope").setup({
options = { indent_at_cursor = false }, options = { indent_at_cursor = false },
}) })
require("mini.map").setup() require("mini.map").setup()
-- require('mini.move').setup() -- has not hit stable yet require("mini.move").setup() -- has not hit stable yet
require("mini.pairs").setup() require("mini.pairs").setup()
require("mini.trailspace").setup() require("mini.trailspace").setup()

View file

@ -0,0 +1,55 @@
require("toggleterm").setup({
open_mapping = [[<leader>=]],
insert_mappings = false, -- don't map the key in insert mode
})
local Terminal = require("toggleterm.terminal").Terminal
-- need to disable indentlines since they obscure first line of terminal
if require("util").is_available("mini.nvim") then
vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
callback = function()
vim.b.miniindentscope_disable = true
end,
})
end
-- create a lazygit window with the lazygit command
local lazygit = Terminal:new({
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = { border = "curved" },
})
function _Lazygit_toggle()
lazygit:toggle()
end
-- create python window
local function get_python_cmd()
if vim.fn.executable("ptipython") then
return "ptipython"
end
if vim.fn.executable("ipython") then
return "ipython"
end
if vim.fn.executable("ptpython") then
return "ptpython"
end
if vim.fn.executable("python") then
return "python"
end
end
local pythonterm = Terminal:new({
cmd = get_python_cmd(),
hidden = true,
direction = "float",
float_opts = { border = "curved" },
})
function _Pythonterm_toggle()
pythonterm:toggle()
end
vim.cmd([[command! Lazygit :lua _Lazygit_toggle()<cr>]])
vim.cmd([[command! Pythonterm :lua _Pythonterm_toggle()<cr>]])

View file

@ -0,0 +1,46 @@
return {
-- allow seamless navigation between vim buffers and tmux/wezterm splits
{
"numToStr/Navigator.nvim",
branch = "master",
config = true,
event = "VeryLazy",
},
-- jump between letters with improved fFtT quicksearch, mimics sneak
{ "ggandor/lightspeed.nvim", event = "VeryLazy" },
-- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
{ "ojroques/vim-oscyank", event = "VeryLazy" },
-- personal dict improvements for git sync
{ "micarmst/vim-spellsync", event = "VeryLazy" },
{
"folke/which-key.nvim",
config = true,
event = "VeryLazy",
},
-- collection of plugins
{
"echasnovski/mini.nvim",
version = "*",
config = function()
require("plugins.config.mini")
end,
event = "VimEnter", -- need to load pretty soon for Starter screen
},
-- simpler, programmable and multiple terminal toggling for nvim
{
"akinsho/nvim-toggleterm.lua",
config = function()
require("plugins.config.toggleterm")
end,
lazy = false,
cmd = { "ToggleTerm", "TermExec", "Lazygit", "Pythonterm" },
},
-- colorschemes
{
"RRethy/nvim-base16",
lazy = false,
priority = 1000,
dependencies = { "rktjmp/fwatch.nvim" },
},
}

View file

@ -0,0 +1,55 @@
return {
{
"quarto-dev/quarto-nvim",
dependencies = {
"jmbuhr/otter.nvim",
"neovim/nvim-lspconfig",
"vim-pandoc/vim-pandoc-syntax",
"hrsh7th/nvim-cmp",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("quarto").setup({
lspFeatures = {
enabled = true,
languages = { "r", "python", "julia" },
diagnostics = { enabled = true, triggers = { "BufWrite" } },
completion = { enabled = true },
},
})
end,
ft = "quarto",
},
{
"lkhphuc/jupyter-kernel.nvim",
config = true,
cmd = "JupyterAttach",
build = ":UpdateRemotePlugins",
keys = {
{
"<localleader>ck",
"<Cmd>JupyterInspect<CR>",
desc = "Inspect object in kernel",
},
},
},
-- REPL work
{
"WhiteBlackGoose/magma-nvim-goose",
build = ":UpdateRemotePlugins",
config = function()
vim.g.magma_image_provider = "kitty"
vim.g.magma_automatically_open_output = false
end,
cmd = {
"MagmaInit",
"MagmaEvaluateOperator",
"MagmaEvaluateLine",
"MagmaEvaluateVisual",
"MagmaRestart",
},
ft = { "quarto", "python" },
},
}

View file

@ -0,0 +1,52 @@
return {
-- adds exchange operator with cx. common use: cxiw . on 2 words to switch
{
"tommcdo/vim-exchange",
event = "VeryLazy",
},
-- Align tables and other alignable things
{
"junegunn/vim-easy-align",
event = "VeryLazy",
},
-- surround things with other things using ys/cs/ds
{ "kylechui/nvim-surround", version = "*", config = true, event = "VeryLazy" },
-- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
{
"monaqa/dial.nvim",
config = function()
local augend = require("dial.augend")
require("dial.config").augends:register_group({
-- default augends used when no group name is specified
default = {
augend.integer.alias.decimal,
augend.integer.alias.hex,
augend.date.alias["%Y/%m/%d"],
augend.date.alias["%Y-%m-%d"],
augend.date.alias["%m/%d"],
augend.date.alias["%H:%M:%S"],
augend.date.alias["%H:%M"],
augend.constant.alias.de_weekday_full,
augend.constant.alias.de_weekday,
augend.constant.alias.bool,
augend.semver.alias.semver,
augend.constant.alias.Alpha,
augend.constant.alias.alpha,
augend.hexcolor.new({ case = "lower" }),
augend.constant.new({
elements = { "and", "or" },
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
cyclic = true, -- "or" is incremented into "and".
}),
augend.constant.new({
elements = { "&&", "||" },
word = false,
cyclic = true,
}),
},
})
end,
event = "VeryLazy",
},
}

View file

@ -0,0 +1,18 @@
return {
{
"vifm/vifm.vim",
config = function()
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.vifm_replace_netrw = 1
vim.g.vifm_exec_args = '-c "set vifminfo=" -c "set statusline=" -c "only"'
end,
cmd = "Vifm",
}, -- integrate file manager
{
"nvim-tree/nvim-tree.lua", -- integrate file tree
config = true,
dependencies = { "nvim-tree/nvim-web-devicons", config = true },
cmd = "NvimTreeToggle",
},
}

View file

@ -0,0 +1,64 @@
return {
{
"lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter
event = "VeryLazy",
config = function()
require("gitsigns").setup({
numhl = true,
signcolumn = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map("n", "]h", function()
if vim.wo.diff then
return "]h"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
map("n", "[h", function()
if vim.wo.diff then
return "[h"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })
-- Actions
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })
map("n", "<localleader>hu", gs.undo_stage_hunk, { desc = "undo stage hunk" })
map("n", "<localleader>hR", gs.reset_buffer, { desc = "reset buffer" })
map("n", "<localleader>hp", gs.preview_hunk, { desc = "preview hunk" })
map("n", "<localleader>hb", function()
gs.blame_line({ full = true })
end, { desc = "blame line" })
map("n", "<localleader>hB", gs.toggle_current_line_blame, { desc = "toggle blame" })
map("n", "<localleader>hd", gs.diffthis, { desc = "diffthis" })
map("n", "<localleader>hD", function()
gs.diffthis("~")
end, { desc = "diffbase" })
map("n", "<localleader>ht", gs.toggle_deleted, { desc = "toggle deleted" })
-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
map({ "o", "x" }, "ah", ":<C-U>Gitsigns select_hunk<CR>")
end,
})
end,
},
}

View file

@ -0,0 +1,73 @@
return {
-- vista-like outline view for code
{ "simrat39/symbols-outline.nvim", config = true, cmd = "SymbolsOutline" },
-- show a signature whenever editing a function or similar
{ "ray-x/lsp_signature.nvim", config = true, event = "VeryLazy" },
{
"junnplus/lsp-setup.nvim",
dependencies = {
"neovim/nvim-lspconfig",
{
"williamboman/mason.nvim",
cmd = {
"Mason",
"MasonInstall",
"MasonUninstall",
"MasonUninstallAll",
"MasonLog",
"MasonUpdate",
},
build = ":MasonUpdate",
},
{
"williamboman/mason-lspconfig.nvim",
cmd = { "LspInstall", "LspUninstall" },
},
{
"jose-elias-alvarez/null-ls.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"jay-babu/mason-null-ls.nvim",
},
event = "VeryLazy",
},
},
event = "BufReadPost",
config = function()
require("plugins.config.lsp")
end,
},
{
"hrsh7th/nvim-cmp",
branch = "main",
dependencies = {
"andersevenrud/cmp-tmux",
"cbarrete/completion-vcard",
"f3fora/cmp-spell",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
"dmitmel/cmp-digraphs",
"jc-doyle/cmp-pandoc-references",
"kdheepak/cmp-latex-symbols",
"lukas-reineke/cmp-rg",
"crispgm/cmp-beancount",
"ray-x/cmp-treesitter",
"saadparwaiz1/cmp_luasnip",
{
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
},
},
config = function()
require("plugins.config.cmp")
end,
event = { "InsertEnter", "CmdlineEnter", "VeryLazy" },
},
-- loading animations for some LSP
{ "j-hui/fidget.nvim", config = true, tag = "legacy", event = "VeryLazy" },
-- a pretend-lsp for formatters and linters
}

View file

@ -0,0 +1,5 @@
return {
{ "edKotinsky/Arduino.nvim", ft = "arduino", config = true }, -- statusline
{ "euclidianAce/BetterLua.vim", ft = "lua" }, -- better syntax highlighting for lua
{ "aliou/bats.vim", ft = { "bash", "sh", "zsh", "bats" } }, -- enable syntax for bats shell-code testing library
}

View file

@ -0,0 +1,56 @@
local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex" }
return {
-- UI improvements
-- provide distraction free writing
{ "folke/zen-mode.nvim", config = true, event = "VeryLazy" },
-- provide even distraction free-er writing (lowlight paragraphs)
{ "folke/twilight.nvim", event = "VeryLazy" },
-- enable 'speed-reading' mode (bionic reading)
{
"JellyApple102/easyread.nvim",
config = true,
ft = writing_ft,
cmd = "EasyreadToggle",
},
{
"andrewferrier/wrapping.nvim",
config = function()
require("wrapping").setup({
create_keymappings = false,
notify_on_switch = false,
})
end,
},
-- generate an auto-updating html preview for md files
{
"iamcco/markdown-preview.nvim",
build = function()
vim.fn["mkdp#util#install"]()
end,
ft = writing_ft,
},
-- bring zettelkasten commands
{
"mickael-menu/zk-nvim",
config = function()
require("zk").setup({ picker = "telescope" })
end,
},
-- simple static markdown linking and link following using zettel IDs
{ "marty-oehme/zettelkasten.nvim", ft = writing_ft, event = "VeryLazy" },
-- syntax highlighting for markdown criticmarkup (comments, additions, ...)
{ "vim-pandoc/vim-criticmarkup", ft = writing_ft },
-- inline display of latex formulas
-- TODO always demands latex treesitter to be installed even if it is
-- TODO always turns softwrapped lines off on exiting insert mode
--{
--"jbyuki/nabla.nvim",
--ft = writing_ft,
--config = function()
--require("nabla").enable_virt({ autogen = true, silent = true })
--end,
--},
}

View file

@ -0,0 +1,77 @@
return {
-- fuzzy matching
{
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
event = "VeryLazy",
cmd = "Telescope",
config = function()
-- Setup up telescope fuzzy finding settings
--
-- Makes use of optionally installed external programs to work fully:
-- rg (ripgrep) for in-text searches
-- fd for quicker directory structure searches
-- lsp for a variety of lsp queries
require("telescope").setup({
defaults = {
vimgrep_arguments = {
"rg",
"--ignore-vcs",
"--hidden",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
generic_sorter = require("mini.fuzzy").get_telescope_sorter,
-- Appearance
prompt_prefix = "",
selection_caret = "󰳟 ",
color_devicons = true,
},
pickers = {
buffers = { theme = "ivy" },
oldfiles = { theme = "ivy" },
find_files = {
theme = "dropdown",
-- nice minimal picker design
borderchars = {
{ "", "", "", "", "", "", "", "" },
prompt = { "", "", " ", "", "", "", "", "" },
results = {
"",
"",
"",
"",
"",
"",
"",
"",
},
preview = {
"",
"",
"",
"",
"",
"",
"",
"",
},
},
width = 0.8,
previewer = false,
prompt_title = false,
},
},
})
require("telescope").load_extension("fzf")
end,
},
}

View file

@ -0,0 +1,73 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local rainbow = require("ts-rainbow")
require("nvim-treesitter.configs").setup({
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "all",
highlight = {
enable = true,
disable = function(_, bufnr)
return vim.api.nvim_buf_line_count(bufnr) > 7000
end,
},
incremental_selection = { enable = true },
textobjects = { enable = true },
indent = { enable = true },
autotag = { enable = true },
-- enable rainbow brackets, needs p00f/nvim-ts-rainbow
rainbow = {
enable = true,
strategy = { rainbow.strategy.global },
},
-- for improved commentstrings, needs corresponding plugin
context_commentstring = {
enable = true,
enable_autocmd = false, -- since we run it as a hook from the mini.comment plugin
},
-- allows using . and ; to target treesitter branches
textsubjects = {
enable = true,
keymaps = {
["."] = "textsubjects-smart",
[";"] = "textsubjects-container-outer",
},
},
})
end,
event = "BufReadPost",
cmd = {
"TSBufDisable",
"TSBufEnable",
"TSBufToggle",
"TSDisable",
"TSEnable",
"TSToggle",
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSModuleInfo",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
},
-- rainbow brackets using treesitter
-- show current cursor context at top of buffer
-- improves commenting plugin above by using ts
dependencies = {
"https://gitlab.com/HiPhish/nvim-ts-rainbow2.git",
{ "romgrk/nvim-treesitter-context", config = true },
"JoosepAlviste/nvim-ts-context-commentstring",
{
"RRethy/nvim-treesitter-textsubjects",
},
"windwp/nvim-ts-autotag",
},
},
{ "nvim-treesitter/playground", cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
}

View file

@ -0,0 +1,53 @@
return {
-- statusline
{
"nvim-lualine/lualine.nvim",
requires = { "nvim-tree/nvim-web-devicons", config = true },
config = function()
require("plugins.config.lualine")
end,
event = "VeryLazy",
},
-- create a pretty pop-up notification
{
"rcarriga/nvim-notify",
config = function()
vim.notify = require("notify")
end,
event = "VeryLazy",
},
-- make all vim.ui interfaces prettyy
{ "stevearc/dressing.nvim", config = true, event = "VeryLazy" },
-- numbers to absolute for all buffers but the current which is relative
{ "jeffkreeftmeijer/vim-numbertoggle", event = "VeryLazy" },
-- auto-hiding colorcolumn
{
"m4xshen/smartcolumn.nvim",
event = "VeryLazy",
opts = {
colorcolumn = { "100" },
scope = "window",
disabled_filetypes = {
"help",
"text",
"markdown",
"NvimTree",
"lazy",
"mason",
"help",
"quarto",
},
},
},
-- display pretty colors when they are mentioned in buffer
{
"NvChad/nvim-colorizer.lua", -- color hex, named colors in the correct preview scheme
config = function()
require("colorizer").setup({
user_default_options = { mode = "virtualtext" },
})
end,
event = "VeryLazy",
},
}

View file

@ -0,0 +1,12 @@
local T = {}
-- from astronvim util function
--- Check if a plugin is defined in lazy. Useful with lazy loading when a plugin is not necessarily loaded yet
---@param plugin string The plugin to search for
---@return boolean available # Whether the plugin is available
function T.is_available(plugin)
local lazy_config_avail, lazy_config = pcall(require, "lazy.core.config")
return lazy_config_avail and lazy_config.plugins[plugin] ~= nil
end
return T

View file

@ -1,15 +0,0 @@
" --[[ scratchpad.lua
"
" creates a 'scratch' buffer which is ephemeral --
" it will disappear when vim closes, does not save to anything and does not
" appear in the buffer list. Useful for e.g. jotting down quick notes and thoughts.
"
" If called with bang, will replace the current buffer with the scratch
" window, otherwise opens a new split.
"
" The buffer, by default is set to the pandoc filetype.
" This can be changed by setting the `g:scratchpad_ft` variable or the `b:scratchpad_ft`
" variable to the intended filetype.
" ]]--
command! -nargs=? -bang ScratchPad :lua require("personal.scratchpad").create("<bang>","<args>")

View file

@ -1,8 +0,0 @@
function! SearchNotes()
let l:curpath=getcwd()
:execute(":cd " . g:wiki_root)
let l:texttofind=input("Search in Notes: ")
:execute(":CtrlSF " . l:texttofind)
:CtrlSFFocus
:execute(":cd " . l:curpath)
endfunction

View file

@ -1,18 +0,0 @@
" remove default keymappings
let g:tq_map_keys=0
" set custom mthesaur file if we have it
if exists('$XDG_DATA_HOME')
let g:tq_mthesaur_file='$XDG_DATA_HOME' . '/nvim/thesaurus/mthesaur.txt'
else
let g:tq_mthesaur_file=expand('~/.local/share/nvim/thesaurus/mthesaur.txt')
endif
" download if we don't
if !filereadable(glob(g:tq_mthesaur_file))
echom 'No thesaurus file found, attempting to download in background...'
execute '!curl -fLo ' . expand(g:tq_mthesaur_file) . ' --create-dirs
\ http://www.gutenberg.org/files/3202/files/mthesaur.txt'
endif
let g:tq_language=['en', 'de']

View file

@ -1,4 +0,0 @@
let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
let g:vifm_replace_netrw = 1
let g:vifm_exec_args = '-c "set vifminfo=''''" -c "set statusline=''''" -c "only"'

166
writing/.config/pubs/pubsrc Normal file
View file

@ -0,0 +1,166 @@
[main]
# Where the pubs repository files (bibtex, metadata, notes) are located
pubsdir = ~/documents/library
# Where the documents files are located (default: $(pubsdir)/doc/)
docsdir = ~/documents/library/doc
# Specify if a document should be copied or moved in the docdir, or only
# linked when adding a publication.
doc_add = copy
# the command to use when opening document files
open_cmd = xdg-open
# which editor to use when editing bibtex files.
# if using a graphical editor, use the --wait or --block option, i.e.:
# "atom --wait"
# "kate --block"
# If set to an empty string (default) pubs uses the value of the environment
# variable $EDITOR.
edit_cmd = ""
# Which default extension to use when creating a note file.
note_extension = md
# How many authors to display when displaying a citation. If there are more
# authors, only the first author is diplayed followed by 'et al.'.
max_authors = 3
# If true debug mode is on which means exceptions are not catched and
# the full python stack is printed.
debug = False
# If true the citekey is normalized using the 'citekey_format' on adding new publications.
normalize_citekey = False
# String specifying how to format the citekey. All strings of
# the form '{substitution:modifier}' and '{substitution}' will
# be substituted with their appropriate values. The following
# substitutions are used:
# author_last_name: last name of the first author
# year: year of publication
# short_title: first word of the title (excluding words such as "the", "an", ...)
# modifiers:
# l: converts the text to lowercase
# u: converts the text to uppercase
# examples:
# {author_last_name:l}{year} generates 'yang2020'
# {author_last_name}{year}{short_title} generates 'Yang2020Towards'
# {author_last_name:l}{year}{short_title:l} generates 'yang2020towards'
# {author_last_name:u}{year} generates 'YANG2020'
#
citekey_format = {author_last_name}{year}
# which bibliographic fields to exclude from bibtex files. By default, none.
# Please note that excluding critical fields such as `title` or `author`
# will break many commands of pubs.
exclude_bibtex_fields = ,
[formating]
# Enable bold formatting, if the terminal supports it.
bold = True
# Enable italics, if the terminal supports it.
italics = True
# Enable colors, if the terminal supports it.
color = True
[theme]
# Here you can define the color theme used by pubs, if enabled in the
# 'formating' section. Predefined theme are available at:
# https://github.com/pubs/pubs/blob/master/extra/themes.md
# Available colors are: 'black', 'red', 'green', 'yellow', 'blue', 'purple',
# 'cyan', and 'grey'. Bold colors are available by prefixing 'b' in front of
# the color name ('bblack', 'bred', etc.), italic colors by prefixing 'i',
# and bold italic by prefixing 'bi'. Finally, 'bold', 'italic' and
# 'bolditalic' can be used to apply formatting without changing the color.
# For no color, use an empty string ''
# messages
ok = green
warning = yellow
error = red
# ui elements
filepath = bold
citekey = purple
tag = cyan
# bibliographic fields
author = bold
title = ""
publisher = ""
year = bold
volume = bold
pages = ""
[plugins]
# Comma-separated list of the plugins to load.
# Currently pubs comes with built-in plugins alias and git.
active = alias,git
[[alias]]
# new subcommands can be defined, e.g.:
# print = open --with lp
# evince = open --with evince
# shell commands can also be defined, by prefixing them with a bang `!`, e.g:
# count = !pubs list -k | wc -l
# aliases can also be defined with descriptions using the following configobj
# subsectioning. NOTE: any aliases defined this way should come after all other
# aliases, otherwise simple aliases will be ignored.
# [[[count]]]
# command = !pubs list -k | wc -l
# description = lists number of pubs in repo
# new subcommands can be defined, e.g.:
# print = open --with lp
# evince = open --with evince
# shell commands can also be defined, by prefixing them with a bang `!`, e.g:
# count = !pubs list -k | wc -l
# aliases can also be defined with descriptions using the following configobj
# subsectioning. NOTE: any aliases defined this way should come after all other
# aliases, otherwise simple aliases will be ignored.
# [[[count]]]
# command = !pubs list -k | wc -l
# description = lists number of pubs in repo
# To use commas in the description, wrap them in a "" string. For example:
# description = "lists number of pubs in repo, greets the user afterward"
[[git]]
# The git plugin will commit changes to the repository in a git repository
# created at the root of the pubs directory. All detected changes will be
# commited every time a change is made by a pubs command.
# The plugin also propose the `pubs git` subcommand, to directly send git
# commands to the pubs repository. Therefore, `pubs git status` is equivalent
# to `git -C <pubsdir> status`, with the `-C` flag instructing
# to invoke git as if the current directory was <pubsdir>. Note that a
# limitation of the subcommand is that you cannot use git commands with the
# `-c` option (pubs will interpret it first.)
# if False, will display git output when automatic commit are made.
# Invocation of `pubs git` will always have output displayed.
quiet = True
# if True, git will not automatically commit changes
manual = False
# if True, color will be conserved from git output (this add `-c color:always`
# to the git invocation).
force_color = True
[internal]
# The version of this configuration file. Do not edit.
version = 0.9.0

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
pubs() {
command pubs --config "$XDG_CONFIG_HOME/pubs/pubsrc" "${@}"
if [ -f "$BIBFILE" ]; then
command pubs export > "$BIBFILE"
fi
}