tinymist/editors/neovim/samples/lazyvim-dev/init.lua
Myriad-Dreamin a0d5d7bee7
feat: move neovim config files (#1857)
* feat: move neovim config files

* fix: bootstrap
2025-06-30 10:49:42 +08:00

93 lines
3.3 KiB
Lua

-- This is a single file that bootstraps neovim editor for development.
-- Plus plugins in the `plugins` directory, it should be ready total edit typst files.
-- -- bootstrap lazy.nvim and your plugins
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.opt.clipboard:append 'unnamedplus'
-- Fix "waiting for osc52 response from terminal" message
-- https://github.com/neovim/neovim/issues/28611
if vim.env.SSH_TTY ~= nil then
-- Set up clipboard for ssh
local function my_paste(_)
return function(_)
local content = vim.fn.getreg '"'
return vim.split(content, '\n')
end
end
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy '+',
['*'] = require('vim.ui.clipboard.osc52').copy '*',
},
paste = {
-- No OSC52 paste action since wezterm doesn't support it
-- Should still paste from nvim
['+'] = my_paste '+',
['*'] = my_paste '*',
},
}
end
vim.api.nvim_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", { noremap = true, silent = true })
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight" } },
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})