wip: move various programs to nix

This commit is contained in:
DashieTM 2024-04-16 01:41:58 +02:00
parent 17a2a04b96
commit f4e8c1725a
65 changed files with 2460 additions and 2229 deletions

View file

@ -0,0 +1,201 @@
local Util = require("lazyvim.util")
local function map(mode, lhs, rhs, opts)
local keys = require("lazy.core.handler").handlers.keys
---@cast keys LazyKeysHandler
-- do not create the map if a lazy keys handler exists
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
opts = opts or {}
opts.silent = opts.silent ~= false
vim.keymap.set(mode, lhs, rhs, opts)
end
end
local opts = { noremap = true, silent = true }
local term_opts = { silent = true }
-- crimes against humanity, but I don't care
map("n", "j", "h", opts)
map("n", "l", "k", opts)
map("n", "k", "j", opts)
map("n", ";", "l", opts)
map("v", "j", "h", opts)
map("v", "k", "j", opts)
map("v", "l", "k", opts)
map("v", ";", "l", opts)
-- test plugin
map("n", "<leader>OO", ':lua require("test_plugin").test()<CR>', { desc = "Toggle breakpoint" })
-- debug
map("n", "<leader>db", ':lua require("dap").toggle_breakpoint()<CR>', { desc = "Toggle breakpoint" })
map("n", "<leader>do", ':lua require("dap").step_over()<CR>', { desc = "Step over" })
map("n", "<leader>di", ':lua require("dap").step_into()<CR>', { desc = "Step into" })
map("n", "<leader>dc", ':lua require("dap").continue()<CR>', { desc = "Continue" })
map("n", "<leader>du", function()
require("dapui").toggle()
end, { desc = "Toggle DAP UI" })
map("n", "<leader>de", function()
require("dapui").eval()
end, { desc = "DAP Eval" })
-- window movement
map("n", "<A-j>", [[<Cmd>wincmd h<CR>]], opts)
map("n", "<A-;>", [[<Cmd>wincmd l<CR>]], opts)
map("n", "<A-t>", [[<Cmd>wincmd j<CR>]], opts)
map("i", "<A-j>", [[<Cmd>wincmd h<CR>]], opts)
map("i", "<A-;>", [[<Cmd>wincmd l<CR>]], opts)
map("i", "<A-k>", [[<Cmd>wincmd j<CR>]], opts)
-- toggle terminal
local lazyterm = function()
Util.terminal(nil, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false })
end
map("n", "<c-t>", lazyterm, { desc = "Terminal (root dir)" })
map("t", "<c-t>", "<cmd>close<cr>", { desc = "Hide Terminal" })
-- semicolon thing
-- map("i","<C-m>" ,"<C-o>A;<CR>", {desc = "add semi and newline"})
-- map("i","<C-n>" ,"<C-o>A;<ESC>", {desc = "add semi"})
map("n", "<leader>m", "$a;<CR>", { desc = "add semi and newline" })
map("n", "<leader>n", "$a;<ESC>", { desc = "add semi" })
-- tab switching
map("n", "<F1>", ":BufferLineCyclePrev<CR>", opts)
map("n", "<F2>", ":BufferLineCycleNext<CR>", opts)
-- git
map("n", "<leader>gq", function()
require("telescope.builtin").git_commits()
end, { desc = "Commits" })
map("n", "<leader>gw", function()
require("telescope.builtin").git_bcommits()
end, { desc = "Commits in branch" })
map("n", "<leader>gb", function()
require("telescope.builtin").git_branches()
end, { desc = "Branches" })
map("n", "<leader>gr", function()
require("telescope.builtin").git_status()
end, { desc = "Git status" })
map("n", "<leader>ga", function()
require("telescope.builtin").git_stash()
end, { desc = "Git stash" })
map("n", "<leader>gg", function()
Util.terminal({ "gitui" }, { cwd = Util.root() })
end, { desc = "gitui (root dir)" })
map("n", "<leader>gG", function()
Util.terminal({ "gitui" })
end, { desc = "gitui (cwd)" })
map("n", "<leader>gB", function()
require("gitblame")
vim.cmd(":GitBlameToggle")
end, { desc = "git blame" })
-- harpoon man
map("n", "<leader>h1", function()
require("harpoon.ui").nav_file(1)
end, { desc = "First Harpoon File" })
map("n", "<leader>h2", function()
require("harpoon.ui").nav_file(2)
end, { desc = "Second Harpoon File" })
map("n", "<leader>h3", function()
require("harpoon.ui").nav_file(3)
end, { desc = "First Harpoon File" })
map("n", "<leader>ha", function()
require("harpoon.mark").add_file()
end, { desc = "First Harpoon File" })
map("n", "<leader>hd", function()
require("harpoon.mark").remove_file()
end, { desc = "First Harpoon File" })
map("n", "<leader>hm", ":Telescope harpoon marks<CR>", { noremap = true, silent = true, desc = "Show harpoon marks" })
-- telescope
map("n", "<leader>fb", function()
require("telescope").extensions.file_browser.file_browser({})
end, { desc = "File Browser" })
map("n", "<leader>ff", function()
require("telescope.builtin").find_files()
end, { desc = "Find Files" })
map("n", "<leader>fg", function()
Live_grep_from_project_git_root()
end, { desc = "Live Grep (root)" })
map("n", "<leader>fG", function()
require("telescope.builtin").live_grep()
end, { desc = "Live Grep (cwd)" })
map("n", "<leader>fh", function()
require("telescope.builtin").help_tags()
end, { desc = "Help" })
map("n", "<leader>fp", function()
require("telescope").extensions.project.project({})
end, { noremap = true, silent = true, desc = "Projects" })
map("n", "<leader>z", function()
require("telescope").extensions.zoxide.list({})
end, { desc = "Zoxide" })
-- neoscroll
local t = {}
t["<A-l>"] = { "scroll", { "-vim.wo.scroll", "true", "250" } }
t["<A-k>"] = { "scroll", { "vim.wo.scroll", "true", "250" } }
require("neoscroll.config").set_mappings(t)
-- trouble
map("n", "<leader>t", "<cmd>TroubleToggle<CR>", term_opts)
-- format
map({ "n", "v" }, "<F4>", function()
Util.format({ force = true })
end, { desc = "Format" })
-- better yank
function Better_yank(opts)
local current_line = unpack(vim.api.nvim_win_get_cursor(0))
vim.api.nvim_command(current_line .. "," .. (opts.count - (current_line - 1)) .. "y")
end
vim.api.nvim_create_user_command("BetterYank", Better_yank, { count = 1 })
map("n", "by", ":BetterYank<CR>", term_opts)
-- better delete
function Better_delete(opts)
local current_line = unpack(vim.api.nvim_win_get_cursor(0))
vim.api.nvim_command(current_line .. "," .. (opts.count - (current_line - 1)) .. "d")
end
vim.api.nvim_create_user_command("BetterDelete", Better_delete, { count = 1 })
map("n", "bd", ":BetterDelete<CR>", term_opts)
-- neovide zoom
local change_scale_factor = function(delta)
vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta
end
vim.keymap.set("n", "<C-=>", function()
change_scale_factor(1.25)
end)
vim.keymap.set("n", "<C-->", function()
change_scale_factor(1 / 1.25)
end)
-- neovide paste
vim.g.neovide_input_use_logo = 1
vim.api.nvim_set_keymap("i", "<C-S-V>", "<ESC>p<CR>I", { noremap = true, silent = true })
function Get_git_root()
local opts = {}
local function is_git_repo()
vim.fn.system("git rev-parse --is-inside-work-tree")
return vim.v.shell_error == 0
end
if is_git_repo() then
local dot_git_path = vim.fn.finddir(".git", ".;")
local root = vim.fn.fnamemodify(dot_git_path, ":h")
opts = {
cwd = root,
}
end
return opts
end
function Live_grep_from_project_git_root()
local opts = Get_git_root()
require("telescope.builtin").live_grep(opts)
end

View file

@ -0,0 +1,56 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.ui.alpha" },
-- { import = "lazyvim.plugins.extras.ui.edgy" },
{ import = "plugins" },
{ import = "plugins.plugins" },
{ import = "lazyvim.plugins.extras.lang.rust" },
{ import = "lazyvim.plugins.extras.lang.tailwind" },
{ import = "lazyvim.plugins.extras.lang.java" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.clangd" },
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.python" },
{ import = "lazyvim.plugins.extras.lang.markdown" },
{ import = "lazyvim.plugins.extras.lang.cmake" },
{ import = "lazyvim.plugins.extras.lang.omnisharp" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.tex" },
{ import = "lazyvim.plugins.extras.util.dot" },
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.test.core" },
},
defaults = {
lazy = true,
version = false,
},
install = { colorscheme = { "tokyonight", "catppuccin-mocha" } },
checker = { enabled = true, notify = false },
change_detection = { enabled = true, notify = false },
performance = {
rtp = {
disabled_plugins = {
"gzip",
"netrw",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -0,0 +1,126 @@
local M = {}
---@type PluginLspKeys
M._keys = nil
---@return (LazyKeys|{has?:string})[]
function M.get()
local format = function()
require("lazyvim.util").format({ force = true })
end
if not M._keys then
---@class PluginLspKeys
M._keys = {
{ "<leader>cld", vim.diagnostic.open_float, desc = "Line Diagnostics" },
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
{ "<leader>ca", "<cmd>Telescope lsp_definitions<cr>", desc = "Goto Definition", has = "definition" },
{ "<leader>cs", "<cmd>Telescope lsp_references<cr>", desc = "References" },
{ "<leader>cA", vim.lsp.buf.declaration, desc = "Goto Declaration" },
{ "<leader>cf", "<cmd>Telescope lsp_implementations<cr>", desc = "Goto Implementation" },
{ "<leader>cd", "<cmd>Telescope lsp_type_definitions<cr>", desc = "Goto Type Definition" },
{ "<leader>ce", vim.lsp.buf.hover, desc = "Hover" },
{ "<leader>cw", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },
{ "<c-k>", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" },
{ "]d", M.diagnostic_goto(true), desc = "Next Diagnostic" },
{ "[d", M.diagnostic_goto(false), desc = "Prev Diagnostic" },
{ "]e", M.diagnostic_goto(true, "ERROR"), desc = "Next Error" },
{ "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" },
{ "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" },
{ "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" },
{ "<F4>", format, desc = "Format Range", mode = "v", has = "documentRangeFormatting" },
{ "<leader>cr", ":IncRename ", desc = "Rename", has = "rename" },
{
"<leader>cq",
function()
vim.lsp.buf.code_action({
context = {
only = {
"quickfix",
"quickfix.ltex",
"source",
"source.fixAll",
"source.organizeImports",
"",
},
},
})
end,
desc = "Fix",
mode = { "n", "v" },
has = "codeAction",
},
{
"<leader>cQ",
function()
vim.lsp.buf.code_action({
context = {
only = {
"refactor",
"refactor.inline",
"refactor.extract",
"refactor.rewrite",
},
},
})
end,
desc = "Refactor",
mode = { "n", "v" },
has = "codeAction",
},
}
end
return M._keys
end
---@param method string
function M.has(buffer, method)
method = method:find("/") and method or "textDocument/" .. method
local clients = require("lazyvim.util").lsp.get_clients({ bufnr = buffer })
for _, client in ipairs(clients) do
if client.supports_method(method) then
return true
end
end
return false
end
---@return (LazyKeys|{has?:string})[]
function M.resolve(buffer)
local Keys = require("lazy.core.handler.keys")
if not Keys.resolve then
return {}
end
local spec = M.get()
local opts = require("lazyvim.util").opts("nvim-lspconfig")
local clients = require("lazyvim.util").lsp.get_clients({ bufnr = buffer })
for _, client in ipairs(clients) do
local maps = opts.servers[client.name] and opts.servers[client.name].keys or {}
vim.list_extend(spec, maps)
end
return Keys.resolve(spec)
end
function M.on_attach(_, buffer)
local Keys = require("lazy.core.handler.keys")
local keymaps = M.resolve(buffer)
for _, keys in pairs(keymaps) do
if not keys.has or M.has(buffer, keys.has) then
local opts = Keys.opts(keys)
opts.has = nil
opts.silent = opts.silent ~= false
opts.buffer = buffer
vim.keymap.set(keys.mode or "n", keys.lhs, keys.rhs, opts)
end
end
end
function M.diagnostic_goto(next, severity)
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
severity = severity and vim.diagnostic.severity[severity] or nil
return function()
go({ severity = severity })
end
end
return M

View file

@ -0,0 +1,25 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
local options = {
fileencoding = "utf-8",
number = true,
showmode = true,
termguicolors = true,
spelllang = "en_us",
shell = "fish",
relativenumber = false,
scrolloff = 5,
scrolljump = 5,
wrap = false,
}
vim.o.guifont = "JetBrainsMono Nerd Font:h14"
vim.g.neovide_refresh_rate_idle = 180
vim.g.neovide_refresh_rate_idle = 5
vim.g.neovide_hide_mouse_when_typing = true
vim.g.mkdp_browser = "/usr/bin/firefox"
vim.g.mkdp_auto_start = 1
vim.g.autoformat = false
for k, v in pairs(options) do
vim.opt[k] = v
end

View file

@ -0,0 +1,302 @@
local Util = require("lazyvim.util")
return {
{
"LazyVim/LazyVim",
opts = {
colorscheme = "tokyonight-night",
-- colorscheme = "catppuccin-mocha",
},
},
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
keys = function()
return {}
end,
opts = {
defaults = {
layout_strategy = 'flex';
layout_config = {
flex = {
height = 0.95,
width = 0.95,
flip_columns = 100,
vertical = { preview_height = 0.5, preview_cutoff = 5 },
horizontal = { preview_width = 0.7, preview_cutoff = 99 },
},
},
},
},
},
{
"ThePrimeagen/harpoon",
lazy = true,
config = function()
require("telescope").load_extension("harpoon")
end,
},
{
"iamcco/markdown-preview.nvim",
lazy = true,
event = "FileType markdown",
build = "cd app && yarn install",
},
{
"nvim-telescope/telescope-project.nvim",
lazy = true,
},
{
"nvim-telescope/telescope-file-browser.nvim",
lazy = true,
config = function()
require("telescope").load_extension("file_browser")
end,
},
{
"jvgrootveld/telescope-zoxide",
lazy = true,
config = function()
local z_utils = require("telescope._extensions.zoxide.utils")
local t = require("telescope")
-- Configure the extension
t.setup({
extensions = {
zoxide = {
prompt_title = "[ Queries ]",
mappings = {
default = {
after_action = function(selection)
print("Update to (" .. selection.z_score .. ") " .. selection.path)
end,
},
["<C-s>"] = {
before_action = function(selection)
print("before C-s")
end,
action = function(selection)
vim.cmd("edit " .. selection.path)
end,
},
["<C-q>"] = { action = z_utils.create_basic_command("split") },
},
},
},
})
-- Load the extension
t.load_extension("zoxide")
end,
},
{
"lervag/vimtex",
config = function()
vim.cmd("let g:vimtex_quickfix_mode=0")
vim.cmd("let g:vimtex_view_general_viewer = 'evince'")
vim.cmd("let g:vimtex_compiler_method = 'latexmk'")
vim.cmd(
"let g:vimtex_compiler_latexmk = {'options': ['-pdf', '-shell-escape', '-file-line-error', '--extra-mem-bot=10000000', '-synctex=1', '-interaction=nonstopmode',],}"
)
end,
},
{
"rcarriga/nvim-notify",
opts = {
top_down = false,
},
},
{
"jbyuki/instant.nvim",
config = function()
vim.cmd("let g:instant_username = 'dashie'")
end,
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
},
},
},
{
"karb94/neoscroll.nvim",
config = function()
require("neoscroll").setup()
end,
},
{
"kaarmu/typst.vim",
lazy = true,
event = "FileType typst",
},
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
plugins = { spelling = true },
defaults = {
mode = { "n", "v" },
["g"] = { name = "+goto" },
["gz"] = { name = "+surround" },
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader><tab>"] = { name = "+tabs" },
["<leader>b"] = { name = "+buffer" },
["<leader>c"] = { name = "+code" },
["<leader>f"] = { name = "+file/find" },
["<leader>g"] = { name = "+git" },
["<leader>gh"] = { name = "+hunks" },
["<leader>q"] = { name = "+quit/session" },
["<leader>s"] = { name = "+search" },
["<leader>u"] = { name = "+ui" },
["<leader>w"] = { name = "+windows" },
["<leader>x"] = { name = "+diagnostics/quickfix" },
["<leader>h"] = { name = "+harpoon" },
["<leader>d"] = { name = "+DAP" },
},
},
config = function(_, opts)
local wk = require("which-key")
wk.setup(opts)
wk.register(opts.defaults)
end,
},
{
"f-person/git-blame.nvim",
lazy = true,
},
{
"mg979/vim-visual-multi",
},
{
"barreiroleo/ltex_extra.nvim",
ft = { "markdown", "tex", "typst", "typ" },
lazy = true,
},
{
"smjonas/inc-rename.nvim",
lazy = true,
event = "BufEnter",
config = function()
require("inc_rename").setup({
cmd_name = "IncRename", -- the name of the command
hl_group = "Substitute", -- the highlight group used for highlighting the identifier's new name
preview_empty_name = true, -- whether an empty new name should be previewed; if false the command preview will be cancelled instead
show_message = true, -- whether to display a `Renamed m instances in n files` message after a rename operation
input_buffer_type = nil, -- the type of the external input buffer to use (the only supported value is currently "dressing")
post_hook = nil, -- callback to run after renaming, receives the result table (from LSP handler) as an argument
})
end,
},
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
window = {
position = "right",
mappings = {
["l"] = "none",
},
},
},
keys = {
{
"<leader>fe",
function()
require("neo-tree.command").execute({ position = "right", toggle = true, dir = Util.root() })
end,
desc = "Explorer NeoTree (root dir)",
},
{
"<leader>fE",
function()
require("neo-tree.command").execute({ position = "right", toggle = true, dir = vim.loop.cwd() })
end,
desc = "Explorer NeoTree (cwd)",
},
{ "<A-f>", "<leader>fe", desc = "Explorer NeoTree (root dir)", remap = true },
{ "<A-F>", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
},
},
{
"folke/edgy.nvim",
opts = {
animate = {
enabled = false,
},
left = {},
right = {
-- Neo-tree filesystem always takes half the screen height
{
title = "Neo-Tree",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "filesystem"
end,
size = { height = 0.5 },
},
{
title = "Neo-Tree Git",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "git_status"
end,
pinned = true,
open = "Neotree position=right git_status",
},
{
title = "Neo-Tree Buffers",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "buffers"
end,
pinned = true,
open = "Neotree position=top buffers",
},
{
ft = "Outline",
pinned = true,
open = "SymbolsOutlineOpen",
},
-- any other neo-tree windows
"neo-tree",
},
},
},
{
"rcarriga/nvim-dap-ui",
keys = {
{
"<leader>dk",
function()
require("dap").down()
end,
desc = "Down",
},
{
"<leader>dl",
function()
require("dap").up()
end,
desc = "Up",
},
{
"<leader>d;",
function()
require("dap").run_last()
end,
desc = "Run Last",
},
},
},
}

