Added so much stuff
This commit is contained in:
parent
1b17dc6cf3
commit
71f7586a61
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
node_modules
|
||||
./secrets.nix
|
||||
result
|
||||
*.qcow2
|
||||
|
||||
|
|
17
dotfiles/neovim/.neoconf.json
Normal file
17
dotfiles/neovim/.neoconf.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"neoconf": {
|
||||
"plugins": {
|
||||
"sumneko_lua": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"neodev": {
|
||||
"library": {
|
||||
"enabled": true,
|
||||
"types": true,
|
||||
"plugins": false,
|
||||
"runtime": true
|
||||
}
|
||||
}
|
||||
}
|
128
dotfiles/neovim/README.md
Normal file
128
dotfiles/neovim/README.md
Normal file
|
@ -0,0 +1,128 @@
|
|||
# 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
|
||||
|
||||
Table of my own keybinds. Here as documentation for myself. I am yet to include any of the keybinds for cmp here.
|
||||
|
||||
> Things written using italics are chords
|
||||
> (aka all the keys need to be pressed at the same time)
|
||||
|
||||
| Keybind | Description | Plugins |
|
||||
| ------------ | ----------------------------------- | ------------------ |
|
||||
| _vs_ | Create vertical split | |
|
||||
| _cp_ | Use system clipboard | |
|
||||
| _jl_ | Save | |
|
||||
| _jk_ | Exit insert mode | |
|
||||
| _rw_ | Rename word under cursor | |
|
||||
| _\<leader>k_ | Insert digraph | |
|
||||
| _\<leader>a_ | Swap last 2 used buffers | |
|
||||
| C-n | Open tree | nvim-tree |
|
||||
| _vc_ | Clear vimux window | vimux |
|
||||
| _vl_ | Rerun last vimux command | vimux |
|
||||
| _vp_ | Run command in another tmux pane | vimux |
|
||||
| C-hjkl | Navigation between vim & tmux panes | vim-tmux-navigator |
|
||||
| J | Show line diagnostics | lspconfig |
|
||||
| K | Show hover info | lspconfig |
|
||||
| L | Signature help (?) | lspconfig |
|
||||
| gD | Go to declaration | lspconfig |
|
||||
| gd | Go to definition | lspconfig |
|
||||
| gi | Go to implementation | lspconfig |
|
||||
| \<leader>rn | Rename | lspconfig |
|
||||
| \<leader>f | format | lspconfig |
|
||||
| \<leader>ca | code actions | lspconfig |
|
||||
|
||||
### Telescope
|
||||
|
||||
| Keybind | Description | Plugins |
|
||||
| ----------- | ------------------------------ | ---------------------- |
|
||||
| Ctrl-P | Find files | |
|
||||
| Ctrl-F | Grep in project | |
|
||||
| \<leader>d | Diagnostics | lspconfig |
|
||||
| \<leader>ca | Code actions | lspconfig |
|
||||
| \<leader>t | Show builtin pickers | |
|
||||
| \<leader>s | Show symbols using tree-sitter | |
|
||||
| \<leader>gj | List git commits | |
|
||||
| \<leader>gk | List git branches | |
|
||||
| _jp_ | Interactive file broswer | telescope-file-browser |
|
||||
| _ui_ | Insert unicode char | |
|
||||
|
||||
### Idris
|
||||
|
||||
> The idris and arpeggio plugins are implicit here
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | ------------------- |
|
||||
| _isc_ | Case split |
|
||||
| _imc_ | Make case |
|
||||
| _iml_ | Make lemma |
|
||||
| _ies_ | Expression search |
|
||||
| _igd_ | Generate definition |
|
||||
| _irh_ | Refine hole |
|
||||
| _iac_ | Add clause |
|
||||
|
||||
### Purescript
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | ------------------------------------------- |
|
||||
| _vb_ | Make tmux run spago build in sepearate pane |
|
||||
| _vt_ | Make tmux run spago test in separate pane |
|
||||
|
||||
### Nix
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | ------------------------------------ |
|
||||
| _ug_ | Run nix-fetchgit on the current file |
|
||||
|
||||
### Lean
|
||||
|
||||
- Extra brackets: ⟨⟩
|
||||
|
||||
## Some cool vim keybinds I sometimes forget about
|
||||
|
||||
Documentation for myself
|
||||
|
||||
| Keybind | Description | Plugins |
|
||||
| ------- | ----------------------- | ------- |
|
||||
| zz | Center the current line | |
|
||||
|
||||
## Important plugins I use the default mappins of
|
||||
|
||||
- paperplanes
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | ------------------------- |
|
||||
| :PP | Create pastebin-like link |
|
||||
|
||||
- nvim-comment
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | ----------------- |
|
||||
| gcc | Comment line |
|
||||
| gc | Comment selection |
|
||||
|
||||
- neogit
|
||||
|
||||
| Keybind | Description |
|
||||
| ------- | ----------- |
|
||||
| C-g | Open neogit |
|
||||
|
||||
- gitlinker
|
||||
|
||||
| Keybind | Description |
|
||||
| ---------- | ------------------ |
|
||||
| <leader>gy | Create remote link |
|
||||
|
||||
- nvim-surround
|
||||
|
||||
| Keybind | Description | Mode |
|
||||
| -------- | ----------------------------------- | ---- |
|
||||
| cs[a][b] | Change surrounding pair from a to b | n |
|
||||
| ds[a] | Delete surrounding pair of a | n |
|
||||
| ys[m][a] | Surround the motion m with a | n |
|
||||
| S[a] | Surround selected code with a | v |
|
7
dotfiles/neovim/ftdetect/hkf.lua
Normal file
7
dotfiles/neovim/ftdetect/hkf.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
|
||||
group = vim.api.nvim_create_augroup("Detect hkf", {}),
|
||||
pattern = "*.hkf",
|
||||
callback = function()
|
||||
vim.opt.filetype = "hkf"
|
||||
end
|
||||
})
|
1
dotfiles/neovim/ftplugin/hkf.lua
Normal file
1
dotfiles/neovim/ftplugin/hkf.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.api.nvim_buf_set_option(0, "commentstring", "-- %s")
|
25
dotfiles/neovim/ftplugin/lua.lua
Normal file
25
dotfiles/neovim/ftplugin/lua.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local opts = function(desc)
|
||||
return { desc = desc, buffer = true }
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>lf", ":source %<cr>", opts("Run [l]ua [f]ile "))
|
||||
vim.keymap.set("n", "<leader>ls", 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.setup) == "function" then
|
||||
M.setup()
|
||||
print("M.setup() executed succesfully!")
|
||||
else
|
||||
print("Module does not return a setup function")
|
||||
end
|
||||
else
|
||||
print("Module returned nil")
|
||||
end
|
||||
else
|
||||
print("Cannot import current file :(")
|
||||
end
|
||||
end, opts("Run .setup() in current file"))
|
||||
|
9
dotfiles/neovim/ftplugin/nix.lua
Normal file
9
dotfiles/neovim/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")
|
32
dotfiles/neovim/ftplugin/purescript.lua
Normal file
32
dotfiles/neovim/ftplugin/purescript.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local A = require("my.abbreviations")
|
||||
|
||||
-- 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
|
||||
|
||||
local abbreviations = {
|
||||
{ "land", "/\\" },
|
||||
{ "lor", "\\/" },
|
||||
{ "tto", "->" },
|
||||
{ "iip", "=>" },
|
||||
{ "frl", "forall" },
|
||||
{ "ott", "<-" }, -- opposite of tto
|
||||
}
|
||||
|
||||
A.manyLocalAbbr(abbreviations)
|
||||
|
||||
|
178
dotfiles/neovim/ftplugin/tex.lua
Normal file
178
dotfiles/neovim/ftplugin/tex.lua
Normal file
|
@ -0,0 +1,178 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
|
||||
require("my.helpers.wrapMovement").setup()
|
||||
|
||||
vim.opt.conceallevel = 0
|
||||
vim.opt.wrap = true
|
||||
|
||||
-- vim.opt.foldcolumn = "1"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.opt.foldmethod = "expr"
|
||||
|
||||
-- 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 = {
|
||||
-- Greek chars
|
||||
{ "eps", "\\epsilon" },
|
||||
{ "delta", "\\delta" },
|
||||
{ "Delta", "\\Delta" },
|
||||
{ "pi", "\\pi" },
|
||||
{ "psi", "\\psi" },
|
||||
{ "alpha", "\\alpha" },
|
||||
{ "beta", "\\beta" },
|
||||
{ "theta", "\\theta" },
|
||||
{ "gamma", "\\gamma" },
|
||||
{ "lam", "\\lambda" },
|
||||
{ "nuls", "\\varnothing" }, -- Other fancy symvols
|
||||
|
||||
{ "tmat", "^T" }, -- Tranpose of a matrix
|
||||
{ "cmat", "^*" }, -- Conjugate of a matrix
|
||||
{ "ortco", "^{\\bot}" }, -- Orthogonal complement
|
||||
{ "sinter", "^{\\circ}" }, -- Interior of a set
|
||||
|
||||
-- Basic commands
|
||||
{ "mangle", "\\measuredangle" },
|
||||
{ "aangle", "\\angle" },
|
||||
|
||||
{ "sdiff", "\\setminus" },
|
||||
{ "sst", "\\subset" },
|
||||
{ "sseq", "\\subseteq" },
|
||||
{ "nin", "\\not\\in" },
|
||||
{ "iin", "\\in" },
|
||||
{ "tto", "\\to" },
|
||||
{ "iip", "\\implies" },
|
||||
{ "iff", "\\iff" },
|
||||
{ "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" },
|
||||
{ "comp", "\\circ" },
|
||||
{ "mul", "\\cdot" },
|
||||
{ "smul", "\\times" },
|
||||
{ "card", "\\#" },
|
||||
{ "div", "\\|" },
|
||||
{ "ndiv", "\\not\\|\\:" },
|
||||
|
||||
-- words
|
||||
{ "rref", "reduced row echalon form" }
|
||||
}
|
||||
|
||||
---@type ExpansionOptions
|
||||
local no_capitalization = { capitalized = false }
|
||||
|
||||
-- Todo: convert exponents and subscripts
|
||||
-- to use this more concise notation.
|
||||
---@type ExpansionInput[]
|
||||
local abolishAbbreviations = {
|
||||
-- General phrases
|
||||
{ "thrf", "therefore" },
|
||||
{ "bcla", "by contradiction let's assume" },
|
||||
{ "wlg", "without loss of generality" },
|
||||
{ "stam{,s}", "statement{}" },
|
||||
|
||||
-- Calculus
|
||||
{ "ib{p,s}", "integration by {parts,substitution}" },
|
||||
|
||||
-- Linear algebra
|
||||
{ "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}" },
|
||||
|
||||
-- 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}",
|
||||
"{\\\\\\&,&,}{=,\\neq,\\leq,\\geq,<,>}",
|
||||
options = no_capitalization
|
||||
},
|
||||
|
||||
-- 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\\},-,+}}",
|
||||
options = 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 = no_capitalization
|
||||
},
|
||||
|
||||
-- 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,})" },
|
||||
}
|
||||
|
||||
local expanded = scrap.expand_many(abolishAbbreviations)
|
||||
|
||||
-- print("Expanded")
|
||||
A.manyLocalAbbr(abbreviations)
|
||||
A.manyLocalAbbr(expanded)
|
||||
|
||||
vim.keymap.set("n", "<leader>lc", "<cmd>VimtexCompile<cr>",
|
||||
{ desc = "Compile current buffer using vimtex", buffer = true })
|
18
dotfiles/neovim/init.lua
Normal file
18
dotfiles/neovim/init.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
-- 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()
|
64
dotfiles/neovim/lazy-lock.json
Normal file
64
dotfiles/neovim/lazy-lock.json
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "5570fd797eae0790affb54ea669a150cad76db5d" },
|
||||
"abbreinder.nvim": { "branch": "main", "commit": "5b2b5ff08a9ada42238d733aeebc6d3d96314d77" },
|
||||
"abbremand.nvim": { "branch": "main", "commit": "d633341f632b0b2666dfc6dfe6b9842ba1610a1d" },
|
||||
"catppuccin": { "branch": "main", "commit": "3020af75aae098a77737d91ee37c7147c8450d99" },
|
||||
"clipboard-image.nvim": { "branch": "main", "commit": "d1550dc26729b7954f95269952e90471b838fa25" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" },
|
||||
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "e517188dab55493fb9034b4d4f1a508ccacfcd45" },
|
||||
"dhall-vim": { "branch": "master", "commit": "68500ef46ff3706f46c99db3be7a0c8abcf6a3ae" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "44585a0c0085765195e6961c15529ba6c5a2a13b" },
|
||||
"firenvim": { "branch": "master", "commit": "17a189f0f1e2d4197e00cd56dbeaed8c268bac8c" },
|
||||
"gitlinker.nvim": { "branch": "master", "commit": "c68d4873a14d2ae614875685ccca2e49472989e8" },
|
||||
"glow.nvim": { "branch": "main", "commit": "20d1cd087f8728f21a048a3b6259f6177237b39e" },
|
||||
"hydra.nvim": { "branch": "master", "commit": "7e2aa29f88d534371c6b0263d3abbfac7c2376ce" },
|
||||
"idris2-nvim": { "branch": "main", "commit": "dd850c1c67bcacd2395121b0898374fe9cdd228f" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "48c4aa2be19f79e79b465a9bb37ee9fbe6c606f5" },
|
||||
"iron.nvim": { "branch": "master", "commit": "f4131638454aeb96cbd92652dd8c396e48eb4118" },
|
||||
"kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" },
|
||||
"knap": { "branch": "main", "commit": "62eae7803d9d87d33513b3b565c6f5791f1de1ea" },
|
||||
"kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85173dcc4d7a39e67370571316a6290f31a0de4a" },
|
||||
"leap": { "branch": "main", "commit": "e0145906c5f004b23eb6ec876fad55ffd3382ec9" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "32a7382a75a52e8ad05f4cec7eeb8bbfbe80d461" },
|
||||
"mind.nvim": { "branch": "master", "commit": "5aa39d57d1091999ca5bdcdd056a27a032156c2d" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "590ff74e81694088c43f1f73982dcb7aa51c03ff" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "c045c0fe93b1f9c78443d0f3b88660fffbcf64a7" },
|
||||
"neogit": { "branch": "master", "commit": "0d6002c6af432343937283fb70791fc76fa7227c" },
|
||||
"nui.nvim": { "branch": "main", "commit": "4939282919885e1c83aff68ecb35b3cadf6015a9" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "d09d7d82cc26d63673cef85cb62895dd68aab6d8" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "03580d758231956d33c8dd91e2be195106a79fa4" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "c49ad26e894e137e401b1d294948c46327877eaf" },
|
||||
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "6b43ce561d97412cc512b569db6938e44529293e" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "951b6e7e55da8aee9566cc0b17c11f9451cec349" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "12e95e160d7d45b76a36bca6303dd8447ab77490" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "d816761ec1ea4a605689bc5f4111088459cf74d4" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" },
|
||||
"nvim_context_vt": { "branch": "master", "commit": "31436f34f3f95e4e70853cd653fdf78246cb0e85" },
|
||||
"paperplanes.nvim": { "branch": "master", "commit": "d704b2e1e594b32d454cc7e0c5f2cf9b391e3cc1" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" },
|
||||
"presence.nvim": { "branch": "main", "commit": "c1c54758824cbecd4e18065d37191f7666fdd097" },
|
||||
"purescript-vim": { "branch": "main", "commit": "7af25a840d38dc6767c85edd1f35c1f835618071" },
|
||||
"scrap.nvim": { "branch": "main", "commit": "16db44ae9403ec9c4b140394f294475d1af80a18" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "fdd158ce7554dc830fb86e0fe952cd9476cdf726" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "304508fb7bea78e3c0eeddd88c4837501e403ae8" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "fab3e2212e206f4f8b3bbaa656e129443c9b802e" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "e960efa60e97df58e089b00270f09d60f27202c8" },
|
||||
"venn.nvim": { "branch": "main", "commit": "c114563960b8fb1197695d42798d1f3e7190b798" },
|
||||
"vim-abolish": { "branch": "master", "commit": "3f0c8faadf0c5b68bcf40785c1c42e3731bfa522" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "8332f123a63c739c870c96907d987cc3ff719d24" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "18f0c7fc1e7181e6422247505727d7111c5da544" },
|
||||
"vim-wakatime": { "branch": "master", "commit": "7d8ca4667f46e783388609ca7f04a65e4389338a" },
|
||||
"vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "8682d3003595017cd8ffb4c860a07576647cc6f8" }
|
||||
}
|
4
dotfiles/neovim/lua/.luarc.json
Normal file
4
dotfiles/neovim/lua/.luarc.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
||||
"Lua.workspace.checkThirdParty": false
|
||||
}
|
19
dotfiles/neovim/lua/my/abbreviations.lua
Normal file
19
dotfiles/neovim/lua/my/abbreviations.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local M = {}
|
||||
|
||||
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
|
||||
|
||||
return M
|
19
dotfiles/neovim/lua/my/helpers.lua
Normal file
19
dotfiles/neovim/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
|
40
dotfiles/neovim/lua/my/helpers/env.lua
Normal file
40
dotfiles/neovim/lua/my/helpers/env.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local function makeEnv(cond)
|
||||
return {
|
||||
active = cond,
|
||||
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 os.getenv("INSIDE_NEOVIDE") == "1"
|
||||
end),
|
||||
firenvim = makeEnv(function()
|
||||
return vim.g.started_by_firenvim ~= nil
|
||||
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
dotfiles/neovim/lua/my/helpers/math/mod.lua
Normal file
15
dotfiles/neovim/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
|
15
dotfiles/neovim/lua/my/helpers/wrapMovement.lua
Normal file
15
dotfiles/neovim/lua/my/helpers/wrapMovement.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
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
|
||||
|
||||
function M.setup()
|
||||
swap("j")
|
||||
swap("k")
|
||||
swap("0")
|
||||
swap("$")
|
||||
end
|
||||
|
||||
return M
|
10
dotfiles/neovim/lua/my/init.lua
Normal file
10
dotfiles/neovim/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
|
103
dotfiles/neovim/lua/my/keymaps.lua
Normal file
103
dotfiles/neovim/lua/my/keymaps.lua
Normal file
|
@ -0,0 +1,103 @@
|
|||
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
|
||||
function M.nmap(from, to, desc, silent)
|
||||
if silent == nil then
|
||||
silent = true
|
||||
end
|
||||
vim.keymap.set("n", from, to, { desc = desc })
|
||||
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 current buffer / all buffers
|
||||
vim.keymap.set({ "n", "v" }, "<leader>q", function()
|
||||
local buf = vim.api.nvim_win_get_buf(0)
|
||||
|
||||
-- Only save if file is writable
|
||||
if vim.bo[buf].modifiable and not vim.bo[buf].readonly then
|
||||
vim.cmd([[write]])
|
||||
end
|
||||
|
||||
vim.cmd("q")
|
||||
end, { desc = "[Q]uit current buffer" })
|
||||
|
||||
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")
|
||||
-- }}}
|
||||
-- {{{ 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.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*
|
||||
-- }}}
|
||||
-- {{{ Allow quiting basic buffers with "q"
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help" },
|
||||
callback = function(event)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"q",
|
||||
"<cmd>close<cr>",
|
||||
{ buffer = event.buf, silent = true, desc = "[q]uit current buffer" }
|
||||
)
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
|
||||
return M
|
||||
end
|
||||
|
||||
return M
|
39
dotfiles/neovim/lua/my/lazy.lua
Normal file
39
dotfiles/neovim/lua/my/lazy.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("lazy").setup("my.plugins", {
|
||||
defaults = { lazy = true },
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
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 = { "catpuccin" },
|
||||
},
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
notify = false,
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
paths = {
|
||||
-- Extra runtime path specified by nix
|
||||
os.getenv("NVIM_EXTRA_RUNTIME") or "",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>L", "<cmd>Lazy<cr>", { desc = "[L]azy ui" })
|
||||
|
||||
return M
|
13
dotfiles/neovim/lua/my/neovide.lua
Normal file
13
dotfiles/neovim/lua/my/neovide.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local default_length = 0.04
|
||||
vim.g.neovide_floating_blur_amount_x = 3.0
|
||||
vim.g.neovide_floating_blur_amount_y = 3.0
|
||||
vim.g.neovide_transparency = 1.0
|
||||
vim.g.pumblend = 30
|
||||
vim.g.neovide_cursor_animation_length = default_length
|
||||
vim.g.neovide_cursor_animate_in_insert_mode = false
|
||||
end
|
||||
|
||||
return M
|
44
dotfiles/neovim/lua/my/options.lua
Normal file
44
dotfiles/neovim/lua/my/options.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
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
|
||||
|
||||
-- Line numbers
|
||||
vim.opt.number = true -- Show line numbers
|
||||
vim.opt.relativenumber = true -- Relative line numbers
|
||||
|
||||
-- TODO: only do this for specific filestypes
|
||||
vim.opt.expandtab = true -- Use spaces for the tab char
|
||||
|
||||
vim.opt.scrolloff = 4 -- Lines of context
|
||||
vim.opt.shiftround = true -- Round indent
|
||||
vim.opt.shiftwidth = 2 -- Size of an indent
|
||||
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.smartindent = true -- Insert indents automatically
|
||||
|
||||
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" }
|
||||
|
||||
-- Set leader
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldmethod = "marker"
|
||||
end
|
||||
|
||||
return M
|
18
dotfiles/neovim/lua/my/plugins/catppuccin.lua
Normal file
18
dotfiles/neovim/lua/my/plugins/catppuccin.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local M = {
|
||||
"catppuccin/nvim", name = "catppuccin",
|
||||
lazy = false
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local catppuccin = require("catppuccin")
|
||||
vim.g.catppuccin_flavour = os.getenv("CATPPUCCIN_FLAVOUR")
|
||||
|
||||
catppuccin.setup({ transparent_background = false, integrations = { nvimtree = true } })
|
||||
|
||||
vim.cmd [[highlight NotifyINFOIcon guifg=#d6b20f]]
|
||||
vim.cmd [[highlight NotifyINFOTitle guifg=#d6b20f]]
|
||||
|
||||
vim.cmd [[colorscheme catppuccin]]
|
||||
end
|
||||
|
||||
return M
|
39
dotfiles/neovim/lua/my/plugins/clipboard-image.lua
Normal file
39
dotfiles/neovim/lua/my/plugins/clipboard-image.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local M = {
|
||||
-- paste images from clipbaord
|
||||
"ekickx/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}",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
117
dotfiles/neovim/lua/my/plugins/cmp.lua
Normal file
117
dotfiles/neovim/lua/my/plugins/cmp.lua
Normal file
|
@ -0,0 +1,117 @@
|
|||
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 = {
|
||||
completion = {
|
||||
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 })
|
||||
|
||||
kind.kind = " " .. strings[1] .. " "
|
||||
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
|
14
dotfiles/neovim/lua/my/plugins/dashboard.lua
Normal file
14
dotfiles/neovim/lua/my/plugins/dashboard.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"glepnir/dashboard-nvim",
|
||||
lazy = false,
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local db = require("dashboard")
|
||||
db.custom_header = {}
|
||||
end
|
||||
|
||||
return M
|
19
dotfiles/neovim/lua/my/plugins/firenvim.lua
Normal file
19
dotfiles/neovim/lua/my/plugins/firenvim.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"glacambre/firenvim", -- vim inside chrome
|
||||
lazy = false,
|
||||
cond = env.firenvim.active(),
|
||||
}
|
||||
|
||||
function M.setup()
|
||||
vim.g.firenvim_config = {
|
||||
localSettings = {
|
||||
[".*"] = {
|
||||
filename = "/tmp/firenvim_{hostname}_{pathname%10}_{timestamp%32}.{extension}",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
127
dotfiles/neovim/lua/my/plugins/hydra.lua
Normal file
127
dotfiles/neovim/lua/my/plugins/hydra.lua
Normal file
|
@ -0,0 +1,127 @@
|
|||
local M = {
|
||||
-- keybinds where you only hit the head once
|
||||
"anuvyklack/hydra.nvim",
|
||||
dependencies = {
|
||||
"jbyuki/venn.nvim", -- draw ascii diagrams
|
||||
"mrjones2014/smart-splits.nvim", -- the name says it all
|
||||
},
|
||||
keys = { "<C-w>", "<leader>v" },
|
||||
}
|
||||
|
||||
local venn_hint = [[
|
||||
Arrow^^^^^^ Select region with <C-v>
|
||||
^ ^ _K_ ^ ^ _f_: surround it with box
|
||||
_H_ ^ ^ _L_
|
||||
^ ^ _J_ ^ ^ _<Esc>_
|
||||
]]
|
||||
|
||||
local window_hint = [[
|
||||
^^^^^^^^^^^^ 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
|
||||
]]
|
||||
|
||||
function M.config()
|
||||
local Hydra = require("hydra")
|
||||
local pcmd = require("hydra.keymap-util").pcmd
|
||||
local splits = require("smart-splits")
|
||||
|
||||
Hydra({
|
||||
name = "Draw Diagram",
|
||||
hint = venn_hint,
|
||||
config = {
|
||||
color = "pink",
|
||||
invoke_on_body = true,
|
||||
hint = {
|
||||
border = "rounded",
|
||||
},
|
||||
on_enter = function()
|
||||
vim.o.virtualedit = "all"
|
||||
end,
|
||||
},
|
||||
mode = "n",
|
||||
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 } },
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<C-w>", "<Nop>")
|
||||
|
||||
Hydra({
|
||||
name = "Windows",
|
||||
hint = window_hint,
|
||||
config = {
|
||||
invoke_on_body = true,
|
||||
hint = {
|
||||
border = "rounded",
|
||||
offset = -1,
|
||||
},
|
||||
},
|
||||
mode = "n",
|
||||
body = "<C-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>",
|
||||
function()
|
||||
splits.resize_left(2)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<C-j>",
|
||||
function()
|
||||
splits.resize_down(2)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<C-k>",
|
||||
function()
|
||||
splits.resize_up(2)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<C-l>",
|
||||
function()
|
||||
splits.resize_right(2)
|
||||
end,
|
||||
},
|
||||
{ "=", "<C-w>=", { desc = "equalize" } },
|
||||
|
||||
{ "s", pcmd("split", "E36") },
|
||||
{ "<C-s>", pcmd("split", "E36"), { desc = false } },
|
||||
{ "v", pcmd("vsplit", "E36") },
|
||||
{ "<C-v>", pcmd("vsplit", "E36"), { desc = false } },
|
||||
|
||||
{ "w", "<C-w>w", { exit = true, desc = false } },
|
||||
{ "<C-w>", "<C-w>w", { exit = true, desc = false } },
|
||||
|
||||
{ "o", "<C-w>o", { exit = true, desc = "remain only" } },
|
||||
{ "<C-o>", "<C-w>o", { exit = true, desc = false } },
|
||||
|
||||
{ "q", pcmd("close", "E444"), { desc = "close window" } },
|
||||
{ "<C-q>", pcmd("close", "E444"), { desc = false } },
|
||||
|
||||
{ "<Esc>", nil, { exit = true, desc = false } },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
44
dotfiles/neovim/lua/my/plugins/idris.lua
Normal file
44
dotfiles/neovim/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]plit")
|
||||
nmap("L", "make_lemma", "Make [l]emma")
|
||||
nmap("c", "add_clause", "Add [c]lause")
|
||||
nmap("s", "expr_search", "Expression [s]earch")
|
||||
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
|
217
dotfiles/neovim/lua/my/plugins/init.lua
Normal file
217
dotfiles/neovim/lua/my/plugins/init.lua
Normal file
|
@ -0,0 +1,217 @@
|
|||
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(),
|
||||
},
|
||||
|
||||
{
|
||||
"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(),
|
||||
},
|
||||
--}}}
|
||||
|
||||
{
|
||||
-- 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",
|
||||
},
|
||||
|
||||
"MunifTanjim/nui.nvim",
|
||||
|
||||
{
|
||||
"terrortylor/nvim-comment",
|
||||
keys = { "gc", "gcc", { "gc", mode = "v" } },
|
||||
config = function()
|
||||
require("nvim_comment").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- nice looking icons
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
|
||||
{
|
||||
-- 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(),
|
||||
},
|
||||
|
||||
{
|
||||
-- smooth scrolling
|
||||
"psliwka/vim-smoothie",
|
||||
-- enabled = env.neovide.not_active(),
|
||||
enabled = false,
|
||||
event = "VeryLazy",
|
||||
},
|
||||
|
||||
{
|
||||
-- show context on closing parenthesis
|
||||
-- TODO: move this to treesitter file
|
||||
"haringsrob/nvim_context_vt",
|
||||
event = "BufReadPost",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
-- show progress for lsp stuff
|
||||
"j-hui/fidget.nvim",
|
||||
event = "BufReadPre",
|
||||
cond = env.vscode.not_active(),
|
||||
config = true,
|
||||
},
|
||||
|
||||
{
|
||||
-- export to pastebin like services
|
||||
"rktjmp/paperplanes.nvim",
|
||||
config = {
|
||||
provider = "paste.rs",
|
||||
},
|
||||
keys = { "PP" },
|
||||
},
|
||||
|
||||
{
|
||||
-- case switching + the subvert command
|
||||
"tpope/vim-abolish",
|
||||
event = "VeryLazy",
|
||||
},
|
||||
|
||||
{
|
||||
-- reminds you of abbreviations
|
||||
"0styx0/abbreinder.nvim",
|
||||
dependencies = "0styx0/abbremand.nvim",
|
||||
event = "InsertEnter",
|
||||
},
|
||||
|
||||
{
|
||||
-- md preview (in terminal)
|
||||
"ellisonleao/glow.nvim",
|
||||
cmd = "Glow",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"frabjous/knap", -- md preview
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
-- automatically set options based on current file
|
||||
"tpope/vim-sleuth",
|
||||
event = "BufRead",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
-- vim-abolish rewrite
|
||||
"mateiadrielrafael/scrap.nvim",
|
||||
|
||||
{
|
||||
"ruifm/gitlinker.nvim", -- generate permalinks for code
|
||||
-- dependencies = { "plenary.nvim" },
|
||||
config = {
|
||||
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",
|
||||
},
|
||||
|
||||
{
|
||||
-- magit clone
|
||||
"TimUntersberger/neogit",
|
||||
-- dependencies = { "plenary.nvim" },
|
||||
cmd = "Neogit",
|
||||
enabled = 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 = true,
|
||||
},
|
||||
|
||||
{
|
||||
-- discord rich presence
|
||||
"andweeb/presence.nvim",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
config = function()
|
||||
require("presence"):setup()
|
||||
end,
|
||||
lazy = false,
|
||||
},
|
||||
}
|
63
dotfiles/neovim/lua/my/plugins/iron.lua
Normal file
63
dotfiles/neovim/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
|
22
dotfiles/neovim/lua/my/plugins/lean.lua
Normal file
22
dotfiles/neovim/lua/my/plugins/lean.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
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 {}
|
15
dotfiles/neovim/lua/my/plugins/leap.lua
Normal file
15
dotfiles/neovim/lua/my/plugins/leap.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local M = {
|
||||
-- removes the need for spamming w or e
|
||||
"ggandor/leap.nvim",
|
||||
name = "leap",
|
||||
event = "VeryLazy"
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("leap").add_default_mappings()
|
||||
end
|
||||
|
||||
-- (something)
|
||||
-- something
|
||||
|
||||
return M
|
220
dotfiles/neovim/lua/my/plugins/lspconfig.lua
Normal file
220
dotfiles/neovim/lua/my/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,220 @@
|
|||
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,
|
||||
},
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local M = {
|
||||
lspconfig,
|
||||
{
|
||||
"smjonas/inc-rename.nvim",
|
||||
cmd = "IncRename",
|
||||
config = {
|
||||
input_buffer_type = "dressing",
|
||||
},
|
||||
dependencies = {
|
||||
"dressing.nvim",
|
||||
},
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
}
|
||||
|
||||
function M.on_attach(client, bufnr)
|
||||
-- {{{ Auto format
|
||||
local function format()
|
||||
vim.lsp.buf.format({ async = false, bufnr = bufnr })
|
||||
end
|
||||
|
||||
if false and client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("LspFormatting", { clear = false }),
|
||||
buffer = bufnr,
|
||||
callback = format,
|
||||
})
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ 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
|
||||
-- }}}
|
||||
-- {{{ Go to declaration / definition / 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
|
||||
nmap("K", vim.lsp.buf.hover, "Hover")
|
||||
nmap("L", vim.lsp.buf.signature_help, "Signature help")
|
||||
-- }}}
|
||||
-- {{{ Code actions
|
||||
nmap("<leader>c", vim.lsp.buf.code_action, "[C]ode actions")
|
||||
nmap("<leader>F", format, "[F]ormat")
|
||||
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
|
||||
local servers = {
|
||||
-- {{{ Typescript
|
||||
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 = {
|
||||
purescript = {
|
||||
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
|
||||
formatter = "purs-tidy",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Haskell
|
||||
hls = {
|
||||
haskell = {
|
||||
-- set formatter
|
||||
formattingProvider = "ormolu",
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Lua
|
||||
sumneko_lua = {
|
||||
cmd = {
|
||||
"lua-language-server",
|
||||
"--logpath=/home/adrielus/.local/share/lua-language-server/log",
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ 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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
rnix = {},
|
||||
cssls = {},
|
||||
jsonls = {},
|
||||
rust_analyzer = {},
|
||||
dhall_lsp_server = {},
|
||||
}
|
||||
-- }}}
|
||||
-- {{{ Capabilities
|
||||
M.capabilities = function()
|
||||
-- require("lazy").load({ plugins = "hrsh7th/cmp-nvim-lsp" })
|
||||
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
|
29
dotfiles/neovim/lua/my/plugins/lualine.lua
Normal file
29
dotfiles/neovim/lua/my/plugins/lualine.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
theme = "catppuccin",
|
||||
},
|
||||
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
dotfiles/neovim/lua/my/plugins/luasnip.lua
Normal file
34
dotfiles/neovim/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
|
29
dotfiles/neovim/lua/my/plugins/mind.lua
Normal file
29
dotfiles/neovim/lua/my/plugins/mind.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
local M = {
|
||||
"phaazon/mind.nvim", -- Organize shit as trees
|
||||
cmd = "MindOpenMain",
|
||||
}
|
||||
|
||||
function M.init()
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>m",
|
||||
"<cmd>MindOpenMain<cr>",
|
||||
{ desc = "[M]ind panel" }
|
||||
)
|
||||
end
|
||||
|
||||
function M.config()
|
||||
local mind = require("mind")
|
||||
|
||||
mind.setup({
|
||||
persistence = {
|
||||
state_path = "~/Mind/mind.json",
|
||||
data_dir = "~/Mind/data",
|
||||
},
|
||||
ui = {
|
||||
width = 50,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
20
dotfiles/neovim/lua/my/plugins/moonwalk.lua
Normal file
20
dotfiles/neovim/lua/my/plugins/moonwalk.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local M = {}
|
||||
|
||||
-- function M.setup()
|
||||
-- require("moonwalk").add_loader("tl", function(src, path)
|
||||
-- local tl = require("tl")
|
||||
-- local errs = {}
|
||||
-- local _, program = tl.parse_program(tl.lex(src), errs)
|
||||
--
|
||||
-- if #errs > 0 then
|
||||
-- error(
|
||||
-- path .. ":" .. errs[1].y .. ":" .. errs[1].x .. ": " .. errs[1].msg,
|
||||
-- 0
|
||||
-- )
|
||||
-- end
|
||||
--
|
||||
-- return tl.pretty_print_ast(program)
|
||||
-- end)
|
||||
-- end
|
||||
|
||||
return M
|
12
dotfiles/neovim/lua/my/plugins/neoconf.lua
Normal file
12
dotfiles/neovim/lua/my/plugins/neoconf.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"folke/neoconf.nvim",
|
||||
cmd = "Neoconf",
|
||||
config = {
|
||||
-- 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
|
||||
},
|
||||
},
|
||||
}
|
27
dotfiles/neovim/lua/my/plugins/null-ls.lua
Normal file
27
dotfiles/neovim/lua/my/plugins/null-ls.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
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(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local sources = {
|
||||
null_ls.builtins.formatting.prettierd.with({ extra_filetypes = {} }), -- format ts files
|
||||
null_ls.builtins.formatting.stylua.with({}), -- format lua code
|
||||
-- null_ls.builtins.formatting.lua_format.with({}), -- format lua code
|
||||
}
|
||||
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
on_attach = lspconfig.on_attach,
|
||||
debug = true,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
20
dotfiles/neovim/lua/my/plugins/nvim-tree.lua
Normal file
20
dotfiles/neovim/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
|
12
dotfiles/neovim/lua/my/plugins/surround.lua
Normal file
12
dotfiles/neovim/lua/my/plugins/surround.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
local M = {
|
||||
-- work with brackets, quotes, tags, etc
|
||||
"tpope/vim-surround",
|
||||
event = "VeryLazy",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.g.surround_113 = '"\r"'
|
||||
vim.g.surround_97 = "'\r'"
|
||||
end
|
||||
|
||||
return M
|
80
dotfiles/neovim/lua/my/plugins/telescope.lua
Normal file
80
dotfiles/neovim/lua/my/plugins/telescope.lua
Normal file
|
@ -0,0 +1,80 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local telescope = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
dependencies = {
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
version = "0.1.x",
|
||||
pin = true,
|
||||
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>fp",
|
||||
find_files_by_extension("purs"),
|
||||
"[F]ind [p]urescript files",
|
||||
},
|
||||
{ "<Leader>d", "diagnostics", "[D]iagnostics" },
|
||||
{ "<C-F>", "live_grep", "[F]ind in project" },
|
||||
{ "<C-S-F>", "file_browser", "[F]ile browser" },
|
||||
{ "<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 = {
|
||||
file_browser = { path = "%:p:h" },
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("telescope").setup(settings)
|
||||
require("telescope").load_extension("fzf")
|
||||
require("telescope").load_extension("file_browser")
|
||||
end
|
||||
|
||||
return M
|
105
dotfiles/neovim/lua/my/plugins/treesitter.lua
Normal file
105
dotfiles/neovim/lua/my/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,105 @@
|
|||
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",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"c",
|
||||
"cpp",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"elixir",
|
||||
"fish",
|
||||
"html",
|
||||
"json",
|
||||
"jsonc",
|
||||
"latex",
|
||||
"python",
|
||||
"rust",
|
||||
"scss",
|
||||
"toml",
|
||||
"tsx",
|
||||
"vim",
|
||||
"yaml",
|
||||
"nix",
|
||||
},
|
||||
sync_install = false,
|
||||
--}}}
|
||||
--{{{ Highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "kotlin" },
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
--}}}
|
||||
--{{{ Incremental selection
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = "<C-s>",
|
||||
node_decremental = "<C-b>",
|
||||
},
|
||||
},
|
||||
--}}}
|
||||
--{{{ Textsubjects
|
||||
textsubjects = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
["."] = "textsubjects-smart",
|
||||
[";"] = "textsubjects-container-outer",
|
||||
},
|
||||
},
|
||||
--}}}
|
||||
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",
|
||||
["]c"] = "@class.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]F"] = "@function.outer",
|
||||
["]C"] = "@class.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[f"] = "@function.outer",
|
||||
["[c"] = "@class.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[F"] = "@function.outer",
|
||||
["[C"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
--}}}
|
||||
},
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
26
dotfiles/neovim/lua/my/plugins/vimtex.lua
Normal file
26
dotfiles/neovim/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
dotfiles/neovim/lua/my/plugins/vimux.lua
Normal file
40
dotfiles/neovim/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
|
36
dotfiles/neovim/lua/my/plugins/whichkey.lua
Normal file
36
dotfiles/neovim/lua/my/plugins/whichkey.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
local env = require("my.helpers.env")
|
||||
local M = {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local wk = require("which-key")
|
||||
|
||||
local winblend = 0
|
||||
|
||||
if env.neovide.active() then
|
||||
winblend = 30
|
||||
end
|
||||
|
||||
wk.setup({
|
||||
window = {
|
||||
winblend = winblend,
|
||||
},
|
||||
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" },
|
||||
v = "which_key_ignore",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
92
dotfiles/neovim/lua/telescope/extensions/unicode.lua
Normal file
92
dotfiles/neovim/lua/telescope/extensions/unicode.lua
Normal file
|
@ -0,0 +1,92 @@
|
|||
local M = {}
|
||||
local pickers = require "telescope.pickers"
|
||||
local finders = require "telescope.finders"
|
||||
local conf = require("telescope.config").values
|
||||
local actions = require "telescope.actions"
|
||||
local action_state = require "telescope.actions.state"
|
||||
local previewers = require "telescope.previewers"
|
||||
local utils = require "telescope.utils"
|
||||
|
||||
local add_abbreviations = false
|
||||
|
||||
local unicodeChars = {
|
||||
nats = "ℕ",
|
||||
rationals = "ℚ",
|
||||
reals = "ℝ",
|
||||
integers = "ℤ",
|
||||
forall = "∀",
|
||||
lambda = "λ",
|
||||
arrow = "→",
|
||||
compose = "∘",
|
||||
inverse = "⁻¹",
|
||||
dots = "…",
|
||||
alpha = "ɑ",
|
||||
beta = "β",
|
||||
pi = "π",
|
||||
Pi = 'Π',
|
||||
sigma = "σ",
|
||||
Sigma = "Σ",
|
||||
tau = "τ",
|
||||
theta = "θ",
|
||||
gamma = "γ",
|
||||
Gamma = "Γ",
|
||||
context = "Γ"
|
||||
}
|
||||
|
||||
-- our picker function for unicode chars
|
||||
function M.picker(opts)
|
||||
opts = opts or {}
|
||||
local results = {}
|
||||
|
||||
for key, value in pairs(unicodeChars) do
|
||||
-- Name: char pair
|
||||
table.insert(results, { key, value })
|
||||
end
|
||||
|
||||
print(results)
|
||||
|
||||
pickers.new(opts, {
|
||||
prompt_title = "Unicode characters",
|
||||
finder = finders.new_table {
|
||||
results = results,
|
||||
entry_maker = function(entry)
|
||||
return { value = entry, display = entry[1], ordinal = entry[1] }
|
||||
end
|
||||
},
|
||||
sorter = conf.generic_sorter(opts),
|
||||
previewer = previewers.new {
|
||||
preview_fn = function(_, entry) return entry.value[2] end
|
||||
},
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
|
||||
if selection == nil then
|
||||
utils.__warn_no_selection "my.abbreviations"
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_put({ selection.value[2] }, "", false, true)
|
||||
vim.cmd("startinsert")
|
||||
end)
|
||||
return true
|
||||
end
|
||||
}):find()
|
||||
end
|
||||
|
||||
function M.setupAbbreviations(prefix, ending)
|
||||
prefix = prefix or ""
|
||||
ending = ending or ""
|
||||
|
||||
if not add_abbreviations then return end
|
||||
|
||||
local abbreviate = require("my.abbreviations").abbr
|
||||
|
||||
for key, value in pairs(unicodeChars) do
|
||||
-- By default abbreviations are triggered using "_"
|
||||
abbreviate(prefix .. key .. ending, value)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
1
dotfiles/neovim/neoconf.json
Normal file
1
dotfiles/neovim/neoconf.json
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
32
dotfiles/neovim/syntax/hkf.vim
Normal file
32
dotfiles/neovim/syntax/hkf.vim
Normal file
|
@ -0,0 +1,32 @@
|
|||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax keyword kfKeyword alias template layer using path name input output assume fun as import exporting module unsafe def
|
||||
syntax keyword kfFunction LayerTemplate Sequence Chord Keycode Layer Broken
|
||||
|
||||
syntax match kfComment "\v--.*$"
|
||||
|
||||
syntax match kfOperator "\v_"
|
||||
syntax match kfOperator "\v\,"
|
||||
syntax match kfOperator "\v\."
|
||||
syntax match kfOperator "\v\:"
|
||||
syntax match kfOperator "\v\|"
|
||||
syntax match kfOperator "\v\="
|
||||
syntax match kfOperator "\v\=\>"
|
||||
syntax match kfOperator "\v\-\>"
|
||||
syntax match kfOperator "\v→"
|
||||
syntax match kfOperator "\v\*"
|
||||
syntax match kfOperator "\v\("
|
||||
syntax match kfOperator "\v\)"
|
||||
syntax match kfOperator "\vλ"
|
||||
|
||||
syntax region kfString start=/\v"/ skip=/\v\\./ end=/\v"/
|
||||
|
||||
highlight link kfKeyword Keyword
|
||||
highlight link kfFunction Function
|
||||
highlight link kfComment Comment
|
||||
highlight link kfOperator Operator
|
||||
highlight link kfString String
|
||||
|
||||
let b:current_syntax = "hkf"
|
3
dotfiles/neovim/tl/my/plugins/chunk.tl
Normal file
3
dotfiles/neovim/tl/my/plugins/chunk.tl
Normal file
|
@ -0,0 +1,3 @@
|
|||
function hi()
|
||||
print("Hello world!")
|
||||
end
|
3
dotfiles/vscode-snippets/README.md
Normal file
3
dotfiles/vscode-snippets/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Vscode snippets
|
||||
|
||||
These are snippets usable both in vscode and neovim, defined in vscode format.
|
49
dotfiles/vscode-snippets/package.json
Normal file
49
dotfiles/vscode-snippets/package.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
300
dotfiles/vscode-snippets/snippets/latex/core.json
Normal file
300
dotfiles/vscode-snippets/snippets/latex/core.json
Normal file
|
@ -0,0 +1,300 @@
|
|||
{
|
||||
"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"
|
||||
},
|
||||
"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}"]
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"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": ["\\[", "\t\\begin{aligned}", "\t\t$0", "\t\\end{aligned}", "\\]"]
|
||||
},
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
77
dotfiles/vscode-snippets/snippets/latex/explain.json
Normal file
77
dotfiles/vscode-snippets/snippets/latex/explain.json
Normal file
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
}
|
33
dotfiles/vscode-snippets/snippets/lua/core.json
Normal file
33
dotfiles/vscode-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)"
|
||||
]
|
||||
}
|
||||
}
|
77
dotfiles/vscode-snippets/snippets/purescript/deriving.json
Normal file
77
dotfiles/vscode-snippets/snippets/purescript/deriving.json
Normal file
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
62
dotfiles/vscode-snippets/snippets/purescript/imports.json
Normal file
62
dotfiles/vscode-snippets/snippets/purescript/imports.json
Normal file
|
@ -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
dotfiles/vscode-snippets/snippets/purescript/other.json
Normal file
61
dotfiles/vscode-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"]
|
||||
}
|
||||
}
|
217
flake.lock
Normal file
217
flake.lock
Normal file
|
@ -0,0 +1,217 @@
|
|||
{
|
||||
"nodes": {
|
||||
"agenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1665870395,
|
||||
"narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=",
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"rev": "a630400067c6d03c9b3e0455347dc8559db14288",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"base16": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1658847131,
|
||||
"narHash": "sha256-X6Mml7cT0YR3WCD5fkUhpRVV5ZPcwdcDsND8r8xMqTE=",
|
||||
"owner": "SenchoPens",
|
||||
"repo": "base16.nix",
|
||||
"rev": "6b404cda2e04ca3cf5ca7b877af9c469e1386acb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "SenchoPens",
|
||||
"repo": "base16.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"catppuccin-base16": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1665586920,
|
||||
"narHash": "sha256-fZDsmJ+xFjOJDoI+bPki9W7PEI5lT5aGoCYtkatcZ8A=",
|
||||
"owner": "catppuccin",
|
||||
"repo": "base16",
|
||||
"rev": "ca74b4070d6ead4213e92da1273fcc1853de7af8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "catppuccin",
|
||||
"repo": "base16",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1668681692,
|
||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1671966569,
|
||||
"narHash": "sha256-jbLgfSnmLchARBNFRvCic63CFQ9LAyvlXnBpc2kwjQc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "c55fa26ce05fee8e063db22918d05a73d430b2ea",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"impermanence": {
|
||||
"locked": {
|
||||
"lastModified": 1668668915,
|
||||
"narHash": "sha256-QjY4ZZbs9shwO4LaLpvlU2bO9J1juYhO9NtV3nrbnYQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"rev": "5df9108b346f8a42021bf99e50de89c9caa251c3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"neovim-flake": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"neovim-nightly-overlay",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"dir": "contrib",
|
||||
"lastModified": 1673238050,
|
||||
"narHash": "sha256-PEOcZLLChNoFVPTaveIWRABKXw6p6ow9du9Fe/bypro=",
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"rev": "c19bd47c0a2e3cc77d7f5e41ed184edb41685bd3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "contrib",
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"neovim-nightly-overlay": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"neovim-flake": "neovim-flake",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1673252101,
|
||||
"narHash": "sha256-9ewLxnRQhkWzDcO6aZAsYFHzKw6Y4ahLbZ1TUFOAmNE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "neovim-nightly-overlay",
|
||||
"rev": "8becc470aeb9d50d6a4b2e6025000cc4d18b967d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "neovim-nightly-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1671883564,
|
||||
"narHash": "sha256-C15oAtyupmLB3coZY7qzEHXjhtUx/+77olVdqVMruAg=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dac57a4eccf1442e8bf4030df6fcbb55883cb682",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-22.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
"base16": "base16",
|
||||
"catppuccin-base16": "catppuccin-base16",
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
37
flake.nix
37
flake.nix
|
@ -8,6 +8,25 @@
|
|||
# Home manager
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Agenix
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
agenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Base16-nix
|
||||
base16.url = github:SenchoPens/base16.nix;
|
||||
base16.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Catpuccin base16 color schemes
|
||||
catppuccin-base16.url = github:catppuccin/base16;
|
||||
catppuccin-base16.flake = false;
|
||||
|
||||
# Impermanence
|
||||
impermanence.url = "github:nix-community/impermanence";
|
||||
|
||||
# Neovim nightly
|
||||
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
|
||||
neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
|
@ -20,6 +39,11 @@
|
|||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
|
||||
specialArgs = {
|
||||
inherit inputs outputs;
|
||||
paths.dotfiles = "~/Projects/satellite/dotfiles";
|
||||
};
|
||||
in
|
||||
rec {
|
||||
# Acessible through 'nix build', 'nix shell', etc
|
||||
|
@ -48,9 +72,16 @@
|
|||
# Available through 'nixos-rebuild --flake .#...
|
||||
nixosConfigurations = {
|
||||
tethys = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs outputs; };
|
||||
inherit specialArgs;
|
||||
|
||||
modules = [
|
||||
./hosts/tethys
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users.adrielus = import ./home/adrielus/tethys.nix;
|
||||
home-manager.extraSpecialArgs = specialArgs;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
./hosts/nixos/tethys
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@ -60,7 +91,7 @@
|
|||
homeConfigurations = {
|
||||
"adrielus@tethys" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
extraSpecialArgs = { inherit inputs outputs; };
|
||||
extraSpecialArgs = specialArgs;
|
||||
modules = [
|
||||
./home/adrielus/tethys.nix
|
||||
];
|
||||
|
|
6
home/adrielus/features/cli/bat.nix
Normal file
6
home/adrielus/features/cli/bat.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config.theme = "base16";
|
||||
};
|
||||
}
|
27
home/adrielus/features/cli/default.nix
Normal file
27
home/adrielus/features/cli/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, ... }: {
|
||||
imports = [ ./bat.nix ./git.nix ./ssh.nix ./fish.nix ./tmux ./starship.nix ];
|
||||
|
||||
# Enable bash
|
||||
programs.bash.enable = true;
|
||||
|
||||
# Enable direnv
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
|
||||
# Install clis
|
||||
home.packages = with pkgs; [
|
||||
tree # Print directory structure
|
||||
ranger # Terminal file explorer
|
||||
comma # Intstall and run programs by sticking a , before them
|
||||
bc # Calculator
|
||||
ncdu # TUI disk usage
|
||||
exa # Better ls
|
||||
ripgrep # Better grep
|
||||
fd # Better find
|
||||
httpie # Better curl
|
||||
mkpasswd # Hash passwords
|
||||
neofetch # Display system information
|
||||
unzip # For working with .zip files
|
||||
unrar # For extracting shit from rars
|
||||
];
|
||||
}
|
75
home/adrielus/features/cli/fish.nix
Normal file
75
home/adrielus/features/cli/fish.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
base16-fish = pkgs.fetchFromGitHub {
|
||||
owner = "tomyun";
|
||||
repo = "base16-fish";
|
||||
sha256 = "142fmqm324gy3qsv48vijm5k81v6mw85ym9mmhnvyv2q2ndg5rix";
|
||||
rev = "2f6dd973a9075dabccd26f1cded09508180bf5fe";
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
shellAbbrs = {
|
||||
ls = "exa -la";
|
||||
cat = "bat";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
# Print available battery
|
||||
battery = "acpi";
|
||||
|
||||
# Rebuild nixos
|
||||
rebuild = "sudo -u adrielus nixos-rebuild switch --flake ~/Projects/nixos-config/";
|
||||
};
|
||||
|
||||
plugins = with pkgs.fishPlugins; [
|
||||
# Jump to directories by typing "z <directory-name>"
|
||||
{
|
||||
name = "z";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "jethrokuan";
|
||||
repo = "z";
|
||||
rev = "85f863f20f24faf675827fb00f3a4e15c7838d76";
|
||||
sha256 = "1kaa0k9d535jnvy8vnyxd869jgs0ky6yg55ac1mxcxm8n0rh2mgq";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
interactiveShellInit =
|
||||
# Start tmux if not already inside tmux
|
||||
''
|
||||
if status is-interactive
|
||||
and not set -q TMUX
|
||||
exec tmux attach -t Welcome || tmux || echo "Something went wrong trying to start tmux"
|
||||
end
|
||||
'' +
|
||||
# Sets cursor based on vim mode
|
||||
''
|
||||
set fish_cursor_default block # Set the normal and visual mode cursors to a block
|
||||
set fish_cursor_insert line # Set the insert mode cursor to a line
|
||||
set fish_cursor_replace_one underscore # Set the replace mode cursor to an underscore
|
||||
|
||||
# Force fish to skip some checks (I think)
|
||||
set fish_vi_force_cursor
|
||||
'' +
|
||||
# Use vim-style keybinds
|
||||
''
|
||||
function fish_user_key_bindings
|
||||
# Use the vim keybinds
|
||||
fish_vi_key_bindings
|
||||
|
||||
bind -e -M insert -k f10 # unbinds f10
|
||||
bind -M insert -m default -k f10 'commandline -f repaint' # Exit insert mode with <f10>
|
||||
end
|
||||
'' +
|
||||
# Starship hook
|
||||
''
|
||||
starship init fish | source
|
||||
'' +
|
||||
# Theming
|
||||
(builtins.readFile (config.scheme base16-fish))
|
||||
;
|
||||
};
|
||||
}
|
26
home/adrielus/features/cli/git.nix
Normal file
26
home/adrielus/features/cli/git.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ pkgs, ... }: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitFull;
|
||||
|
||||
aliases = {
|
||||
graph = "log --decorate --oneline --graph";
|
||||
};
|
||||
|
||||
userName = "Matei Adriel";
|
||||
userEmail = "rafaeladriel11@gmail.com";
|
||||
|
||||
extraConfig = {
|
||||
github.user = "Mateiadrielrafael";
|
||||
hub.protocol = "ssh";
|
||||
core.editor = "nvim";
|
||||
rebase.autoStash = true;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# Two github clis
|
||||
gh
|
||||
hub
|
||||
];
|
||||
}
|
7
home/adrielus/features/cli/ssh.nix
Normal file
7
home/adrielus/features/cli/ssh.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ ... }: {
|
||||
programs.ssh.enable = true;
|
||||
|
||||
# home.persistence = {
|
||||
# "/persist/home/adrielus".directories = [ ".ssh" ];
|
||||
# };
|
||||
}
|
5
home/adrielus/features/cli/starship.nix
Normal file
5
home/adrielus/features/cli/starship.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
36
home/adrielus/features/cli/tmux/default.nix
Normal file
36
home/adrielus/features/cli/tmux/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
base16-tmux = pkgs.fetchFromGitHub {
|
||||
owner = "tinted-theming";
|
||||
repo = "base16-tmux";
|
||||
sha256 = "1p6czpd9f0sbibdsph1hdw4ljp6zzjij2159bks16wbfbg3p1hhx";
|
||||
rev = "3312bb2cbb26db7eeb2d2235ae17d4ffaef5e59b";
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
|
||||
clock24 = true; # 24h clock format
|
||||
historyLimit = 10000; # increase amount of saved lines
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
sessionist # Nicer workflow for switching around between sessions
|
||||
resurrect # Save / restore tmux sessions
|
||||
{
|
||||
plugin = continuum; # Automatically restore tmux sessions
|
||||
extraConfig = ''
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-boot 'on'
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
source ${./tmux.conf}
|
||||
|
||||
# Theme
|
||||
${builtins.readFile (config.scheme base16-tmux)}
|
||||
'';
|
||||
};
|
||||
}
|
62
home/adrielus/features/cli/tmux/tmux.conf
Normal file
62
home/adrielus/features/cli/tmux/tmux.conf
Normal file
|
@ -0,0 +1,62 @@
|
|||
# {{{ Remap prefix to Control + a
|
||||
set -g prefix C-a
|
||||
unbind C-b
|
||||
bind C-a send-prefix
|
||||
# }}}
|
||||
# {{{ Hide status bar
|
||||
set -g status off
|
||||
# }}}
|
||||
# {{{ Don't rename windows automatically
|
||||
set-option -g allow-rename off
|
||||
# }}}
|
||||
# {{{ Fix slow esc
|
||||
set -sg escape-time 10
|
||||
# }}}
|
||||
# {{{ Visual stuff
|
||||
set -g default-terminal "screen-256color"
|
||||
set -ga terminal-overrides ",xterm-256color:Tc"
|
||||
# }}}
|
||||
# {{{ Split panes with \ and -
|
||||
bind \\ split-window -h
|
||||
bind - split-window -v
|
||||
unbind '"'
|
||||
unbind %
|
||||
# }}}
|
||||
# {{{ Zoom with C-z
|
||||
unbind C-z
|
||||
bind -n C-z resize-pane -Z
|
||||
# }}}
|
||||
# {{{ Vim-mode
|
||||
set-window-option -g mode-keys vi
|
||||
# }}}
|
||||
# {{{ Vim like keybinds for leaving insert mode
|
||||
unbind [ # unbind the default way to copy text
|
||||
bind -T prefix j copy-mode # allow exiting insert mode with C-a j
|
||||
# }}}
|
||||
# {{{ Vim like keybinds for copying and pasting
|
||||
bind -T copy-mode-vi p paste-buffer
|
||||
bind -T copy-mode-vi V send-keys -X rectangle-toggle # Check if this works
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind -T copy-mode-vi y send-keys -X copy-selection
|
||||
# }}}
|
||||
# {{{ Smart pane switching with awareness of Vim splits.
|
||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||
# Also see: https://github.com/christoomey/vim-tmux-navigator/issues/264
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|\.?n?vim?x?(-wrapped)?)(diff)?$'"
|
||||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
|
||||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
|
||||
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
|
||||
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
|
||||
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
||||
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
||||
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
||||
|
||||
bind-key -T copy-mode-vi 'C-h' select-pane -L
|
||||
bind-key -T copy-mode-vi 'C-j' select-pane -D
|
||||
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
||||
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
||||
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||||
# }}}
|
28
home/adrielus/features/desktop/common/polybar/default.nix
Normal file
28
home/adrielus/features/desktop/common/polybar/default.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ pkgs, lib, paths, config, ... }:
|
||||
let
|
||||
base16-polybar = pkgs.fetchFromGitHub {
|
||||
owner = "tinted-theming";
|
||||
repo = "base16-polybar";
|
||||
sha256 = "142fmqm324gy3qsv48vijm5k81v6mw85ym9mmhnvyv2q2ndg5rix";
|
||||
rev = "2f6dd973a9075dabccd26f1cded09508180bf5fe";
|
||||
};
|
||||
in
|
||||
{
|
||||
services.polybar = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
; Generated theme
|
||||
${builtins.readFile (config.scheme base16-polybar)}
|
||||
|
||||
; Actual config
|
||||
include-file = ${paths.dotfiles}/polybar/config.ini
|
||||
'';
|
||||
};
|
||||
|
||||
xsession = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
polybar main &
|
||||
'';
|
||||
};
|
||||
}
|
111
home/adrielus/features/desktop/common/polybar/polybar.ini
Normal file
111
home/adrielus/features/desktop/common/polybar/polybar.ini
Normal file
|
@ -0,0 +1,111 @@
|
|||
[module/battery]
|
||||
type = internal/battery
|
||||
|
||||
; Use the following command to list batteries and adapters:
|
||||
; $ ls -1 /sys/class/power_supply/
|
||||
battery = BAT0
|
||||
adapter = AC
|
||||
|
||||
format-charging = <animation-charging> <label-charging>
|
||||
format-discharging = <animation-discharging> <label-discharging>
|
||||
format-low = <animation-low> <label-low>
|
||||
|
||||
; Only applies if <animation-charging> is used
|
||||
animation-charging-0 =
|
||||
animation-charging-1 =
|
||||
animation-charging-2 =
|
||||
animation-charging-3 =
|
||||
animation-charging-4 =
|
||||
; Framerate in milliseconds
|
||||
animation-charging-framerate = 750
|
||||
|
||||
; Only applies if <animation-discharging> is used
|
||||
animation-discharging-0 =
|
||||
animation-discharging-1 =
|
||||
animation-discharging-2 =
|
||||
animation-discharging-3 =
|
||||
animation-discharging-4 =
|
||||
; Framerate in milliseconds
|
||||
animation-discharging-framerate = 500
|
||||
|
||||
; Only applies if <animation-low> is used
|
||||
; New in version 3.6.0
|
||||
animation-low-0 = !
|
||||
animation-low-1 =
|
||||
animation-low-framerate = 200
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
date = %d-%m-%Y%
|
||||
time = %H:%M
|
||||
label = %date% %time%
|
||||
|
||||
[module/wireless-network]
|
||||
type = internal/network
|
||||
interface = wlp0s20f3
|
||||
|
||||
format-connected = <label-connected>
|
||||
format-packetloss = <animation-packetloss> <label-connected>
|
||||
format-disconnected = <label-disconnected>
|
||||
|
||||
label-connected = %essid% %downspeed% %upspeed%
|
||||
label-disconnected = 睊
|
||||
label-packetloss = %essid%
|
||||
|
||||
animation-packetloss-0 = ⚠
|
||||
animation-packetloss-0-foreground = #ffa64c
|
||||
animation-packetloss-1 = 📶
|
||||
animation-packetloss-1-foreground = #000000
|
||||
animation-packetloss-framerate = 500
|
||||
|
||||
[module/ewmh]
|
||||
type = internal/xworkspaces
|
||||
icon-0 = 1:dev;
|
||||
icon-1 = 2:browser;
|
||||
icon-2 = 3:chat;ﭮ
|
||||
icon-3 = 4:terminal;
|
||||
icon-4 = 5:reading;
|
||||
icon-default =
|
||||
|
||||
format = <label-state>
|
||||
|
||||
label-active = %icon%
|
||||
label-active-background = ${color.base05}
|
||||
label-active-foreground = ${color.base00}
|
||||
label-active-padding = 2
|
||||
|
||||
label-urgent = %icon%
|
||||
label-urgent-background = ${color.base09}
|
||||
label-urgent-foreground = ${color.base00}
|
||||
label-urgent-padding = 2
|
||||
|
||||
label-occupied = %icon%
|
||||
label-occupied-padding = 2
|
||||
|
||||
label-empty =
|
||||
|
||||
[bar/main]
|
||||
font-0 = FiraCode Nerd Font:style=Regular
|
||||
font-1 = Source Code Pro Nerd Font:style=Regular
|
||||
|
||||
modules-left = date battery
|
||||
modules-center = ewmh
|
||||
modules-right = wireless-network
|
||||
|
||||
padding-right = 2
|
||||
padding-left = 2
|
||||
padding-top = 4
|
||||
module-margin = 2
|
||||
|
||||
height=4%
|
||||
|
||||
border-top-size = 1
|
||||
border-top-color = ${color.base05}
|
||||
|
||||
background = ${color.base00}
|
||||
foreground = ${color.base05}
|
||||
|
||||
bottom = true
|
98
home/adrielus/features/desktop/common/rofi/config.rasi
Normal file
98
home/adrielus/features/desktop/common/rofi/config.rasi
Normal file
|
@ -0,0 +1,98 @@
|
|||
configuration {
|
||||
location: 0;
|
||||
cycle: true;
|
||||
font: "Source Code Pro 16";
|
||||
|
||||
modi: "run,drun,window";
|
||||
icon-theme: "Oranchelo";
|
||||
show-icons: true;
|
||||
terminal: "alacritty";
|
||||
drun-display-format: "{icon} {name}";
|
||||
disable-history: false;
|
||||
hide-scrollbar: true;
|
||||
display-drun: " Apps ";
|
||||
display-run: " Run ";
|
||||
display-window: " Window";
|
||||
display-Network: " Network";
|
||||
sidebar-mode: true;
|
||||
}
|
||||
|
||||
listview {
|
||||
columns: 1;
|
||||
}
|
||||
|
||||
* {
|
||||
width: 600;
|
||||
font: "JetBrainsMono Nerd Font 14";
|
||||
}
|
||||
|
||||
element-text, element-icon , mode-switcher {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
|
||||
window {
|
||||
border: 3px;
|
||||
|
||||
height: 50%;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
inputbar {
|
||||
children: [prompt,entry];
|
||||
border-radius: 5px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
prompt {
|
||||
padding: 6px;
|
||||
border-radius: 3px;
|
||||
margin: 20px 0px 0px 20px;
|
||||
}
|
||||
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: ":";
|
||||
}
|
||||
|
||||
entry {
|
||||
padding: 6px;
|
||||
margin: 20px 0px 0px 10px;
|
||||
}
|
||||
|
||||
listview {
|
||||
border: 0px 0px 0px;
|
||||
padding: 6px 0px 0px;
|
||||
margin: 10px 0px 0px 20px;
|
||||
columns: 2;
|
||||
lines: 5;
|
||||
}
|
||||
|
||||
element {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
element-icon {
|
||||
size: 25px;
|
||||
}
|
||||
|
||||
mode-switcher {
|
||||
spacing: 0;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
}
|
||||
|
||||
message {
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
textbox {
|
||||
padding: 6px;
|
||||
margin: 20px 0px 0px 20px;
|
||||
}
|
20
home/adrielus/features/desktop/common/rofi/default.nix
Normal file
20
home/adrielus/features/desktop/common/rofi/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
base16-rofi = pkgs.fetchFromGitHub {
|
||||
owner = "tinted-theming";
|
||||
repo = "base16-rofi";
|
||||
sha256 = "03y4ydnd6sijscrrp4qdvckrckscd39r8gyhpzffs60a1w4n76j5";
|
||||
rev = "3f64a9f8d8cb7db796557b516682b255172c4ab4";
|
||||
};
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [ rofi ];
|
||||
|
||||
xdg.configFile."rofi/config.rasi".text = ''
|
||||
// Manual config
|
||||
${builtins.readFile ./config.rasi}
|
||||
|
||||
// Theme
|
||||
${builtins.readFile (config.scheme base16-rofi)}
|
||||
'';
|
||||
}
|
3
home/adrielus/features/desktop/xmonad.nix
Normal file
3
home/adrielus/features/desktop/xmonad.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
imports = [ ./common/rofi ];
|
||||
}
|
89
home/adrielus/features/neovim/default.nix
Normal file
89
home/adrielus/features/neovim/default.nix
Normal file
|
@ -0,0 +1,89 @@
|
|||
{ pkgs, lib, config, paths, ... }:
|
||||
let
|
||||
devMode = false;
|
||||
extraPackages = with pkgs; [
|
||||
# Language servers
|
||||
nodePackages.typescript-language-server # typescript
|
||||
nodePackages_latest.purescript-language-server # purescript
|
||||
sumneko-lua-language-server # lua
|
||||
rnix-lsp # nix
|
||||
haskell-language-server # haskell
|
||||
tectonic # something related to latex (?)
|
||||
texlab # latex
|
||||
nodePackages_latest.vscode-langservers-extracted
|
||||
|
||||
# Formatters
|
||||
luaformatter # Lua
|
||||
stylua # Lua
|
||||
ormolu # Haskell
|
||||
nodePackages_latest.purs-tidy # Purescript
|
||||
nodePackages_latest.prettier_d_slim # Js & friends
|
||||
|
||||
# Others
|
||||
nodePackages.typescript # typescript
|
||||
wakatime # time tracking
|
||||
fd # file finder
|
||||
ripgrep # Grep rewrite
|
||||
update-nix-fetchgit # Useful for nix stuff
|
||||
tree-sitter # Syntax highlighting
|
||||
libstdcxx5 # Required by treesitter aparently
|
||||
zathura # Pdf reader
|
||||
xdotool # For zathura reverse search or whatever it's called
|
||||
lua # For repls and whatnot
|
||||
glow #Mmd preview in terminal
|
||||
pandoc # Md processing
|
||||
libsForQt5.falkon # Aparently needed for md preview
|
||||
|
||||
texlive.combined.scheme-full # Latex stuff
|
||||
python38Packages.pygments # required for latex syntax highlighting
|
||||
];
|
||||
in
|
||||
let
|
||||
simlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
|
||||
extraRuntime = [
|
||||
(if devMode
|
||||
then simlink "${paths.dotfiles}/vscode-snippets"
|
||||
else ../../../../dotfiles/vscode-snippets)
|
||||
];
|
||||
|
||||
# Wraps a neovim client, providing the dependencies
|
||||
# and setting some flags:
|
||||
#
|
||||
# TODO: change this to a more general thing like "NVIM_CLIENT_NAME"
|
||||
# - INSIDE_NEOVIDE is used to detect when running inside neovide,
|
||||
# before the in-client flag gets set (this was causing me problems in the past)
|
||||
#
|
||||
# - NVIM_EXTRA_RUNTIME provides extra directories to add to the runtimepath.
|
||||
# I cannot just install those dirs using the builtin package support because
|
||||
# my package manager (lazy.nvim) disables those.
|
||||
wrapClient = { base, name }:
|
||||
pkgs.symlinkJoin {
|
||||
inherit (base) name meta;
|
||||
paths = [ base ];
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/${name} \
|
||||
--prefix PATH : ${lib.makeBinPath extraPackages} \
|
||||
--set INSIDE_NEOVIDE ${if name == "neovide" then "1" else "0"} \
|
||||
--set NVIM_EXTRA_RUNTIME ${lib.strings.concatStringsSep "," extraRuntime}
|
||||
'';
|
||||
};
|
||||
|
||||
neovim = wrapClient { base = pkgs.neovim-nightly; name = "nvim"; };
|
||||
neovide = wrapClient { base = pkgs.neovide; name = "neovide"; };
|
||||
in
|
||||
{
|
||||
# Do not manage neovim via nix
|
||||
programs.neovim.enable = false;
|
||||
|
||||
home.file.".config/nvim".source =
|
||||
if devMode then
|
||||
simlink "${paths.dotfiles}/neovim" else
|
||||
../../../../dotfiles/neovim;
|
||||
|
||||
home.packages = [
|
||||
neovim
|
||||
neovide
|
||||
];
|
||||
}
|
48
home/adrielus/global/default.nix
Normal file
48
home/adrielus/global/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{ inputs, lib, pkgs, config, outputs, ... }:
|
||||
let
|
||||
imports = [
|
||||
# inputs.impermanence.nixosModules.home-manager.impermanence
|
||||
inputs.base16.homeManagerModule
|
||||
|
||||
../features/cli
|
||||
../features/neovim
|
||||
];
|
||||
|
||||
# Import all modules defined in modules/home-manager
|
||||
moduleImports = builtins.attrValues outputs.homeManagerModules;
|
||||
in
|
||||
{
|
||||
imports = imports ++ moduleImports;
|
||||
|
||||
nixpkgs = {
|
||||
# Add all overlays defined in the overlays directory
|
||||
overlays = builtins.attrValues outputs.overlays ++
|
||||
[
|
||||
inputs.neovim-nightly-overlay.overlay
|
||||
];
|
||||
|
||||
# Allow unfree packages
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = (_: true);
|
||||
};
|
||||
};
|
||||
|
||||
# Nicely reload system units when changing configs
|
||||
systemd.user.startServices = "sd-switch";
|
||||
|
||||
# Enable the home-manager and git clis
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
git.enable = true;
|
||||
};
|
||||
|
||||
scheme = lib.mkDefault "${inputs.catppuccin-base16}/base16/latte.yaml";
|
||||
|
||||
# Set reasonable defaults for some settings
|
||||
home = {
|
||||
username = lib.mkDefault "adrielus";
|
||||
homeDirectory = lib.mkDefault "/home/${config.home.username}";
|
||||
stateVersion = lib.mkDefault "22.11";
|
||||
};
|
||||
}
|
|
@ -1,32 +1,6 @@
|
|||
{ inputs, outputs, lib, config, pkgs, ... }: {
|
||||
imports = [
|
||||
|
||||
./global
|
||||
./features/desktop/xmonad.nix
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
# You can add overlays here
|
||||
overlays = [
|
||||
];
|
||||
|
||||
# Configure your nixpkgs instance
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = (_: true);
|
||||
};
|
||||
};
|
||||
|
||||
home = {
|
||||
username = "rafael";
|
||||
homeDirectory = "/home/rafael";
|
||||
};
|
||||
|
||||
# Enable home-manager and git
|
||||
programs.home-manager.enable = true;
|
||||
programs.git.enable = true;
|
||||
|
||||
# Nicely reload system units when changing configs
|
||||
systemd.user.startServices = "sd-switch";
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
home.stateVersion = "22.11";
|
||||
}
|
||||
|
|
25
hosts/nixos/common/global/default.nix
Normal file
25
hosts/nixos/common/global/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Configuration pieces included on all (nixos) hosts
|
||||
{ inputs, outputs, ... }: {
|
||||
imports = [
|
||||
inputs.agenix.nixosModule
|
||||
# inputs.impermanence.nixosModule
|
||||
|
||||
./nix.nix
|
||||
./openssh.nix
|
||||
./fish.nix
|
||||
./locale.nix
|
||||
./wireless.nix
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
# Add all overlays defined in the overlays directory
|
||||
overlays = builtins.attrValues outputs.overlays ++ [
|
||||
inputs.neovim-nightly-overlay.overlay
|
||||
];
|
||||
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
10
hosts/nixos/common/global/fish.nix
Normal file
10
hosts/nixos/common/global/fish.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
vendor = {
|
||||
completions.enable = true;
|
||||
config.enable = true;
|
||||
functions.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
4
hosts/nixos/common/global/locale.nix
Normal file
4
hosts/nixos/common/global/locale.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ pkgs, ... }: {
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
time.timeZone = "Europe/Amsterdam";
|
||||
}
|
59
hosts/nixos/common/global/nix.nix
Normal file
59
hosts/nixos/common/global/nix.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ config, lib, pkgs, inputs, ... }: {
|
||||
nix = {
|
||||
# Flake support and whatnot
|
||||
package = pkgs.nixUnstable;
|
||||
|
||||
# Weekly clean up the store, I think
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
};
|
||||
|
||||
# Protect nix shell from garbage collection
|
||||
extraOptions = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
|
||||
# TODO: look into what this does,
|
||||
# and why it was here in my old config
|
||||
optimise.automatic = true;
|
||||
|
||||
# This will add each flake input as a registry
|
||||
# To make nix3 commands consistent with your flake
|
||||
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
|
||||
|
||||
# This will additionally add your inputs to the system's legacy channels
|
||||
# Making legacy nix commands consistent as well, awesome!
|
||||
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
|
||||
|
||||
settings = {
|
||||
# Enable flakes and new 'nix' command
|
||||
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
|
||||
|
||||
# Disable warning when rebuilding before commiting
|
||||
warn-dirty = false;
|
||||
|
||||
# Deduplicate and optimize nix store
|
||||
auto-optimise-store = true;
|
||||
|
||||
# TODO: what is a trusted user?
|
||||
trusted-users = [ "root" "@wheel" ];
|
||||
|
||||
# {{{ Caching and whatnot
|
||||
substituters = [
|
||||
"https://cache.nixos.org" # Default nixos cache
|
||||
"https://nix-community.cachix.org" # I think I need this for neovim-nightly?
|
||||
"https://cm-idris2-pkgs.cachix.org" # Idris packages
|
||||
"https://danth.cachix.org" # stylix
|
||||
];
|
||||
|
||||
trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"cm-idris2-pkgs.cachix.org-1:YB2oJSEsD5oMJjAESxolC2GQtE6B5I6jkWhte2gtXjk="
|
||||
"danth.cachix.org-1:wpodfSL7suXRc/rJDZZUptMa1t4MJ795hemRN0q84vI="
|
||||
];
|
||||
# }}}
|
||||
};
|
||||
};
|
||||
}
|
51
hosts/nixos/common/global/openssh.nix
Normal file
51
hosts/nixos/common/global/openssh.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
# This setups a SSH server.
|
||||
{ outputs, config, lib, ... }:
|
||||
let
|
||||
# Record containing all the hosts
|
||||
hosts = outputs.nixosConfigurations;
|
||||
|
||||
# Name of the current hostname
|
||||
hostname = config.networking.hostName;
|
||||
|
||||
# Function from hostname to relative path to public ssh key
|
||||
pubKey = host: ../../${host}/ssh_host_ed25519_key.pub;
|
||||
in
|
||||
{
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
|
||||
# Forbid root login through SSH.
|
||||
permitRootLogin = "no";
|
||||
|
||||
# Use keys only. Remove if you want to SSH using password (not recommended)
|
||||
passwordAuthentication = false;
|
||||
|
||||
# Automatically remove stale sockets
|
||||
extraConfig = ''
|
||||
StreamLocalBindUnlink yes
|
||||
'';
|
||||
|
||||
# TODO: look into what this does
|
||||
# Allow forwarding ports to everywhere
|
||||
gatewayPorts = "clientspecified";
|
||||
|
||||
# Generate ssh key
|
||||
hostKeys = [{
|
||||
path = "/persist/etc/ssh/ssh_host_ed25519_key";
|
||||
type = "ed25519";
|
||||
}];
|
||||
};
|
||||
|
||||
# Passwordless sudo when SSH'ing with keys
|
||||
security.pam.enableSSHAgentAuth = true;
|
||||
|
||||
# Add each host in this repo to the knownHosts list
|
||||
programs.ssh = {
|
||||
knownHosts = builtins.mapAttrs
|
||||
(name: _: {
|
||||
publicKeyFile = pubKey name;
|
||||
extraHostNames = lib.optional (name == hostname) "localhost";
|
||||
})
|
||||
hosts;
|
||||
};
|
||||
}
|
43
hosts/nixos/common/global/wireless.nix
Normal file
43
hosts/nixos/common/global/wireless.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{ config, lib, ... }: {
|
||||
# Wireless secrets stored through agenix
|
||||
age.secrets.wireless = {
|
||||
file = ../../../../secrets/wifi_passwords.age;
|
||||
};
|
||||
|
||||
networking.wireless = {
|
||||
enable = true;
|
||||
fallbackToWPA2 = false;
|
||||
|
||||
# Declarative
|
||||
environmentFile = config.age.secrets.wireless.path;
|
||||
networks = {
|
||||
"Neptune".psk = "@PHONE_HOTSPOT_PASS@";
|
||||
"TP-Link_522C".psk = "@TG_HOME_PASS@";
|
||||
};
|
||||
|
||||
# Imperative
|
||||
allowAuxiliaryImperativeNetworks = true;
|
||||
userControlled = {
|
||||
enable = true;
|
||||
group = "network";
|
||||
};
|
||||
|
||||
# TODO: look into what this does
|
||||
extraConfig = ''
|
||||
update_config=1
|
||||
'';
|
||||
};
|
||||
|
||||
# Ensure group exists
|
||||
users.groups.network = { };
|
||||
|
||||
# Convenient alias for connecting to wifi
|
||||
environment.shellAliases.wifi = "sudo nmcli con up id";
|
||||
|
||||
# Persist imperative config
|
||||
# environment.persistence = {
|
||||
# "/persist".files = [
|
||||
# "/etc/wpa_supplicant.conf"
|
||||
# ];
|
||||
# };
|
||||
}
|
23
hosts/nixos/common/optional/pipewire.nix
Normal file
23
hosts/nixos/common/optional/pipewire.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
security.rtkit.enable = true;
|
||||
hardware.pulseaudio.enable = false;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
|
||||
# Volume controls
|
||||
environment.shellAliases = {
|
||||
# Relative
|
||||
"v-up" = "pactl set-sink-volume @DEFAULT_SINK@ +5%";
|
||||
"v-down" = "pactl set-sink-volume @DEFAULT_SINK@ +5%";
|
||||
|
||||
# Absolute
|
||||
"v-min" = "pactl set-sink-volume @DEFAULT_SINK@ 0%";
|
||||
"v-mid" = "pactl set-sink-volume @DEFAULT_SINK@ 50%";
|
||||
"v-max" = "pactl set-sink-volume @DEFAULT_SINK@ 100%";
|
||||
};
|
||||
}
|
21
hosts/nixos/common/optional/touchpad.nix
Normal file
21
hosts/nixos/common/optional/touchpad.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
# My touchpad configuration
|
||||
{ ... }: {
|
||||
services.xserver.libinput = {
|
||||
enable = true;
|
||||
|
||||
touchpad = {
|
||||
# How fast we should scroll I think
|
||||
accelSpeed = "3.5";
|
||||
|
||||
# #TODO: I forgor what this did
|
||||
naturalScrolling = true;
|
||||
|
||||
# Dsiable the touchpad while typing
|
||||
disableWhileTyping = true;
|
||||
|
||||
# This is the most evil setting ever.
|
||||
# I cannot imagine living with this on
|
||||
tappingDragLock = false;
|
||||
};
|
||||
};
|
||||
}
|
73
hosts/nixos/common/optional/xmonad/Main.hs
Normal file
73
hosts/nixos/common/optional/xmonad/Main.hs
Normal file
|
@ -0,0 +1,73 @@
|
|||
{-# LANGUAGE BlockArguments #-}
|
||||
|
||||
import Control.Monad (forM_, join)
|
||||
import Data.Function ((&))
|
||||
import System.Environment
|
||||
import System.Process
|
||||
import XMonad
|
||||
import XMonad.Actions.SpawnOn
|
||||
import XMonad.Config
|
||||
import XMonad.Hooks.EwmhDesktops (ewmh, fullscreenEventHook)
|
||||
import XMonad.Hooks.ManageDocks
|
||||
import XMonad.Layout.NoBorders
|
||||
import XMonad.Layout.Spacing
|
||||
import XMonad.Layout.ThreeColumns
|
||||
import XMonad.Operations
|
||||
import XMonad.Util.EZConfig
|
||||
|
||||
main =
|
||||
xmonad $
|
||||
ewmh $
|
||||
docks $
|
||||
def
|
||||
{ modMask = mod4Mask,
|
||||
terminal = myTerminal,
|
||||
workspaces = myWorkspaces,
|
||||
borderWidth = 5,
|
||||
focusedBorderColor = "#4c4f69",
|
||||
normalBorderColor = "#4c4f69",
|
||||
startupHook = startup,
|
||||
layoutHook = avoidStruts myLayoutHook,
|
||||
manageHook = manageDocks <+> manageSpawn <+> manageHook def,
|
||||
handleEventHook = fullscreenEventHook <+> docksEventHook <+> handleEventHook def
|
||||
}
|
||||
`additionalKeysP` keymap
|
||||
where
|
||||
myWorkspaces =
|
||||
["1:dev", "2:browser", "3:chat", "4:terminal", "5:reading", "6:gaming"]
|
||||
|
||||
myTerminal = "alacritty"
|
||||
myBrowser = "google-chrome-stable"
|
||||
|
||||
keymap =
|
||||
[ ("M-p", spawn "rofi -show drun"),
|
||||
("M-w", spawn "rofi -show window"),
|
||||
("M-g", spawn myBrowser),
|
||||
("M-d", spawn "Discord"),
|
||||
("M-v", spawn "alacritty -e vimclip"),
|
||||
("M-s", spawn "spectacle -rcb"),
|
||||
("M-S-s", spawn "spectacle -mcb"),
|
||||
("M-C-s", spawn "spectacle -ucb"),
|
||||
("M-f", sendMessage ToggleStruts),
|
||||
("M-c", kill)
|
||||
]
|
||||
|
||||
uniformBorder = join $ join $ join Border
|
||||
border = uniformBorder 0
|
||||
spacingHook = spacingRaw False border False border True
|
||||
|
||||
tall = Tall 1 (3 / 100) (1 / 2)
|
||||
|
||||
layouts = tall ||| Full
|
||||
myLayoutHook = spacingHook layouts
|
||||
|
||||
startupApps =
|
||||
[ (0, "alacritty"),
|
||||
(1, "google-chrome-stable"),
|
||||
(2, "Discord")
|
||||
]
|
||||
|
||||
startup :: X ()
|
||||
startup = do
|
||||
forM_ startupApps \(index, app) -> do
|
||||
spawnOn (myWorkspaces !! index) app
|
43
hosts/nixos/common/optional/xmonad/default.nix
Normal file
43
hosts/nixos/common/optional/xmonad/default.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
catpuccin-sddm = pkgs.fetchFromGitHub {
|
||||
owner = "catppuccin";
|
||||
repo = "sddm";
|
||||
sha256 = "1lg10dyxgz080qfcp6k3zk6374jlj067s6p5fgx5r135ivy8mrki";
|
||||
rev = "bde6932e1ae0f8fdda76eff5c81ea8d3b7d653c0";
|
||||
};
|
||||
|
||||
sddm-theme = "${catpuccin-sddm}/src/caputccin-latte";
|
||||
in
|
||||
{
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
||||
# Enable xmonad
|
||||
windowManager.xmonad = {
|
||||
enable = true;
|
||||
enableContribAndExtras = true;
|
||||
config = ./Main.hs;
|
||||
};
|
||||
|
||||
displayManager = {
|
||||
# make xmonad session the default
|
||||
defaultSession = "none+xmonad";
|
||||
|
||||
# enable sddm
|
||||
# sddm = {
|
||||
# enable = true;
|
||||
# theme = sddm-theme;
|
||||
# };
|
||||
|
||||
# enable startx
|
||||
startx.enable = true;
|
||||
|
||||
# autoLogin = {
|
||||
# enable = true;
|
||||
# user = "adrielus";
|
||||
# };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
8
hosts/nixos/common/optional/xserver.nix
Normal file
8
hosts/nixos/common/optional/xserver.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
||||
# keyboard layout
|
||||
xkbOptions = "eurosign:e";
|
||||
};
|
||||
}
|
37
hosts/nixos/common/users/adrielus.nix
Normal file
37
hosts/nixos/common/users/adrielus.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{ pkgs, config, ... }:
|
||||
{
|
||||
# Password file stored through agenix
|
||||
age.secrets.adrielusPassword = {
|
||||
file = ../../../../secrets/adrielus_password.age;
|
||||
};
|
||||
|
||||
users = {
|
||||
# Configure users through nix only
|
||||
mutableUsers = false;
|
||||
|
||||
# Create an user named adrielus
|
||||
users.adrielus = {
|
||||
# File containing my password, managed by agenix
|
||||
passwordFile = config.age.secrets.adrielusPassword.path;
|
||||
|
||||
# Add user to the following groups
|
||||
extraGroups = [
|
||||
"wheel" # access to sudo
|
||||
"network" # for wireless stuff
|
||||
"networkmanager" # I assume this let's me access network stuff?
|
||||
"lp" # Allows me to use printers
|
||||
"docker" # Allows me to use docker (?)
|
||||
"audio" # Allows me to use audio devices
|
||||
"video" # Allows me to use a webcam
|
||||
|
||||
# TODO: find out why I added these here a long time ago
|
||||
"sound"
|
||||
"input"
|
||||
"tty"
|
||||
];
|
||||
|
||||
# Adds me to some default groups, and creates the home dir
|
||||
isNormalUser = true;
|
||||
};
|
||||
};
|
||||
}
|
34
hosts/nixos/tethys/boot.nix
Normal file
34
hosts/nixos/tethys/boot.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
# This file contains arcane configurations copied from a random old wiki entry
|
||||
# One day I shall revisit this and see what's needed and what isn't
|
||||
{...}: {
|
||||
boot.loader = {
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
# assuming /boot is the mount point of the EFI partition in NixOS (as the installation section recommends).
|
||||
efiSysMountPoint = "/boot";
|
||||
};
|
||||
grub = {
|
||||
# despite what the configuration.nix manpage seems to indicate,
|
||||
# as of release 17.09, setting device to "nodev" will still call
|
||||
# `grub-install` if efiSupport is true
|
||||
# (the devices list is not used by the EFI grub install,
|
||||
# but must be set to some value in order to pass an assert in grub.nix)
|
||||
devices = [ "nodev" ];
|
||||
efiSupport = true;
|
||||
enable = true;
|
||||
# set $FS_UUID to the UUID of the EFI partition
|
||||
extraEntries = ''
|
||||
menuentry "Windows" {
|
||||
insmod part_gpt
|
||||
insmod fat
|
||||
insmod search_fs_uuid
|
||||
insmod chain
|
||||
search --fs-uuid --set=root $FS_UUID
|
||||
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
|
||||
}
|
||||
'';
|
||||
|
||||
version = 2;
|
||||
};
|
||||
};
|
||||
}
|
20
hosts/nixos/tethys/default.nix
Normal file
20
hosts/nixos/tethys/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ inputs, outputs, lib, config, pkgs, ... }: {
|
||||
imports = [
|
||||
../common/global
|
||||
../common/users/adrielus.nix
|
||||
|
||||
../common/optional/pipewire.nix
|
||||
../common/optional/touchpad.nix
|
||||
../common/optional/xserver.nix
|
||||
../common/optional/xmonad
|
||||
|
||||
./hardware-configuration.nix
|
||||
./boot.nix
|
||||
];
|
||||
|
||||
networking.hostName = "tethys";
|
||||
hardware.opengl.enable = true;
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
system.stateVersion = "22.11";
|
||||
}
|
47
hosts/nixos/tethys/hardware-configuration.nix
Normal file
47
hosts/nixos/tethys/hardware-configuration.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "sd_mod" "sdhci_pci" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/57846041-f177-45eb-aff3-503006bac638";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/01E6-A013";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/5cf4167c-77f4-4afe-b978-65ed5472e3d0"; }
|
||||
];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.br-0bc5903170c6.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.br-53c5ffb3733e.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.br-8b13cd8694f3.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.docker0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.ham0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.veth544819a.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
1
hosts/nixos/tethys/ssh_host_ed25519_key.pub
Normal file
1
hosts/nixos/tethys/ssh_host_ed25519_key.pub
Normal file
|
@ -0,0 +1 @@
|
|||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINmdOiG0elKHvJ5yoUMd8I5qQdygvjdq45bxv65K230G tethys
|
|
@ -1 +0,0 @@
|
|||
{ pkgs, ... }: { }
|
|
@ -2,5 +2,5 @@
|
|||
# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example'
|
||||
|
||||
{ pkgs ? (import ../nixpkgs.nix) { } }: {
|
||||
# example = pkgs.callPackage ./example { };
|
||||
# example = pkgs.callPackage (import ./example.nix) {};
|
||||
}
|
||||
|
|
7
scripts/hm-activate.sh
Executable file
7
scripts/hm-activate.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/run/current-system/sw/bin/bash
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
~/.local/share/hm-result/activate
|
||||
else
|
||||
~/.local/share/hm-result/specialization/$1/activate
|
||||
fi
|
4
scripts/hm-rebuild.sh
Executable file
4
scripts/hm-rebuild.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/run/current-system/sw/bin/bash
|
||||
home-manager build --flake .#$1
|
||||
rm -rf result ~/.local/share/hm-result/$1
|
||||
mv result ~/.local/share/hm-result/$1
|
8
secrets/adrielus_password.age
Normal file
8
secrets/adrielus_password.age
Normal file
|
@ -0,0 +1,8 @@
|
|||
age-encryption.org/v1
|
||||
-> ssh-ed25519 UUF9JQ AWyd+vbllVT7QeD8xfu8D4NhxEA1RxwYCKwxGIrkIEw
|
||||
m7/XC6vhyhHW5vY+48bxmBsb6Zfhof+mavhq1fdpd+U
|
||||
-> E-grease s%$ F5jZ"f E(>8 x|#B"9
|
||||
dilxxi2WlTIReh+uvkscDubze9MyfGaW7Tn22L6p8X8YZ40muPOtVaWkgQBv1OLo
|
||||
SkccszU/cr1NEJm62YOPZGnmK96MwxA/ZWnlG5Ls/my47MqymDq7/1ySWKU5xA
|
||||
--- wOqvODKflq/JZT0/Qssb8FEl/IDNou+yKMGPn/nI81Q
|
||||
m>W¨u!ĚNą@˝ĎĎ‹yB"űGÉłĆL'A)+)áĆEzQü$Ł"Z;w-
|
7
secrets/secrets.nix
Normal file
7
secrets/secrets.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
let
|
||||
tethys = builtins.readFile ../hosts/nixos/tethys/ssh_host_ed25519_key.pub;
|
||||
in
|
||||
{
|
||||
"wifi_passwords.age".publicKeys = [ tethys ];
|
||||
"adrielus_password.age".publicKeys = [ tethys ];
|
||||
}
|
7
secrets/wifi_passwords.age
Normal file
7
secrets/wifi_passwords.age
Normal file
|
@ -0,0 +1,7 @@
|
|||
age-encryption.org/v1
|
||||
-> ssh-ed25519 UUF9JQ Qc1AgNo+N/kjGhMVHa/QDPt5nRCtuC8BvNdxuwHHKRA
|
||||
ZnOW8dIH2Sd5WDlvVA27hpp5AVHieJXIpwCmtg+dcp0
|
||||
-> rD3(ZZw-grease ZvlDZ7| G|:Xj NsbyfDh L\'
|
||||
hZeXb1QaqOPfJKTKYdB60pMyHt6G42sIEmfzNqRI/w
|
||||
--- RFPqwBq0YPAoxa/g0gEmJmWTiYH6c77ZYR0snUIx0vE
|
||||
æÀµÞêS©_!…º™s¥_i?·><3E>ËÉry<0C>V‹|ŽÞ^ò:…ó>¯ÍúLˉQÃ~æð€<19>3W®O9eÛ(•æ<ÈyŒC JòÇRqrù
|
Loading…
Reference in a new issue