Started rewriting my nixos config
This commit is contained in:
parent
f9f3b19299
commit
1b17dc6cf3
186 changed files with 135 additions and 7404 deletions
dotfiles/neovim/lua
.luarc.json
my
telescope/extensions
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
||||
"Lua.workspace.checkThirdParty": false
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
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
|
|
@ -1,19 +0,0 @@
|
|||
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
|
|
@ -1,40 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
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
|
|
@ -1,22 +0,0 @@
|
|||
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
|
||||
|
||||
-- Same as swap, but the key is aprt of an arpeggio chord
|
||||
local function swapArpeggio(key)
|
||||
vim.keymap.set({ "n", "v" }, "<Plug>(arpeggio-default:" .. key .. ")", "g" .. key,
|
||||
{ buffer = true })
|
||||
vim.keymap.set({ "n", "v" }, "g" .. key, key, { buffer = true })
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
swapArpeggio("j")
|
||||
swap("k")
|
||||
swap("0")
|
||||
swap("$")
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,10 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
-- Import my other files
|
||||
require("my.options").setup()
|
||||
require('my.keymaps').setup()
|
||||
require('my.lazy').setup()
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,98 +0,0 @@
|
|||
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 (exit insert mode, save, clipboard)
|
||||
-- }}}
|
||||
-- {{{ 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
|
|
@ -1,31 +0,0 @@
|
|||
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
|
|
@ -1,22 +0,0 @@
|
|||
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.api.nvim_create_autocmd("WinEnter", {
|
||||
group = vim.api.nvim_create_augroup("Setup transparency", {}),
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.wo.winblend = 30
|
||||
end,
|
||||
})
|
||||
|
||||
vim.g.neovide_cursor_animate_in_insert_mode = false
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,44 +0,0 @@
|
|||
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.o.foldmethod = "marker"
|
||||
end
|
||||
|
||||
return M
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
},
|
||||
}
|
|
@ -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
|
|
@ -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 {}
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
},
|
||||
},
|
||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -1,92 +0,0 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue