Move neovim dotfiles
This commit is contained in:
parent
bfc89aff7f
commit
a5eae4da13
78 changed files with 3 additions and 5 deletions
home/features/neovim
config
.neoconf.jsonREADME.mdneoconf.json
default.nixftplugin
init.lualazy-lock.jsonlua/my
abbreviations
helpers.luahelpers
init.luakeymaps.lualazy.luaneovide.luaoptions.luaplugins
clipboard-image.luacmp.luacrates.luadashboard.luafirenvim.luaflash.luaformat-nvim.luagitsigns.luaharpoon.luahaskell-tools.luahydra.luaidris.luainit.luairon.lualean.lualspconfig.lualualine.lualuasnip.luamagma.luamini-files.luamini-operators.luamini-surround.luaneoconf.luaneogit.luaneorg.luanull-ls.luanvim-tree.luaobsidian.luarust-tools.luatelescope.lua
themes
treesitter.luavenn.luavimtex.luavimux.luawhichkey.luasnippets
17
home/features/neovim/config/.neoconf.json
Normal file
17
home/features/neovim/config/.neoconf.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"neoconf": {
|
||||
"plugins": {
|
||||
"lua_ls": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"neodev": {
|
||||
"library": {
|
||||
"enabled": true,
|
||||
"types": true,
|
||||
"plugins": true,
|
||||
"runtime": true
|
||||
}
|
||||
}
|
||||
}
|
242
home/features/neovim/config/README.md
Normal file
242
home/features/neovim/config/README.md
Normal file
|
@ -0,0 +1,242 @@
|
|||
# Neovim config
|
||||
|
||||
## Articles
|
||||
|
||||
- [Textobjects](https://blog.carbonfive.com/vim-text-objects-the-definitive-guide/)
|
||||
- [Registers](https://www.brianstorti.com/vim-registers/)
|
||||
- [Markers](https://vim.fandom.com/wiki/Using_marks)
|
||||
|
||||
## Keybinds
|
||||
|
||||
I feel like macro recording is a rare thing, so I moved it to `yq/yQ`. This frees up `q` as a "namespace" of sorts for other default vim keybinds I want to move out. For example, I use `J` for diagnostics, so I moved the default action from `J` to `qj`.
|
||||
|
||||
> Things written using italics are chords
|
||||
> (aka all the keys need to be pressed at the same time)
|
||||
|
||||
### Base
|
||||
|
||||
| Keybind | Description | Plugins |
|
||||
| ----------- | ------------------------------------------------ | ------- |
|
||||
| \<leader>a | [A]lternate file | |
|
||||
| \<leader>rw | [R]eplace [w]ord under cursor in the entire file | |
|
||||
| \<leader>sw | toggle word [w]rap and visual-line keybinds | |
|
||||
| Q | [Q]uit all buffers | |
|
||||
| [d | Previous [d]iagnostic | |
|
||||
| d] | Next [d]iagnostic | |
|
||||
| J | Hover over diagnostic | |
|
||||
| yq | Merge with next line | |
|
||||
| \<leader>D | [D]iagnostic loclist | |
|
||||
| _jk_ | Exit insert mode | |
|
||||
| _jo_ | Save file | |
|
||||
| S-Enter | Newline without continuing comment | |
|
||||
|
||||
### Textobjects
|
||||
|
||||
| Keybinds | Description | Plugins |
|
||||
| -------- | -------------------------- | ------- |
|
||||
| aq | [A]round [q]uotes | |
|
||||
| iq | [I]nside [q]uotes | |
|
||||
| aa | [A]round [a]phostrophes | |
|
||||
| ia | [I]nside [a]phostrophes | |
|
||||
| ar | [A]round squa[r]e brackets | |
|
||||
| ir | [I]nside squa[r]e brackets | |
|
||||
|
||||
### Treesitter
|
||||
|
||||
| Keybinds | Description |
|
||||
| -------- | ------------------------------- |
|
||||
| ]f | Go to next [f]unction start |
|
||||
| ]F | Go to next [f]unction end |
|
||||
| [f | Go to previous [f]unction start |
|
||||
| [F | Go to previous [f]unction end |
|
||||
| ]c | Go to next [c]lass start |
|
||||
| ]C | Go to next [c]lass end |
|
||||
| [c | Go to previous [c]lass start |
|
||||
| [C | Go to previous [c]lass end |
|
||||
|
||||
#### Textobjects
|
||||
|
||||
| Keybinds | Description |
|
||||
| -------- | ------------------- |
|
||||
| af | [A]round [f]unction |
|
||||
| if | [I]nside [f]unction |
|
||||
| ac | [A]round [c]lass |
|
||||
| ic | [I]nside [c]lass |
|
||||
|
||||
### Telescope
|
||||
|
||||
The `<leader>f` namespace contains keybinds which search for a specific filetype.
|
||||
|
||||
| Keybind | Description | Plugins |
|
||||
| ----------- | -------------------- | --------- |
|
||||
| C-p | Find files | |
|
||||
| C-f | Grep in project | |
|
||||
| \<leader>d | Diagnostics | lspconfig |
|
||||
| \<leader>t | Show builtin pickers | |
|
||||
| \<leader>ft | Typescript Files | |
|
||||
| \<leader>fl | Latex Files | |
|
||||
| \<leader>fp | Purescript Files | |
|
||||
| \<leader>fn | Nix Files | |
|
||||
|
||||
### Cmp
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | ------------------------ |
|
||||
| C-d | Scroll completion up |
|
||||
| C-s | Scroll completion down |
|
||||
| Enter | Accept current competion |
|
||||
|
||||
### Lsp
|
||||
|
||||
The lsp configuration introduces the namespace `<leader>w` used for workspace manipulation.
|
||||
|
||||
| Keybind | Description |
|
||||
| ----------- | --------------------------- |
|
||||
| gd | [G]o to [d]efinition |
|
||||
| gr | [G]o to [r]eferences |
|
||||
| gi | [G]o to [i]mplementation |
|
||||
| K | Hover |
|
||||
| L | Signature help |
|
||||
| \<leader>c | [C]ode actions |
|
||||
| \<leader>F | [F]ormat file |
|
||||
| \<leader>li | [l]sp [i]nfo |
|
||||
| \<leader>rn | [R]e[n]ame |
|
||||
| \<leader>wa | [W]orkspace [a]dd folder |
|
||||
| \<leader>wr | [W]orkspace [r]emove folder |
|
||||
| \<leader>wl | [W]orkspace [l]ist folders |
|
||||
|
||||
### Vimux
|
||||
|
||||
Vimux keybinds live in the `<leader>v` namespace. Most vimux keybinds are filetype specific.
|
||||
|
||||
| Keybind | Description |
|
||||
| ----------- | -------------------------- |
|
||||
| \<leader>vc | [V]imux clear |
|
||||
| \<leader>vl | [V]imux rerun last |
|
||||
| \<leader>vp | [V]imux prompt for command |
|
||||
|
||||
### Luasnip
|
||||
|
||||
| Keybind | Description |
|
||||
| ----------- | ---------------------------- |
|
||||
| Tab | Jump to next placeholder |
|
||||
| S-Tab | Jump to previous placeholder |
|
||||
| \<leader>rs | [R]eload [s]nippets |
|
||||
|
||||
### Filetypes
|
||||
|
||||
General filetype local keybinds reside inside the `<leader>l` namespace.
|
||||
|
||||
#### Purescript
|
||||
|
||||
| Keybind | Description |
|
||||
| ----------- | ------------------------- |
|
||||
| \<leader>vb | [V]imux run spago [b]uild |
|
||||
| \<leader>vt | [V]imux run spago [t]est |
|
||||
|
||||
#### Nix
|
||||
|
||||
| Keybind | Description |
|
||||
| ----------- | ------------------------ |
|
||||
| \<leader>lg | Update [g]it fetch calls |
|
||||
|
||||
#### Idris
|
||||
|
||||
Idris keybinds live in the `<leader>I` namespace.
|
||||
|
||||
| Keybind | Description |
|
||||
| ----------- | ------------------- |
|
||||
| \<leader>IC | Make [c]ase |
|
||||
| \<leader>IL | Make [l]emma |
|
||||
| \<leader>Ic | Add [c]lause |
|
||||
| \<leader>Ie | [E]xpression search |
|
||||
| \<leader>Id | Generate [d]ef |
|
||||
| \<leader>Is | [S]plit case |
|
||||
| \<leader>Ih | Refine [h]ole |
|
||||
|
||||
#### Lua
|
||||
|
||||
| Keybind | Description |
|
||||
| ----------- | --------------------------------- |
|
||||
| \<leader>lf | Run [f]ile |
|
||||
| \<leader>ls | Import [f]ile and call .[s]etup() |
|
||||
|
||||
### Hydra
|
||||
|
||||
| Keybind | Description |
|
||||
| ---------- | ------------------- |
|
||||
| C-W | Enter [w]indow mode |
|
||||
| \<leader>v | Enter [v]enn mode |
|
||||
|
||||
#### Window mode
|
||||
|
||||
| Keybind | Description |
|
||||
| --------- | ---------------------------------------- |
|
||||
| h/j/k/l | Move cursor by window in given direction |
|
||||
| H/J/K/L | Move window in given direction |
|
||||
| C-h/j/k/l | Resize window in given direction |
|
||||
| = | Equalize |
|
||||
| s | Split horizontally |
|
||||
| v | Split vertically |
|
||||
| o | Close all other |
|
||||
| q | Close window |
|
||||
|
||||
#### Venn mode
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | --------------------------------- |
|
||||
| H/J/K/L | Continue arrow in given direction |
|
||||
| f | Surround selected region with box |
|
||||
|
||||
### Firenvim
|
||||
|
||||
The following keybinds are available only when running inside firenvim:
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | ------------- |
|
||||
| C-z | Expand window |
|
||||
|
||||
### Small plugin keybinds
|
||||
|
||||
| Keybind | Description | Plugins |
|
||||
| --------------------- | ----------------------------------- | -------------------- |
|
||||
| gcc | Comment line | nvim-comment |
|
||||
| gc | Comment selection | nvim-comment |
|
||||
| C-g | Open neo[g]it | neogit |
|
||||
| \<leader>yg | [Y]ank remote [g]it url | gitlinker |
|
||||
| <tab>r[a][b] | Change surrounding pair from a to b | mini.surround |
|
||||
| <tab>d[a] | Delete surrounding pair of a | mini.surround |
|
||||
| <tab>s[m][a] | Surround the motion m with a | mini.surround |
|
||||
| <tab>s[a] | Surround selected code with a | mini.surround |
|
||||
| g= | Evaluate text | mini.operators |
|
||||
| gm | Duplicate text | mini.operators |
|
||||
| gr | Replace text with register | mini.operators |
|
||||
| gx | Exchange text | mini.operators |
|
||||
| C-F | Interactive file broswer | mini.files |
|
||||
| s | Flash [s]earch | flash |
|
||||
| S | Flash treesitter [s]elect | flash |
|
||||
| r | remote [f]lash | flash |
|
||||
| R | remote treesitter [f]lash | flash |
|
||||
| C-s | Toggle flash [s]earch | flash |
|
||||
| C-n | Open filetree | nvim-tree |
|
||||
| \<leader>p | [P]aste imge from clipboard | clipboard-image.nvim |
|
||||
| \<leader>L | [L]azy ui | lazy.nvim |
|
||||
| C-h/j/k/l | Navigate panes | vim-tmux-navigator |
|
||||
| \<leader\>H | Add file to harpoon | harpoon |
|
||||
| C-a | Harpoon quick menu | harpoon |
|
||||
| C-s q/w/e/r/a/s/d/f/z | Open harpoon file with index 0-9 | harpoon |
|
||||
| <leader>lc | Open [l]ocal [c]argo.toml | rust-tools |
|
||||
|
||||
### Undocumented
|
||||
|
||||
#### Iron.nvim
|
||||
|
||||
Iron.nvim commands rest in the `<leader>i` namespace. There is a lot of them, and I rarely use this plugin, so I won't document them here just yet.
|
||||
|
||||
#### Magma
|
||||
|
||||
Magma commands live under the namespace `<leader>M`. I barely use this plugin, so I won't document my keybinds just yet.
|
||||
|
||||
#### Gitsigns
|
||||
|
||||
I use a slightly modified version of the default keybinds, and I've been too lazy to document everything.
|
1
home/features/neovim/config/ftplugin/hkf.lua
Normal file
1
home/features/neovim/config/ftplugin/hkf.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.api.nvim_buf_set_option(0, "commentstring", "-- %s")
|
39
home/features/neovim/config/ftplugin/lua.lua
Normal file
39
home/features/neovim/config/ftplugin/lua.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local opts = function(desc)
|
||||
return { desc = desc, buffer = true }
|
||||
end
|
||||
|
||||
local function runLocal(functionName)
|
||||
return function()
|
||||
local path = vim.api.nvim_buf_get_name(0)
|
||||
local status, M = pcall(dofile, path)
|
||||
|
||||
if status then
|
||||
if M ~= nil then
|
||||
if type(M[functionName]) == "function" then
|
||||
M[functionName]()
|
||||
print("M." .. functionName .. "() executed succesfully!")
|
||||
else
|
||||
print("Module does not return a " .. functionName .. " function")
|
||||
end
|
||||
else
|
||||
print("Module returned nil")
|
||||
end
|
||||
else
|
||||
print("Cannot import current file :(")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>lf", ":source %<cr>", opts("Run [l]ua [f]ile "))
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>ls",
|
||||
runLocal("setup"),
|
||||
opts("Run .[s]etup() in current file")
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>lc",
|
||||
runLocal("config"),
|
||||
opts("Run .[c]onfig() in current file")
|
||||
)
|
1
home/features/neovim/config/ftplugin/markdown.lua
Normal file
1
home/features/neovim/config/ftplugin/markdown.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require("my.helpers.wrapMovement").enable()
|
9
home/features/neovim/config/ftplugin/nix.lua
Normal file
9
home/features/neovim/config/ftplugin/nix.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- Use _<leader>lg_ to fetchgit stuff
|
||||
vim.keymap.set("n", "<leader>lg", function()
|
||||
require("my.helpers").saveCursor(function()
|
||||
vim.cmd(":%!update-nix-fetchgit")
|
||||
end)
|
||||
end, { buffer = true, desc = "Update all fetchgit calls" })
|
||||
|
||||
-- Idk why this isn't here by default
|
||||
vim.api.nvim_buf_set_option(0, "commentstring", "# %s")
|
19
home/features/neovim/config/ftplugin/purescript.lua
Normal file
19
home/features/neovim/config/ftplugin/purescript.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
-- Use vt to test
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>vt",
|
||||
':VimuxRunCommand "clear && spago test"<CR>',
|
||||
{ desc = "[V]imtex run [t]ests", buffer = true }
|
||||
)
|
||||
|
||||
-- Use vb to build
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>vb",
|
||||
':VimuxRunCommand "clear && spago build"<CR>',
|
||||
{ desc = "[V]imtex [b]uild", buffer = true }
|
||||
)
|
||||
|
||||
vim.opt.expandtab = true -- Use spaces for the tab char
|
||||
|
||||
require("my.abbreviations.fp").setup()
|
198
home/features/neovim/config/ftplugin/tex.lua
Normal file
198
home/features/neovim/config/ftplugin/tex.lua
Normal file
|
@ -0,0 +1,198 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
|
||||
require("my.helpers.wrapMovement").enable()
|
||||
require("my.abbreviations.math").setup()
|
||||
|
||||
vim.opt.conceallevel = 0
|
||||
|
||||
-- {{{ Older functions for calculating things inside vim
|
||||
-- vim.keymap.set("n", "<leader>lg", function()
|
||||
-- if not pcall(function()
|
||||
-- local a = tonumber(vim.fn.input("A: "))
|
||||
-- local b = tonumber(vim.fn.input("B: "))
|
||||
--
|
||||
-- local g, x, y = require("my.helpers.math.mod").gcd(a, b)
|
||||
--
|
||||
-- vim.fn.input("Result: " .. g .. " " .. x .. " " .. y)
|
||||
-- end) then vim.fn.input("No results exist") end
|
||||
-- end, { buffer = true, desc = "Gcd calculator" })
|
||||
--
|
||||
-- vim.keymap.set("n", "<leader>li", function()
|
||||
-- if not pcall(function()
|
||||
-- local class = tonumber(vim.fn.input("Mod class: "))
|
||||
-- local num = tonumber(vim.fn.input("Number: "))
|
||||
--
|
||||
-- vim.fn.input("Result: " .. require("my.helpers.math.mod").modinverse(num, class))
|
||||
-- end) then vim.fn.input("No results exist") end
|
||||
-- end, { buffer = true, desc = "Mod inverse calculator" })
|
||||
-- }}}
|
||||
|
||||
local abbreviations = {
|
||||
-- Other fancy symvols
|
||||
{ "tmat", "^T" }, -- Tranpose of a matrix
|
||||
{ "cmat", "^*" }, -- Conjugate of a matrix
|
||||
{ "sneg", "^C" }, -- Set complement
|
||||
{ "ortco", "^\\bot" }, -- Orthogonal complement
|
||||
{ "sinter", "^\\circ" }, -- Interior of a set
|
||||
{ "nuls", "\\varnothing" },
|
||||
|
||||
-- Basic commands
|
||||
{ "mangle", "\\measuredangle" },
|
||||
{ "aangle", "\\angle" },
|
||||
{ "sdiff", "\\setminus" },
|
||||
{ "sst", "\\subset" },
|
||||
{ "spt", "\\supset" },
|
||||
{ "sseq", "\\subseteq" },
|
||||
{ "speq", "\\supseteq" },
|
||||
{ "nin", "\\not\\in" },
|
||||
{ "iin", "\\in" },
|
||||
{ "tto", "\\to" },
|
||||
{ "land", "\\land" },
|
||||
{ "lor", "\\lor" },
|
||||
{ "ssin", "\\sin" },
|
||||
{ "ccos", "\\cos" },
|
||||
{ "ttan", "\\ttan" },
|
||||
{ "ssec", "\\sec" },
|
||||
{ "lln", "\\ln" },
|
||||
{ "frl", "\\forall" },
|
||||
{ "exs", "\\exists" },
|
||||
{ "iinf", "\\infty" },
|
||||
{ "ninf", "-\\infty" },
|
||||
{ "nlnl", "\\pm" }, -- had this as npnp first but it was hard-ish to type
|
||||
{ "ccup", "\\cup" },
|
||||
{ "ccap", "\\cap" },
|
||||
{ "nope", "\\bot" },
|
||||
{ "yee", "\\top" },
|
||||
{ "ccan", "\\cancel" },
|
||||
{ "com", "\\circ" },
|
||||
{ "mul", "\\cdot" },
|
||||
{ "smul", "\\times" },
|
||||
{ "card", "\\#" },
|
||||
{ "div", "\\|" },
|
||||
{ "ndiv", "\\not\\|\\:" },
|
||||
{ "perp", "\\perp" },
|
||||
{ "cdots", "\\cdots" }, -- center dots
|
||||
{ "ldots", "\\ldots" }, -- low dots
|
||||
{ "cldots", ",\\ldots," }, -- comma, low dots
|
||||
{ "frac", "\\frac" }, -- fraction
|
||||
{ "lim", "\\lim" }, -- Limit
|
||||
{ "sup", "\\sup" }, -- supremum
|
||||
{ "limsup", "\\lim\\sup" }, -- Limit of the supremum
|
||||
{ "cal", "\\mathcal" }, -- Limit of the supremum
|
||||
|
||||
-- Decorations
|
||||
{ "hat", "\\hat" },
|
||||
{ "bar", "\\bar" },
|
||||
|
||||
-- Custom commands
|
||||
{ "abs", "\\abs" }, -- custom abs command
|
||||
{ "norm", "\\norm" }, -- custom norm command
|
||||
{ "iprod", "\\iprod" }, -- custom inner product command
|
||||
{ "diprod", "\\dprod" }, -- custom self inner product command
|
||||
{ "prob", "\\prob" }, -- custom probability function
|
||||
{ "dist", "\\dist" }, -- custom dist function
|
||||
{ "oball", "\\ball" }, -- custom ball function
|
||||
{ "diam", "\\diam" }, -- custom diam operator
|
||||
{ "gen", "\\gen" }, -- custom command for group generated by element
|
||||
{ "ord", "\\ordop" }, -- order of a group
|
||||
{ "vsm", "\\vecspace" }, -- custom math vector space
|
||||
{ "half", "\\half" }, -- 1/2 fraction
|
||||
}
|
||||
|
||||
local abolishAbbreviations = {
|
||||
-- {{{ Special chars
|
||||
-- System for writing special characters which need to also be easly
|
||||
-- accessible as {sub/super}scripts.
|
||||
--
|
||||
-- The reason epsilon and lambda are separated out from everything else in
|
||||
-- the pattern is because they are the only ones where `foo` doesn't expand
|
||||
-- to `\\foo` directly (so I saved some keystrokes by letting scrap.nvim
|
||||
-- repeat everything for me).
|
||||
{
|
||||
"{,e,s}{{eps,lam},{star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega}}",
|
||||
"{,^,_}\\\\{{epsilon,lambda},{}}",
|
||||
options = A.no_capitalization,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Set symbols
|
||||
-- - nats => naturals
|
||||
-- - ints => integers
|
||||
-- - rats => rationals
|
||||
-- - irats => irationals
|
||||
-- - rrea => reals
|
||||
-- - comp => complex
|
||||
-- - ppri => primes
|
||||
-- - ffie => fields
|
||||
{
|
||||
"{nats,ints,rats,irats,rrea,comp,ppri,ffie}",
|
||||
"\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}",
|
||||
options = A.no_capitalization,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ My own operator syntax:
|
||||
-- - Any operator can be prefixed with "a" to
|
||||
-- align in aligned mode
|
||||
-- - Any operator can be prefixed with cr to
|
||||
-- start a new line and align in aligned mode
|
||||
{
|
||||
"{cr,a,}{eq,neq,leq,geq,lt,gt,iff,iip,iib}",
|
||||
"{\\\\\\&,&,}{=,\\neq,\\leq,\\geq,<,>,\\iff,\\implies,\\impliedby}",
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ General function calls:
|
||||
-- {function-name}{modifier?}{argument}{argument-modifier?}
|
||||
--
|
||||
-- - function-name = f/g/h/P
|
||||
-- - modifier:
|
||||
-- - d => derivative
|
||||
-- - 2 => squared
|
||||
-- - 3 => cubed
|
||||
-- - i => inverse
|
||||
-- - argument = x/y/z/a/t/i/n/k
|
||||
-- - argument-modifier:
|
||||
-- - n => subscript n
|
||||
{
|
||||
"{f,g,h,P}{d,2,3,i,}{x,y,z,a,t,i,n,k}{n,}",
|
||||
"{}{',^2,^3,^\\{-1\\},}({}{_n,})",
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Graph theory
|
||||
-- Graph theory function syntax:
|
||||
-- gt[function]{graph}{modifier}
|
||||
-- - function:
|
||||
-- - basic functions: e/E/v/G/L
|
||||
-- - k => connectivity
|
||||
-- - a => size of the biggest stable set
|
||||
-- - w => size of the biggest clique
|
||||
-- - d => biggest degree
|
||||
-- - c{target}{kind} => {target} {kind} chromatic number
|
||||
-- - target:
|
||||
-- - vertices by default
|
||||
-- - e => edges
|
||||
-- - kind:
|
||||
-- - normal by default
|
||||
-- - l => list
|
||||
-- - graph:
|
||||
-- - G by default
|
||||
-- - s/x/y/h => S/X/Y/H
|
||||
-- - modifier:
|
||||
-- - a => '
|
||||
-- - 1/2 => _k
|
||||
{
|
||||
"gt{{e,E,v,V,L},k,a,w,d,md{,e},c{,e}{,l}}{,s,h,x,y}{,a,1,2}",
|
||||
"{{},\\kappa,\\alpha,\\omega,\\Delta,\\delta{,'},\\chi{,'}{,_l}}({G,S,H,X,Y}{,',_1,_2})",
|
||||
options = A.no_capitalization,
|
||||
},
|
||||
-- }}}
|
||||
}
|
||||
|
||||
local expanded = scrap.expand_many(abolishAbbreviations)
|
||||
|
||||
-- Last I checked this contained 1229 abbreviations
|
||||
-- print(#abbreviations + #expanded)
|
||||
|
||||
A.manyLocalAbbr(abbreviations)
|
||||
A.manyLocalAbbr(expanded)
|
||||
|
||||
vim.opt_local.list = false -- The lsp usese tabs for formatting
|
3
home/features/neovim/config/ftplugin/typst.lua
Normal file
3
home/features/neovim/config/ftplugin/typst.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
require("my.helpers.wrapMovement").enable()
|
||||
require("my.abbreviations.math").setup()
|
||||
require("my.abbreviations.unicode").setup()
|
21
home/features/neovim/config/init.lua
Normal file
21
home/features/neovim/config/init.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
-- enable experimental lua loader
|
||||
vim.loader.enable()
|
||||
|
||||
-- bootstrap from github
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"--single-branch",
|
||||
"git@github.com:folke/lazy.nvim.git",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
|
||||
vim.opt.runtimepath:prepend(lazypath)
|
||||
|
||||
-- Start the actual init process
|
||||
require("my.init").setup()
|
76
home/features/neovim/config/lazy-lock.json
Normal file
76
home/features/neovim/config/lazy-lock.json
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "409535b8fc54c650eb845b0c35e0cc7f08810284" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "63a860e7ed3ae41ee92481ea65a48fb35431ae21" },
|
||||
"catppuccin": { "branch": "main", "commit": "490078b1593c6609e6a50ad5001e7902ea601824" },
|
||||
"clipboard-image.nvim": { "branch": "main", "commit": "af8fdaad7e6fed0741e18dbf2f57bdc7494adaee" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"crates.nvim": { "branch": "main", "commit": "d5caf28aba49e81ac4099426231f3cf3c151013a" },
|
||||
"dhall-vim": { "branch": "master", "commit": "68500ef46ff3706f46c99db3be7a0c8abcf6a3ae" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "6bde51adabba06f7fd4a469885a85f36d78a5f52" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||
"flash.nvim": { "branch": "main", "commit": "967117690bd677cb7b6a87f0bc0077d2c0be3a27" },
|
||||
"formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" },
|
||||
"github-actions-yaml.vim": { "branch": "master", "commit": "f2f16243447cea174daa6b4a9ffd3ff9213814ef" },
|
||||
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" },
|
||||
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
|
||||
"haskell-tools.nvim": { "branch": "master", "commit": "b19df600da8ef5fb4fb280815415ebd2a4228f0f" },
|
||||
"hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
|
||||
"hyprland-vim-syntax": { "branch": "main", "commit": "8488a24b50882da969979103b4d668c70e7995b9" },
|
||||
"idris2-nvim": { "branch": "main", "commit": "3a2b4d2b5ffeab9e47298456c59c31b4e1ddebc9" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" },
|
||||
"iron.nvim": { "branch": "master", "commit": "7f876ee3e1f4ea1e5284b1b697cdad5b256e8046" },
|
||||
"kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" },
|
||||
"kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
|
||||
"lean.nvim": { "branch": "main", "commit": "67580fab5bed73920fa3fdd712fc8e805c389c3d" },
|
||||
"live-command.nvim": { "branch": "main", "commit": "d460067d47948725a6f25b20f31ea8bbfdfe4622" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||
"magma-nvim": { "branch": "main", "commit": "ff3deba8a879806a51c005e50782130246143d06" },
|
||||
"mini.files": { "branch": "main", "commit": "dea80a8147aa4e3025c34d2e2aaa6f2aeb7b21dd" },
|
||||
"mini.operators": { "branch": "main", "commit": "15f137f28412517e2248d39cf0663bd3a87aa24a" },
|
||||
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "08f146d53e075055500dca35e93281faff95716b" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "9a5c0f0de5c15fba52d4fb83d425d3f4fa7abfa1" },
|
||||
"neogit": { "branch": "master", "commit": "e4c428239928425829cb5247e430f26d25d5788e" },
|
||||
"neorg": { "branch": "main", "commit": "f296a22864bbac0d94ad00fa18cc8231dbeaa1e3" },
|
||||
"neorg-telescope": { "branch": "main", "commit": "1310d4aaefd8149c9839bbe1d5610e94389e2f0e" },
|
||||
"nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
|
||||
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a981d4447b92c54a4d464eb1a76b799bc3f9a771" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "18c7a3119839adc4599d838726deae662859c8b2" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "93ee00cd9daf8d2e3fbaa2a18b8b9adcb4471b16" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "a17c31268b56d53624fdc9cb03a225d4a17cabdb" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "ab899311f8ae00a47eae8e0879506cead8eb1561" },
|
||||
"nvim_context_vt": { "branch": "master", "commit": "f44f46ecad6e6983fd04dac84c5a5c03815d3427" },
|
||||
"paperplanes.nvim": { "branch": "master", "commit": "d704b2e1e594b32d454cc7e0c5f2cf9b391e3cc1" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"purescript-vim": { "branch": "main", "commit": "82348352e6568fcc0385bd7c99a8ead3a479feea" },
|
||||
"rasi.vim": { "branch": "main", "commit": "eac9969cf935cd4380987dc99bfa10d69d3f34a6" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
|
||||
"scrap.nvim": { "branch": "main", "commit": "16db44ae9403ec9c4b140394f294475d1af80a18" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "7aad6019dee974a01333523a5b8e122b7e7da454" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
|
||||
"typst.vim": { "branch": "main", "commit": "6a99324a138c2da69589a8ab2e49375774e43d77" },
|
||||
"undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" },
|
||||
"venn.nvim": { "branch": "main", "commit": "c114563960b8fb1197695d42798d1f3e7190b798" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
||||
"vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "cdd66d6a37d991bba7997d593586fc51a5b37aa8" },
|
||||
"vim-wakatime": { "branch": "master", "commit": "018fa9a80c27ccf2a8967b9e27890372e5c2fb4f" },
|
||||
"vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" },
|
||||
"yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" }
|
||||
}
|
39
home/features/neovim/config/lua/my/abbreviations/fp.lua
Normal file
39
home/features/neovim/config/lua/my/abbreviations/fp.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
local M = {}
|
||||
|
||||
M.symols = {
|
||||
{ "mto", ">>=" }, -- [M]onadic [t]o
|
||||
{ "oalt", "<\\|>" }, -- [O]peration [A]lternative
|
||||
{ "omono", "<>" }, -- [O]peration [M]onoid
|
||||
}
|
||||
|
||||
M.types = {
|
||||
{ "tarr", "Array" },
|
||||
{ "tlis", "List" },
|
||||
{ "tmay", "Maybe" },
|
||||
{ "teff", "Effect" },
|
||||
{ "taff", "Aff" },
|
||||
{ "tnea", "NonEmptyArray" },
|
||||
}
|
||||
|
||||
M.functions = {
|
||||
{ "tfold", "toUnfoldable" }, -- [T]o [f]oldable
|
||||
{ "ffold", "fromFoldable" }, -- [F]rom un[f]oldable
|
||||
}
|
||||
|
||||
function M.setup()
|
||||
scrap.many_local_abbreviations(
|
||||
scrap.expand_many(M.types, A.no_capitalization)
|
||||
)
|
||||
|
||||
scrap.many_local_abbreviations(
|
||||
scrap.expand_many(M.symols, A.no_capitalization)
|
||||
)
|
||||
|
||||
scrap.many_local_abbreviations(
|
||||
scrap.expand_many(M.functions, A.no_capitalization)
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
30
home/features/neovim/config/lua/my/abbreviations/global.lua
Normal file
30
home/features/neovim/config/lua/my/abbreviations/global.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
local M = {}
|
||||
|
||||
-- {{{ Ascii
|
||||
M.ascii = {
|
||||
{ "tto", "->" }, -- [t]o
|
||||
{ "ffrom", "<-" }, -- [f]rom
|
||||
{ "iip", "=>" }, -- [i]t [i]m[p]lies
|
||||
{ "iib", "<=" }, -- [i]t's [i]mplied [b]ly
|
||||
|
||||
{ "leq", "<=" }, -- [l]ess than or [e][q]ual
|
||||
{ "geq", ">=" }, -- [g]reater than or [e][q]ual
|
||||
{ "seq", "=" }, -- [s]ingle [e][q]ual
|
||||
{ "deq", "==" }, -- [d]ouble [e][q]ual
|
||||
{ "land", "/\\" }, -- [l]ogial [a][n][d]
|
||||
{ "lor", "\\/" }, -- [l]ogial [o][r]
|
||||
}
|
||||
-- }}}
|
||||
|
||||
M.words = {
|
||||
{ "thrf", "therefore" },
|
||||
}
|
||||
|
||||
function M.setup()
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.words))
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.ascii, { capitalized = false }))
|
||||
end
|
||||
|
||||
return M
|
31
home/features/neovim/config/lua/my/abbreviations/init.lua
Normal file
31
home/features/neovim/config/lua/my/abbreviations/init.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local M = {}
|
||||
|
||||
M.no_capitalization = { capitalized = false }
|
||||
|
||||
function M.localAbbr(lhs, rhs)
|
||||
-- Create abbreviation
|
||||
vim.cmd(":iabbrev <buffer> " .. lhs .. " " .. rhs)
|
||||
end
|
||||
|
||||
function M.manyLocalAbbr(abbreviations)
|
||||
for _, value in pairs(abbreviations) do
|
||||
M.localAbbr(value[1], value[2])
|
||||
end
|
||||
end
|
||||
|
||||
function M.abbr(lhs, rhs)
|
||||
-- Create abbreviation
|
||||
vim.cmd(":iabbrev " .. lhs .. " " .. rhs)
|
||||
end
|
||||
|
||||
function M.manyGlobalAbbr(abbreviations)
|
||||
for _, value in pairs(abbreviations) do
|
||||
M.abbr(value[1], value[2])
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
require("my.abbreviations.global").setup()
|
||||
end
|
||||
|
||||
return M
|
100
home/features/neovim/config/lua/my/abbreviations/math.lua
Normal file
100
home/features/neovim/config/lua/my/abbreviations/math.lua
Normal file
|
@ -0,0 +1,100 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
local M = {}
|
||||
|
||||
M.words = {
|
||||
-- {{{ General phrases
|
||||
{ "thrf", "therefore" },
|
||||
{ "bcla", "by contradiction let's assume" },
|
||||
{ "wlg", "without loss of generality" },
|
||||
{ "tits", "that is to say," },
|
||||
{ "wpbd", "we will prove the statement in both directions." },
|
||||
{ "stam{,s}", "statement{}" },
|
||||
{ "{ww,tt}{m,i}", "{which,this} {means,implies}" },
|
||||
{ "cex{,s}", "counterexample{}" },
|
||||
{ "er{t,s,r}", "{transitivity,symmetry,reflexivity}" },
|
||||
-- }}}
|
||||
-- {{{ Special chars
|
||||
-- System for writing special characters which need to also be easly
|
||||
-- accessible as {sub/super}scripts.
|
||||
--
|
||||
-- The reason epsilon and lambda are separated out from everything else in
|
||||
-- the pattern is because they are the only ones where `foo` doesn't expand
|
||||
-- to `\\foo` directly (so I saved some keystrokes by letting scrap.nvim
|
||||
-- repeat everything for me).
|
||||
{
|
||||
"{,e,s}{{eps,lam},{star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega}}",
|
||||
"{,^,_}\\\\{{epsilon,lambda},{}}",
|
||||
options = A.no_capitalization,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Set symbols
|
||||
-- - nats => naturals
|
||||
-- - ints => integers
|
||||
-- - rats => rationals
|
||||
-- - irats => irationals
|
||||
-- - rrea => reals
|
||||
-- - comp => complex
|
||||
-- - ppri => primes
|
||||
-- - ffie => fields
|
||||
{
|
||||
"{nats,ints,rats,irats,rrea,comp,ppri,ffie}",
|
||||
"\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}",
|
||||
options = A.no_capitalization,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Calculus & analysis
|
||||
{ "ib{p,s}", "integration by {parts,substitution}" },
|
||||
{ "nb{,h}{,s}", "neighbour{,hood}{}" },
|
||||
-- }}}
|
||||
-- {{{ Linear algebra
|
||||
{ "rref", "reduced row echalon form" },
|
||||
{ "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
|
||||
{ "mx{,s}", "matri{x,ces}" },
|
||||
{ "dete{,s}", "determinant{}" },
|
||||
{ "ort{n,g}", "orto{normal,gonal}" },
|
||||
{ "l{in,de}", "linearly {independent,dependent}" },
|
||||
{ "lcon{,s}", "linear combination{}" },
|
||||
{ "vst{,s}", "vector space{}" }, -- text vector space
|
||||
{
|
||||
"rizz", -- ok please ignore this one 💀
|
||||
"Riesz vector",
|
||||
options = A.no_capitalization,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Differential equations
|
||||
-- Note: we must add the space inside the {} in order for capitalization to work!
|
||||
{
|
||||
"{{s,o,l},}deq{s,}",
|
||||
"{{scalar,ordinary,linear} ,}differential equation{}",
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Graph theory
|
||||
{ "vx{,s}", "vert{ex,ices}" },
|
||||
{ "edg{,s}", "edge{}" },
|
||||
-- }}}
|
||||
}
|
||||
|
||||
M.notation = {
|
||||
-- {{{ Exponents and subscripts:
|
||||
-- {operation}{argument}
|
||||
-- - operation = e (exponent) | s (subscript)
|
||||
-- - argument = t{special} | {basic}
|
||||
-- - basic = 0-9|n|i|t|k
|
||||
-- - special =
|
||||
-- - "p" => +
|
||||
-- - "m" => -
|
||||
-- - "i" => -1
|
||||
{
|
||||
"{e,s}{{0,1,2,3,4,5,6,7,8,9,n,i,t,k},t{i,m,p}}",
|
||||
"{^,_}{{},{\\{-1\\},-,+}}",
|
||||
},
|
||||
-- }}}
|
||||
}
|
||||
|
||||
function M.setup()
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.words))
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.notation, { capitalized = false }))
|
||||
end
|
||||
|
||||
return M
|
149
home/features/neovim/config/lua/my/abbreviations/unicode.lua
Normal file
149
home/features/neovim/config/lua/my/abbreviations/unicode.lua
Normal file
|
@ -0,0 +1,149 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
local M = {}
|
||||
|
||||
-- {{{ Unicode
|
||||
M.unicode = {
|
||||
-- {{{ Logic
|
||||
{ "frl", "∀" }, -- [f]o[r]al[l]
|
||||
{ "exs", "∃" }, -- [e][x]ist[s]
|
||||
{ "land", "∧" }, -- [l]ogical [and]
|
||||
{ "Land", "⋀" }, -- arbitrary [l]ogical [and]
|
||||
{ "lor", "∨" }, -- [l]ogical [or]
|
||||
{ "Lor", "⋁" }, -- [l]ogical [or]
|
||||
{ "bot", "⊥" }, -- false
|
||||
{ "top", "⊤" }, -- true
|
||||
{ "iip", "⟹" }, -- [i]t [i]m[p]lies
|
||||
{ "iib", "⟸" }, -- [i]t's [i]mplied [b]y
|
||||
{ "iff", "⟺" }, -- [if] and only i[f]
|
||||
{ "lneg", "¬" }, -- [l]ogical [neg]ation
|
||||
-- }}}
|
||||
-- {{{ Set theory
|
||||
{ "nolla", "∅" },
|
||||
{ "sect", "∩" }, -- set intersection
|
||||
{ "Sect", "⋂" }, -- arbitrary set intersection
|
||||
{ "dsect", "⊓" }, -- disjoint set intersection (whatever that means lol)
|
||||
{ "union", "∪" }, -- set union
|
||||
{ "Union", "⋃" }, -- arbitrary set union
|
||||
{ "dnion", "⊔" }, -- disjoint set union
|
||||
-- {{{ Inclusions
|
||||
{ "sst", "⊂" }, -- [s]ub[s]et
|
||||
{ "nsst", "⊄" }, -- [n]ot [s]ub[s]et
|
||||
{ "sseq", "⊆" }, -- [s]ub[s]et or [eq]ual
|
||||
{ "nsseq", "⊈" }, -- [n]ot [s]ub[s]et or [eq]ual
|
||||
{ "psseq", "⊊" }, -- [p]roper [s]ub[s]et or [eq]ual
|
||||
{ "spt", "⊃" }, -- [s]u[p]erset
|
||||
{ "nspt", "⊅" }, -- [s]u[p]erset
|
||||
{ "speq", "⊇" }, -- [s]u[p]erset or [eq]ual
|
||||
{ "nspeq", "⊉" }, -- [n]ot [s]u[p]erset or [eq]ual
|
||||
{ "pspeq", "⊋" }, -- [p]roper [s]u[p]erset or [eq]ual
|
||||
-- }}}
|
||||
-- }}}
|
||||
-- {{{ Double stroked chars
|
||||
{ "AA", "𝔸" },
|
||||
{ "BB", "𝔹" },
|
||||
{ "CC", "ℂ" },
|
||||
{ "DD", "ⅅ" },
|
||||
{ "EE", "𝔼" },
|
||||
{ "FF", "𝔽" },
|
||||
{ "GG", "𝔾" },
|
||||
{ "HH", "ℍ" },
|
||||
{ "II", "𝕀" },
|
||||
{ "JJ", "𝕁" },
|
||||
{ "KK", "𝕂" },
|
||||
{ "LL", "𝕃" },
|
||||
{ "MM", "𝕄" },
|
||||
{ "NN", "ℕ" },
|
||||
{ "OO", "𝕆" },
|
||||
{ "PP", "ℙ" },
|
||||
{ "QQ", "ℚ" },
|
||||
{ "RR", "ℝ" },
|
||||
{ "SS", "𝕊" },
|
||||
{ "TT", "𝕋" },
|
||||
{ "UU", "𝕌" },
|
||||
{ "VV", "𝕍" },
|
||||
{ "WW", "𝕎" },
|
||||
{ "XX", "𝕏" },
|
||||
{ "YY", "𝕐" },
|
||||
{ "ZZ", "ℤ" },
|
||||
-- }}}
|
||||
-- {{{ Common operators
|
||||
{ "comp", "∘" }, -- composition
|
||||
{ "mul", "⋅" }, -- multiplication
|
||||
{ "sqrt", "√" }, -- square root
|
||||
{ "cbrt", "∛" }, -- cube root
|
||||
-- }}}
|
||||
-- {{{ Integrals
|
||||
{ "int", "∫" }, -- integral
|
||||
{ "iint", "∬" }, -- integral
|
||||
{ "iiint", "∭" }, -- integral
|
||||
{ "pint", "∮" }, -- integral
|
||||
{ "piint", "∯" }, -- integral
|
||||
{ "piiint", "∰" }, -- integral
|
||||
-- }}}
|
||||
-- {{{ Common relations
|
||||
{ "sim", "∼" }, -- similarity
|
||||
{ "simeq", "≃" },
|
||||
{ "cong", "≅" }, -- congruence
|
||||
{ "defas", "≔" }, -- defined as
|
||||
{ "eq", "=" }, -- [eq]ual
|
||||
{ "neq", "≠" }, -- [n]ot [eq]ual
|
||||
{ "leq", "≤" }, -- [l]ess than or [e][q]ual
|
||||
{ "geq", "≥" }, -- [g]reater than or [e][q]ual
|
||||
|
||||
{ "iin", "∈" }, -- [I]ncluded [i][n]
|
||||
{ "nin", "∉" }, -- [n]ot included [i][n]
|
||||
{ "iic", "∋" }, -- [I]n[c]ludes
|
||||
{ "nic", "∌" }, -- does'[n]t [i]n[c]lude
|
||||
-- }}}
|
||||
-- {{{ Greek characters
|
||||
{ "alpha", "α" },
|
||||
{ "beta", "β" },
|
||||
{ "gamma", "γ" },
|
||||
{ "Gamma", "Γ" },
|
||||
{ "delta", "δ" },
|
||||
{ "Delta", "Δ" },
|
||||
{ "eps", "ε" },
|
||||
{ "zeta", "ζ" },
|
||||
{ "eta", "η" },
|
||||
{ "theta", "θ" },
|
||||
{ "Theta", "Θ" },
|
||||
{ "iota", "ι" },
|
||||
{ "kappa", "κ" },
|
||||
{ "lambda", "λ" },
|
||||
{ "Lambda", "Λ" },
|
||||
{ "mu", "μ" },
|
||||
{ "nu", "ν" },
|
||||
{ "xi", "ξ" },
|
||||
{ "pi", "π" },
|
||||
{ "Pi", "∏" },
|
||||
{ "rho", "ρ" },
|
||||
{ "sigma", "ς" },
|
||||
{ "Sigma", "Σ" },
|
||||
{ "tau", "τ" },
|
||||
{ "upsilon", "υ" },
|
||||
{ "phi", "ϕ" },
|
||||
{ "Phi", "Φ" },
|
||||
{ "chi", "χ" },
|
||||
{ "psi", "ψ" },
|
||||
{ "Psi", "Ψ" },
|
||||
{ "omega", "ω" },
|
||||
{ "Omega", "Ω" },
|
||||
-- }}}
|
||||
-- {{{ Common symbols
|
||||
{ "iinf", "∞" },
|
||||
{ "star", "⋆" },
|
||||
{ "diamond", "⋄" },
|
||||
-- }}}
|
||||
-- {{{ Brackets
|
||||
{ "langle", "⟨" },
|
||||
{ "rangle", "⟩" },
|
||||
-- }}}
|
||||
}
|
||||
-- }}}
|
||||
|
||||
function M.setup()
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.unicode, { capitalized = false }))
|
||||
end
|
||||
|
||||
return M
|
19
home/features/neovim/config/lua/my/helpers.lua
Normal file
19
home/features/neovim/config/lua/my/helpers.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local M = {}
|
||||
|
||||
function M.mergeTables(t1, t2)
|
||||
local t3 = {}
|
||||
|
||||
if t1 ~= nil then for k, v in pairs(t1) do t3[k] = v end end
|
||||
|
||||
if t2 ~= nil then for k, v in pairs(t2) do t3[k] = v end end
|
||||
|
||||
return t3
|
||||
end
|
||||
|
||||
function M.saveCursor(callback)
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
callback()
|
||||
vim.api.nvim_win_set_cursor(0, cursor)
|
||||
end
|
||||
|
||||
return M
|
43
home/features/neovim/config/lua/my/helpers/env.lua
Normal file
43
home/features/neovim/config/lua/my/helpers/env.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
local function makeEnv(cond)
|
||||
return {
|
||||
-- I am doing this to get type hints!
|
||||
active = function()
|
||||
return cond
|
||||
end,
|
||||
not_active = function()
|
||||
return not cond()
|
||||
end,
|
||||
unless = function(f)
|
||||
if not cond() then
|
||||
f()
|
||||
end
|
||||
end,
|
||||
when = function(f)
|
||||
if cond() then
|
||||
f()
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
vscode = makeEnv(function()
|
||||
return vim.g.vscode ~= nil
|
||||
end),
|
||||
neovide = makeEnv(function()
|
||||
return vim.g.neovide ~= nil or require("nix.env") == "neovide"
|
||||
end),
|
||||
firenvim = makeEnv(function()
|
||||
return vim.g.started_by_firenvim ~= nil or require("nix.env") == "firenvim"
|
||||
end),
|
||||
_and = function(a, b)
|
||||
return makeEnv(function()
|
||||
return a.active() and b.active()
|
||||
end)
|
||||
end,
|
||||
_or = function(a, b)
|
||||
return makeEnv(function()
|
||||
return a.active() or b.active()
|
||||
end)
|
||||
end,
|
||||
}
|
15
home/features/neovim/config/lua/my/helpers/math/mod.lua
Normal file
15
home/features/neovim/config/lua/my/helpers/math/mod.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
function M.modinverse(b, m)
|
||||
local g, x, _ = M.gcd(b, m)
|
||||
if g ~= 1 then return nil end
|
||||
return x % m
|
||||
end
|
||||
|
||||
function M.gcd(a, b)
|
||||
if a == 0 then return b, 0, 1 end
|
||||
local g, x1, y1 = M.gcd(b % a, a)
|
||||
return g, y1 - (math.floor(b / a)) * x1, x1
|
||||
end
|
||||
|
||||
return M
|
13
home/features/neovim/config/lua/my/helpers/string.lua
Normal file
13
home/features/neovim/config/lua/my/helpers/string.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local M = {}
|
||||
|
||||
function M.split(text, sep)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local sep, fields = sep or ":", {}
|
||||
local pattern = string.format("([^%s]+)", sep)
|
||||
text:gsub(pattern, function(c)
|
||||
fields[#fields + 1] = c
|
||||
end)
|
||||
return fields
|
||||
end
|
||||
|
||||
return M
|
39
home/features/neovim/config/lua/my/helpers/wrapMovement.lua
Normal file
39
home/features/neovim/config/lua/my/helpers/wrapMovement.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local M = {}
|
||||
|
||||
local function swap(key)
|
||||
vim.keymap.set({ "n", "v" }, key, "g" .. key, { buffer = true })
|
||||
vim.keymap.set({ "n", "v" }, "g" .. key, key, { buffer = true })
|
||||
end
|
||||
|
||||
local function unswap(key)
|
||||
vim.keymap.del({ "n", "v" }, key)
|
||||
vim.keymap.del({ "n", "v" }, "g" .. key)
|
||||
end
|
||||
|
||||
function M.enable()
|
||||
vim.opt.wrap = true
|
||||
|
||||
swap("j")
|
||||
swap("k")
|
||||
swap("0")
|
||||
swap("$")
|
||||
end
|
||||
|
||||
function M.disable()
|
||||
vim.opt.wrap = false
|
||||
|
||||
unswap("j")
|
||||
unswap("k")
|
||||
unswap("0")
|
||||
unswap("$")
|
||||
end
|
||||
|
||||
function M.toggle()
|
||||
if vim.opt.wrap == true then
|
||||
M.disable()
|
||||
else
|
||||
M.enable()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
10
home/features/neovim/config/lua/my/init.lua
Normal file
10
home/features/neovim/config/lua/my/init.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
-- Import my other files
|
||||
require("my.options").setup()
|
||||
require("my.keymaps").setup()
|
||||
require("my.lazy").setup()
|
||||
end
|
||||
|
||||
return M
|
125
home/features/neovim/config/lua/my/keymaps.lua
Normal file
125
home/features/neovim/config/lua/my/keymaps.lua
Normal file
|
@ -0,0 +1,125 @@
|
|||
local helpers = require("my.helpers")
|
||||
|
||||
local M = {}
|
||||
|
||||
-- {{{ Helpers
|
||||
---Performs a basic move operation
|
||||
---Moves a keybind to a different set of keys.
|
||||
---Useful for moving built in keybinds out of the way.
|
||||
---@param from string
|
||||
---@param to string
|
||||
---@param opts table|nil
|
||||
function M.move(from, to, opts)
|
||||
vim.keymap.set("n", to, from, opts)
|
||||
vim.keymap.set("n", from, "<Nop>")
|
||||
end
|
||||
|
||||
---Create a textobject defined by some delimiters
|
||||
---@param from string
|
||||
---@param to string
|
||||
---@param name string
|
||||
---@param perhapsOpts table|nil
|
||||
function M.delimitedTextobject(from, to, name, perhapsOpts)
|
||||
local opts = helpers.mergeTables(perhapsOpts or {}, { desc = name })
|
||||
|
||||
vim.keymap.set({ "v", "o" }, "i" .. from, "i" .. to, opts)
|
||||
vim.keymap.set({ "v", "o" }, "a" .. from, "a" .. to, opts)
|
||||
end
|
||||
|
||||
---Helper to create a normal mode mapping and give it some description.
|
||||
---@param from string
|
||||
---@param to string|function
|
||||
---@param desc string
|
||||
---@param silent boolean|nil
|
||||
---@param isLocal boolean|nil
|
||||
function M.nmap(from, to, desc, silent, isLocal)
|
||||
if silent == nil then
|
||||
silent = true
|
||||
end
|
||||
|
||||
if isLocal == nil then
|
||||
isLocal = false
|
||||
end
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
from,
|
||||
to,
|
||||
{ desc = desc, silent = silent, buffer = isLocal }
|
||||
)
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
function M.setup()
|
||||
-- {{{ Free up q and Q
|
||||
M.move("q", "yq", { desc = "Record macro" })
|
||||
M.move("Q", "yQ")
|
||||
-- }}}
|
||||
-- {{{ Easier access to <C-^>
|
||||
M.move("<C-^>", "<Leader>a", { desc = "[A]lternate file" })
|
||||
-- }}}
|
||||
-- {{{ Quit all buffers
|
||||
M.nmap("Q", ":wqa<cr>", "Save all files and [q]uit")
|
||||
-- }}}
|
||||
-- {{{ Replace word in file
|
||||
M.nmap("<leader>rw", ":%s/<C-r><C-w>/", "[R]eplace [w]ord in file")
|
||||
-- }}}
|
||||
-- {{{ Toggle settings
|
||||
M.nmap(
|
||||
"<leader>sw",
|
||||
require("my.helpers.wrapMovement").toggle,
|
||||
"toggle word [w]rap"
|
||||
)
|
||||
-- }}}
|
||||
-- {{{ Text objects
|
||||
M.delimitedTextobject("q", '"', "[q]uotes")
|
||||
M.delimitedTextobject("a", "'", "[a]postrophes")
|
||||
M.delimitedTextobject("r", "[", "squa[r]e brackets")
|
||||
-- }}}
|
||||
-- {{{Diagnostic keymaps
|
||||
M.nmap("[d", vim.diagnostic.goto_prev, "Goto previous [d]iagnostic")
|
||||
M.nmap("]d", vim.diagnostic.goto_next, "Goto next [d]iagnostic")
|
||||
M.move("J", "qj")
|
||||
M.nmap("J", vim.diagnostic.open_float, "Open current diagnostic")
|
||||
M.nmap("<leader>D", vim.diagnostic.setloclist, "[D]iagnostic loclist")
|
||||
-- }}}
|
||||
-- {{{ Chords (save, clipboard)
|
||||
-- Different chords get mapped to f keys by a custom script of mine.
|
||||
-- In the future, I might get this on my keyboard firmware.
|
||||
vim.keymap.set({ "i", "v" }, "<f10>", "<Esc>", { desc = "Exit insert mode" }) -- Exit inset mode using *jk*
|
||||
vim.keymap.set({ "n", "v" }, "<f11>", '"+', { desc = "Use global clipboard" }) -- Use global clipboard with *cp*
|
||||
M.nmap("<f12>", ":silent write<cr>", "Save current file") -- Save using *ji*
|
||||
-- }}}
|
||||
-- {{{ Shift-Enter for not continuing the current comment
|
||||
-- This does not preserve intendation. Not sure what a better solution would look like.
|
||||
vim.keymap.set("i", "<S-CR>", function()
|
||||
vim.paste({ "", "" }, -1)
|
||||
end, { desc = "Insert newline without continuing the current comment" })
|
||||
-- }}}
|
||||
-- {{{ Allow quiting basic buffers with "qq"
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help" },
|
||||
group = vim.api.nvim_create_augroup("BasicBufferQuitting", {}),
|
||||
callback = function(event)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"qq",
|
||||
"<cmd>close<cr>",
|
||||
{ buffer = event.buf, silent = true, desc = "[q]uit current buffer" }
|
||||
)
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
-- -- {{{ Winblend
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "*" },
|
||||
group = vim.api.nvim_create_augroup("WinblendSettings", {}),
|
||||
callback = function()
|
||||
vim.opt.winblend = 0
|
||||
end,
|
||||
})
|
||||
-- -- }}}
|
||||
end
|
||||
|
||||
return M
|
48
home/features/neovim/config/lua/my/lazy.lua
Normal file
48
home/features/neovim/config/lua/my/lazy.lua
Normal file
|
@ -0,0 +1,48 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("lazy").setup("my.plugins", {
|
||||
defaults = { lazy = true },
|
||||
install = {
|
||||
-- install missing plugins on startup. This doesn't increase startup time.
|
||||
missing = true,
|
||||
-- try to load one of these colorschemes when starting an installation during startup
|
||||
colorscheme = { "rose-pine", "catpuccin" },
|
||||
},
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
notify = false,
|
||||
},
|
||||
dev = {
|
||||
-- Fallback to git when local plugin doesn't exist
|
||||
fallback = true,
|
||||
|
||||
-- Directory where I store my local plugin projects
|
||||
path = "~/Projects",
|
||||
|
||||
patterns = { "Mateiadrielrafael" },
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
paths = {
|
||||
-- Extra runtime path specified by nix
|
||||
os.getenv("NVIM_EXTRA_RUNTIME") or "",
|
||||
},
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>L", "<cmd>Lazy<cr>", { desc = "[L]azy ui" })
|
||||
|
||||
return M
|
14
home/features/neovim/config/lua/my/neovide.lua
Normal file
14
home/features/neovim/config/lua/my/neovide.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local default_length = 0.04
|
||||
-- vim.g.neovide_floating_blur_amount_x = 10.0
|
||||
-- vim.g.neovide_floating_blur_amount_y = 10.0
|
||||
vim.g.neovide_transparency = 0.5
|
||||
-- vim.g.transparency = 0.6
|
||||
-- vim.g.pumblend = 0
|
||||
vim.g.neovide_cursor_animation_length = default_length
|
||||
vim.g.neovide_cursor_animate_in_insert_mode = false
|
||||
end
|
||||
|
||||
return M
|
49
home/features/neovim/config/lua/my/options.lua
Normal file
49
home/features/neovim/config/lua/my/options.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
-- Disable filetype.vim
|
||||
vim.g.do_filetype_lua = true
|
||||
vim.g.did_load_filetypes = false
|
||||
|
||||
-- Basic options
|
||||
vim.opt.joinspaces = false -- No double spaces with join
|
||||
vim.opt.list = true -- Show some invisible characters
|
||||
vim.opt.cmdheight = 0 -- Hide command line when it's not getting used
|
||||
|
||||
-- tcqj are there by default, and "r" automatically continues comments on enter
|
||||
vim.opt.formatoptions = "tcqjr"
|
||||
|
||||
-- Line numbers
|
||||
vim.opt.number = true -- Show line numbers
|
||||
vim.opt.relativenumber = true -- Relative line numbers
|
||||
|
||||
vim.opt.expandtab = true -- Use spaces for the tab char
|
||||
vim.opt.shiftwidth = 2 -- Size of an indent
|
||||
vim.opt.tabstop = 2 -- Size of tab character
|
||||
vim.opt.shiftround = true -- When using < or >, rounds to closest multiple of shiftwidth
|
||||
vim.opt.smartindent = true -- Insert indents automatically
|
||||
|
||||
vim.opt.scrolloff = 4 -- Starts scrolling 4 lines from the edge of the screen
|
||||
vim.opt.termguicolors = true -- True color support
|
||||
|
||||
vim.opt.ignorecase = true -- Ignore case
|
||||
vim.opt.smartcase = true -- Do not ignore case with capitals
|
||||
|
||||
vim.opt.splitbelow = true -- Put new windows below current
|
||||
vim.opt.splitright = true -- Put new windows right of current
|
||||
|
||||
vim.opt.wrap = false -- Disable line wrap (by default)
|
||||
vim.opt.wildmode = { "list", "longest" } -- Command-line completion mode
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
vim.opt.undofile = true -- persist undos!!
|
||||
|
||||
-- Set leader
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldmethod = "marker" -- use {{{ }}} for folding
|
||||
vim.opt.foldcolumn = "1" -- show column with folds on the left
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,42 @@
|
|||
local M = {
|
||||
"postfen/clipboard-image.nvim",
|
||||
cmd = "PasteImg",
|
||||
}
|
||||
|
||||
local function img_name()
|
||||
vim.fn.inputsave()
|
||||
local name = vim.fn.input("Name: ")
|
||||
vim.fn.inputrestore()
|
||||
|
||||
if name == nil or name == "" then
|
||||
return os.date("%y-%m-%d-%H-%M-%S")
|
||||
end
|
||||
return name
|
||||
end
|
||||
|
||||
function M.init()
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>p",
|
||||
":PasteImg<cr>",
|
||||
{ desc = "[P]aste image from clipboard" }
|
||||
)
|
||||
end
|
||||
|
||||
function M.config()
|
||||
require("clipboard-image").setup({
|
||||
default = {
|
||||
img_name = img_name,
|
||||
},
|
||||
tex = {
|
||||
img_dir = { "%:p:h", "img" },
|
||||
affix = "\\includegraphics[width=\\textwidth]{%s}",
|
||||
},
|
||||
typst = {
|
||||
img_dir = { "%:p:h", "img" },
|
||||
affix = '#image("%s", width: 100)',
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
123
home/features/neovim/config/lua/my/plugins/cmp.lua
Normal file
123
home/features/neovim/config/lua/my/plugins/cmp.lua
Normal file
|
@ -0,0 +1,123 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"onsails/lspkind.nvim", -- show icons in lsp completion menus
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"L3MON4D3/LuaSnip", -- snippeting engine
|
||||
},
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local function has_words_before()
|
||||
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
|
||||
|
||||
function M.config()
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
local cmp = require("cmp")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
local options = {
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
completion = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
||||
col_offset = -3,
|
||||
side_padding = 0,
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
local kind = lspkind.cmp_format({
|
||||
mode = "symbol",
|
||||
maxwidth = 50,
|
||||
symbol_map = {
|
||||
Text = ".",
|
||||
},
|
||||
})(entry, vim_item)
|
||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||
|
||||
-- Rust analyzer sometimes has this be nil when working with lifetime arguments.
|
||||
if strings[1] ~= nil then
|
||||
kind.kind = " " .. strings[1] .. " "
|
||||
end
|
||||
|
||||
kind.menu = ""
|
||||
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-d>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-s>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffers" },
|
||||
{ name = "emoji" },
|
||||
{ name = "path" },
|
||||
-- { name = 'omni' },
|
||||
}),
|
||||
}
|
||||
|
||||
cmp.setup(options)
|
||||
|
||||
-- Use buffer source for `/`
|
||||
cmp.setup.cmdline("/", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
return M
|
51
home/features/neovim/config/lua/my/plugins/crates.lua
Normal file
51
home/features/neovim/config/lua/my/plugins/crates.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
local K = require("my.keymaps")
|
||||
local M = {
|
||||
"saecki/crates.nvim",
|
||||
event = "BufReadPost Cargo.toml",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local crates = require("crates")
|
||||
|
||||
crates.setup({
|
||||
null_ls = {
|
||||
enabled = true,
|
||||
name = "crates.nvim",
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
group = vim.api.nvim_create_augroup("CmpSourceCargo", {}),
|
||||
pattern = "Cargo.toml",
|
||||
callback = function()
|
||||
require("cmp").setup.buffer({ sources = { { name = "crates" } } })
|
||||
end,
|
||||
})
|
||||
|
||||
local function nmap(from, to, desc)
|
||||
K.nmap(from, to, desc, true, true)
|
||||
end
|
||||
|
||||
nmap("<leader>lct", crates.toggle, "[c]rates [t]oggle")
|
||||
nmap("<leader>lcr", crates.reload, "[c]rates [r]efresh")
|
||||
|
||||
nmap("<leader>lcH", crates.open_homepage, "[c]rates [H]omepage")
|
||||
nmap("<leader>lcR", crates.open_repository, "[c]rates [R]repository")
|
||||
nmap("<leader>lcD", crates.open_documentation, "[c]rates [D]ocumentation")
|
||||
nmap("<leader>lcC", crates.open_crates_io, "[c]rates [C]rates.io")
|
||||
|
||||
nmap("<leader>lcv", crates.show_versions_popup, "[c]rates [v]ersions")
|
||||
nmap("<leader>lcf", crates.show_features_popup, "[c]rates [f]eatures")
|
||||
nmap("<leader>lcd", crates.show_dependencies_popup, "[c]rates [d]eps")
|
||||
nmap("K", crates.show_popup, "crates popup")
|
||||
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.register({
|
||||
["<leader>lc"] = {
|
||||
name = "[l]ocal [c]rates",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
69
home/features/neovim/config/lua/my/plugins/dashboard.lua
Normal file
69
home/features/neovim/config/lua/my/plugins/dashboard.lua
Normal file
|
@ -0,0 +1,69 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local header_string = [[
|
||||
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ██████╗
|
||||
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ██╗╚════██╗
|
||||
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ╚═╝ █████╔╝
|
||||
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ██╗ ╚═══██╗
|
||||
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ╚═╝██████╔╝
|
||||
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═════╝
|
||||
]]
|
||||
|
||||
local header = require("my.helpers.string").split(header_string, "\n")
|
||||
|
||||
local M = {
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local theme = require("alpha.themes.dashboard")
|
||||
theme.opts.width = 70
|
||||
theme.opts.position = "center"
|
||||
theme.section.buttons.val = {}
|
||||
|
||||
-- See [the header generator](https://patorjk.com/software/taag/#p=display&v=0&f=ANSI%20Shadow&t=NEOVim%20%3A3)
|
||||
theme.section.header.opts.hl = "AlphaHeader"
|
||||
theme.section.header.val = header
|
||||
local footer = function()
|
||||
local version = "🚀 "
|
||||
.. vim.version().major
|
||||
.. "."
|
||||
.. vim.version().minor
|
||||
.. "."
|
||||
.. vim.version().patch
|
||||
local lazy_ok, lazy = pcall(require, "lazy")
|
||||
if lazy_ok then
|
||||
local total_plugins = lazy.stats().count .. " Plugins"
|
||||
local startuptime = (
|
||||
math.floor(lazy.stats().startuptime * 100 + 0.5) / 100
|
||||
)
|
||||
return version
|
||||
.. " — 🧰 "
|
||||
.. total_plugins
|
||||
.. " — 🕐 "
|
||||
.. startuptime
|
||||
.. "ms"
|
||||
else
|
||||
return version
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyVimStarted",
|
||||
callback = function()
|
||||
theme.section.footer.val = footer()
|
||||
vim.cmd("AlphaRedraw")
|
||||
end,
|
||||
desc = "Footer for Alpha",
|
||||
})
|
||||
|
||||
theme.section.footer.opts.hl = "AlphaFooter"
|
||||
theme.section.header.opts.hl = "AlphaHeader"
|
||||
theme.section.buttons.opts.hl = "AlphaButton"
|
||||
|
||||
require("alpha").setup(theme.config)
|
||||
end,
|
||||
lazy = false,
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
return M
|
61
home/features/neovim/config/lua/my/plugins/firenvim.lua
Normal file
61
home/features/neovim/config/lua/my/plugins/firenvim.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
local env = require("my.helpers.env")
|
||||
local K = require("my.keymaps")
|
||||
|
||||
local M = {
|
||||
"glacambre/firenvim", -- vim inside chrome
|
||||
lazy = false,
|
||||
cond = env.firenvim.active(),
|
||||
}
|
||||
|
||||
M.localSettings = {}
|
||||
|
||||
local function make_url_regex(url)
|
||||
return "https?:\\/\\/(?:www\\.)?" .. url .. ".*"
|
||||
end
|
||||
|
||||
local function blacklist(url)
|
||||
M.localSettings[make_url_regex(url)] = { takeover = "never", priority = 0 }
|
||||
end
|
||||
|
||||
function M.config()
|
||||
-- {{{ Filename
|
||||
M.localSettings[".*"] = {
|
||||
filename = "/tmp/firenvim_{hostname}_{pathname}_{selector}_{timestamp}.{extension}",
|
||||
}
|
||||
-- }}}
|
||||
-- {{{ Ctrl-z to expand window
|
||||
K.nmap("<C-z>", function()
|
||||
vim.opt.lines = 25
|
||||
end, "Expand the neovim window!")
|
||||
-- }}}
|
||||
-- {{{ Filetype detection
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = { "firenvim_localhost_notebooks*.txt" },
|
||||
group = vim.api.nvim_create_augroup("JupyterMarkdownFiletype", {}),
|
||||
callback = function()
|
||||
vim.opt.filetype = "markdown"
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
-- {{{ Disable status line
|
||||
vim.opt.laststatus = 0
|
||||
-- }}}
|
||||
-- {{{ Blacklist websites
|
||||
blacklist("web\\.whatsapp\\.com")
|
||||
blacklist("twitter\\.com")
|
||||
blacklist("desmos\\.com\\/calculator")
|
||||
blacklist("geogebra\\.org\\/calculator")
|
||||
blacklist("google\\.com\\/search")
|
||||
blacklist("github\\.com\\/.*\\/blob")
|
||||
-- }}}
|
||||
-- {{{ Comitting our config changes
|
||||
vim.g.firenvim_config = { localSettings = M.localSettings }
|
||||
-- }}}
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
M.config()
|
||||
print(vim.inspect(M.localSettings))
|
||||
end
|
||||
|
||||
return M
|
36
home/features/neovim/config/lua/my/plugins/flash.lua
Normal file
36
home/features/neovim/config/lua/my/plugins/flash.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
local function keybind(keys, action, desc, modes)
|
||||
if modes == nil then
|
||||
modes = { "n", "x", "o" }
|
||||
end
|
||||
|
||||
return {
|
||||
keys,
|
||||
mode = modes,
|
||||
function()
|
||||
require("flash")[action]()
|
||||
end,
|
||||
desc = desc,
|
||||
}
|
||||
end
|
||||
|
||||
local M = {
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
---@type Flash.Config
|
||||
opts = {
|
||||
modes = {
|
||||
char = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
keybind("s", "jump", "Flash"),
|
||||
keybind("S", "treesitter", "Flash Treesitter"),
|
||||
keybind("r", "remote", "Remote Flash", { "o" }),
|
||||
keybind("R", "treesitter_search", "Treesitter Search", { "o", "x" }),
|
||||
keybind("<C-S>", "toggle", "Toggle Flash Search", { "c" }),
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
42
home/features/neovim/config/lua/my/plugins/format-nvim.lua
Normal file
42
home/features/neovim/config/lua/my/plugins/format-nvim.lua
Normal file
|
@ -0,0 +1,42 @@
|
|||
local env = require("my.helpers.env")
|
||||
local K = require("my.keymaps")
|
||||
|
||||
local M = {
|
||||
"mhartington/formatter.nvim",
|
||||
event = "BufReadPre",
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local any = require("formatter.filetypes.any")
|
||||
local formatters = {
|
||||
markdown = {
|
||||
require("formatter.filetypes.markdown").prettier,
|
||||
},
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
},
|
||||
["*"] = {
|
||||
any.remove_trailing_whitespace,
|
||||
},
|
||||
}
|
||||
|
||||
require("formatter").setup({ filetype = formatters })
|
||||
|
||||
local format = function()
|
||||
if formatters[vim.bo.filetype] ~= nil then
|
||||
vim.cmd([[Format]])
|
||||
elseif next(vim.lsp.get_active_clients({ bufnr = 0 })) == nil then
|
||||
vim.lsp.buf.format()
|
||||
end
|
||||
end
|
||||
|
||||
K.nmap("<leader>F", format, "[F]ormat file")
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("Formatting", { clear = false }),
|
||||
callback = format,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
98
home/features/neovim/config/lua/my/plugins/gitsigns.lua
Normal file
98
home/features/neovim/config/lua/my/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,98 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "BufReadPost",
|
||||
cond = env.firenvim.not_active() and env.vscode.not_active(),
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local wk = require("which-key")
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
-- {{{ Helpers
|
||||
local function map(mode, from, to, desc, expr)
|
||||
vim.keymap.set(
|
||||
mode,
|
||||
from,
|
||||
to,
|
||||
{ expr = expr, silent = true, buffer = bufnr, desc = desc }
|
||||
)
|
||||
end
|
||||
|
||||
local function exprmap(from, to, desc)
|
||||
map("n", from, to, desc, true)
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Navigation
|
||||
exprmap("]c", function()
|
||||
if vim.wo.diff then
|
||||
return "]c"
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
|
||||
return "<Ignore>"
|
||||
end, "Navigate to next hunk")
|
||||
|
||||
exprmap("[c", function()
|
||||
if vim.wo.diff then
|
||||
return "[c"
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
|
||||
return "<Ignore>"
|
||||
end, "Navigate to previous hunk")
|
||||
-- }}}
|
||||
-- {{{ Actions
|
||||
local prefix = "<leader>h"
|
||||
|
||||
wk.register({
|
||||
["<leader>"] = { h = { name = "gitsigns" } },
|
||||
})
|
||||
|
||||
-- {{{ Normal mode
|
||||
map("n", prefix .. "s", gs.stage_hunk, "[s]tage hunk")
|
||||
map("n", prefix .. "r", gs.reset_hunk, "[r]eset hunk")
|
||||
map("n", prefix .. "S", gs.stage_buffer, "[s]tage buffer")
|
||||
map("n", prefix .. "u", gs.undo_stage_hunk, "[u]ndo hunk staging")
|
||||
map("n", prefix .. "R", gs.reset_buffer, "[r]eset buffer")
|
||||
map("n", prefix .. "p", gs.preview_hunk, "[p]review hunk")
|
||||
map("n", prefix .. "b", function()
|
||||
gs.blame_line({ full = true })
|
||||
end, "[b]lame line")
|
||||
map("n", prefix .. "d", gs.diffthis, "[d]iff this")
|
||||
map("n", prefix .. "D", function()
|
||||
gs.diffthis("~")
|
||||
end, "[d]iff file (?)")
|
||||
-- }}}
|
||||
-- {{{ Toggles
|
||||
map(
|
||||
"n",
|
||||
prefix .. "tb",
|
||||
gs.toggle_current_line_blame,
|
||||
"[t]oggle line [b]laming"
|
||||
)
|
||||
map("n", prefix .. "td", gs.toggle_deleted, "[t]oggle [d]eleted")
|
||||
-- }}}
|
||||
-- {{{ Visual
|
||||
map("v", prefix .. "s", function()
|
||||
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "stage visual hunk")
|
||||
map("v", prefix .. "r", function()
|
||||
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "reset visual hunk")
|
||||
-- }}}
|
||||
-- }}}
|
||||
-- {{{ Text objects
|
||||
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Inside hunk")
|
||||
-- }}}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
30
home/features/neovim/config/lua/my/plugins/harpoon.lua
Normal file
30
home/features/neovim/config/lua/my/plugins/harpoon.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
local M = {
|
||||
"ThePrimeagen/harpoon",
|
||||
}
|
||||
|
||||
local function bindHarpoon(key, index)
|
||||
vim.keymap.set("n", "<C-s>" .. key, function()
|
||||
require("harpoon.ui").nav_file(index)
|
||||
end, { desc = "Harpoon file " .. index })
|
||||
end
|
||||
|
||||
function M.init()
|
||||
vim.keymap.set("n", "<leader>H", function()
|
||||
require("harpoon.mark").add_file()
|
||||
end, { desc = "Add file to [h]arpoon" })
|
||||
vim.keymap.set("n", "<C-a>", function()
|
||||
require("harpoon.ui").toggle_quick_menu()
|
||||
end, { desc = "Toggle harpoon quickmenu" })
|
||||
|
||||
bindHarpoon("q", 1)
|
||||
bindHarpoon("w", 2)
|
||||
bindHarpoon("e", 3)
|
||||
bindHarpoon("r", 4)
|
||||
bindHarpoon("a", 5)
|
||||
bindHarpoon("s", 6)
|
||||
bindHarpoon("d", 7)
|
||||
bindHarpoon("f", 8)
|
||||
bindHarpoon("z", 9)
|
||||
end
|
||||
|
||||
return M
|
32
home/features/neovim/config/lua/my/plugins/haskell-tools.lua
Normal file
32
home/features/neovim/config/lua/my/plugins/haskell-tools.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local lspconfig = require("my.plugins.lspconfig")
|
||||
local M = {
|
||||
"mrcjkb/haskell-tools.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
version = "^2",
|
||||
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.g.haskell_tools = {
|
||||
hls = {
|
||||
on_attach = lspconfig.on_attach,
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = "fourmolu",
|
||||
-- This seems to work better with custom preludes
|
||||
-- See this issue https://github.com/fourmolu/fourmolu/issues/357
|
||||
plugin = { fourmolu = { config = { external = true } } },
|
||||
},
|
||||
},
|
||||
},
|
||||
tools = {
|
||||
hover = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
404
home/features/neovim/config/lua/my/plugins/hydra.lua
Normal file
404
home/features/neovim/config/lua/my/plugins/hydra.lua
Normal file
|
@ -0,0 +1,404 @@
|
|||
local M = {
|
||||
-- keybinds where you only hit the head once
|
||||
"anuvyklack/hydra.nvim",
|
||||
dependencies = {
|
||||
"mrjones2014/smart-splits.nvim", -- the name says it all
|
||||
},
|
||||
keys = { "<C-S-w>" },
|
||||
}
|
||||
|
||||
-- {{{ Helpers
|
||||
local function identity(x)
|
||||
return x
|
||||
end
|
||||
|
||||
local function len(x)
|
||||
return #x
|
||||
end
|
||||
|
||||
local function box(value, w, h)
|
||||
return { value = value, width = w, height = h }
|
||||
end
|
||||
|
||||
local function min(l, r)
|
||||
if l < r then
|
||||
return l
|
||||
else
|
||||
return r
|
||||
end
|
||||
end
|
||||
|
||||
local function max(l, r)
|
||||
return -min(-l, -r)
|
||||
end
|
||||
|
||||
local function zip_with(l, r, f, default)
|
||||
local output = {}
|
||||
for i = 1, max(#l, #r), 1 do
|
||||
output[i] = f(l[i] or default, r[i] or default)
|
||||
end
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
local function flatten_list(list)
|
||||
local output = {}
|
||||
|
||||
for i = 1, #list, 1 do
|
||||
for j = 1, #list[i], 1 do
|
||||
table.insert(output, list[i][j])
|
||||
end
|
||||
end
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
local function map_list(list, f)
|
||||
local output = {}
|
||||
for i = 1, #list, 1 do
|
||||
output[i] = f(list[i])
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
local function l_repeat(v, times)
|
||||
if times == 0 then
|
||||
return {}
|
||||
end
|
||||
|
||||
local o = {}
|
||||
|
||||
for i = 1, times, 1 do
|
||||
o[i] = v
|
||||
end
|
||||
|
||||
return o
|
||||
end
|
||||
|
||||
local function s_repeat(text, times)
|
||||
local o = ""
|
||||
|
||||
for _ = 1, times, 1 do
|
||||
o = o .. text
|
||||
end
|
||||
|
||||
return o
|
||||
end
|
||||
local function string_split(text, sep)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local sep, fields = sep or ":", {}
|
||||
local pattern = string.format("([^%s]+)", sep)
|
||||
text:gsub(pattern, function(c)
|
||||
fields[#fields + 1] = c
|
||||
end)
|
||||
return fields
|
||||
end
|
||||
|
||||
local function table_max(list, f, default)
|
||||
if #list == 0 then
|
||||
return default
|
||||
end
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local f = f or identity
|
||||
local c_max = list[1]
|
||||
for i = 1, #list, 1 do
|
||||
if f(list[i]) >= f(c_max) then
|
||||
c_max = list[i]
|
||||
end
|
||||
end
|
||||
|
||||
return c_max
|
||||
end
|
||||
|
||||
local function string_value(t)
|
||||
if type(t) == "string" then
|
||||
return t
|
||||
end
|
||||
|
||||
return t.value
|
||||
end
|
||||
|
||||
local function lines(text)
|
||||
return string_split(string_value(text), "\n")
|
||||
end
|
||||
|
||||
local function unlines(text)
|
||||
return table.concat(text, "\n")
|
||||
end
|
||||
|
||||
local function map_lines(text, f)
|
||||
return unlines(map_list(lines(text), f))
|
||||
end
|
||||
|
||||
local function string_width(t)
|
||||
if type(t) == "string" then
|
||||
return #table_max(lines(t), len, "")
|
||||
end
|
||||
|
||||
return t.width
|
||||
end
|
||||
|
||||
local function string_height(t)
|
||||
if type(t) == "string" then
|
||||
return #lines(t)
|
||||
end
|
||||
|
||||
return t.height
|
||||
end
|
||||
|
||||
local function half_down(num)
|
||||
return math.floor(num / 2)
|
||||
end
|
||||
|
||||
local function half_up(num)
|
||||
return math.ceil(num / 2)
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Hint helpers
|
||||
local H = {}
|
||||
|
||||
function H.highlight(t)
|
||||
return box("_" .. t .. "_", string_width(t), 1)
|
||||
end
|
||||
|
||||
function H.spacing(amount)
|
||||
return s_repeat(" ", amount)
|
||||
end
|
||||
|
||||
function H.spacing_for(text)
|
||||
return H.spacing(string_width(text))
|
||||
end
|
||||
|
||||
function H.spacing_largest(values)
|
||||
return H.spacing_for(table_max(values))
|
||||
end
|
||||
|
||||
H.nojustify = { justify = "nojustify" }
|
||||
|
||||
function H.pad_left(text, length)
|
||||
local spaces = length - string_width(text)
|
||||
|
||||
return box(
|
||||
map_lines(text, function(line)
|
||||
return H.spacing(spaces) .. line
|
||||
end),
|
||||
length,
|
||||
string_height(text)
|
||||
)
|
||||
end
|
||||
|
||||
function H.pad_right(text, length)
|
||||
local spaces = length - string_width(text)
|
||||
return box(
|
||||
map_lines(text, function(line)
|
||||
return line .. H.spacing(spaces)
|
||||
end),
|
||||
length,
|
||||
string_height(text)
|
||||
)
|
||||
end
|
||||
|
||||
function H.pad_around(text, length)
|
||||
local spaces = length - string_width(text)
|
||||
return box(
|
||||
map_lines(text, function(line)
|
||||
return H.spacing(half_up(spaces)) .. line .. H.spacing(half_down(spaces))
|
||||
end),
|
||||
length,
|
||||
string_height(text)
|
||||
)
|
||||
end
|
||||
|
||||
function H.pad(text, length, justify)
|
||||
if justify == "nojustify" then
|
||||
return text
|
||||
elseif justify == "center" then
|
||||
return H.pad_around(text, length)
|
||||
elseif justify == "right" then
|
||||
return H.pad_left(text, length)
|
||||
elseif justify == "left" then
|
||||
return H.pad_right(text, length)
|
||||
end
|
||||
|
||||
error("No justify provided")
|
||||
end
|
||||
|
||||
function H.directional(h, j, k, l, spacing_amount)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local spacing_amount = spacing_amount or 1
|
||||
|
||||
return H.concat_many_w({
|
||||
H.highlight(k),
|
||||
H.concat_many_h({
|
||||
H.highlight(h),
|
||||
H.spacing(spacing_amount),
|
||||
H.highlight(l),
|
||||
}),
|
||||
H.highlight(j),
|
||||
})
|
||||
end
|
||||
|
||||
function H.add_title(title, body)
|
||||
local width = max(string_width(title), string_width(body))
|
||||
|
||||
return H.concat_many_w({
|
||||
title,
|
||||
s_repeat("-", width),
|
||||
body,
|
||||
})
|
||||
end
|
||||
|
||||
function H.concat_h(left, right, spacing_amount)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local spacing_amount = spacing_amount or 0
|
||||
|
||||
return box(
|
||||
unlines(zip_with(lines(left), lines(right), function(l, r)
|
||||
return l .. H.spacing(spacing_amount) .. r
|
||||
end, "")),
|
||||
string_width(left) + string_width(right) + spacing_amount,
|
||||
max(string_height(left), string_height(right))
|
||||
)
|
||||
end
|
||||
|
||||
function H.concat_w(above, below, opts)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local opts = opts or {}
|
||||
local spacing_amount = opts.spacing_amount or 0
|
||||
local justify = opts.justify or "center"
|
||||
local width = max(string_width(above), string_width(below))
|
||||
|
||||
return box(
|
||||
unlines(flatten_list({
|
||||
{ H.pad(above, width, justify).value },
|
||||
l_repeat(H.spacing(width), spacing_amount),
|
||||
{ H.pad(below, width, justify).value },
|
||||
})),
|
||||
width,
|
||||
spacing_amount + string_height(above) + string_height(below)
|
||||
)
|
||||
end
|
||||
|
||||
function H.concat_many_h(list, spacing_amount)
|
||||
local result = list[1]
|
||||
|
||||
for i = 2, #list, 1 do
|
||||
result = H.concat_h(result, list[i], spacing_amount)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function H.concat_many_w(list, opts)
|
||||
local result = list[1]
|
||||
|
||||
for i = 2, #list, 1 do
|
||||
result = H.concat_w(result, list[i], opts)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function H.pad_lengths_right(list)
|
||||
local max_length = table_max(list, string_width)
|
||||
return map_list(list, function(t)
|
||||
return H.concat_h(t, H.spacing(max_length - string_width(t)))
|
||||
end)
|
||||
end
|
||||
|
||||
M.hint = H
|
||||
-- }}}
|
||||
|
||||
local window_hint_old = [[
|
||||
^^^^^^ Move ^^^^^^ ^^ Size ^^ ^^ Split
|
||||
^^^^^^-------------^^^^^^ ^^-----------^^ ^^---------------
|
||||
^ ^ _k_ ^ ^ ^ ^ _K_ ^ ^ ^ _<C-k>_ ^ _s_: horizontally
|
||||
_h_ ^ ^ _l_ _H_ ^ ^ _L_ _<C-h>_ _<C-l>_ _v_: vertically
|
||||
^ ^ _j_ ^ ^ ^ ^ _J_ ^ ^ ^ _<C-j>_ ^ _q_: close
|
||||
^^^focus^^^ ^^^window^^^ ^_=_: equalize^ _o_: close remaining
|
||||
]]
|
||||
|
||||
local window_hint = H.concat_many_h({
|
||||
H.add_title(
|
||||
"Move",
|
||||
H.concat_h(
|
||||
H.concat_w(H.directional("h", "j", "k", "l", 3), "focus"),
|
||||
H.concat_w(
|
||||
H.directional("H", "J", "K", "L", 3),
|
||||
"window",
|
||||
{ justify = "left" }
|
||||
),
|
||||
2
|
||||
)
|
||||
),
|
||||
H.add_title(
|
||||
"Size",
|
||||
H.concat_w(
|
||||
H.directional("<C-h>", "<C-j>", "<C-k>", "<C-l>"),
|
||||
H.concat_many_h({
|
||||
H.highlight("="),
|
||||
": equalize",
|
||||
})
|
||||
)
|
||||
),
|
||||
H.add_title(
|
||||
"Split",
|
||||
H.concat_many_w({
|
||||
H.concat_h(H.highlight("s"), ": horizontally"),
|
||||
H.concat_h(H.highlight("v"), ": vertical"),
|
||||
H.concat_h(H.highlight("q"), ": close"),
|
||||
H.concat_h(H.highlight("o"), ": close remaining"),
|
||||
}, { justify = "left" })
|
||||
),
|
||||
}, 3).value
|
||||
|
||||
function M.config()
|
||||
local Hydra = require("hydra")
|
||||
local pcmd = require("hydra.keymap-util").pcmd
|
||||
local splits = require("smart-splits")
|
||||
|
||||
-- {{{ Windows
|
||||
local resize = function(direction)
|
||||
return function()
|
||||
splits["resize_" .. direction](2)
|
||||
end
|
||||
end
|
||||
|
||||
Hydra({
|
||||
name = "Windows",
|
||||
hint = window_hint,
|
||||
config = {
|
||||
invoke_on_body = true,
|
||||
hint = {
|
||||
border = "single",
|
||||
offset = -1, -- vertical offset (larger => higher up)
|
||||
},
|
||||
},
|
||||
mode = "n",
|
||||
body = "<C-S-w>",
|
||||
heads = {
|
||||
{ "h", "<C-w>h" },
|
||||
{ "j", "<C-w>j" },
|
||||
{ "k", "<C-w>k" },
|
||||
{ "l", "<C-w>l" },
|
||||
|
||||
{ "H", "<C-w>H" },
|
||||
{ "J", "<C-w>J" },
|
||||
{ "K", "<C-w>K" },
|
||||
{ "L", "<C-w>L" },
|
||||
|
||||
{ "<C-h>", resize("left") },
|
||||
{ "<C-j>", resize("down") },
|
||||
{ "<C-k>", resize("up") },
|
||||
{ "<C-l>", resize("right") },
|
||||
{ "=", "<C-w>=", { desc = "equalize" } },
|
||||
{ "s", pcmd("split", "E36") },
|
||||
{ "v", pcmd("vsplit", "E36") },
|
||||
{ "o", "<C-w>o", { exit = true, desc = "remain only" } },
|
||||
{ "q", pcmd("close", "E444"), { desc = "close window" } },
|
||||
},
|
||||
})
|
||||
-- }}}
|
||||
end
|
||||
|
||||
return M
|
44
home/features/neovim/config/lua/my/plugins/idris.lua
Normal file
44
home/features/neovim/config/lua/my/plugins/idris.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
local env = require("my.helpers.env")
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
|
||||
local M = {
|
||||
"ShinKage/idris2-nvim",
|
||||
dependencies = {"nui.nvim", "nvim-lspconfig"},
|
||||
ft = { "idris2", "lidris2", "ipkg" },
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local idris2 = require("idris2")
|
||||
|
||||
idris2.setup({
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
lspconfig.on_attach(client, bufnr)
|
||||
|
||||
local function nmap(from, to, desc)
|
||||
vim.keymap.set("n", "<leader>I" .. from, function()
|
||||
require("idris2.code_action")[to]()
|
||||
end, { desc = desc, bufnr = true })
|
||||
end
|
||||
|
||||
nmap("C", "make_case", "Make [c]ase")
|
||||
nmap("L", "make_lemma", "Make [l]emma")
|
||||
nmap("c", "add_clause", "Add [c]lause")
|
||||
nmap("e", "expr_search", "[E]xpression search")
|
||||
nmap("d", "generate_def", "Generate [d]efinition")
|
||||
nmap("s", "case_split", "Case [s]plit")
|
||||
nmap("h", "refine_hole", "Refine [h]ole")
|
||||
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({ ["<leader>I"] = { name = "[I]dris", buffer = bufnr } })
|
||||
end
|
||||
end,
|
||||
},
|
||||
client = { hover = { use_split = true } },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
225
home/features/neovim/config/lua/my/plugins/init.lua
Normal file
225
home/features/neovim/config/lua/my/plugins/init.lua
Normal file
|
@ -0,0 +1,225 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
if env.neovide.active() then
|
||||
require("my.neovide").setup()
|
||||
end
|
||||
|
||||
return {
|
||||
--{{{ Language support
|
||||
{
|
||||
"purescript-contrib/purescript-vim",
|
||||
ft = "purescript",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"elkowar/yuck.vim",
|
||||
ft = "yuck",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"Fymyte/rasi.vim",
|
||||
ft = "rasi",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"teal-language/vim-teal",
|
||||
ft = "teal",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"udalov/kotlin-vim",
|
||||
ft = "kotlin",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"kmonad/kmonad-vim",
|
||||
ft = "kbd",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"vmchale/dhall-vim",
|
||||
ft = "dhall",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"yasuhiroki/github-actions-yaml.vim",
|
||||
ft = { "yml", "yaml" },
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"kaarmu/typst.vim",
|
||||
ft = "typst",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"theRealCarneiro/hyprland-vim-syntax",
|
||||
ft = "hypr",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
--}}}
|
||||
|
||||
{
|
||||
-- Better ui for inputs/selects
|
||||
"stevearc/dressing.nvim",
|
||||
config = true,
|
||||
-- https://github.com/folke/dot/blob/master/config/nvim/lua/config/plugins/init.lua
|
||||
init = function()
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.ui.select = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.select(...)
|
||||
end
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.ui.input = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.input(...)
|
||||
end
|
||||
end,
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Helper libs
|
||||
{
|
||||
"nvim-lua/plenary.nvim",
|
||||
-- Autoload when running tests
|
||||
cmd = { "PlenaryBustedDirectory", "PlenaryBustedFile" },
|
||||
},
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- nice looking icons
|
||||
{
|
||||
"mateiadrielrafael/scrap.nvim",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("my.abbreviations").setup()
|
||||
end,
|
||||
}, -- vim-abolish rewrite
|
||||
|
||||
{
|
||||
"terrortylor/nvim-comment",
|
||||
keys = { "gc", "gcc", { "gc", mode = "v" } },
|
||||
config = function()
|
||||
require("nvim_comment").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
-- easly switch between tmux and vim panes
|
||||
"christoomey/vim-tmux-navigator",
|
||||
keys = { "<C-h>", "<C-j>", "<C-k>", "<C-l>" },
|
||||
cond = env.vscode.not_active()
|
||||
and env.neovide.not_active()
|
||||
and env.firenvim.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
-- track time usage
|
||||
"wakatime/vim-wakatime",
|
||||
event = "VeryLazy",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
-- show progress for lsp stuff
|
||||
"j-hui/fidget.nvim",
|
||||
tag = "legacy",
|
||||
event = "BufReadPre",
|
||||
cond = env.vscode.not_active(),
|
||||
config = true,
|
||||
},
|
||||
|
||||
{
|
||||
-- export to pastebin like services
|
||||
"rktjmp/paperplanes.nvim",
|
||||
opts = {
|
||||
provider = "paste.rs",
|
||||
},
|
||||
cmd = "PP",
|
||||
},
|
||||
|
||||
{
|
||||
-- case switching + the subvert command
|
||||
"tpope/vim-abolish",
|
||||
event = "VeryLazy",
|
||||
enabled = false,
|
||||
},
|
||||
|
||||
{
|
||||
-- automatically set options based on current file
|
||||
"tpope/vim-sleuth",
|
||||
event = "BufRead",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
-- generate permalinks for code
|
||||
"ruifm/gitlinker.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = { mappings = "<leader>yg" },
|
||||
init = function()
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
["<leader>yg"] = {
|
||||
desc = "[Y]ank [g]it remote url",
|
||||
},
|
||||
})
|
||||
end
|
||||
end,
|
||||
cond = env.firenvim.not_active(),
|
||||
keys = "<leader>yg",
|
||||
},
|
||||
|
||||
{
|
||||
-- discord rich presence
|
||||
"andweeb/presence.nvim",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
config = function()
|
||||
require("presence"):setup()
|
||||
end,
|
||||
event = "VeryLazy",
|
||||
},
|
||||
|
||||
-- Live command preview for stuff like :norm
|
||||
{
|
||||
"smjonas/live-command.nvim",
|
||||
config = function()
|
||||
require("live-command").setup({
|
||||
commands = {
|
||||
Norm = { cmd = "norm" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
event = "VeryLazy",
|
||||
-- cond = false,
|
||||
},
|
||||
{
|
||||
"mbbill/undotree",
|
||||
cmd = "UndotreeToggle",
|
||||
init = function()
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>u",
|
||||
"<cmd>UndotreeToggle<cr>",
|
||||
{ desc = "[U]ndo tree" }
|
||||
)
|
||||
end,
|
||||
},
|
||||
}
|
63
home/features/neovim/config/lua/my/plugins/iron.lua
Normal file
63
home/features/neovim/config/lua/my/plugins/iron.lua
Normal file
|
@ -0,0 +1,63 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"hkupty/iron.nvim", -- repl support
|
||||
cond = env.vscode.not_active(),
|
||||
cmd = "IronRepl",
|
||||
}
|
||||
|
||||
function M.init()
|
||||
-- iron also has a list of commands, see :h iron-commands for all available commands
|
||||
vim.keymap.set("n", "<space>iss", "<cmd>IronRepl<cr>")
|
||||
vim.keymap.set("n", "<space>ir", "<cmd>IronRestart<cr>")
|
||||
vim.keymap.set("n", "<space>if", "<cmd>IronFocus<cr>")
|
||||
vim.keymap.set("n", "<space>ih", "<cmd>IronHide<cr>")
|
||||
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
["<leader>i"] = {
|
||||
name = "[I]ron repl",
|
||||
s = { name = "[s]end" },
|
||||
m = { name = "[m]ark" },
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
local iron = require("iron.core")
|
||||
|
||||
iron.setup({
|
||||
config = {
|
||||
-- Your repl definitions come here
|
||||
repl_definition = {},
|
||||
-- How the repl window will be displayed
|
||||
-- See below for more information
|
||||
repl_open_cmd = require("iron.view").right(40),
|
||||
},
|
||||
-- Iron doesn't set keymaps by default anymore.
|
||||
-- You can set them here or manually add keymaps to the functions in iron.core
|
||||
keymaps = {
|
||||
send_motion = "<space>isc",
|
||||
visual_send = "<space>is",
|
||||
send_file = "<space>isf",
|
||||
send_line = "<space>isl",
|
||||
send_mark = "<space>ism",
|
||||
mark_motion = "<space>imc",
|
||||
mark_visual = "<space>imc",
|
||||
remove_mark = "<space>imd",
|
||||
cr = "<space>is<cr>",
|
||||
interrupt = "<space>is<space>",
|
||||
exit = "<space>isq",
|
||||
clear = "<space>isr",
|
||||
},
|
||||
-- If the highlight is on, you can change how it looks
|
||||
-- For the available options, check nvim_set_hl
|
||||
highlight = { italic = true },
|
||||
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
26
home/features/neovim/config/lua/my/plugins/lean.lua
Normal file
26
home/features/neovim/config/lua/my/plugins/lean.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local env = require("my.helpers.env")
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
|
||||
local M = {
|
||||
"Julian/lean.nvim", -- lean support
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
ft = "lean",
|
||||
config = function()
|
||||
require("lean").setup({
|
||||
abbreviations = { builtin = true, cmp = true },
|
||||
lsp = {
|
||||
on_attach = lspconfig.on_attach,
|
||||
capabilities = lspconfig.capabilities(),
|
||||
},
|
||||
lsp3 = false,
|
||||
mappings = true,
|
||||
})
|
||||
end,
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
return M
|
241
home/features/neovim/config/lua/my/plugins/lspconfig.lua
Normal file
241
home/features/neovim/config/lua/my/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,241 @@
|
|||
local helpers = require("my.helpers")
|
||||
local env = require("my.helpers.env")
|
||||
|
||||
local lspconfig = {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = "BufReadPre",
|
||||
dependencies = {
|
||||
"folke/neoconf.nvim",
|
||||
{
|
||||
"folke/neodev.nvim",
|
||||
config = true,
|
||||
},
|
||||
"simrat39/rust-tools.nvim",
|
||||
},
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local M = {
|
||||
lspconfig,
|
||||
{
|
||||
"smjonas/inc-rename.nvim",
|
||||
cmd = "IncRename",
|
||||
opts = {
|
||||
input_buffer_type = "dressing",
|
||||
},
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
}
|
||||
|
||||
function M.on_attach(client, bufnr)
|
||||
-- {{{ Keymap helpers
|
||||
local opts = function(desc)
|
||||
return { noremap = true, silent = true, desc = desc, buffer = bufnr }
|
||||
end
|
||||
|
||||
local nmap = function(from, to, desc)
|
||||
vim.keymap.set("n", from, to, opts(desc))
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Auto format
|
||||
local function format()
|
||||
vim.lsp.buf.format({ async = false, bufnr = bufnr })
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
nmap("<leader>F", format, "[F]ormat")
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("LspFormatting", { clear = false }),
|
||||
buffer = bufnr,
|
||||
callback = format,
|
||||
})
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Go to declaration / references / implementation
|
||||
nmap("gd", vim.lsp.buf.definition, "[G]o to [d]efinition")
|
||||
nmap("gi", vim.lsp.buf.implementation, "[G]o to [i]mplementation")
|
||||
nmap("gr", vim.lsp.buf.references, "[G]o to [r]eferences")
|
||||
-- }}}
|
||||
-- {{{ Hover
|
||||
-- Note: diagnostics are already covered in keymaps.lua
|
||||
if client.supports_method("textDocument/hover") then
|
||||
nmap("K", vim.lsp.buf.hover, "Hover")
|
||||
end
|
||||
nmap("L", vim.lsp.buf.signature_help, "Signature help")
|
||||
-- }}}
|
||||
-- {{{ Code actions
|
||||
nmap("<leader>c", vim.lsp.buf.code_action, "[C]ode actions")
|
||||
nmap("<leader>li", "<cmd>LspInfo<cr>", "[L]sp [i]nfo")
|
||||
|
||||
vim.keymap.set("n", "<leader>rn", function()
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end, helpers.mergeTables(opts("[R]e[n]ame"), { expr = true }))
|
||||
|
||||
vim.keymap.set(
|
||||
"v",
|
||||
"<leader>c",
|
||||
":'<,'> lua vim.lsp.buf.range_code_action()",
|
||||
opts("[C]ode actions")
|
||||
)
|
||||
-- }}}
|
||||
-- {{{ Workspace stuff
|
||||
nmap(
|
||||
"<leader>wa",
|
||||
vim.lsp.buf.add_workspace_folder,
|
||||
"[W]orkspace [A]dd Folder"
|
||||
)
|
||||
nmap(
|
||||
"<leader>wr",
|
||||
vim.lsp.buf.remove_workspace_folder,
|
||||
"[W]orkspace [R]emove Folder"
|
||||
)
|
||||
nmap("<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, "[W]orkspace [L]ist Folders")
|
||||
-- }}}
|
||||
end
|
||||
|
||||
-- {{{ General server config
|
||||
---@type lspconfig.options
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
local servers = {
|
||||
-- {{{ Typescript
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
tsserver = {
|
||||
on_attach = function(client, bufnr)
|
||||
-- We handle formatting using null-ls and prettierd
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
M.on_attach(client, bufnr)
|
||||
end,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Purescript
|
||||
purescriptls = {
|
||||
settings = {
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
purescript = {
|
||||
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
|
||||
formatter = "purs-tidy",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Lua
|
||||
lua_ls = {
|
||||
cmd = {
|
||||
"lua-language-server",
|
||||
"--logpath=/home/adrielus/.local/share/lua-language-server/log",
|
||||
},
|
||||
settings = {
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
Lua = {
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Latex
|
||||
texlab = {
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
args = {
|
||||
-- Here by default:
|
||||
"-pdf",
|
||||
"-interaction=nonstopmode",
|
||||
"-synctex=1",
|
||||
"%f",
|
||||
-- Required for syntax highlighting inside the generated pdf aparently
|
||||
"-shell-escape",
|
||||
},
|
||||
executable = "latexmk",
|
||||
forwardSearchAfter = true,
|
||||
onSave = true,
|
||||
},
|
||||
chktex = {
|
||||
onOpenAndSave = true,
|
||||
onEdit = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Nix
|
||||
rnix = {},
|
||||
nil_ls = {},
|
||||
nixd = {},
|
||||
-- }}}
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
cssls = {},
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
jsonls = {},
|
||||
dhall_lsp_server = {},
|
||||
typst_lsp = {},
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
elmls = {},
|
||||
-- {{{ Inactive
|
||||
-- pylsp = {},
|
||||
-- pyright = {},
|
||||
-- }}}
|
||||
}
|
||||
-- }}}
|
||||
-- {{{ Capabilities
|
||||
M.capabilities = function()
|
||||
local c = require("cmp_nvim_lsp").default_capabilities()
|
||||
-- Add folding capabilities
|
||||
c.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
return c
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Nice diagnostic icons
|
||||
-- See https://github.com/folke/dot/blob/master/config/nvim/lua/config/plugins/lsp/diagnostics.lua
|
||||
local function diagnostics_icons()
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
end
|
||||
|
||||
--}}}
|
||||
-- {{{ Main config function
|
||||
function lspconfig.config()
|
||||
diagnostics_icons()
|
||||
-- -- {{{ Change on-hover borders
|
||||
vim.lsp.handlers["textDocument/hover"] =
|
||||
vim.lsp.with(vim.lsp.handlers.hover, { border = "single" })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" })
|
||||
-- -- }}}
|
||||
|
||||
local capabilities = M.capabilities()
|
||||
-- Setup basic language servers
|
||||
for lsp, details in pairs(servers) do
|
||||
if details.on_attach == nil then
|
||||
-- Default setting for on_attach
|
||||
details.on_attach = M.on_attach
|
||||
end
|
||||
|
||||
require("lspconfig")[lsp].setup({
|
||||
on_attach = details.on_attach,
|
||||
settings = details.settings, -- Specific per-language settings
|
||||
flags = {
|
||||
debounce_text_changes = 150, -- This will be the default in neovim 0.7+
|
||||
},
|
||||
cmd = details.cmd,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
--}}}
|
||||
|
||||
return M
|
32
home/features/neovim/config/lua/my/plugins/lualine.lua
Normal file
32
home/features/neovim/config/lua/my/plugins/lualine.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
theme = "auto",
|
||||
disabled_filetypes = {
|
||||
"undotree",
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "branch" },
|
||||
lualine_b = { "filename" },
|
||||
lualine_c = { "filetype" },
|
||||
lualine_x = { "diagnostics" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
-- Integration with other plugins
|
||||
extensions = { "nvim-tree" },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
34
home/features/neovim/config/lua/my/plugins/luasnip.lua
Normal file
34
home/features/neovim/config/lua/my/plugins/luasnip.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"L3MON4D3/LuaSnip", -- snippeting engine
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local function reload()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end
|
||||
|
||||
function M.config()
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
vim.keymap.set("i", "<Tab>", function()
|
||||
if luasnip.jumpable(1) then
|
||||
return "<cmd>lua require('luasnip').jump(1)<cr>"
|
||||
else
|
||||
return "<Tab>"
|
||||
end
|
||||
end, { expr = true })
|
||||
|
||||
vim.keymap.set("i", "<S-Tab>", function()
|
||||
luasnip.jump(-1)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<leader>rs", reload, {
|
||||
desc = "[R]eload [s]nippets",
|
||||
})
|
||||
|
||||
reload()
|
||||
end
|
||||
|
||||
return M
|
61
home/features/neovim/config/lua/my/plugins/magma.lua
Normal file
61
home/features/neovim/config/lua/my/plugins/magma.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
local M = {
|
||||
"dccsillag/magma-nvim",
|
||||
cmd = "MagmaInit",
|
||||
config = function()
|
||||
local prefix = "<leader>M"
|
||||
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
[prefix] = {
|
||||
desc = "[M]agma",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "e",
|
||||
"<cmd>MagmaEvaluateOperator<cr>",
|
||||
{ expr = true, silent = true, desc = "[E]valuate motion" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "ee",
|
||||
"<cmd>MagmaEvaluateLine<cr>",
|
||||
{ silent = true, desc = "[E]valuate line" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "r",
|
||||
"<cmd>MagmaReevaluateCell<cr>",
|
||||
{ silent = true, desc = "[R]e-evaluate cell" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "d",
|
||||
"<cmd>MagmaDelete<cr>",
|
||||
{ silent = true, desc = "[D]elete cell" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "o",
|
||||
"<cmd>MagmaShowOutput<cr>",
|
||||
{ silent = true, desc = "Show [o]utput" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"v",
|
||||
prefix .. "e",
|
||||
"<cmd><C-u>MagmaEvaluateVisual<cr>",
|
||||
{ silent = true, desc = "[E]vluate visual selection" }
|
||||
)
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
31
home/features/neovim/config/lua/my/plugins/mini-files.lua
Normal file
31
home/features/neovim/config/lua/my/plugins/mini-files.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local K = require("my.keymaps")
|
||||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"echasnovski/mini.files",
|
||||
version = "main",
|
||||
event = "VeryLazy",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local files = require("mini.files")
|
||||
|
||||
files.setup({
|
||||
windows = {
|
||||
preview = false,
|
||||
},
|
||||
mappings = {
|
||||
go_in_plus = "l",
|
||||
},
|
||||
})
|
||||
|
||||
K.nmap("<C-S-F>", function()
|
||||
if not files.close() then
|
||||
files.open(vim.api.nvim_buf_get_name(0))
|
||||
files.reveal_cwd()
|
||||
end
|
||||
end, "[S]earch [F]iles")
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,8 @@
|
|||
local M = {
|
||||
"echasnovski/mini.operators",
|
||||
version = false,
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
||||
|
||||
return M
|
43
home/features/neovim/config/lua/my/plugins/mini-surround.lua
Normal file
43
home/features/neovim/config/lua/my/plugins/mini-surround.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
local M = {
|
||||
"echasnovski/mini.surround",
|
||||
version = "main",
|
||||
event = "VeryLazy",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("mini.surround").setup({
|
||||
mappings = {
|
||||
add = "<tab>s", -- Add surrounding in Normal and Visul modes
|
||||
delete = "<tab>d", -- Delete surrounding
|
||||
find = "<tab>f", -- Find surrounding (to the right)
|
||||
find_left = "<tab>F", -- Find surrounding (to the left)
|
||||
highlight = "<tab>h", -- Highlight surrounding
|
||||
replace = "<tab>r", -- Replace surrounding
|
||||
update_n_lines = "", -- Update `n_lines`
|
||||
},
|
||||
custom_surroundings = {
|
||||
["b"] = {
|
||||
input = { "%b()", "^.%s*().-()%s*.$" },
|
||||
output = { left = "(", right = ")" },
|
||||
},
|
||||
["B"] = {
|
||||
input = { "%b{}", "^.%s*().-()%s*.$" },
|
||||
output = { left = "{", right = "}" },
|
||||
},
|
||||
["r"] = {
|
||||
input = { "%b[]", "^.%s*().-()%s*.$" },
|
||||
output = { left = "[", right = "]" },
|
||||
},
|
||||
["q"] = {
|
||||
input = { '".-"', "^.().*().$" },
|
||||
output = { left = '"', right = '"' },
|
||||
},
|
||||
["a"] = {
|
||||
input = { "'.-'", "^.().*().$" },
|
||||
output = { left = "'", right = "'" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
12
home/features/neovim/config/lua/my/plugins/neoconf.lua
Normal file
12
home/features/neovim/config/lua/my/plugins/neoconf.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"folke/neoconf.nvim",
|
||||
cmd = "Neoconf",
|
||||
opts = {
|
||||
-- import existing settings from other plugins
|
||||
import = {
|
||||
vscode = true, -- local .vscode/settings.json
|
||||
coc = false, -- global/local coc-settings.json
|
||||
nlsp = false, -- global/local nlsp-settings.nvim json settings
|
||||
},
|
||||
},
|
||||
}
|
26
home/features/neovim/config/lua/my/plugins/neogit.lua
Normal file
26
home/features/neovim/config/lua/my/plugins/neogit.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"TimUntersberger/neogit",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
cmd = "Neogit",
|
||||
cond = env.firenvim.not_active() and env.vscode.not_active(),
|
||||
init = function()
|
||||
vim.keymap.set("n", "<C-g>", "<cmd>Neogit<cr>", { desc = "Open neo[g]it" })
|
||||
end,
|
||||
config = function()
|
||||
require("neogit").setup({})
|
||||
|
||||
-- {{{ Disable folds inside neogit
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "NeogitStatus" },
|
||||
group = vim.api.nvim_create_augroup("NeogitStatusOptions", {}),
|
||||
callback = function()
|
||||
vim.opt.foldenable = false
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
54
home/features/neovim/config/lua/my/plugins/neorg.lua
Normal file
54
home/features/neovim/config/lua/my/plugins/neorg.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
local M = {
|
||||
"nvim-neorg/neorg",
|
||||
build = ":Neorg sync-parsers",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "nvim-neorg/neorg-telescope" },
|
||||
ft = "norg",
|
||||
config = function()
|
||||
require("neorg").setup({
|
||||
load = {
|
||||
["core.defaults"] = {}, -- Loads default behaviour
|
||||
["core.concealer"] = {}, -- Adds pretty icons to your documents
|
||||
["core.integrations.telescope"] = {},
|
||||
-- {{{ Completions
|
||||
["core.completion"] = {
|
||||
config = {
|
||||
engine = "nvim-cmp",
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Dirman
|
||||
["core.dirman"] = { -- Manages Neorg workspaces
|
||||
config = {
|
||||
workspaces = {
|
||||
notes = "~/Neorg",
|
||||
["uni-notes"] = "~/Projects/uni-notes",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Keybinds
|
||||
["core.keybinds"] = {
|
||||
config = {
|
||||
hook = function(keybinds)
|
||||
-- Binds the `gtd` key in `norg` mode to execute `:echo 'Hello'`
|
||||
keybinds.map("norg", "n", "gtd", "<cmd>echo 'Hello!'<CR>")
|
||||
end,
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
},
|
||||
})
|
||||
|
||||
-- {{{ Lazy cmp loading
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
group = vim.api.nvim_create_augroup("CmpSourceNeorg", {}),
|
||||
pattern = "*.norg",
|
||||
callback = function()
|
||||
require("cmp").setup.buffer({ sources = { { name = "neorg" } } })
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
44
home/features/neovim/config/lua/my/plugins/null-ls.lua
Normal file
44
home/features/neovim/config/lua/my/plugins/null-ls.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"jose-elias-alvarez/null-ls.nvim", -- generic language server
|
||||
event = "BufReadPre",
|
||||
dependencies = "neovim/nvim-lspconfig",
|
||||
cond = env.vscode.not_active(),
|
||||
enable = false,
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local sources = {
|
||||
-- {{{ Typescript formatting
|
||||
-- null_ls.builtins.formatting.prettierd, -- format ts files
|
||||
null_ls.builtins.formatting.prettier, -- format ts files
|
||||
-- }}}
|
||||
-- {{{ Lua formatting
|
||||
-- null_ls.builtins.formatting, -- format lua code
|
||||
null_ls.builtins.formatting.stylua, -- format lua code
|
||||
-- }}}
|
||||
-- {{{ Python
|
||||
-- Formatting:
|
||||
-- null_ls.builtins.formatting.black,
|
||||
-- null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.yapf.with({
|
||||
extra_args = { [[--style="{ indent_width: 2 }"]] },
|
||||
}),
|
||||
-- Diagnostics
|
||||
null_ls.builtins.diagnostics.ruff, -- Linting
|
||||
-- null_ls.builtins.diagnostics.mypy, -- Type checking
|
||||
-- }}}
|
||||
}
|
||||
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
on_attach = lspconfig.on_attach,
|
||||
debug = true,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
20
home/features/neovim/config/lua/my/plugins/nvim-tree.lua
Normal file
20
home/features/neovim/config/lua/my/plugins/nvim-tree.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
cmd = "NvimTreeToggle",
|
||||
config = true,
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.init()
|
||||
-- Toggle nerdtree with Control-n
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<C-n>",
|
||||
":NvimTreeToggle<CR>",
|
||||
{ desc = "Toggle [n]vim-tree" }
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
32
home/features/neovim/config/lua/my/plugins/obsidian.lua
Normal file
32
home/features/neovim/config/lua/my/plugins/obsidian.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local env = require("my.helpers.env")
|
||||
local vault = "/home/adrielus/Projects/stellar-sanctum"
|
||||
|
||||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
opts = {
|
||||
dir = vault,
|
||||
notes_subdir = "chaos",
|
||||
daily_notes = {
|
||||
folder = "daily",
|
||||
date_format = "%Y-%m-%d",
|
||||
},
|
||||
completion = {
|
||||
nvim_cmp = true,
|
||||
min_chars = 2,
|
||||
new_notes_location = "current_dir",
|
||||
prepend_note_id = true,
|
||||
},
|
||||
mappings = {},
|
||||
disable_frontmatter = true,
|
||||
},
|
||||
keys = {
|
||||
{ "<C-O>", "<cmd>ObsidianQuickSwitch<cr>" },
|
||||
},
|
||||
cond = env.vscode.not_active()
|
||||
and env.firenvim.not_active()
|
||||
and vim.loop.cwd() == vault,
|
||||
}
|
25
home/features/neovim/config/lua/my/plugins/rust-tools.lua
Normal file
25
home/features/neovim/config/lua/my/plugins/rust-tools.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local K = require("my.keymaps")
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
|
||||
local M = {
|
||||
"simrat39/rust-tools.nvim",
|
||||
config = function()
|
||||
require("rust-tools").setup({
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
K.nmap(
|
||||
"<leader>lc",
|
||||
"<cmd>RustOpenCargo<cr>",
|
||||
"Open [c]argo.toml",
|
||||
true,
|
||||
true
|
||||
)
|
||||
|
||||
lspconfig.on_attach(client, bufnr)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
76
home/features/neovim/config/lua/my/plugins/telescope.lua
Normal file
76
home/features/neovim/config/lua/my/plugins/telescope.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local telescope = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
dependencies = {
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
version = "0.1.x",
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local M = telescope
|
||||
|
||||
local function find_files_by_extension(extension)
|
||||
return "find_files find_command=rg,--files,--glob=**/*." .. extension
|
||||
end
|
||||
|
||||
local function with_theme(base, theme)
|
||||
return base .. " theme=" .. theme
|
||||
end
|
||||
|
||||
local defaultTheme = "ivy"
|
||||
|
||||
local keybinds = {
|
||||
{ "<C-P>", "find_files", "Find files" },
|
||||
{ "<Leader>ft", find_files_by_extension("tex"), "[F]ind [t]ex files" },
|
||||
{ "<Leader>fl", find_files_by_extension("lua"), "[F]ind [l]ua files" },
|
||||
{ "<Leader>fn", find_files_by_extension("nix"), "[F]ind [n]ix files" },
|
||||
{
|
||||
"<Leader>fp",
|
||||
find_files_by_extension("purs"),
|
||||
"[F]ind [p]urescript files",
|
||||
},
|
||||
{ "<Leader>d", "diagnostics", "[D]iagnostics" },
|
||||
{ "<C-F>", "live_grep", "[F]ind in project" },
|
||||
{ "<Leader>t", "builtin", "[T]elescope pickers" },
|
||||
}
|
||||
|
||||
local function mkAction(action)
|
||||
if not string.find(action, "theme=") then
|
||||
action = with_theme(action, defaultTheme)
|
||||
end
|
||||
|
||||
if not string.find(action, "winblend=") and env.neovide.active() then
|
||||
action = action .. " winblend=45"
|
||||
end
|
||||
|
||||
return "<cmd>Telescope " .. action .. "<cr>"
|
||||
end
|
||||
|
||||
function telescope.init()
|
||||
for _, mapping in pairs(keybinds) do
|
||||
vim.keymap.set("n", mapping[1], mkAction(mapping[2]), { desc = mapping[3] })
|
||||
end
|
||||
end
|
||||
|
||||
function telescope.config()
|
||||
local settings = {
|
||||
defaults = { mappings = { i = { ["<C-h>"] = "which_key" } } },
|
||||
pickers = { find_files = { hidden = true } },
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("telescope").setup(settings)
|
||||
require("telescope").load_extension("fzf")
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,22 @@
|
|||
local H = require("my.plugins.themes.helpers")
|
||||
local T = require("nix.theme")
|
||||
|
||||
local M = {
|
||||
"uloco/bluloco.nvim",
|
||||
lazy = false,
|
||||
dependencies = { "rktjmp/lush.nvim" },
|
||||
enabled = H.theme_contains("Bluloco"),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local bluloco = require("bluloco")
|
||||
|
||||
bluloco.setup({
|
||||
transparent = T.transparency.enable,
|
||||
style = H.variant("Bluloco"),
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme bluloco")
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,30 @@
|
|||
local H = require("my.plugins.themes.helpers")
|
||||
local T = require("nix.theme")
|
||||
|
||||
local M = {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
enabled = H.theme_contains("Catppuccin"),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local catppuccin = require("catppuccin")
|
||||
vim.g.catppuccin_flavour = H.variant("Catppuccin")
|
||||
|
||||
catppuccin.setup({
|
||||
transparent_background = T.transparency.enable,
|
||||
integrations = { nvimtree = true, telescope = true },
|
||||
})
|
||||
|
||||
vim.cmd([[highlight NotifyINFOIcon guifg=#d6b20f]])
|
||||
vim.cmd([[highlight NotifyINFOTitle guifg=#d6b20f]])
|
||||
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
|
||||
if T.transparency.enable then
|
||||
vim.cmd([[highlight FloatBorder blend=0]])
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,14 @@
|
|||
local theme = require("nix.theme").name
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.theme_contains(name)
|
||||
return string.find(theme, name) ~= nil
|
||||
end
|
||||
|
||||
function M.variant(name)
|
||||
-- +1 for 1-indexed strings and +1 for the space between name and variant
|
||||
return string.lower(string.sub(theme, string.len(name) + 2))
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
require("my.plugins.themes.catppuccin"),
|
||||
require("my.plugins.themes.rosepine"),
|
||||
require("my.plugins.themes.bluloco"),
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
local H = require("my.plugins.themes.helpers")
|
||||
|
||||
local M = {
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
lazy = false,
|
||||
enabled = H.theme_contains("Rosé Pine"),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local variant = H.variant("Rosé Pine")
|
||||
|
||||
if variant == "dawn" then
|
||||
vim.o.background = "light"
|
||||
else
|
||||
vim.o.background = "dark"
|
||||
end
|
||||
|
||||
local dark_variants = {
|
||||
[""] = "main",
|
||||
moon = "moon",
|
||||
}
|
||||
|
||||
require("rose-pine").setup({
|
||||
dark_variant = dark_variants[variant],
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
end
|
||||
|
||||
return M
|
105
home/features/neovim/config/lua/my/plugins/treesitter.lua
Normal file
105
home/features/neovim/config/lua/my/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,105 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
event = "BufReadPost",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
--{{{Languages
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"elixir",
|
||||
"fish",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"jsonc",
|
||||
"latex",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"nix",
|
||||
"python",
|
||||
"rust",
|
||||
"scss",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
sync_install = false,
|
||||
--}}}
|
||||
--{{{ Highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "kotlin" },
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
--}}}
|
||||
textobjects = {
|
||||
--{{{ Select
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
},
|
||||
--}}}
|
||||
--{{{ Move
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
["]f"] = "@function.outer",
|
||||
["]t"] = "@class.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]F"] = "@function.outer",
|
||||
["]T"] = "@class.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[f"] = "@function.outer",
|
||||
["[t"] = "@class.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[F"] = "@function.outer",
|
||||
["[T"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
--}}}
|
||||
},
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- show context on closing parenthesis
|
||||
"haringsrob/nvim_context_vt",
|
||||
event = "BufReadPost",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
{
|
||||
-- show context at top of file
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
event = "BufReadPost",
|
||||
cond = env.vscode.not_active(),
|
||||
opts = { enable = true },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
66
home/features/neovim/config/lua/my/plugins/venn.lua
Normal file
66
home/features/neovim/config/lua/my/plugins/venn.lua
Normal file
|
@ -0,0 +1,66 @@
|
|||
local M = {
|
||||
"jbyuki/venn.nvim", -- draw ascii diagrams
|
||||
dependencies = {
|
||||
"anuvyklack/hydra.nvim",
|
||||
},
|
||||
keys = { "<leader>V" },
|
||||
}
|
||||
|
||||
local venn_hint_old = [[
|
||||
^^^Draw arrow^^^ Select region with <C-v>
|
||||
^ ^ _K_ ^ ^ _f_: surround it with box
|
||||
_H_ ^ ^ _L_
|
||||
^ ^ _J_ ^ ^ _<Esc>_
|
||||
]]
|
||||
|
||||
local H = require("my.plugins.hydra").hint
|
||||
|
||||
local venn_hint = H.concat_many_h({
|
||||
H.add_title("Draw arrows", H.directional("H", "J", "K", "L", 3)),
|
||||
H.add_title(
|
||||
"Actions",
|
||||
H.concat_many_w({
|
||||
H.concat_h("<C-v>", ": select region"),
|
||||
H.concat_h(H.pad_right(H.highlight("f"), 5), ": surround with box"),
|
||||
H.concat_h(H.pad_right(H.highlight("<Esc>"), 5), ": quit"),
|
||||
}, { justify = "left" })
|
||||
),
|
||||
}, 3).value
|
||||
|
||||
function M.config()
|
||||
local Hydra = require("hydra")
|
||||
|
||||
Hydra({
|
||||
name = "Draw Diagram",
|
||||
hint = venn_hint,
|
||||
config = {
|
||||
color = "pink",
|
||||
invoke_on_body = true,
|
||||
hint = {
|
||||
border = "single",
|
||||
},
|
||||
on_enter = function()
|
||||
vim.o.virtualedit = "all"
|
||||
end,
|
||||
},
|
||||
mode = "n",
|
||||
desc = "[V]enn mode",
|
||||
body = "<leader>V",
|
||||
heads = {
|
||||
{ "H", "<C-v>h:VBox<CR>" },
|
||||
{ "J", "<C-v>j:VBox<CR>" },
|
||||
{ "K", "<C-v>k:VBox<CR>" },
|
||||
{ "L", "<C-v>l:VBox<CR>" },
|
||||
{ "f", ":VBox<CR>", { mode = "v" } },
|
||||
{ "<Esc>", nil, { exit = true } },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function M.init()
|
||||
require("which-key").register({
|
||||
["<leader>V"] = { name = "[V]enn mode" },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
26
home/features/neovim/config/lua/my/plugins/vimtex.lua
Normal file
26
home/features/neovim/config/lua/my/plugins/vimtex.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local M = {
|
||||
"lervag/vimtex", -- latex support
|
||||
ft = "tex",
|
||||
enabled = false
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.g.vimtex_view_method = "zathura"
|
||||
vim.g.Tex_DefaultTargetFormat = "pdf"
|
||||
vim.g.vimtex_compiler_latexmk = {
|
||||
options = {
|
||||
"-pdf",
|
||||
"-shell-escape",
|
||||
"-verbose",
|
||||
"-file-line-error",
|
||||
"-synctex=1",
|
||||
"-interaction=nonstopmode",
|
||||
},
|
||||
}
|
||||
|
||||
vim.g.vimtex_fold_enabled = 0
|
||||
vim.g.vimtex_imaps_enabled = 0
|
||||
vim.g.vimtex_syntax_conceal_disable = 1
|
||||
end
|
||||
|
||||
return M
|
40
home/features/neovim/config/lua/my/plugins/vimux.lua
Normal file
40
home/features/neovim/config/lua/my/plugins/vimux.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local K = require("my.keymaps")
|
||||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"preservim/vimux", -- interact with tmux from within vim
|
||||
cmd = { "VimuxPromptCommand", "VimuxRunCommand", "VimuxRunLastCommand" },
|
||||
-- TODO: only enable when actually inside tmux
|
||||
cond = env.vscode.not_active()
|
||||
-- and env.neovide.not_active()
|
||||
and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.init()
|
||||
--{{{ Register keybinds
|
||||
K.nmap(
|
||||
"<leader>vp",
|
||||
":VimuxPromptCommand<CR>",
|
||||
"[V]imux: [p]rompt for command"
|
||||
)
|
||||
K.nmap("<leader>vc", ':VimuxRunCommand "clear"<CR>', "[V]imux: [c]lear pane")
|
||||
K.nmap(
|
||||
"<leader>vl",
|
||||
":VimuxRunLastCommand<CR>",
|
||||
"[V]imux: rerun [l]ast command"
|
||||
)
|
||||
--}}}
|
||||
--{{{ Register which-key docs
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
["<leader>v"] = {
|
||||
name = "[V]imux",
|
||||
},
|
||||
})
|
||||
end
|
||||
--}}}
|
||||
end
|
||||
|
||||
return M
|
31
home/features/neovim/config/lua/my/plugins/whichkey.lua
Normal file
31
home/features/neovim/config/lua/my/plugins/whichkey.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local M = {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup({
|
||||
window = {
|
||||
winblend = 0,
|
||||
pumblend = 0,
|
||||
border = "single",
|
||||
},
|
||||
layout = { align = "center" },
|
||||
})
|
||||
|
||||
wk.register({
|
||||
["<leader>"] = {
|
||||
f = { name = "[F]iles" },
|
||||
g = { name = "[G]o to" },
|
||||
r = { name = "[R]ename / [R]eplace / [R]eload" },
|
||||
l = { name = "[L]ocal" },
|
||||
w = { name = "[W]orkspace" },
|
||||
y = { name = "[Y]ank" },
|
||||
s = { name = "[S]ettings" },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
1
home/features/neovim/config/neoconf.json
Normal file
1
home/features/neovim/config/neoconf.json
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -78,7 +78,7 @@ let
|
|||
# {{{ extraRuntime
|
||||
extraRuntime = env: [
|
||||
# Snippets
|
||||
(config.satellite.dev.path "dotfiles/vscode-snippets")
|
||||
(config.satellite.dev.path "home/features/neovim/snippets")
|
||||
|
||||
# Base16 theme
|
||||
(pkgs.writeTextDir
|
||||
|
@ -136,13 +136,10 @@ let
|
|||
in
|
||||
{
|
||||
# {{{ Basic config
|
||||
# Do not manage neovim via the default home manager module
|
||||
programs.neovim.enable = false;
|
||||
|
||||
# We still want other modules to know that we are using neovim!
|
||||
satellite.toggles.neovim.enable = true;
|
||||
|
||||
xdg.configFile.nvim.source = config.satellite.dev.path "dotfiles/neovim";
|
||||
xdg.configFile.nvim.source = config.satellite.dev.path "home/features/neovim/config";
|
||||
home.sessionVariables.EDITOR = "nvim";
|
||||
|
||||
home.packages = [
|
||||
|
|
3
home/features/neovim/snippets/README.md
Normal file
3
home/features/neovim/snippets/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Vscode snippets
|
||||
|
||||
These are snippets usable both in vscode and neovim, defined in vscode format.
|
55
home/features/neovim/snippets/package.json
Normal file
55
home/features/neovim/snippets/package.json
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"name": "adriels-snippets",
|
||||
"engines": {
|
||||
"vscode": "^1.11.0"
|
||||
},
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": [
|
||||
"purs",
|
||||
"purescript"
|
||||
],
|
||||
"path": "./snippets/purescript/other.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"purs",
|
||||
"purescript"
|
||||
],
|
||||
"path": "./snippets/purescript/imports.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"purs",
|
||||
"purescript"
|
||||
],
|
||||
"path": "./snippets/purescript/deriving.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"tex"
|
||||
],
|
||||
"path": "./snippets/latex/core.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"tex"
|
||||
],
|
||||
"path": "./snippets/latex/explain.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"lua"
|
||||
],
|
||||
"path": "./snippets/lua/core.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"nix"
|
||||
],
|
||||
"path": "./snippets/nix/core.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
378
home/features/neovim/snippets/snippets/latex/core.json
Normal file
378
home/features/neovim/snippets/snippets/latex/core.json
Normal file
|
@ -0,0 +1,378 @@
|
|||
{
|
||||
"Begin": {
|
||||
"prefix": "begin",
|
||||
"description": "Begin anything",
|
||||
"body": [
|
||||
"\\begin{$1}",
|
||||
"\t$0",
|
||||
"\\end{$1}"
|
||||
]
|
||||
},
|
||||
"Set": {
|
||||
"prefix": "set",
|
||||
"description": "Set I guess",
|
||||
"body": "\\{$1\\\\}$0"
|
||||
},
|
||||
"Absolute value": {
|
||||
"prefix": "abs",
|
||||
"description": "Absolute values",
|
||||
"body": "\\abs{$1}$0"
|
||||
},
|
||||
"Norm": {
|
||||
"prefix": "norm",
|
||||
"description": "Norm of a vector",
|
||||
"body": "\\norm{$1}$0"
|
||||
},
|
||||
"Probability function": {
|
||||
"prefix": "prob",
|
||||
"description": "Probability function applied to some set",
|
||||
"body": "\\prob{$1}$0"
|
||||
},
|
||||
"Inner product": {
|
||||
"prefix": "iprod",
|
||||
"description": "Inner product of two vectors",
|
||||
"body": "\\iprod{$1}{$2}$0"
|
||||
},
|
||||
"Self inner product": {
|
||||
"prefix": "diprod",
|
||||
"description": "Inner product of a vector with itself",
|
||||
"body": "\\dprod{$1}$0"
|
||||
},
|
||||
"Lemma": {
|
||||
"prefix": "lemma",
|
||||
"description": "Create a lemma",
|
||||
"body": [
|
||||
"\\begin{lemma}[$1]\\label{lem:$1}",
|
||||
"\t$0",
|
||||
"\\end{lemma}"
|
||||
]
|
||||
},
|
||||
"Example*": {
|
||||
"prefix": "example*",
|
||||
"description": "Create an example*",
|
||||
"body": [
|
||||
"\\begin{example*}",
|
||||
"\t$0",
|
||||
"\\end{example*}"
|
||||
]
|
||||
},
|
||||
"Example": {
|
||||
"prefix": "example",
|
||||
"description": "Create an example",
|
||||
"body": [
|
||||
"\\begin{example}[$1]\\label{exp:$1}",
|
||||
"\t$0",
|
||||
"\\end{example}"
|
||||
]
|
||||
},
|
||||
"Theorem": {
|
||||
"prefix": "theorem",
|
||||
"description": "Create a theorem",
|
||||
"body": [
|
||||
"\\begin{theorem}[$1]\\label{thm:$1}",
|
||||
"\t$0",
|
||||
"\\end{theorem}"
|
||||
]
|
||||
},
|
||||
"Exercise": {
|
||||
"prefix": "exercise",
|
||||
"description": "Create a exercise",
|
||||
"body": [
|
||||
"\\begin{exercise}[$1]\\label{exe:$1}",
|
||||
"\t$0",
|
||||
"\\end{exercise}"
|
||||
]
|
||||
},
|
||||
"Definition": {
|
||||
"prefix": "definition",
|
||||
"description": "Create a definition",
|
||||
"body": [
|
||||
"\\begin{definition}[$1]\\label{def:$1}",
|
||||
"\t$0",
|
||||
"\\end{definition}"
|
||||
]
|
||||
},
|
||||
"Display math": {
|
||||
"prefix": "dm",
|
||||
"description": "Display math section",
|
||||
"body": [
|
||||
"\\[",
|
||||
"$0",
|
||||
"\\]"
|
||||
]
|
||||
},
|
||||
"Subscript": {
|
||||
"prefix": "ss",
|
||||
"description": "Subscript",
|
||||
"body": "_{$1}$0"
|
||||
},
|
||||
"Exponent": {
|
||||
"prefix": "ee",
|
||||
"description": "Exponent",
|
||||
"body": "^{$1}$0"
|
||||
},
|
||||
"Nth derivative": {
|
||||
"prefix": "dd",
|
||||
"description": "Nth derivative",
|
||||
"body": "^{($1)}$0"
|
||||
},
|
||||
"Overline": {
|
||||
"prefix": "ol",
|
||||
"description": "Overline",
|
||||
"body": "\\overline{$1}$0"
|
||||
},
|
||||
"Z Mod": {
|
||||
"prefix": "zmod",
|
||||
"description": "The set of Z/nZ",
|
||||
"body": "\\mathbb{Z}/$1\\mathbb{Z}$0"
|
||||
},
|
||||
"Section": {
|
||||
"prefix": "section",
|
||||
"description": "Add section",
|
||||
"body": [
|
||||
"\\section{$1}",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"Subsection": {
|
||||
"prefix": "subsection",
|
||||
"description": "Add subsection",
|
||||
"body": [
|
||||
"\\subsection{$1}",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"Subsubsection": {
|
||||
"prefix": "subsubsection",
|
||||
"description": "Add subsubsection",
|
||||
"body": [
|
||||
"\\subsubsection{$1}",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"Chapter": {
|
||||
"prefix": "chapter",
|
||||
"description": "Add chapter",
|
||||
"body": [
|
||||
"\\chapter{$1}",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"Proof": {
|
||||
"prefix": "proof",
|
||||
"description": "Create proof",
|
||||
"body": [
|
||||
"\\begin{proof}",
|
||||
"\t$0",
|
||||
"\\end{proof}"
|
||||
]
|
||||
},
|
||||
"Itemize": {
|
||||
"prefix": "item",
|
||||
"body": [
|
||||
"\\\\begin{itemize}",
|
||||
"\t\\item $0",
|
||||
"\\\\end{itemize}"
|
||||
],
|
||||
"description": "Itemize env"
|
||||
},
|
||||
"Enumerate": {
|
||||
"prefix": "enum",
|
||||
"body": [
|
||||
"\\\\begin{enumerate}",
|
||||
"\t\\item $0",
|
||||
"\\\\end{enumerate}"
|
||||
],
|
||||
"description": "Enumerate env"
|
||||
},
|
||||
"Reference definition": {
|
||||
"prefix": "rdef",
|
||||
"description": "Reference a definition",
|
||||
"body": "\\ref{def:$1}$0"
|
||||
},
|
||||
"Reference lemma": {
|
||||
"prefix": "rlemma",
|
||||
"description": "Reference a lemma",
|
||||
"body": "\\ref{lem:$1}$0"
|
||||
},
|
||||
"Reference theorem": {
|
||||
"prefix": "rtheorem",
|
||||
"description": "Reference a theorem",
|
||||
"body": "\\ref{thm:$1}$0"
|
||||
},
|
||||
"Sigma sum": {
|
||||
"prefix": "bsum",
|
||||
"description": "Create a sum using sigma notation",
|
||||
"body": "\\sum_{$1 = $2}^{$3}$0"
|
||||
},
|
||||
"Pi product": {
|
||||
"prefix": "bproduct",
|
||||
"description": "Create a produt using pi notation",
|
||||
"body": "\\prod_{$1 = $2}^{$3}$0"
|
||||
},
|
||||
"Fraction": {
|
||||
"prefix": "frac",
|
||||
"description": "Create a fraction",
|
||||
"body": "\\frac{$1}{$2}$0"
|
||||
},
|
||||
"Choose": {
|
||||
"prefix": "binom",
|
||||
"description": "Create a (n choose k) thingy",
|
||||
"body": "\\binom{$1}{$2}$0"
|
||||
},
|
||||
"Limit": {
|
||||
"prefix": "lim",
|
||||
"description": "Create a limit",
|
||||
"body": "\\lim _{$1 \\to $2}$0"
|
||||
},
|
||||
"Limit to infinity": {
|
||||
"prefix": "ilim",
|
||||
"description": "Create a limit as a variable goes to infinity",
|
||||
"body": "\\lim _{$1 \\to \\infty}$0"
|
||||
},
|
||||
"Limit to negative infinity": {
|
||||
"prefix": "nlim",
|
||||
"description": "Create a limit as a variable goes to negative infinity",
|
||||
"body": "\\lim _{$1 \\to -\\infty}$0"
|
||||
},
|
||||
"Limit to zero": {
|
||||
"prefix": "zlim",
|
||||
"description": "Create a limit as a variable goes to 0",
|
||||
"body": "\\lim _{$1 \\to 0}$0"
|
||||
},
|
||||
"Sqrt": {
|
||||
"prefix": "sqrt",
|
||||
"description": "Create a sqrt",
|
||||
"body": "\\sqrt[$1]{$2}$0"
|
||||
},
|
||||
"Sin": {
|
||||
"prefix": "sin",
|
||||
"description": "Create a sin call",
|
||||
"body": "\\sin($1)$0"
|
||||
},
|
||||
"Cos": {
|
||||
"prefix": "cos",
|
||||
"description": "Create a cos call",
|
||||
"body": "\\cos($1)$0"
|
||||
},
|
||||
"Ln": {
|
||||
"prefix": "ln",
|
||||
"description": "Create a ln call",
|
||||
"body": "\\ln($1)$0"
|
||||
},
|
||||
"Aligned": {
|
||||
"prefix": "aligned",
|
||||
"description": "Create an aligned environment",
|
||||
"body": [
|
||||
"\\begin{aligned}",
|
||||
"\t$0",
|
||||
"\\end{aligned}"
|
||||
]
|
||||
},
|
||||
"Let": {
|
||||
"prefix": "let",
|
||||
"description": "Let something equal something else",
|
||||
"body": "Let $$1 = $2$. $0"
|
||||
},
|
||||
"Force newline": {
|
||||
"prefix": "cr",
|
||||
"description": "Force newline in math mode",
|
||||
"body": "{\\ \\\\\\\\}"
|
||||
},
|
||||
"Aligned display math": {
|
||||
"prefix": "maligned",
|
||||
"description": "Create an aligned display math environment",
|
||||
"body": [
|
||||
"\\begin{align*}",
|
||||
"\t$0",
|
||||
"\\end{align*}"
|
||||
]
|
||||
},
|
||||
"System of equations": {
|
||||
"prefix": "eqsystem",
|
||||
"description": "Create a system of equations",
|
||||
"body": [
|
||||
"\\left\\{",
|
||||
"\t\\begin{array}{rl}",
|
||||
"\t\t$0",
|
||||
"\t\\end{array}",
|
||||
"\\right\\\\\\}"
|
||||
]
|
||||
},
|
||||
"Aligned equation": {
|
||||
"prefix": "aleq",
|
||||
"description": "Aligned equation",
|
||||
"body": [
|
||||
"\\\\\\ $1 &= $2",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"2x2 matrices": {
|
||||
"prefix": "mat22",
|
||||
"description": "Create a 2x2 matrix",
|
||||
"body": [
|
||||
"\\begin{bmatrix}",
|
||||
" ${1:1} & ${2:0}",
|
||||
"\\\\\\ ${3:0} & ${4:1}",
|
||||
"\\end{bmatrix}$0"
|
||||
]
|
||||
},
|
||||
"3x3 matrices": {
|
||||
"prefix": "mat33",
|
||||
"description": "Create a 3x3 matrix",
|
||||
"body": [
|
||||
"\\begin{bmatrix}",
|
||||
" ${1:1} & ${2:0} & ${3:0}",
|
||||
"\\\\\\ ${4:0} & ${5:1} & ${6:0}",
|
||||
"\\\\\\ ${7:0} & ${8:0} & ${9:1}",
|
||||
"\\end{bmatrix}$0"
|
||||
]
|
||||
},
|
||||
"3x3 determinants": {
|
||||
"prefix": "det33",
|
||||
"description": "Create a 3x3 determinant",
|
||||
"body": [
|
||||
"\\begin{vmatrix}",
|
||||
" $1 & $2 & $3",
|
||||
"\\\\\\ $4 & $5 & $6",
|
||||
"\\\\\\ $7 & $8 & $9",
|
||||
"\\end{vmatrix}$0"
|
||||
]
|
||||
},
|
||||
"2x2 determinants": {
|
||||
"prefix": "det22",
|
||||
"description": "Create a 2x2 determinant",
|
||||
"body": [
|
||||
"\\begin{vmatrix}",
|
||||
" $1 & $2",
|
||||
"\\\\\\ $3 & $4",
|
||||
"\\end{vmatrix}$0"
|
||||
]
|
||||
},
|
||||
"Definite integral": {
|
||||
"prefix": "dintegral",
|
||||
"description": "Definite integral",
|
||||
"body": "\\int_{$1}^{$2} $3 d${4:x}$0"
|
||||
},
|
||||
"Indefinite integral": {
|
||||
"prefix": "integral",
|
||||
"description": "Integral",
|
||||
"body": "\\int $1 d${2:x}$0"
|
||||
},
|
||||
"Iff cases": {
|
||||
"prefix": "ciff",
|
||||
"description": "Prove an equivalence in both directions",
|
||||
"body": [
|
||||
"\\begin{enumerate}",
|
||||
"\t\\item[$\\implies$]$1",
|
||||
"\t\\item[$\\impliedby$]$2",
|
||||
"\\end{enumerate}",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"quote": {
|
||||
"prefix": "quote",
|
||||
"description": "Quote a bunch of text",
|
||||
"body": "``$1''$0"
|
||||
}
|
||||
}
|
87
home/features/neovim/snippets/snippets/latex/explain.json
Normal file
87
home/features/neovim/snippets/snippets/latex/explain.json
Normal file
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
"Text explanation in math mode": {
|
||||
"prefix": "texpl",
|
||||
"description": "Explain a step using text in math mode",
|
||||
"body": "&& \\text{($1)}$0"
|
||||
},
|
||||
"Explanation in math mode": {
|
||||
"prefix": "expl",
|
||||
"description": "Explain a step in math mode",
|
||||
"body": "&& ($1) $0"
|
||||
},
|
||||
"Explain division": {
|
||||
"prefix": "exdiv",
|
||||
"description": "Explain a division inside an equation",
|
||||
"body": "&& \\left(\\frac{\\square}{$1}\\right)$0"
|
||||
},
|
||||
"Explain fraction": {
|
||||
"prefix": "exfract",
|
||||
"description": "Explain a step which wraps both sides of an equation by a fraction",
|
||||
"body": "&& \\left(\\frac{$1}{$2} \\right)$0"
|
||||
},
|
||||
"Explain right multiplication": {
|
||||
"prefix": "exmul",
|
||||
"description": "Explain a right multiplication inside an equation",
|
||||
"body": "&& \\left(\\square \\cdot $1 \\right)$0"
|
||||
},
|
||||
"Explain left multiplication": {
|
||||
"prefix": "exlmul",
|
||||
"description": "Explain a left multiplication inside an equation",
|
||||
"body": "&& \\left($1 \\cdot \\square\\right)$0"
|
||||
},
|
||||
"Explain differentiation": {
|
||||
"prefix": "exdiff",
|
||||
"description": "Explain a step which differentiates both sides of an equation",
|
||||
"body": "&& \\left( \\frac{d \\square} {d $1} \\right)$0"
|
||||
},
|
||||
"Explain integration": {
|
||||
"prefix": "exint",
|
||||
"description": "Explain a step which integrates both sides of an equation",
|
||||
"body": "&& \\left(\\int \\square d$1 \\right)$0"
|
||||
},
|
||||
"Explain definite integration": {
|
||||
"prefix": "exdint",
|
||||
"description": "Explain a step which applies a definite integral to both sides of an equation",
|
||||
"body": "&& \\left(\\int _{$1} ^{$2} \\square d$3 \\right)$0"
|
||||
},
|
||||
"Explain addition": {
|
||||
"prefix": "exadd",
|
||||
"description": "Explain a step which adds to both sides of an equation",
|
||||
"body": "&& \\left( \\square + $1 \\right)$0"
|
||||
},
|
||||
"Explain subtraction": {
|
||||
"prefix": "exsub",
|
||||
"description": "Explain a step which subtracts from both sides of an equation",
|
||||
"body": "&& \\left( \\square - $1 \\right)$0"
|
||||
},
|
||||
"Explain negation": {
|
||||
"prefix": "exneg",
|
||||
"description": "Explain a step which negates both sides of an equation",
|
||||
"body": "&& (- \\square )$0"
|
||||
},
|
||||
"Explain power": {
|
||||
"prefix": "expow",
|
||||
"description": "Explain a step which raises both sides of an equation to a given power",
|
||||
"body": "&& \\left( \\square ^{$1} \\right)$0"
|
||||
},
|
||||
"Explain exponentiation": {
|
||||
"prefix": "exexp",
|
||||
"description": "Explain a step which raises a given value to both sides of an equation",
|
||||
"body": "&& \\left( $1 ^{\\square} \\right)$0"
|
||||
},
|
||||
"Explain natural logarithm": {
|
||||
"prefix": "exln",
|
||||
"description": "Explain a step which applies the ln function to both sides of an equation",
|
||||
"body": "&& \\left( \\ln $1 \\right)$0"
|
||||
},
|
||||
"Explain triangle inequality": {
|
||||
"prefix": "extrin",
|
||||
"description": "Explain a step using the triangle inequality in math mode",
|
||||
"body": "&& \\text{(Triangle inequality on $ $1 $)}$0"
|
||||
},
|
||||
"Explain being bounded": {
|
||||
"prefix": "exbound",
|
||||
"description": "Explain that something is bounded in math mode",
|
||||
"body": "&& \\text{($ $1 $ is bounded)}$0"
|
||||
}
|
||||
}
|
33
home/features/neovim/snippets/snippets/lua/core.json
Normal file
33
home/features/neovim/snippets/snippets/lua/core.json
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"Lua setup-module": {
|
||||
"prefix": "msetup",
|
||||
"description": "Create lua module with setup function inside",
|
||||
"body": [
|
||||
"local M = {}",
|
||||
"",
|
||||
"function M.setup()",
|
||||
" $0",
|
||||
"end",
|
||||
"",
|
||||
"return M"
|
||||
]
|
||||
},
|
||||
"Busted describe": {
|
||||
"prefix": "describe",
|
||||
"description": "Create a describe call for a busted test",
|
||||
"body": [
|
||||
"describe(\"$1\", function ()",
|
||||
"\t$0",
|
||||
"end)"
|
||||
]
|
||||
},
|
||||
"Busted it": {
|
||||
"prefix": "it",
|
||||
"description": "Create an it call for a busted test",
|
||||
"body": [
|
||||
"it(\"$1\", function ()",
|
||||
"\t$0",
|
||||
"end)"
|
||||
]
|
||||
}
|
||||
}
|
14
home/features/neovim/snippets/snippets/nix/core.json
Normal file
14
home/features/neovim/snippets/snippets/nix/core.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"Fetch from GitHub": {
|
||||
"prefix": "fetchFromGitHub",
|
||||
"description": "Fetch a repo from github",
|
||||
"body": [
|
||||
"pkgs.fetchFromGitHub {",
|
||||
"\towner = \"$1\";",
|
||||
"\trepo = \"$2\";",
|
||||
"\trev = \"\";",
|
||||
"\tsha256 = \"\";",
|
||||
"}$0"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"Derive newtype instance": {
|
||||
"prefix": "gnderive",
|
||||
"description": "Use newtype deriving on any typeclass",
|
||||
"body": "derive newtype instance $0 $3 $2"
|
||||
},
|
||||
"Generate json instances": {
|
||||
"prefix": "json",
|
||||
"description": "Generate the deriving of the EncodeJson and DecodeJson typeclasses",
|
||||
"body": [
|
||||
"derive newtype instance EncodeJson $1",
|
||||
"derive newtype instance DecodeJson $1"
|
||||
]
|
||||
},
|
||||
"Generic": {
|
||||
"prefix": "dgeneric",
|
||||
"description": "Generate the generic instance for a type",
|
||||
"body": "derive instance Generic $1 _"
|
||||
},
|
||||
"Generic Show": {
|
||||
"prefix": "gshow",
|
||||
"description": "Generate generic show instances",
|
||||
"body": [
|
||||
"instance Show $1 where",
|
||||
" show = genericShow"
|
||||
]
|
||||
},
|
||||
"Generic Debug": {
|
||||
"prefix": "gdebug",
|
||||
"description": "Generate generic debug instances",
|
||||
"body": [
|
||||
"instance Debug $1 where",
|
||||
" debug = genericDebug"
|
||||
]
|
||||
},
|
||||
"Generic json": {
|
||||
"prefix": "gjson",
|
||||
"description": "Generate generic json instances",
|
||||
"body": [
|
||||
"instance EncodeJson $1 where",
|
||||
" encodeJson = genericEncodeJson",
|
||||
"instance DecodeJson $1 where",
|
||||
" decodeJson = genericDecodeJson"
|
||||
]
|
||||
},
|
||||
"Instance": {
|
||||
"prefix": "instance",
|
||||
"description": "Declare typeclass instance",
|
||||
"body": [
|
||||
"instance $2 $3 where",
|
||||
" $0"
|
||||
]
|
||||
},
|
||||
"Functor": {
|
||||
"prefix": "dfunctor",
|
||||
"description": "Derive a Functor instance",
|
||||
"body": "derive instance Functor $1$0"
|
||||
},
|
||||
"Eq": {
|
||||
"prefix": "deq",
|
||||
"description": "Derive an Eq instance",
|
||||
"body": "derive instance Eq $1$0"
|
||||
},
|
||||
"Ord": {
|
||||
"prefix": "dord",
|
||||
"description": "Derive an Ord instance",
|
||||
"body": "derive instance Ord $1$0"
|
||||
},
|
||||
"Eq & Ord": {
|
||||
"prefix": "deqord",
|
||||
"description": "Derive an Eq and an Ord instance",
|
||||
"body": [
|
||||
"derive instance Eq $1",
|
||||
"derive instance Ord $1$0"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"Tuple constructors": {
|
||||
"prefix": "imptuple",
|
||||
"description": "Import tuple constructors",
|
||||
"body": "import Data.Tuple.Nested (type (/\\), (/\\))"
|
||||
},
|
||||
"Map": {
|
||||
"prefix": "impmap",
|
||||
"description": "Import Map module",
|
||||
"body": "import Data.Map as Map"
|
||||
},
|
||||
"HashMap": {
|
||||
"prefix": "imphashmap",
|
||||
"description": "Import HashMap module",
|
||||
"body": "import Data.HashMap as HashMap"
|
||||
},
|
||||
"FRP Event": {
|
||||
"prefix": "impevent",
|
||||
"description": "Import FRP.Event module",
|
||||
"body": "import FRP.Event as E"
|
||||
},
|
||||
"List": {
|
||||
"prefix": "implist",
|
||||
"description": "Import List module",
|
||||
"body": "import Data.List as List"
|
||||
},
|
||||
"Array": {
|
||||
"prefix": "imparray",
|
||||
"description": "import Array module",
|
||||
"body": "import Data.Array as Array"
|
||||
},
|
||||
"AVar": {
|
||||
"prefix": "impavar",
|
||||
"description": "import AVar module",
|
||||
"body": "import Effect.Aff.AVar as AV"
|
||||
},
|
||||
"Object": {
|
||||
"prefix": "impobject",
|
||||
"description": "import Foreign.Object module",
|
||||
"body": "import Foreign.Object as Object"
|
||||
},
|
||||
"STObject": {
|
||||
"prefix": "impstobject",
|
||||
"description": "import STObject module",
|
||||
"body": "import Foreign.Object.ST as STObject"
|
||||
},
|
||||
"Ref": {
|
||||
"prefix": "impref",
|
||||
"description": "import Effect.Ref module",
|
||||
"body": "import Effect.Ref as Ref"
|
||||
},
|
||||
"Int": {
|
||||
"prefix": "impint",
|
||||
"description": "import Data.Int module",
|
||||
"body": "import Data.Int as Int"
|
||||
},
|
||||
"Number": {
|
||||
"prefix": "impnumber",
|
||||
"description": "import Data.Number module",
|
||||
"body": "import Data.Number as Number"
|
||||
}
|
||||
}
|
61
home/features/neovim/snippets/snippets/purescript/other.json
Normal file
61
home/features/neovim/snippets/snippets/purescript/other.json
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"Definition": {
|
||||
"prefix": "definition",
|
||||
"description": "Basic purescript definition",
|
||||
"body": ["$1 :: $2", "$1 = $3"]
|
||||
},
|
||||
"SProxy": {
|
||||
"prefix": "sproxy",
|
||||
"description": "Generate a proxy constant",
|
||||
"body": ["_$1 :: Proxy \"$1\"", "_$1 = Proxy"]
|
||||
},
|
||||
"Proxy": {
|
||||
"prefix": "proxy",
|
||||
"description": "Generate a proxy constant",
|
||||
"body": ["_$1 :: Proxy $1", "_$1 = Proxy"]
|
||||
},
|
||||
"Prop": {
|
||||
"prefix": "prop",
|
||||
"description": "Prop lens",
|
||||
"body": ["_$1 :: Lens' $2 $3", "_$1 = prop (Proxy :: _ \"$1\")"]
|
||||
},
|
||||
"Variant constructor": {
|
||||
"prefix": "inj",
|
||||
"description": "Generate a constructor for a variant an inline sproxy",
|
||||
"body": [
|
||||
"$1 :: forall r a. a -> Variant ( $1 :: a | r)",
|
||||
"$1 = inj (SProxy :: SProxy \"$1\")"
|
||||
]
|
||||
},
|
||||
"Full variant constructor": {
|
||||
"prefix": "injf",
|
||||
"description": "Generate a constructor for a variant with an external sproxy definition",
|
||||
"body": [
|
||||
"$1 :: forall r a. a -> Variant ( $1 :: a | r)",
|
||||
"$1 = inj _$1",
|
||||
"",
|
||||
"_$1 :: Proxy \"$1\"",
|
||||
"_$1 = Proxy"
|
||||
]
|
||||
},
|
||||
"Example code": {
|
||||
"prefix": "ex",
|
||||
"description": "Provide example usage for some piece of code",
|
||||
"body": ["-- |", "-- | Ex:", "-- | ```purs", "-- | $0", "-- | ```"]
|
||||
},
|
||||
"Section": {
|
||||
"prefix": "section",
|
||||
"description": "Delimit a section using 10 dashes",
|
||||
"body": "---------- $0"
|
||||
},
|
||||
"Typeclass instances": {
|
||||
"prefix": "sinstances",
|
||||
"description": "Delimit a section which declares typeclass instances",
|
||||
"body": ["---------- Typeclass instances", "$0"]
|
||||
},
|
||||
"If": {
|
||||
"prefix": "if",
|
||||
"description": "If then else expression",
|
||||
"body": ["if $1", "\tthen $2", "\telse $3"]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue