mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Merge branch 'LazyVim:main' into gitui
This commit is contained in:
commit
dc7737a134
9 changed files with 200 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 12
|
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 13
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Table of Contents *LazyVim-table-of-contents*
|
Table of Contents *LazyVim-table-of-contents*
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
local have_make = vim.fn.executable("make") == 1
|
||||||
|
local have_cmake = vim.fn.executable("cmake") == 1
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
-- file explorer
|
-- file explorer
|
||||||
|
|
@ -141,12 +144,23 @@ return {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
build = vim.fn.executable("make") == 1 and "make"
|
build = have_make and "make"
|
||||||
or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
||||||
enabled = vim.fn.executable("make") == 1 or vim.fn.executable("cmake") == 1,
|
enabled = have_make or have_cmake,
|
||||||
config = function()
|
config = function(plugin)
|
||||||
LazyVim.on_load("telescope.nvim", function()
|
LazyVim.on_load("telescope.nvim", function()
|
||||||
require("telescope").load_extension("fzf")
|
local ok, err = pcall(require("telescope").load_extension, "fzf")
|
||||||
|
if not ok then
|
||||||
|
local lib = plugin.dir .. "/build/libfzf." .. (LazyVim.is_win() and "dll" or "so")
|
||||||
|
if not vim.uv.fs_stat(lib) then
|
||||||
|
LazyVim.warn("`telescope-fzf-native.nvim` not built. Rebuilding...")
|
||||||
|
require("lazy").build({ plugins = { plugin }, show = false }):wait(function()
|
||||||
|
LazyVim.info("Rebuilding `telescope-fzf-native.nvim` done.\nPlease restart Neovim.")
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
LazyVim.error("Failed to load `telescope-fzf-native.nvim`:\n" .. err)
|
||||||
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
125
lua/lazyvim/plugins/extras/editor/refactoring.lua
Normal file
125
lua/lazyvim/plugins/extras/editor/refactoring.lua
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"ThePrimeagen/refactoring.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>rs",
|
||||||
|
function()
|
||||||
|
require("telescope").extensions.refactoring.refactors()
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Refactor",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>ri",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Inline Variable")
|
||||||
|
end,
|
||||||
|
mode = { "n", "v" },
|
||||||
|
desc = "Inline Variable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rb",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Block")
|
||||||
|
end,
|
||||||
|
desc = "Extract Block",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rf",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Block To File")
|
||||||
|
end,
|
||||||
|
desc = "Extract Block To File",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rP",
|
||||||
|
function()
|
||||||
|
require("refactoring").debug.printf({ below = false })
|
||||||
|
end,
|
||||||
|
desc = "Debug Print",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rp",
|
||||||
|
function()
|
||||||
|
require("refactoring").debug.print_var({ normal = true })
|
||||||
|
end,
|
||||||
|
desc = "Debug Print Variable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rc",
|
||||||
|
function()
|
||||||
|
require("refactoring").debug.cleanup({})
|
||||||
|
end,
|
||||||
|
desc = "Debug Cleanup",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rf",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Function")
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Extract Function",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rF",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Function To File")
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Extract Function To File",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rx",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Variable")
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Extract Variable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rp",
|
||||||
|
function()
|
||||||
|
require("refactoring").debug.print_var()
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Debug Print Variable",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
prompt_func_return_type = {
|
||||||
|
go = false,
|
||||||
|
java = false,
|
||||||
|
cpp = false,
|
||||||
|
c = false,
|
||||||
|
h = false,
|
||||||
|
hpp = false,
|
||||||
|
cxx = false,
|
||||||
|
},
|
||||||
|
prompt_func_param_type = {
|
||||||
|
go = false,
|
||||||
|
java = false,
|
||||||
|
cpp = false,
|
||||||
|
c = false,
|
||||||
|
h = false,
|
||||||
|
hpp = false,
|
||||||
|
cxx = false,
|
||||||
|
},
|
||||||
|
printf_statements = {},
|
||||||
|
print_var_statements = {},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("refactoring").setup(opts)
|
||||||
|
if LazyVim.has("telescope.nvim") then
|
||||||
|
LazyVim.on_load("telescope.nvim", function()
|
||||||
|
require("telescope").load_extension("refactoring")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -25,12 +25,14 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-ansible",
|
"mfussenegger/nvim-ansible",
|
||||||
|
ft = {},
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>tr",
|
"<leader>ta",
|
||||||
function()
|
function()
|
||||||
require("ansible").run()
|
require("ansible").run()
|
||||||
end,
|
end,
|
||||||
|
desc = "Ansible Run Playbook/Role",
|
||||||
silent = true,
|
silent = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ return {
|
||||||
"Saecki/crates.nvim",
|
"Saecki/crates.nvim",
|
||||||
event = { "BufRead Cargo.toml" },
|
event = { "BufRead Cargo.toml" },
|
||||||
opts = {
|
opts = {
|
||||||
src = {
|
completion = {
|
||||||
cmp = { enabled = true },
|
cmp = { enabled = true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
46
lua/lazyvim/plugins/extras/lang/vue.lua
Normal file
46
lua/lazyvim/plugins/extras/lang/vue.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "vue" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = function(_, opts)
|
||||||
|
local vue_typescript_plugin = require("mason-registry").get_package("vue-language-server"):get_install_path()
|
||||||
|
.. "/node_modules/@vue/language-server"
|
||||||
|
.. "/node_modules/@vue/typescript-plugin"
|
||||||
|
|
||||||
|
opts.servers = vim.tbl_deep_extend("force", opts.servers, {
|
||||||
|
volar = {},
|
||||||
|
-- Volar 2.0 has discontinued their "take over mode" which in previous version provided support for typescript in vue files.
|
||||||
|
-- The new approach to get typescript support involves using the typescript language server along side volar.
|
||||||
|
tsserver = {
|
||||||
|
init_options = {
|
||||||
|
plugins = {
|
||||||
|
-- Use typescript language server along with vue typescript plugin
|
||||||
|
{
|
||||||
|
name = "@vue/typescript-plugin",
|
||||||
|
location = vue_typescript_plugin,
|
||||||
|
languages = { "javascript", "typescript", "vue" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = {
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"javascript.jsx",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact",
|
||||||
|
"typescript.tsx",
|
||||||
|
"vue",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -35,7 +35,6 @@ return {
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
extension = { rasi = "rasi", rofi = "rasi", wofi = "rasi" },
|
extension = { rasi = "rasi", rofi = "rasi", wofi = "rasi" },
|
||||||
filename = {
|
filename = {
|
||||||
[".env"] = "sh",
|
|
||||||
["vifmrc"] = "vim",
|
["vifmrc"] = "vim",
|
||||||
},
|
},
|
||||||
pattern = {
|
pattern = {
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ end
|
||||||
---@param hl_group? string
|
---@param hl_group? string
|
||||||
---@return string
|
---@return string
|
||||||
function M.format(component, text, hl_group)
|
function M.format(component, text, hl_group)
|
||||||
|
text = text:gsub("%%", "%%%%")
|
||||||
if not hl_group or hl_group == "" then
|
if not hl_group or hl_group == "" then
|
||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,11 @@ function M.lazy_file()
|
||||||
---@type table<string,string[]>
|
---@type table<string,string[]>
|
||||||
local skips = {}
|
local skips = {}
|
||||||
for _, event in ipairs(events) do
|
for _, event in ipairs(events) do
|
||||||
skips[event.event] = skips[event.event] or Event.get_augroups(event.event)
|
local augroups = Event.get_augroups(event.event)
|
||||||
|
local groups = vim.tbl_filter(function(t)
|
||||||
|
return not vim.tbl_contains({ t }, "filetypedetect")
|
||||||
|
end, augroups)
|
||||||
|
skips[event.event] = skips[event.event] or groups
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false })
|
vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false })
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue