1
Fork 0

Started rewriting my nixos config

This commit is contained in:
Matei Adriel 2022-12-28 13:27:18 +01:00
parent f9f3b19299
commit 1b17dc6cf3
186 changed files with 135 additions and 7404 deletions

View file

@ -1,50 +0,0 @@
local helpers = require("my.helpers")
local M = {
-- chord support, let"s fucking goooo
"kana/vim-arpeggio",
event = "VeryLazy",
}
---Create an arpeggio mapping
---@param mode string
---@param lhs string
---@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)
chord(c, lhs, rhs, opts)
end
else
local options = helpers.mergeTables(opts or {}, { noremap = true })
local settings = options.settings or ""
if options.silent then
settings = settings .. "s"
end
arpeggio(mode, settings, not options.noremap, lhs, rhs)
end
end
---Create a silent arpeggio mapping
---@param mode string
---@param lhs string
---@param rhs string
---@param opts table|nil
local function chordSilent(mode, lhs, rhs, opts)
local options = helpers.mergeTables(opts or {}, { silent = true })
chord(mode, lhs, rhs, options)
end
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
end
return M

View file

@ -1,18 +0,0 @@
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,39 +0,0 @@
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

View file

@ -1,112 +0,0 @@
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))
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

View file

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

View file

@ -1,19 +0,0 @@
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,127 +0,0 @@
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

View file

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

View file

@ -1,204 +0,0 @@
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 = 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,63 +0,0 @@
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 = "[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

View file

@ -1,22 +0,0 @@
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 {}

View file

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

View file

@ -1,191 +0,0 @@
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 = {
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,
},
dhall_lsp_server = {},
purescriptls = {
settings = {
purescript = {
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
formatter = "purs-tidy",
},
},
},
hls = {
haskell = {
-- set formatter
formattingProvider = "ormolu",
},
},
rnix = {},
cssls = {},
jsonls = {},
rust_analyzer = {},
-- teal_ls = {},
sumneko_lua = {
cmd = {
"lua-language-server",
"--logpath=/home/adrielus/.local/share/lua-language-server/log",
},
},
}
-- }}}
-- {{{ 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

View file

@ -1,29 +0,0 @@
local env = require("my.helpers.env")
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 = {
component_separators = "",
section_separators = { left = "", right = "" },
},
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

View file

@ -1,35 +0,0 @@
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.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

View file

@ -1,40 +0,0 @@
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
for _, buf in pairs(buffers) do
if vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].filetype == "mind" then
should_open = false
vim.cmd("bd " .. buf)
end
end
if should_open then
mind.open_main()
end
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 +0,0 @@
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

View file

@ -1,12 +0,0 @@
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
},
},
}

View file

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

View file

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

View file

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

View file

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

View file

@ -1,105 +0,0 @@
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", "tex", "latex" },
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,
}
return M

View file

@ -1,24 +0,0 @@
local M = {
"lervag/vimtex", -- latex support
ft = "tex",
}
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",
},
}
end
return M

View file

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

View file

@ -1,27 +0,0 @@
local M = {
"folke/which-key.nvim",
event = "VeryLazy",
}
function M.config()
local wk = require("which-key")
wk.setup({
triggers = { "<leader>", "d", "y", "q", "z", "g", "c" },
show_help = true,
show_keys = true,
})
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