1
Fork 0

Almost rewrote my entire config

This commit is contained in:
Matei Adriel 2022-12-27 20:45:43 +01:00
parent 47d704ad01
commit c5b355601e
51 changed files with 973 additions and 870 deletions

View file

@ -2,7 +2,7 @@ local opts = function(desc)
return { desc = desc, buffer = true }
end
vim.keymap.set("n", "<leader>lf", ":source %<cr>", opts("Run current lua file"))
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)

View file

@ -28,3 +28,5 @@ local abbreviations = {
}
A.manyLocalAbbr(abbreviations)

View file

@ -6,9 +6,6 @@ require("my.helpers.wrapMovement").setup()
vim.opt.conceallevel = 0
vim.opt.wrap = true
vim.g.vimtex_imaps_enabled = 0
vim.g.vimtex_syntax_conceal_disable = 1
vim.keymap.set("n", "<leader>lg", function()
if not pcall(function()
local a = tonumber(vim.fn.input("A: "))

View file

@ -1,9 +1,18 @@
local lazy_path = os.getenv("LAZY_NVIM_PATH")
-- bootstrap from github
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if lazy_path == nil then
error("Lazy.nvim not installed!")
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(lazy_path)
vim.opt.runtimepath:prepend(lazypath)
require("my.init").setup()

View file

@ -0,0 +1,67 @@
{
"LuaSnip": { "branch": "master", "commit": "5570fd797eae0790affb54ea669a150cad76db5d" },
"abbreinder.nvim": { "branch": "main", "commit": "5b2b5ff08a9ada42238d733aeebc6d3d96314d77" },
"abbremand.nvim": { "branch": "main", "commit": "d633341f632b0b2666dfc6dfe6b9842ba1610a1d" },
"catppuccin": { "branch": "main", "commit": "55f43a952856bc0029e6cef066297c6cfab3451d" },
"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": "115b9f9cec10e31aff39c077bf5a4881bc840916" },
"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": "bd5ad2a04195fb7a739eb973fa2d9f7ccc35ab4b" },
"kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" },
"knap": { "branch": "main", "commit": "62eae7803d9d87d33513b3b565c6f5791f1de1ea" },
"kotlin-vim": { "branch": "master", "commit": "1261f851e5fb2192b3a5e1691650597c71dfce2f" },
"lazy.nvim": { "branch": "main", "commit": "0d0d11acb2547ea65e0eba4fb6855f0954ed0239" },
"lean.nvim": { "branch": "main", "commit": "0f7326f7e55ddbb69c057051566f5212d902b7f3" },
"leap": { "branch": "main", "commit": "a5c9504290832e6bdbbb6265fd1ff02fc6485d20" },
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
"lualine.nvim": { "branch": "master", "commit": "fffbcb829288c3ca366f17cdb8d46aefb5c1d6f3" },
"mind.nvim": { "branch": "master", "commit": "5aa39d57d1091999ca5bdcdd056a27a032156c2d" },
"neoconf.nvim": { "branch": "main", "commit": "71e86dc9324069807c1135c46c0c9f6eb793966b" },
"neodev.nvim": { "branch": "main", "commit": "f6ee1a7651280ac476403c0b70bbfb419fa720ab" },
"neogit": { "branch": "master", "commit": "0d6002c6af432343937283fb70791fc76fa7227c" },
"nui.nvim": { "branch": "main", "commit": "4939282919885e1c83aff68ecb35b3cadf6015a9" },
"null-ls.nvim": { "branch": "main", "commit": "eaacba0b93c416252894f8bdc68e6b50b4e4c3b4" },
"nvim-autopairs": { "branch": "master", "commit": "03580d758231956d33c8dd91e2be195106a79fa4" },
"nvim-cmp": { "branch": "main", "commit": "e55033fce468c9c578b946948807f2ac48a6ee08" },
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
"nvim-lspconfig": { "branch": "master", "commit": "42ca8ce0f2252be795da4789fadfa91f6c3f7464" },
"nvim-tree.lua": { "branch": "master", "commit": "9e4c39572f631bb60ee15cb9d46e1daa9927a45e" },
"nvim-treesitter": { "branch": "master", "commit": "fb36ed4c9e962d9fbfa608cd4a5d9313b1e8a8b1" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "83a494a6f93675beff7bbd320c04c87433b1462f" },
"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": "b8581d00afa02c6bb4c947348e3cee62db65b119" },
"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-arpeggio": { "branch": "master", "commit": "01c8fc1a72ef58e490ee0490c65ee313b1b6e843" },
"vim-sleuth": { "branch": "master", "commit": "8332f123a63c739c870c96907d987cc3ff719d24" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" },
"vim-tmux-navigator": { "branch": "master", "commit": "41ea9d23b814014c8d8daf8b44fa0cd827a0e5f4" },
"vim-wakatime": { "branch": "master", "commit": "8c7f33b43a56f89285de0da77ee6ec7e4af1f835" },
"vimtex": { "branch": "master", "commit": "5e03d9052de30c8e4c2f4907600783112454028a" },
"vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" },
"which-key.nvim": { "branch": "main", "commit": "8682d3003595017cd8ffb4c860a07576647cc6f8" }
}

View file

@ -1,12 +1,19 @@
local function makeEnv(cond)
return {
active = cond,
not_active = function()
return not cond()
end,
unless = function(f)
if not cond() then f() end
if not cond() then
f()
end
end,
when = function(f)
if cond() then f() end
if cond() then
f()
end
end,
}
end
@ -15,9 +22,19 @@ return {
return vim.g.vscode ~= nil
end),
neovide = makeEnv(function()
return vim.g.neovide ~= nil
return vim.g.neovide ~= nil or os.getenv("INSIDE_NEOVIDE") ~= nil
end),
firevim = makeEnv(function()
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
}

View file

@ -4,6 +4,7 @@ function M.setup()
-- Import my other files
require("my.options").setup()
require('my.keymaps').setup()
require('my.lazy').setup()
end
return M

View file

@ -58,7 +58,7 @@ function M.setup()
end
vim.cmd("q")
end, { desc = "[q]uit current buffer" })
end, { desc = "[Q]uit current buffer" })
M.nmap("Q", ":wqa<cr>", "Save all files and [q]uit")
-- }}}
@ -74,40 +74,23 @@ function M.setup()
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, "[S]iagnostic loclist")
M.nmap("<leader>D", vim.diagnostic.setloclist, "[D]iagnostic loclist")
-- }}}
-- {{{ Chords (exit insert mode, save, clipboard)
-- }}}
-- {{{ Set up which-key structure
local status, wk = pcall(require, "which-key")
if status then
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" },
v = "which_key_ignore",
},
})
end
-- }}}
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
"help",
"man",
"notify",
"lspinfo"
},
-- {{{ 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" })
vim.keymap.set(
"n",
"q",
"<cmd>close<cr>",
{ buffer = event.buf, silent = true, desc = "[q]uit current buffer" }
)
end,
})
-- }}}
return M
end

View file

@ -0,0 +1,31 @@
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,
},
})
end
vim.keymap.set("n", "<leader>L", "<cmd>Lazy<cr>", { desc = "[L]azy ui" })
return M

View file

@ -0,0 +1,18 @@
local M = {}
function M.setup()
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.api.nvim_create_autocmd("WinEnter", {
group = vim.api.nvim_create_augroup("Setup transparency", {}),
pattern = "*",
callback = function()
vim.wo.winblend = 30
end
})
end
return M

View file

@ -1,98 +0,0 @@
local M = {}
function M.setup()
local paq = require("paq")
local themePackages = require("my.theme").deps
local base = {
"nvim-lua/plenary.nvim", -- async utility lib it seems?
--------------------------------- Unuported
"folke/neoconf.nvim", -- per project neovim configuration
"neovim/nvim-lspconfig", -- configures lsps for me
"folke/neodev.nvim", -- lua support
"windwp/nvim-autopairs", -- closes pairs for me (should look for a better one)
"nvim-telescope/telescope.nvim", -- fuzzy search for say opening files
"purescript-contrib/purescript-vim", -- purescript support
"terrortylor/nvim-comment", -- allows toggling line comments
"nvim-treesitter/nvim-treesitter-textobjects", -- the lean plugin wants me to install this, lol
-- "startup-nvim/startup.nvim", -- splash screen
"glepnir/dashboard-nvim", -- similar to startup.nvim
"kyazdani42/nvim-web-devicons", -- nice looking icons
"nvim-lualine/lualine.nvim", -- customizable status line
"kyazdani42/nvim-tree.lua", -- file tree
"lervag/vimtex", -- latex support
"jose-elias-alvarez/null-ls.nvim", -- generic language server
"nvim-telescope/telescope-file-browser.nvim", -- file creation/deletion menu
"onsails/lspkind.nvim", -- show icons in lsp completion menus
"preservim/vimux", -- interact with tmux from within vim
"christoomey/vim-tmux-navigator", -- easly switch between tmux and vim panes
"kana/vim-arpeggio", -- chord support, let"s fucking goooo
{ "andweeb/presence.nvim", run = ":DownloadUnicode" }, -- discord rich presence
"Julian/lean.nvim", -- lean support
"kmonad/kmonad-vim", -- kmonad config support
-- "LucHermitte/lh-vim-lib", -- dependency for lh-brackets
-- "LucHermitte/lh-brackets", -- kinda useless bruh, should find something better
-- Cmp related stuff
"hrsh7th/cmp-nvim-lsp", -- lsp completion
"hrsh7th/cmp-buffer", -- idr what this is
"hrsh7th/cmp-path", -- path completion ig?
"hrsh7th/cmp-cmdline", -- cmdline completion perhaps?
"hrsh7th/nvim-cmp", -- completion engine
"L3MON4D3/LuaSnip", -- snippeting engine
"saadparwaiz1/cmp_luasnip", -- snippet support for cmp
"wakatime/vim-wakatime", -- track time usage
"vmchale/dhall-vim", -- dhall syntax highlighting
"folke/which-key.nvim", -- shows what other keys I can press to finish a command
{ "psliwka/vim-smoothie", opt = true }, -- smooth scrolling
-- "easymotion/vim-easymotion", -- removes the need for spamming w or e
"ggandor/leap.nvim", -- removes the need for spamming w or e
"tpope/vim-surround", -- work with brackets, quotes, tags, etc
"MunifTanjim/nui.nvim", -- ui stuff required by idris2
"ShinKage/idris2-nvim", -- idris2 support
"udalov/kotlin-vim", -- kotlin support
"haringsrob/nvim_context_vt", -- show context on closing parenthesis
-- "vuki656/package-info.nvim", -- shows latest versions in package.json
"j-hui/fidget.nvim", -- show progress for lsp stuff
"stevearc/dressing.nvim", -- better ui I guess
"rktjmp/paperplanes.nvim", -- export to pastebin like services
"anuvyklack/hydra.nvim", -- keybinds where you only hit the head once
"jbyuki/venn.nvim", -- draw ascii diagrams
"hrsh7th/cmp-omni", -- omnifunc source for cmp
"ekickx/clipboard-image.nvim", -- paste images from clipbaord
"glacambre/firenvim", -- vim inside chrome
"lewis6991/impatient.nvim", -- faster startup times
"tpope/vim-abolish", -- abbreviations on steroids
"mrjones2014/smart-splits.nvim", -- the name says it all
"phaazon/mind.nvim", -- Organize shit as trees
"bfredl/nvim-luadev", -- lua repl thingy
"akinsho/toggleterm.nvim", -- cool terminal thingy
"folke/noice.nvim", -- better ui for cmd line and other stuff
"rcarriga/nvim-notify", -- better notifiaction ui
"hkupty/iron.nvim", -- repl support
"0styx0/abbremand.nvim", -- dependency for the next thing
"0styx0/abbreinder.nvim", -- reminds you of abbreviations
"ellisonleao/glow.nvim", -- md preview (in terminal)
"frabjous/knap", -- md preview
"tpope/vim-sleuth", -- automatically set options based on current file
"mateiadrielrafael/scrap.nvim", -- vim-abolish rewrite
"kevinhwang91/promise-async", -- required by nvim-ufo
"kevinhwang91/nvim-ufo", -- better folds and stuff
"ThePrimeagen/refactoring.nvim", -- refactoring
"gpanders/nvim-moonwalk", -- configure nvim in any language which compiles to lua
"teal-language/vim-teal", -- teal language support
-- Git stuff
"ruifm/gitlinker.nvim", -- generate permalinks for code
{ "TimUntersberger/neogit", opt = true } -- magit clone
}
table.insert(base, 2, { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
for _, v in ipairs(themePackages) do
-- append package in the base list
table.insert(base, v)
end
paq(base)
end
return M

View file

@ -1,227 +0,0 @@
local A = require("my.abbreviations")
local M = {}
-- function M.abolish(from, to)
-- vim.cmd(":Abolish -buffer " .. from .. " " .. to)
-- end
--
-- function M.abolishMany(many)
-- for _, entry in pairs(many) do M.abolish(entry[1], entry[2]) end
-- end
local function concatTables(t1, t2)
assert(type(t1) == "table")
assert(type(t2) == "table")
local t3 = {}
for i = 1, #t1 do t3[#t3 + 1] = t1[i] end
for i = 1, #t2 do t3[#t3 + 1] = t2[i] end
return t3
end
local function betterAbolish(unprocessed, context, out)
local from = unprocessed[1] or {}
local to = unprocessed[2] or {}
assert(type(from) == "table" and type(to) == "table",
"Both arguments should be tables. Found " .. vim.inspect(from) .. " and " ..
vim.inspect(to) .. " instead.")
-- print(vim.inspect({ context = context, unprocessed = unprocessed }))
if #from == 0 and #to == 0 then
table.insert(out, context)
return
end
for i = 1, 2, 1 do
local head = unprocessed[i][1]
if type(head) == "string" then
local context_clone = { context[1], context[2] }
context_clone[i] = context_clone[i] .. head
local unprocessed_clone = { unprocessed[1], unprocessed[2] }
unprocessed_clone[i] = { unpack(unprocessed[i], 2) }
return betterAbolish(unprocessed_clone, context_clone, out)
end
end
-- print(vim.inspect({ from, to, context }))
assert(type(from[1]) == "table", vim.inspect(from) .. " starts with neither a table nor a string")
assert(type(to[1]) == "table", vim.inspect(to) .. " does not start with a table")
for i = 1, #from[1], 1 do
local when = from[1][i]
local replacement = when
if #to[1] > 0 then replacement = to[1][((i - 1) % #to[1]) + 1] end
assert(type(when) == "table")
assert(type(replacement) == "table")
local unprocessed_clone = {
concatTables(when, { unpack(from, 2) }),
concatTables(replacement, { unpack(to, 2) })
}
-- print(vim.inspect({
-- unprocessed_clone = unprocessed_clone,
-- when = when,
-- replacement = replacement,
-- from = from,
-- to = to,
-- i = i
-- }))
betterAbolish(unprocessed_clone, context, out)
end
end
function M.betterAbolish(from, to)
local result = {}
betterAbolish({ from, to }, { "", "" }, result)
return result
end
local function withCasing(input)
local out = {}
for i = 1, #input, 1 do
local from = input[i][1]
local to = input[i][2]
table.insert(out, { from, to })
table.insert(out, { string.upper(from), string.upper(to) })
if #from and #to then
table.insert(out, {
string.upper(string.sub(from, 1, 1)) .. string.sub(from, 2),
string.upper(string.sub(to, 1, 1)) .. string.sub(to, 2)
})
end
end
return out
end
---Parses the input for this plugin
---@param input string
---@param context {delimiters:{left:string,right:string},separator:string}
---@return nil|{positio:number,message:string}
---@return (string|table)[]|nil
local function parse(input, context)
local position = 1
---@type { start:number, contents:(string|table)[] }[]
local stack = { { start = position, contents = {} } }
local function error(message, pos)
return { position = pos or position, message = message }
end
local escaped = false
local escapedChars = {
["\\"] = true,
[context.delimiters.left] = true,
[context.delimiters.right] = true
}
-- When encountering {}, instead of treating it like a single
-- choice containing an empty string, we must treat it as an empty choice
--
-- The specialEmpty arg tells us whether to consider such cases.
local function saveUp(specialEmpty)
local prev = stack[#stack - 1].contents
local current = stack[#stack]
assert(type(prev[#prev]) == "table")
---@cast prev table
-- If specialEmpty is true (so we are processing a '}'),
-- we only want to keep empty strings (so those where #current.contents == 0)
-- if we've had a , before (so #prev[#prev] > 0)
if not specialEmpty or #current.contents > 0 or #prev[#prev] > 0 then
table.insert(prev[#prev], current.contents)
end
end
while position <= string.len(input) do
local first = string.sub(input, position, position)
local next = string.sub(input, position + 1, position + 1)
local current = stack[#stack]
if not escaped and first == "\\" and escapedChars[next] then
escaped = true
elseif not escaped and first == context.delimiters.left then
table.insert(current.contents, {})
stack[#stack + 1] = { start = position, contents = {} }
elseif not escaped and first == context.delimiters.right then
if #stack == 1 then
return nil, error("Delimiter " .. context.delimiters.right .. " never opened")
end
-- we want special treatment for {}
saveUp(true)
stack[#stack] = nil
elseif not escaped and first == context.separator and #stack > 1 then
-- we want to treat empty strings before , as empty strings
saveUp(false)
current.contents = {}
else
local last = current.contents[#current.contents]
if type(last) == "string" then
current.contents[#current.contents] = last .. first
else
table.insert(current.contents, first)
end
escaped = false
end
position = position + 1
end
if #stack > 1 then
return nil, error("Delimiter " .. context.delimiters.left .. " never closed", stack[2].start)
end
return stack[1].contents, nil
end
local context = { delimiters = { left = "{", right = "}" }, separator = "," }
function M.abolishMany(many)
local total = 0
for _, entry in pairs(many) do
local left = parse(entry[1], context)
local right = parse(entry[2], context)
local abbreviations = withCasing(M.betterAbolish(left, right))
total = total + #abbreviations
A.manyLocalAbbr(abbreviations)
end
print("Added " .. total .. " abbreviations")
end
-- function M.setup()
-- local context = { delimiters = { left = "{", right = "}" }, separator = "," }
-- print(vim.inspect({ parse("abc\\d{a, d,e}dsdf\\{sdf\\}", context) }))
-- local parsed, _ = parse("ab{e,{f0,1e,d2},f,{3,4,5},\\{{000,111}\\}}cd", context)
-- -- local parsed, _ = parse("abc", context)
-- print(vim.inspect(parsed))
-- local processed = M.betterAbolish(parsed, parsed)
-- print(vim.inspect(processed))
-- end
return M

View file

@ -1,7 +1,10 @@
local helpers = require("my.helpers")
local arpeggio = vim.fn["arpeggio#map"]
local M = {}
local M = {
-- chord support, let"s fucking goooo
"kana/vim-arpeggio",
event = "VeryLazy",
}
---Create an arpeggio mapping
---@param mode string
@ -9,6 +12,8 @@ local M = {}
---@param rhs string
---@param opts table|nil
local function chord(mode, lhs, rhs, opts)
local arpeggio = vim.fn["arpeggio#map"]
if string.len(mode) > 1 then
for i = 1, #mode do
local c = mode:sub(i, i)
@ -36,7 +41,7 @@ local function chordSilent(mode, lhs, rhs, opts)
chord(mode, lhs, rhs, options)
end
function M.setup()
function M.config()
chordSilent("n", "ji", ":silent :write<cr>") -- Saving
chord("i", "jk", "<Esc>") -- Remap Esc to jk
chord("nv", "cp", '"+') -- Press cp to use the global clipboard

View file

@ -1,17 +0,0 @@
local M = {}
function M.setup()
-- local cmp_autopairs = require('nvim-autopairs.completion.cmp')
-- local cmp = require('cmp')
--
-- cmp.event:on(
-- 'confirm_done',
-- cmp_autopairs.on_confirm_done()
-- )
require('nvim-autopairs').setup({
enable_abbr = false
})
end
return M

View 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

View file

@ -1,28 +1,39 @@
local M = {}
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: ')
local name = vim.fn.input("Name: ")
vim.fn.inputrestore()
if name == nil or name == '' then
return os.date('%y-%m-%d-%H-%M-%S')
if name == nil or name == "" then
return os.date("%y-%m-%d-%H-%M-%S")
end
return name
end
function M.setup()
require 'clipboard-image'.setup {
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
img_name = img_name,
},
tex = {
img_dir = { "%:p:h", "img" },
affix = "\\includegraphics[width=\\textwidth]{%s}",
},
}
vim.keymap.set("n", "<leader>p", ":PasteImg<cr>", { desc = "Paste image from clipboard" })
})
end
return M

View file

@ -1,4 +1,19 @@
local M = {}
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",
},
cond = env.vscode.not_active()
}
local function has_words_before()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@ -8,10 +23,11 @@ local function has_words_before()
:match('%s') == nil
end
function M.setup()
function M.config()
vim.o.completeopt = "menuone,noselect"
local cmp = require("cmp")
local lspkind = require('lspkind')
-- local luasnip = require("luasnip")
local options = {
window = {
@ -19,6 +35,7 @@ function M.setup()
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = -3,
side_padding = 0,
completeopt = "menu,menuone,noinsert",
},
},
formatting = {
@ -63,15 +80,18 @@ function M.setup()
['<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' }, -- lsp completion
{ name = 'luasnip' }, -- snippets
{ name = 'omni' } -- omnifunc
}, { { name = 'buffer' } })
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffers' },
{ name = 'emoji' },
{ name = 'path' },
-- { name = 'omni' },
})
}
cmp.setup(options)
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
-- Use buffer source for `/`
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
@ -79,12 +99,11 @@ function M.setup()
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
-- Use cmdline & path source for ':'
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'path' },
{ name = 'cmdline' }
})
})

View file

@ -1,6 +1,12 @@
local M = {}
local env = require("my.helpers.env")
function M.setup()
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

View 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

View file

@ -1,13 +0,0 @@
local M = {}
function M.setup()
vim.g.firenvim_config = {
localSettings = {
['.*'] = {
filename = '/tmp/firevim_{hostname}_{pathname%10}_{timestamp%32}.{extension}',
}
}
}
end
return M

View file

@ -1,8 +1,12 @@
local Hydra = require('hydra')
local pcmd = require('hydra.keymap-util').pcmd
local splits = require('smart-splits')
local M = {}
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>
@ -11,7 +15,6 @@ local venn_hint = [[
^ ^ _J_ ^ ^ _<Esc>_
]]
local window_hint = [[
^^^^^^^^^^^^ Move ^^ Size ^^ ^^ Split
^^^^^^^^^^^^------------- ^^-----------^^ ^^---------------
@ -21,80 +24,103 @@ local window_hint = [[
focus^^^^^^ window^^^^^^ ^_=_: equalize^ _o_: close remaining
]]
function M.setup()
function M.config()
local Hydra = require("hydra")
local pcmd = require("hydra.keymap-util").pcmd
local splits = require("smart-splits")
Hydra({
name = 'Draw Diagram',
name = "Draw Diagram",
hint = venn_hint,
config = {
color = 'pink',
color = "pink",
invoke_on_body = true,
hint = {
border = 'rounded'
border = "rounded",
},
on_enter = function()
vim.o.virtualedit = 'all'
vim.o.virtualedit = "all"
end,
},
mode = 'n',
body = '<leader>v',
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 } },
}
{ "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',
name = "Windows",
hint = window_hint,
config = {
invoke_on_body = true,
hint = {
border = 'rounded',
offset = -1
}
border = "rounded",
offset = -1,
},
mode = 'n',
body = '<C-w>',
},
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" },
{ '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' } },
{
"<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 } },
{ "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 } },
{ "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 } },
{ "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 } },
{ "q", pcmd("close", "E444"), { desc = "close window" } },
{ "<C-q>", pcmd("close", "E444"), { desc = false } },
{ '<Esc>', nil, { exit = true, desc = false } }
}
{ "<Esc>", nil, { exit = true, desc = false } },
},
})
end

View file

@ -1,8 +1,14 @@
local env = require("my.helpers.env")
local lspconfig = require("my.plugins.lspconfig")
local M = {}
local M = {
"ShinKage/idris2-nvim",
dependencies = {"nui.nvim", "nvim-lspconfig"},
ft = { "idris2", "lidris2", "ipkg" },
cond = env.vscode.not_active(),
}
function M.setup()
function M.config()
local idris2 = require("idris2")
idris2.setup({

View file

@ -1,67 +1,203 @@
local env = require("my.helpers.env")
local M = {}
function M.setup()
require("my.plugins.moonwalk").setup()
require("my.plugins.chunk")
require('nvim_comment').setup()
require('fidget').setup()
require('dressing').setup()
require('abbreinder').setup()
require("my.plugins.autopairs").setup()
require("my.plugins.telescope").setup()
require("my.plugins.surround").setup()
env.vscode.unless(function()
env.firevim.unless(function()
require('my.plugins.neoconf').setup()
require("presence"):setup({})
require("my.plugins.nvim-tree").setup()
require("my.plugins.lualine").setup()
require("my.plugins.vimux").setup()
-- require("my.plugins.whichkey").setup()
require("toggleterm").setup()
require("my.plugins.neogit").setup()
-- require("my.plugins.noice").setup()
end)
require("my.plugins.neodev").setup()
require("my.plugins.dashboard").setup()
require("my.plugins.treesitter").setup()
require("my.plugins.cmp").setup()
require("my.plugins.luasnip").setup()
require("my.plugins.lspconfig").setup()
require("my.plugins.null-ls").setup()
require("my.plugins.vimtex").setup()
-- require("my.plugins.lean").setup()
require("my.plugins.notify").setup()
end)
if env.neovide.active() then
require("my.plugins.neovide").setup()
else
-- Neovide already provides this functionality!
vim.cmd [[packadd! vim-smoothie]]
require("my.neovide").setup()
end
if env.firevim.active() then
require("my.plugins.firevim").setup()
else
require("gitlinker").setup()
require("my.plugins.paperplanes").setup()
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
require("my.plugins.leap").setup()
require("my.plugins.hydra").setup()
require("my.plugins.clipboard-image").setup()
require("my.plugins.mind").setup()
-- require("my.plugins.ufo").setup()
require("my.plugins.arpeggio").setup()
-- require("my.plugins.slam").setup()
---@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(),
},
return M
{
"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(),
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 = true,
cond = env.firenvim.not_active(),
keys = "<leader>gy",
},
{
-- 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
},
}

View file

@ -1,15 +1,41 @@
local M = {}
local env = require("my.helpers.env")
function M.setup()
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 = "[m]ark",
},
})
end
end
function M.config()
local iron = require("iron.core")
iron.setup {
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)
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
@ -25,23 +51,13 @@ function M.setup()
cr = "<space>is<cr>",
interrupt = "<space>is<space>",
exit = "<space>isq",
clear = "<space>isr"
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
}
-- 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 commands", s = {name = "[s]end"}, m = "[m]ark" } }) end
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
})
end
return M

View file

@ -1,13 +1,22 @@
local env = require("my.helpers.env")
local lspconfig = require("my.plugins.lspconfig")
local M = {}
function M.setup()
require('lean').setup {
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 },
lsp = {
on_attach = lspconfig.on_attach,
capabilities = lspconfig.capabilities(),
},
lsp3 = false,
mappings = true
mappings = true,
})
end,
cond = env.vscode.not_active(),
}
end
return M
return {}

View file

@ -1,6 +1,11 @@
local M = {}
local M = {
-- removes the need for spamming w or e
"ggandor/leap.nvim",
name = "leap",
event = "VeryLazy"
}
function M.setup()
function M.config()
require("leap").add_default_mappings()
end

View file

@ -1,4 +1,34 @@
local M = {}
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
@ -16,7 +46,7 @@ function M.on_attach(client, bufnr)
-- }}}
-- {{{ Keymap helpers
local opts = function(desc)
return { noremap = true, silent = true, desc = desc, buffer = true }
return { noremap = true, silent = true, desc = desc, buffer = bufnr }
end
local nmap = function(from, to, desc)
@ -34,9 +64,13 @@ function M.on_attach(client, bufnr)
nmap("L", vim.lsp.buf.signature_help, "Signature help")
-- }}}
-- {{{ Code actions
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
nmap("<leader>f", format, "[F]ormat")
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",
@ -100,15 +134,31 @@ local servers = {
},
}
-- }}}
-- {{{ Capabilities
M.capabilities = require("cmp_nvim_lsp").default_capabilities()
M.capabilities = function()
-- require("lazy").load({ plugins = "hrsh7th/cmp-nvim-lsp" })
local c = require("cmp_nvim_lsp").default_capabilities()
-- Add folding capabilities
M.capabilities.textDocument.foldingRange =
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 = "" }
function M.setup()
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" })
@ -116,6 +166,7 @@ function M.setup()
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
@ -130,9 +181,11 @@ function M.setup()
debounce_text_changes = 150, -- This will be the default in neovim 0.7+
},
cmd = details.cmd,
capabilities = M.capabilities,
capabilities = capabilities,
})
end
end
--}}}
return M

View file

@ -1,23 +1,28 @@
local M = {}
local env = require("my.helpers.env")
function M.setup()
require('lualine').setup({
theme = vim.g.lualineTheme,
local M = {
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
cond = env.vscode.not_active() and env.neovide.not_active(),
}
function M.config()
require("lualine").setup({
theme = "auto",
options = {
section_separators = { left = '', right = '' },
component_separators = { left = '', right = '' }
component_separators = "",
section_separators = { left = "", right = "" },
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filename' },
lualine_x = {},
-- lualine_y = {'encoding', 'fileformat', 'filetype'},
lualine_y = { 'filetype' },
lualine_z = { 'location' }
lualine_a = { "branch" },
lualine_b = { "filename" },
lualine_c = { "filetype" },
lualine_x = { "diagnostics" },
lualine_y = {},
lualine_z = {},
},
-- Integration with other plugins
extensions = { "nvim-tree" }
extensions = { "nvim-tree" },
})
end

View file

@ -1,11 +1,18 @@
local M = {}
local luasnip = require("luasnip")
local env = require("my.helpers.env")
local M = {
"L3MON4D3/LuaSnip", -- snippeting engine
event = "InsertEnter",
cond = env.vscode.not_active()
}
local function reload()
require("luasnip.loaders.from_vscode").lazy_load()
end
function M.setup()
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>"
@ -13,12 +20,13 @@ function M.setup()
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 = "Reload luasnip snippets"
desc = "[R]eload [s]nippets",
})
reload()

View file

@ -1,18 +1,12 @@
local mind = require("mind")
local M = {}
function M.setup()
mind.setup({
persistence = {
state_path = "~/Mind/mind.json",
data_dir = "~/Mind/data"
},
ui = {
width = 50
local M = {
"phaazon/mind.nvim", -- Organize shit as trees
keys = "<leader>m",
}
})
function M.init()
vim.keymap.set("n", "<leader>m", function()
local mind = require("mind")
local buffers = vim.api.nvim_list_bufs()
local should_open = true
@ -26,7 +20,21 @@ function M.setup()
if should_open then
mind.open_main()
end
end, { desc = "Toggle mind panel" })
end, { 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

View file

@ -1,20 +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
-- 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

View file

@ -1,14 +1,12 @@
local M = {}
function M.setup()
require("neoconf").setup({
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
nlsp = false, -- global/local nlsp-settings.nvim json settings
},
})
end
return M
},
}

View file

@ -1,7 +0,0 @@
local M = {}
function M.setup()
require("neodev").setup()
end
return M

View file

@ -1,14 +0,0 @@
local M = {}
function M.setup()
-- This is here because we do not want to use neogit inside firenvim or vscode!
vim.cmd [[packadd! neogit]]
local neogit = require("neogit")
neogit.setup()
vim.keymap.set("n", "<C-g>", neogit.open)
end
return M

View file

@ -1,18 +0,0 @@
local M = {}
function M.setup()
-- 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.api.nvim_create_autocmd("WinEnter", {
-- group = vim.api.nvim_create_augroup("Setup transparency", {}),
-- pattern = "*",
-- callback = function()
-- vim.wo.winblend = 30
-- end
-- })
end
return M

View file

@ -1,8 +0,0 @@
local M = {}
function M.setup()
-- Toggle nerdtree with Control-t
vim.keymaps.set("n", "<C-t>", ":NERDTreeToggle<CR>", { silent = true })
end
return M

View file

@ -1,34 +0,0 @@
local H = require("my.helpers")
local M = {}
local function skip_containing(string, opts)
local defaultOptions = { event = "msg_show", kind = "", find = string }
local filter = H.mergeTables(defaultOptions, opts or {})
return { filter = filter, opts = { skip = true } }
end
function M.setup()
-- s - search hit bottom messages
-- c - no pattern found and whatnot
vim.opt.shortmess:append("scC")
-- vim.opt.shortmess = "sc"
require("noice").setup({
cmdline = {
view = "cmdline",
format = {
search_down = { kind = "search", pattern = "^/", icon = "🔎", lang = "regex" },
search_up = { kind = "search", pattern = "^%?", icon = "🔎", lang = "regex" }
}
},
routes = {
-- Filter out "Written ..." messages
skip_containing("written"),
skip_containing("search hit", { event = "wmsg" }),
skip_containing("pattern not found", { event = "msg_show" })
},
lsp = { progres = { enabled = false } }
})
end
return M

View file

@ -1,7 +0,0 @@
local M = {}
function M.setup()
-- vim.notify = require("notify")
end
return M

View file

@ -1,17 +1,20 @@
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 M = {}
function M.setup()
local null_ls = require("null-ls")
-- require("refactoring").setup({})
local sources = {
-- null_ls.builtins.formatting.prettier.with({ extra_filetypes = {} }), -- format ts files
null_ls.builtins.formatting.prettierd.with({ extra_filetypes = {} }), -- format ts files
-- null_ls.builtins.formatting.lua_format.with({}), -- format lua code
null_ls.builtins.formatting.stylua.with({}), -- format lua code
-- null_ls.builtins.code_actions.refactoring.with({}), -- refactor stuff
-- null_ls.builtins.formatting.lua_format.with({}), -- format lua code
}
null_ls.setup({

View file

@ -1,9 +1,20 @@
local M = {}
local env = require("my.helpers.env")
function M.setup()
require 'nvim-tree'.setup()
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>")
vim.keymap.set(
"n",
"<C-n>",
":NvimTreeToggle<CR>",
{ desc = "Toggle [n]vim-tree" }
)
end
return M

View file

@ -1,9 +0,0 @@
local M = {}
function M.setup()
require("paperplanes").setup({
provider = "paste.rs"
})
end
return M

View file

@ -1,11 +0,0 @@
vim.opt.runtimepath:append("/home/adrielus/Projects/nvim-slam")
local slam = require("slam.")
local M = {}
function M.setup()
slam.set("n", "ty", ":echo \"slammin'\"<CR>")
slam.set("i", "ty", "<esc>")
end
return M

View file

@ -1,6 +1,10 @@
local M = {}
local M = {
-- work with brackets, quotes, tags, etc
"tpope/vim-surround",
event = "VeryLazy",
}
function M.setup()
function M.config()
vim.g.surround_113 = '"\r"'
vim.g.surround_97 = "'\r'"
end

View file

@ -1,4 +1,19 @@
local M = {}
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
@ -30,25 +45,31 @@ local function mkAction(action)
action = with_theme(action, defaultTheme)
end
return ":Telescope " .. action .. "<cr>"
return "<cmd>Telescope " .. action .. "<cr>"
end
local function setupKeybinds()
function telescope.init()
for _, mapping in pairs(keybinds) do
vim.keymap.set("n", mapping[1], mkAction(mapping[2]), { desc = mapping[3] })
end
end
function M.setup()
setupKeybinds()
function telescope.config()
local settings = {
defaults = { mappings = { i = { ["<C-h>"] = "which_key" } } },
pickers = { find_files = { hidden = true } },
extensions = { file_browser = { path = "%:p:h" } },
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

View file

@ -1,7 +1,13 @@
local M = {}
function M.setup()
require'nvim-treesitter.configs'.setup {
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",
@ -24,22 +30,76 @@ function M.setup()
"vim",
"yaml",
"nix",
"kotlin"
},
sync_install = false,
indent = { enable = true },
--}}}
--{{{ Highlighting
highlight = {
enable = true,
disable = { "kotlin", "tex", "latex" },
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false
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 = false,
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,
}
}
end
return M

View file

@ -1,18 +0,0 @@
local M = {}
function M.setup()
vim.o.foldcolumn = '0'
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- Using ufo provider need remap `zR` and `zM`.
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
-- Tell the server the capability of foldingRange,
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
require('ufo').setup()
end
return M

View file

@ -1,14 +1,23 @@
local M = {}
local M = {
"lervag/vimtex", -- latex support
ft = "tex",
}
function M.setup()
-- Viewer method
function M.config()
vim.g.vimtex_view_method = "zathura"
vim.g.Tex_DefaultTargetFormat = "pdf"
vim.g.vimtex_fold_enabled = 0
vim.g.vimtex_imaps_enabled = 0
vim.g.vimtex_syntax_conceal_disable = 1
vim.g.vimtex_compiler_latexmk = {
options = {
"-pdf", "-shell-escape", "-verbose", "-file-line-error", "-synctex=1", "-interaction=nonstopmode"
}
"-pdf",
"-shell-escape",
"-verbose",
"-file-line-error",
"-synctex=1",
"-interaction=nonstopmode",
},
}
end

View file

@ -1,9 +1,22 @@
local K = require("my.keymaps")
local M = {}
local env = require("my.helpers.env")
function M.setup()
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>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",
@ -17,7 +30,7 @@ function M.setup()
if status then
wk.register({
["<leader>v"] = {
name = "vimux",
name = "[V]imux",
},
})
end

View file

@ -1,16 +1,27 @@
local M = {
"folke/which-key.nvim",
event = "VeryLazy",
}
function M.config()
local wk = require("which-key")
local M = {}
function M.setup()
wk.setup({
-- triggers = { "<leader>", "d", "y", "q", "z", "g", "c" },
triggers = {},
show_help = false,
show_keys = false
triggers = { "<leader>", "d", "y", "q", "z", "g", "c" },
show_help = true,
show_keys = true,
})
wk.register({ ["<leader>l"] = { name = "Local commands" } })
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" },
v = "which_key_ignore",
},
})
end
return M

View file

@ -1,8 +0,0 @@
local luasnip = require("luasnip")
local M = {}
function M.setup()
end
return M

View file

@ -1,12 +1,5 @@
{ pkgs, lib, paths, ... }:
let
paq = pkgs.fetchFromGitHub {
owner = "savq";
repo = "paq-nvim";
rev = "0ed94d59e315e066ced3f453ff00c0ae94938f1e";
sha256 = "0dsq6cjm7jm7jh9dfxym4ipkp46fvw1lr9z98zd80im18rg4fg63";
};
teal = pkgs.fetchFromGitHub {
owner = "teal-language";
repo = "tl";
@ -14,13 +7,6 @@ let
sha256 = "0l31qj492iaiadpp4s0wflfb7vn6zzxwhbiyczisdgpd9ydj20gf";
};
lazy-nvim = pkgs.fetchFromGitHub {
owner = "folke";
repo = "lazy.nvim";
rev = "511524ebff27ed8dea9e8d2eadb26ef19fb322c7";
sha256 = "0c8hfhrj2rfkpff0kwiv5g5bpvdq36b4xzsi8199jrpfvvp79302";
};
theme = pkgs.myThemes.current;
extraPackages = with pkgs; [
@ -70,7 +56,8 @@ let
postBuild = ''
wrapProgram $out/bin/${name} \
--prefix PATH : ${lib.makeBinPath extraPackages} \
--set LAZY_NVIM_PATH ${lazy-nvim}
--set LAZY_NVIM_PATH ${lazy-nvim} \
--set INSIDE_NEOVIDE ${if name == "neovide" then "1" else "0"}
'';
};
@ -87,8 +74,8 @@ in
home.file."${nixPlugins}/start/theming/lua/my/theme.lua".source = theme.neovim.theme;
home.file."${nixPlugins}/start/teal/lua".source = teal; # teal (typed lua)
home.file."${nixPlugins}/start/snippets".source = simlink "${paths.dotfiles}/vscode-snippets";
# home.file.".config/nvim".source = simlink "${paths.dotfiles}/neovim";
home.file.".config/nvim".source = ../../dotfiles/neovim;
home.file.".config/nvim".source = simlink "${paths.dotfiles}/neovim";
# home.file.".config/nvim".source = ../../dotfiles/neovim;
programs.neovim.enable = false;