View file

@ -0,0 +1,144 @@
return {
{
"L3MON4D3/LuaSnip",
build = (not jit.os:find("Windows"))
and "echo -e 'NOTE: jsregexp is optional, so not a big deal if it fails to build\n'; make install_jsregexp"
or nil,
dependencies = {
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
opts = {
history = true,
delete_check_events = "TextChanged",
updateevents = "TextChanged,TextChangedI",
enable_autosnippets = true,
},
keys = function()
return {}
end,
config = function(_, opts)
require("luasnip").setup(opts)
end,
},
{
"hrsh7th/nvim-cmp",
version = false,
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"FelipeLema/cmp-async-path",
"saadparwaiz1/cmp_luasnip",
"Saecki/crates.nvim",
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
},
opts = function()
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local cmp = require("cmp")
local defaults = require("cmp.config.default")()
local luasnip = require("luasnip")
local compare = require("cmp.config.compare")
return {
preselect = cmp.PreselectMode.None,
completion = {
-- completeopt = "menu,menuone,noinsert",
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<S-CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}), -- Accept cur
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert })
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
else
fallback()
end
end, {
"i",
"s",
}),
["<C-j>"] = cmp.mapping(function(fallback)
if luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, {
"i",
"s",
}),
["<C-k>"] = cmp.mapping(function(fallback)
if luasnip.expand_or_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {
"i",
"s",
}),
},
sources = cmp.config.sources({
{ name = "nvim_lsp", priority = 99 },
{ name = "luasnip", priority = 3, max_item_count = 3 },
{ name = "buffer", priority = 2, max_item_count = 2, keyword_length = 5 },
{ name = "async_path", priority = 1, max_item_count = 2, keyword_length = 3, trigger_characters = {} },
{ name = "crates" },
}),
sorting = {
priority_weight = 90,
comparators = {
compare.exact,
compare.score,
compare.offset,
compare.kind,
},
},
formatting = {
preselect = cmp.PreselectMode.None,
format = function(entry, item)
local icons = require("lazyvim.config").icons.kinds
if icons[item.kind] then
item.kind = icons[item.kind] .. item.kind
end
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
end,
},
experimental = {
ghost_text = {
hl_group = "CmpGhostText",
},
},
}
end,
config = function(_, opts)
local cmp = require("cmp")
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })
cmp.setup(opts)
end,
},
}

View file

@ -0,0 +1,100 @@
return {
{
"goolord/alpha-nvim",
event = "VimEnter",
opts = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
[[ _______ ___ _______. __ __ __ _______ ]],
[[| \ / \ / || | | | | | | ____|]],
[[| .--. | / ^ \ | (----`| |__| | | | | |__ ]],
[[| | | | / /_\ \ \ \ | __ | | | | __| ]],
[[| '--' | / _____ \ .----) | | | | | | | | |____ ]],
[[|_______/ /__/ \__\ |_______/ |__| |__| |__| |_______|]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⢤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠪⣍⣒⠒⠦⠤⠤⠤⠄⠠⡜⡐⠁⠪⡢⡀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⢄⠀⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠈⠛⠯⣉⠁⣐⣂⠐⠮⠥⠟⣓⣲⣾⣿⣿⣿⣶⡃⠀⠀⠈⢞⢆⠀⠀⠀⠀⠀⠀⡰⢁⠂⠄⣇⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⣠⠤⠤⠭⠷⠎⡡⠔⠒⠘⠀⢹⣿⣿⣿⣿⣿⠀⠈⠀⠀⠀⢢⢣⠀⠀⠀⠀⢀⡇⠈⠀⢰⢰⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⢸⢰⠀⠀⠀⡩⢋⣀⣤⣤⣤⣤⣤⣿⣿⠟⠿⣿⡀⠀⠀⠀⠀⠀⠆⢳⠀⠀⠀⢸⠀⠂⠀⠀⡈⡆⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⢣⢂⠀⠮⡪⠛⠉⢋⠝⠻⢿⢿⡿⢁⠔⢋⣸⠇⠀⠀⠀⠀⠀⡘⣆⢣⠀⠀⡼⠀⠀⠀⠀⡇⣇⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⡣⢲⡊⠀⠀⠀⠀⠀⡴⠃⣼⠡⢪⠔⠋⠀⠀⠀⢀⠀⠀⠀⢸⣿⡄⢆⠀⡇⠀⠀⠀⠀⠁⢸⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⢰⢡⡇⠀⠀⢀⠔⠠⠊⣰⠞⡇⢠⠃⠀⣠⣶⣿⣷⣷⣷⠄⠀⠈⡟⣷⡸⡄⡇⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⡇⣾⠀⣀⠔⣁⣤⣦⢺⣿⡆⡆⡃⠀⢨⠃⢸⣿⣿⣿⠏⠀⠠⢀⢠⣿⡇⣧⡇⠀⠀⠀⠀⠀⢸⣆⢔⡲⡆⠀ ]],
[[ ⠀⠀⣠⠞⠼⠧⢙⡒⣾⣿⣿⡷⡘⣟⣷⣜⡃⠀⡼⠀⠀⠷⠗⠋⠀⠀⠀⢀⡟⣿⣿⢀⠓⠀⠀⠀⠀⠀⢸⢋⠊⠀⡇⠀ ]],
[[ ⠘⠛⠒⠒⠉⠉⠁⡇⣿⣽⣿⡇⠈⢹⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⣠⠟⠀⣷⣿⣇⠱⡀⠀⠀⠀⡄⢀⠃⠀⡄⡇⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⡇⢸⣏⢀⣧⠀⠈⠆⠀⠀⠀⠀⠀⠀⠀⠀⡠⢊⡴⡟⠀⡼⢁⢸⡙⣠⠁⠀⠀⠀⢇⠆⠀⢀⢳⡇⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⢳⢀⣵⢸⣯⣷⣤⣀⠀⠀⠀⠀⠀⢀⣐⠮⠔⡎⠘⠀⠈⢀⢮⣿⣷⠁⠇⠠⠀⢰⠎⠀⠀⡘⣸⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⢀⠎⢬⢘⣯⠛⢻⠏⣿⣿⣶⣶⡶⠋⠉⠀⠀⢸⠀⠀⡔⠀⣪⣿⣿⢻⠀⠸⠈⡇⠛⠀⠠⢀⢃⡇⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠈⡹⡡⣪⡏⠛⠀⠀⢠⡟⢻⣿⣿⡇⠀⠀⠀⠀⢼⡆⠠⡇⢰⣿⣿⣿⣻⡄⠀⡆⠁⠀⣠⠃⠌⠼⠤⠤⡀ ]],
[[ ⠀⠀⠀⣀⡠⢞⣳⣽⢸⡇⠀⡇⠀⠸⠀⣼⣿⣿⡇⠀⠀⠀⠀⠈⡇⣰⠃⣶⡍⣼⣿⣏⠃⠀⠁⢠⠊⣀⣜⠤⠐⢂⢆⠇ ]],
[[ ⠀⠀⠈⠉⠉⠁⠀⢇⢸⡟⠀⡇⠀⡇⢸⢷⣹⣿⡇⠀⠀⠀⠀⠀⢳⡽⠃⡞⣇⣿⣧⣿⠀⠀⢸⠃⢠⠃⠀⢀⠤⢢⠞⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⢸⡀⡇⠀⠁⢠⠁⣿⠈⣿⣿⠇⠀⠀⠀⠀⠀⠀⠁⡆⡇⣾⠿⣹⣿⠀⠀⠃⡰⠃⡰⢔⣡⠞⠁⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⢇⢠⠀⠂⡌⠀⢽⠁⣟⡟⠀⠀⠀⠀⠀⠀⠀⠀⣇⢶⢹⣤⣿⠇⠀⣀⣈⠝⡱⠒⠉⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠈⣎⡄⠀⡷⠀⢸⠀⢹⠇⠀⠀⠀⠀⠀⠀⠀⠀⠫⣼⣾⣿⢋⠤⠤⠥⢆⡞⠀⠀⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⢀⢫⣡⢸⠎⢃⢘⠀⢈⡄⠀⠀⠀⠀⠀⠀⠀⠀⢀⡽⣽⢀⡋⠉⠑⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠘⠉⠳⡯⣇⢆⠻⣆⠈⣤⠀⠀⠀⠀⣀⡀⠤⢚⡨⠷⣝⠗⠑⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠫⣗⠳⡜⠵⠀⡍⡥⠤⠤⠤⠄⠒⠉⠀⠀⠀⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠫⡆⣇⠇⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡙⡰⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣦⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
}
dashboard.section.buttons.val = {
dashboard.button("f", " Find file", ":lua require('telescope.builtin').find_files()<CR>"),
dashboard.button("y", " Yazi", ":lua require('yazi').yazi()<CR>"),
dashboard.button("p", " Find project", ":lua require('telescope').extensions.project.project{}<CR>"),
dashboard.button("t", " Zoxide", ":lua require('telescope').extensions.zoxide.list{}<CR>"),
dashboard.button("c", " Configuration", ":e ~/.config/nvim/init.lua <CR>"),
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
}
local function footer()
return "dashie@dashie.org"
end
dashboard.section.footer.val = footer()
dashboard.section.footer.opts.hl = "Type"
dashboard.section.header.opts.hl = "Include"
dashboard.section.buttons.opts.hl = "Keyword"
dashboard.opts.opts.noautocmd = true
-- alpha.pad_margin(dashboard.section.header.val, dashboard.opts , 0, 0)
alpha.setup(dashboard.opts)
end,
config = function(_, dashboard)
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "AlphaReady",
callback = function()
require("lazy").show()
end,
})
end
require("alpha").setup({
layout = {
{ type = "padding", val = 1 },
dashboard.section.header,
{ type = "padding", val = 1 },
dashboard.section.buttons,
{ type = "padding", val = 1 },
dashboard.section.footer,
},
})
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
pcall(vim.cmd.AlphaRedraw)
end,
})
end,
},
}

View file

@ -0,0 +1,8 @@
return {
{
{ "rcarriga/nvim-notify", enabled = false },
},
{ { "folke/noice.nvim", enabled = false } },
{ { "nvimtools/none-ls.nvim", enabled = false } },
{ { "nvimdev/dashboard-nvim", enabled = false } },
}

View file

@ -0,0 +1,162 @@
return {
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {},
},
},
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
-- inlay_hints = {
-- enabled = true,
-- },
format_notify = false,
-- LSP Server Settings
---@type lspconfig.options
servers = {
rust_analyzer = {
mason = false,
},
marksman = {
mason = false,
},
clangd = {
mason = false,
},
jdtls = {
mason = false,
},
gopls = {
mason = false,
},
pyright = {
mason = false,
},
ruff_lsp = {
mason = false,
},
texlab = {
mason = false,
},
taplo = {
keys = {
{
"K",
function()
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
require("crates").show_popup()
else
vim.lsp.buf.hover()
end
end,
desc = "Show Crate Documentation",
},
},
mason = false,
},
bashls = {
mason = false,
},
ansiblels = {
mason = false,
},
typst_lsp = {
settings = {
experimentalFormatterMode = "on",
exportPdf = "onSave",
},
mason = false,
},
nil_ls = {
settings = {
["nil"] = {
formatting = {
command = { "nixpkgs-fmt" },
},
},
},
mason = false,
},
ltex = {
settings = {
ltex = {
checkFrequency = "save",
},
},
filetypes = {
"bib",
"gitcommit",
"markdown",
"org",
"plaintex",
"rst",
"rnoweb",
"tex",
"pandoc",
"typst",
"typ",
},
mason = false,
},
sqlls = {
mason = false,
},
lemminx = {
mason = false,
},
opencl_ls = {
mason = false,
},
yamlls = {
mason = false,
},
lua_ls = {
mason = false,
{
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = "Replace",
},
},
},
},
},
},
init = function()
local keys = require("lazyvim.plugins.lsp.keymaps").get()
local my_keys = require("config.lsp-keymap").get()
local count = 0
for _ in pairs(my_keys) do
keys[#keys + 1] = my_keys[count]
count = count + 1
end
end,
},
{
"stevearc/conform.nvim",
opts = {
keys = {
{
-- Customize or remove this keymap to your liking
"<leader>cF",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = "",
desc = "Format buffer",
},
},
formatters_by_ft = {
typst = { "typstfmt" },
nix = { "nixpkgs-fmt" },
lua = { "stylua" },
sh = { "shfmt" },
},
},
},
}

View file

@ -0,0 +1,255 @@
local Util = require("lazyvim.util")
return {
{
"LazyVim/LazyVim",
opts = {
colorscheme = "tokyonight-night",
-- colorscheme = "catppuccin-mocha",
},
},
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
keys = function()
return {}
end,
opts = {
defaults = {
layout_strategy = "flex",
layout_config = {
flex = {
height = 0.95,
width = 0.95,
flip_columns = 100,
},
vertical = { preview_height = 0.5, preview_cutoff = 5 },
horizontal = { preview_width = 0.7, preview_cutoff = 99 },
},
},
},
},
{
"nvim-telescope/telescope-project.nvim",
lazy = true,
},
{
"nvim-telescope/telescope-file-browser.nvim",
lazy = true,
config = function()
require("telescope").load_extension("file_browser")
end,
},
{
"jvgrootveld/telescope-zoxide",
lazy = true,
config = function()
local z_utils = require("telescope._extensions.zoxide.utils")
local t = require("telescope")
-- Configure the extension
t.setup({
extensions = {
zoxide = {
prompt_title = "[ Queries ]",
mappings = {
default = {
after_action = function(selection)
print("Update to (" .. selection.z_score .. ") " .. selection.path)
end,
},
["<C-s>"] = {
before_action = function(selection)
print("before C-s")
end,
action = function(selection)
vim.cmd("edit " .. selection.path)
end,
},
["<C-q>"] = { action = z_utils.create_basic_command("split") },
},
},
},
})
-- Load the extension
t.load_extension("zoxide")
end,
},
{
"lervag/vimtex",
config = function()
vim.cmd("let g:vimtex_quickfix_mode=0")
vim.cmd("let g:vimtex_view_general_viewer = 'evince'")
vim.cmd("let g:vimtex_compiler_method = 'latexmk'")
vim.cmd(
"let g:vimtex_compiler_latexmk = {'options': ['-pdf', '-shell-escape', '-file-line-error', '--extra-mem-bot=10000000', '-synctex=1', '-interaction=nonstopmode',],}"
)
end,
},
{
"jbyuki/instant.nvim",
config = function()
vim.cmd("let g:instant_username = 'dashie'")
end,
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
},
},
},
{
"karb94/neoscroll.nvim",
config = function()
require("neoscroll").setup()
end,
},
{
"kaarmu/typst.vim",
lazy = true,
event = "FileType typst",
},
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
plugins = { spelling = true },
defaults = {
mode = { "n", "v" },
["g"] = { name = "+goto" },
["gz"] = { name = "+surround" },
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader><tab>"] = { name = "+tabs" },
["<leader>b"] = { name = "+buffer" },
["<leader>c"] = { name = "+code" },
["<leader>f"] = { name = "+file/find" },
["<leader>g"] = { name = "+git" },
["<leader>gh"] = { name = "+hunks" },
["<leader>q"] = { name = "+quit/session" },
["<leader>s"] = { name = "+search" },
["<leader>u"] = { name = "+ui" },
["<leader>w"] = { name = "+windows" },
["<leader>x"] = { name = "+diagnostics/quickfix" },
["<leader>h"] = { name = "+harpoon" },
["<leader>d"] = { name = "+DAP" },
},
},
config = function(_, opts)
local wk = require("which-key")
wk.setup(opts)
wk.register(opts.defaults)
end,
},
{
"f-person/git-blame.nvim",
lazy = true,
},
{
"mg979/vim-visual-multi",
},
{
"barreiroleo/ltex_extra.nvim",
ft = { "markdown", "tex", "typst", "typ" },
lazy = true,
},
{
"smjonas/inc-rename.nvim",
lazy = true,
event = "BufEnter",
config = function()
require("inc_rename").setup({
cmd_name = "IncRename", -- the name of the command
hl_group = "Substitute", -- the highlight group used for highlighting the identifier's new name
preview_empty_name = true, -- whether an empty new name should be previewed; if false the command preview will be cancelled instead
show_message = true, -- whether to display a `Renamed m instances in n files` message after a rename operation
input_buffer_type = nil, -- the type of the external input buffer to use (the only supported value is currently "dressing")
post_hook = nil, -- callback to run after renaming, receives the result table (from LSP handler) as an argument
})
end,
},
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
window = {
position = "right",
mappings = {
["l"] = "none",
},
},
},
keys = {
{
"<leader>fe",
function()
require("neo-tree.command").execute({ position = "right", toggle = true, dir = Util.root() })
end,
desc = "Explorer NeoTree (root dir)",
},
{
"<leader>fE",
function()
require("neo-tree.command").execute({ position = "right", toggle = true, dir = vim.loop.cwd() })
end,
desc = "Explorer NeoTree (cwd)",
},
{ "<A-f>", "<leader>fe", desc = "Explorer NeoTree (root dir)", remap = true },
{ "<A-F>", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
},
},
{
"rcarriga/nvim-dap-ui",
keys = {
{
"<leader>dk",
function()
require("dap").down()
end,
desc = "Down",
},
{
"<leader>dl",
function()
require("dap").up()
end,
desc = "Up",
},
{
"<leader>d;",
function()
require("dap").run_last()
end,
desc = "Run Last",
},
},
},
{
"DashieTM/test_plugin",
lazy = false,
opts = {
what = 0,
},
},
{
"DreamMaoMao/yazi.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim",
},
keys = {
{ "<leader>fy", "<cmd>Yazi<CR>", desc = "Toggle Yazi" },
},
},
}