mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
feat: More nvim plugins and changes, better xcodebuild experience.
This commit is contained in:
@@ -1,117 +1,182 @@
|
|||||||
return {
|
return {
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
enabled = true,
|
event = "InsertEnter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||||
"hrsh7th/cmp-buffer",
|
"hrsh7th/cmp-path", -- source for file system paths
|
||||||
"hrsh7th/cmp-path",
|
"L3MON4D3/LuaSnip", -- snippet engine
|
||||||
"hrsh7th/cmp-cmdline",
|
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||||
"hrsh7th/cmp-vsnip",
|
"rafamadriz/friendly-snippets", -- useful snippets
|
||||||
"hrsh7th/vim-vsnip",
|
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||||
'saadparwaiz1/cmp_luasnip',
|
},
|
||||||
"f3fora/cmp-spell",
|
config = function()
|
||||||
"hrsh7th/cmp-calc",
|
local cmp = require("cmp")
|
||||||
"hrsh7th/cmp-emoji",
|
local luasnip = require("luasnip")
|
||||||
"L3MON4D3/LuaSnip",
|
local lspkind = require("lspkind")
|
||||||
-- Adds a number of user-friendly snippets
|
|
||||||
'rafamadriz/friendly-snippets',
|
|
||||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
|
||||||
},
|
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
|
||||||
config = function()
|
|
||||||
-- Setup nvim-cmp.
|
|
||||||
local cmp = require "cmp"
|
|
||||||
local lspkind = require("lspkind")
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
||||||
local luasnip = require('luasnip')
|
|
||||||
|
|
||||||
require('lspconfig').sourcekit.setup {
|
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||||
capabilities = capabilities
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
}
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
lspkind.init({
|
completion = {
|
||||||
symbol_map = {
|
completeopt = "menu,menuone,preview",
|
||||||
|
},
|
||||||
Text = "",
|
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||||
Method = "",
|
expand = function(args)
|
||||||
Function = "",
|
luasnip.lsp_expand(args.body)
|
||||||
Constructor = "",
|
end,
|
||||||
Field = "ﰠ",
|
},
|
||||||
Variable = "",
|
mapping = cmp.mapping.preset.insert({
|
||||||
Class = "ﴯ",
|
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||||
Interface = "",
|
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||||
Module = "",
|
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||||
Property = "ﰠ",
|
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||||
Unit = "塞",
|
["<CR>"] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }),
|
||||||
Value = "",
|
["<C-b>"] = cmp.mapping(function(fallback)
|
||||||
Enum = "",
|
if luasnip.jumpable(-1) then
|
||||||
Keyword = "",
|
luasnip.jump(-1)
|
||||||
Snippet = "",
|
else
|
||||||
Color = "",
|
fallback()
|
||||||
File = "",
|
end
|
||||||
Reference = "",
|
end, { "i", "s" }),
|
||||||
Folder = "",
|
["<C-f>"] = cmp.mapping(function(fallback)
|
||||||
EnumMember = "",
|
if luasnip.jumpable(1) then
|
||||||
Constant = "",
|
luasnip.jump(1)
|
||||||
Struct = "פּ",
|
else
|
||||||
Event = "",
|
fallback()
|
||||||
Operator = "",
|
end
|
||||||
TypeParameter = ""
|
end, { "i", "s" }),
|
||||||
}
|
}),
|
||||||
})
|
-- sources for autocompletion
|
||||||
|
sources = cmp.config.sources({
|
||||||
cmp.setup({
|
{ name = "nvim_lsp" },
|
||||||
completion = {
|
{ name = "luasnip" }, -- snippets
|
||||||
completeopt = "menu,menuone,preview",
|
{ name = "buffer" }, -- text within current buffer
|
||||||
},
|
{ name = "path" }, -- file system paths
|
||||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
}),
|
||||||
expand = function(args)
|
-- configure lspkind for vs-code like pictograms in completion menu
|
||||||
luasnip.lsp_expand(args.body)
|
formatting = {
|
||||||
end,
|
format = lspkind.cmp_format({
|
||||||
},
|
maxwidth = 50,
|
||||||
mapping = cmp.mapping.preset.insert({
|
ellipsis_char = "...",
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
}),
|
||||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
},
|
||||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
})
|
||||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
end,
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }),
|
|
||||||
["<C-b>"] = cmp.mapping(function(fallback)
|
|
||||||
if luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
["<C-f>"] = cmp.mapping(function(fallback)
|
|
||||||
if luasnip.jumpable(1) then
|
|
||||||
luasnip.jump(1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
}),
|
|
||||||
-- sources for autocompletion
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "luasnip" }, -- snippets
|
|
||||||
{ name = "buffer" }, -- text within current buffer
|
|
||||||
{ name = "path" }, -- file system paths
|
|
||||||
{ name = "calc" },
|
|
||||||
{ name = "emoji" },
|
|
||||||
{ name = "spell" },
|
|
||||||
}),
|
|
||||||
-- configure lspkind for vs-code like pictograms in completion menu
|
|
||||||
formatting = {
|
|
||||||
expandable_indicator = true,
|
|
||||||
fields = { 'abbr', 'kind', 'menu' },
|
|
||||||
format = lspkind.cmp_format({
|
|
||||||
maxwidth = 50,
|
|
||||||
ellipsis_char = "...",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
-- return {
|
||||||
|
-- "hrsh7th/nvim-cmp",
|
||||||
|
-- enabled = true,
|
||||||
|
-- dependencies = {
|
||||||
|
-- "hrsh7th/cmp-nvim-lsp",
|
||||||
|
-- "hrsh7th/cmp-buffer",
|
||||||
|
-- "hrsh7th/cmp-path",
|
||||||
|
-- "hrsh7th/cmp-cmdline",
|
||||||
|
-- "hrsh7th/cmp-vsnip",
|
||||||
|
-- "hrsh7th/vim-vsnip",
|
||||||
|
-- "saadparwaiz1/cmp_luasnip",
|
||||||
|
-- "f3fora/cmp-spell",
|
||||||
|
-- "hrsh7th/cmp-calc",
|
||||||
|
-- "hrsh7th/cmp-emoji",
|
||||||
|
-- "L3MON4D3/LuaSnip",
|
||||||
|
-- -- Adds a number of user-friendly snippets
|
||||||
|
-- "rafamadriz/friendly-snippets",
|
||||||
|
-- "onsails/lspkind.nvim", -- vs-code like pictograms
|
||||||
|
-- },
|
||||||
|
-- event = { "BufReadPre", "BufNewFile" },
|
||||||
|
-- config = function()
|
||||||
|
-- -- Setup nvim-cmp.
|
||||||
|
-- local cmp = require("cmp")
|
||||||
|
-- local lspkind = require("lspkind")
|
||||||
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
-- capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||||
|
-- local luasnip = require("luasnip")
|
||||||
|
-- require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
--
|
||||||
|
-- require("lspconfig").sourcekit.setup({
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- lspkind.init({
|
||||||
|
-- symbol_map = {
|
||||||
|
--
|
||||||
|
-- Text = "",
|
||||||
|
-- Method = "",
|
||||||
|
-- Function = "",
|
||||||
|
-- Constructor = "",
|
||||||
|
-- Field = "ﰠ",
|
||||||
|
-- Variable = "",
|
||||||
|
-- Class = "ﴯ",
|
||||||
|
-- Interface = "",
|
||||||
|
-- Module = "",
|
||||||
|
-- Property = "ﰠ",
|
||||||
|
-- Unit = "塞",
|
||||||
|
-- Value = "",
|
||||||
|
-- Enum = "",
|
||||||
|
-- Keyword = "",
|
||||||
|
-- Snippet = "",
|
||||||
|
-- Color = "",
|
||||||
|
-- File = "",
|
||||||
|
-- Reference = "",
|
||||||
|
-- Folder = "",
|
||||||
|
-- EnumMember = "",
|
||||||
|
-- Constant = "",
|
||||||
|
-- Struct = "פּ",
|
||||||
|
-- Event = "",
|
||||||
|
-- Operator = "",
|
||||||
|
-- TypeParameter = "",
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- cmp.setup({
|
||||||
|
-- completion = {
|
||||||
|
-- completeopt = "menu,menuone,preview",
|
||||||
|
-- },
|
||||||
|
-- snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||||
|
-- expand = function(args)
|
||||||
|
-- luasnip.lsp_expand(args.body)
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
-- mapping = cmp.mapping.preset.insert({
|
||||||
|
-- ["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||||
|
-- ["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||||
|
-- ["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||||
|
-- ["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||||
|
-- ["<CR>"] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }),
|
||||||
|
-- ["<C-b>"] = cmp.mapping(function(fallback)
|
||||||
|
-- if luasnip.jumpable(-1) then
|
||||||
|
-- luasnip.jump(-1)
|
||||||
|
-- else
|
||||||
|
-- fallback()
|
||||||
|
-- end
|
||||||
|
-- end, { "i", "s" }),
|
||||||
|
-- ["<C-f>"] = cmp.mapping(function(fallback)
|
||||||
|
-- if luasnip.jumpable(1) then
|
||||||
|
-- luasnip.jump(1)
|
||||||
|
-- else
|
||||||
|
-- fallback()
|
||||||
|
-- end
|
||||||
|
-- end, { "i", "s" }),
|
||||||
|
-- }),
|
||||||
|
-- -- sources for autocompletion
|
||||||
|
-- sources = cmp.config.sources({
|
||||||
|
-- { name = "nvim_lsp" },
|
||||||
|
-- { name = "luasnip" }, -- snippets
|
||||||
|
-- { name = "buffer" }, -- text within current buffer
|
||||||
|
-- { name = "path" }, -- file system paths
|
||||||
|
-- --{ name = "calc" },
|
||||||
|
-- --{ name = "emoji" },
|
||||||
|
-- --{ name = "spell" },
|
||||||
|
-- }),
|
||||||
|
-- -- configure lspkind for vs-code like pictograms in completion menu
|
||||||
|
-- formatting = {
|
||||||
|
-- expandable_indicator = true,
|
||||||
|
-- fields = { "abbr", "kind", "menu" },
|
||||||
|
-- format = lspkind.cmp_format({
|
||||||
|
-- maxwidth = 50,
|
||||||
|
-- ellipsis_char = "...",
|
||||||
|
-- }),
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
-- }
|
||||||
|
|||||||
23
nvim/m-housh/lua/user/plugin/fidget.lua
Normal file
23
nvim/m-housh/lua/user/plugin/fidget.lua
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
return {
|
||||||
|
"j-hui/fidget.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
local fidget = require("fidget")
|
||||||
|
fidget.setup({
|
||||||
|
notification = {
|
||||||
|
window = {
|
||||||
|
normal_hl = "String", -- Base highlight group in the notification window
|
||||||
|
winblend = 0, -- Background color opacity in the notification window
|
||||||
|
border = "rounded", -- Border around the notification window
|
||||||
|
zindex = 45, -- Stacking priority of the notification window
|
||||||
|
max_width = 0, -- Maximum width of the notification window
|
||||||
|
max_height = 0, -- Maximum height of the notification window
|
||||||
|
x_padding = 1, -- Padding from right edge of window boundary
|
||||||
|
y_padding = 1, -- Padding from bottom edge of window boundary
|
||||||
|
align = "bottom", -- How to align the notification window
|
||||||
|
relative = "editor", -- What the notification window position is relative to
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -1,55 +1,69 @@
|
|||||||
return {
|
return {
|
||||||
"mhartington/formatter.nvim",
|
"mhartington/formatter.nvim",
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
local util = require("formatter.util")
|
local util = require("formatter.util")
|
||||||
require("formatter").setup({
|
require("formatter").setup({
|
||||||
filetype = {
|
filetype = {
|
||||||
markdown = function()
|
lua = {
|
||||||
return {
|
require("formatter.filetypes.lua").stylua,
|
||||||
exe = "prettier",
|
function()
|
||||||
args = {
|
return {
|
||||||
"--stdin-filepath",
|
exe = "stylua",
|
||||||
util.escape_path(util.get_current_buffer_file_path()),
|
args = {
|
||||||
"--print-width",
|
"--search-parent-directories",
|
||||||
"80",
|
"--stdin-filepath",
|
||||||
"--prose-wrap",
|
util.escape_path(util.get_current_buffer_file_path()),
|
||||||
"always",
|
"--",
|
||||||
"--parser",
|
"-",
|
||||||
"markdown"
|
},
|
||||||
},
|
stdin = true,
|
||||||
stdin = true,
|
}
|
||||||
try_node_modules = true,
|
end,
|
||||||
}
|
},
|
||||||
end,
|
markdown = function()
|
||||||
swift = function()
|
return {
|
||||||
return {
|
exe = "prettier",
|
||||||
exe = "swiftformat",
|
args = {
|
||||||
}
|
"--stdin-filepath",
|
||||||
end,
|
util.escape_path(util.get_current_buffer_file_path()),
|
||||||
["*"] = {
|
"--print-width",
|
||||||
-- formatter for any / all file types.
|
"80",
|
||||||
require("formatter.filetypes.any").remove_trailing_whitespace
|
"--prose-wrap",
|
||||||
}
|
"always",
|
||||||
}
|
"--parser",
|
||||||
})
|
"markdown",
|
||||||
|
},
|
||||||
|
stdin = true,
|
||||||
|
try_node_modules = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
swift = function()
|
||||||
|
return {
|
||||||
|
exe = "swiftformat",
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
["*"] = {
|
||||||
|
-- formatter for any / all file types.
|
||||||
|
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- Keymaps
|
-- Keymaps
|
||||||
local wk = require('which-key')
|
local wk = require("which-key")
|
||||||
wk.add({
|
wk.add({
|
||||||
{ "<space>f", ":Format", desc = "[F]ormat" },
|
{ "<space>f", ":Format", desc = "[F]ormat" },
|
||||||
{ "<space>F", ":FormateWrite", desc = "[F]ormat write" }
|
{ "<space>F", ":FormateWrite", desc = "[F]ormat write" },
|
||||||
},
|
}, { mode = "n", silent = true })
|
||||||
{ mode = 'n', silent = true }
|
|
||||||
)
|
|
||||||
|
|
||||||
local augroup = vim.api.nvim_create_augroup
|
local augroup = vim.api.nvim_create_augroup
|
||||||
local autocmd = vim.api.nvim_create_autocmd
|
local autocmd = vim.api.nvim_create_autocmd
|
||||||
|
|
||||||
augroup("__formatter__", { clear = true })
|
augroup("__formatter__", { clear = true })
|
||||||
autocmd("BufWritePost", {
|
autocmd("BufWritePost", {
|
||||||
group = "__formatter__",
|
group = "__formatter__",
|
||||||
command = ":FormatWrite"
|
command = ":FormatWrite",
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,94 +1,85 @@
|
|||||||
return {
|
return {
|
||||||
"ThePrimeagen/harpoon",
|
"ThePrimeagen/harpoon",
|
||||||
branch = "harpoon2",
|
branch = "harpoon2",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim"
|
"nvim-lua/plenary.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local harpoon = require('harpoon')
|
local harpoon = require("harpoon")
|
||||||
harpoon:setup({
|
harpoon:setup({
|
||||||
settings = {
|
settings = {
|
||||||
save_on_toggle = true,
|
save_on_toggle = true,
|
||||||
sync_on_ui_close = true,
|
sync_on_ui_close = true,
|
||||||
key = function()
|
key = function()
|
||||||
return vim.loop.cwd()
|
return vim.loop.cwd()
|
||||||
end,
|
end,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local conf = require('telescope.config').values
|
local conf = require("telescope.config").values
|
||||||
local function toggle_telescope(harpoon_files)
|
local function toggle_telescope(harpoon_files)
|
||||||
local file_paths = {}
|
local file_paths = {}
|
||||||
for _, item in ipairs(harpoon_files.items) do
|
for _, item in ipairs(harpoon_files.items) do
|
||||||
table.insert(file_paths, item.value)
|
table.insert(file_paths, item.value)
|
||||||
end
|
end
|
||||||
|
|
||||||
require('telescope.pickers').new({}, {
|
require("telescope.pickers")
|
||||||
prompt_title = 'Harpoon',
|
.new({}, {
|
||||||
finder = require('telescope.finders').new_table({
|
prompt_title = "Harpoon",
|
||||||
results = file_paths,
|
finder = require("telescope.finders").new_table({
|
||||||
}),
|
results = file_paths,
|
||||||
previewer = conf.file_previewer({}),
|
}),
|
||||||
sorter = conf.generic_sorter({}),
|
previewer = conf.file_previewer({}),
|
||||||
}):find()
|
sorter = conf.generic_sorter({}),
|
||||||
end
|
})
|
||||||
|
:find()
|
||||||
|
end
|
||||||
|
|
||||||
-- Keymaps
|
-- Keymaps
|
||||||
vim.keymap.set("n", "<C-e>",
|
vim.keymap.set("n", "<C-e>", function()
|
||||||
function() toggle_telescope(harpoon:list()) end,
|
toggle_telescope(harpoon:list())
|
||||||
{ desc = "Open Harpoon window" }
|
end, { desc = "Open Harpoon window" })
|
||||||
)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>a",
|
vim.keymap.set("n", "<leader>a", function()
|
||||||
function() harpoon:list():add() end,
|
harpoon:list():add()
|
||||||
{ desc = "[A]dd to harpoon list." }
|
end, { desc = "[A]dd to harpoon list." })
|
||||||
)
|
vim.keymap.set("n", "<C-e>", function()
|
||||||
vim.keymap.set("n", "<C-e>",
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||||
function() harpoon.ui:toggle_quick_menu(harpoon:list()) end,
|
end, { desc = "Toggle quick menu." })
|
||||||
{ desc = "Toggle quick menu." }
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Buffer key maps. Currently keeping all buffer movements
|
-- Buffer key maps. Currently keeping all buffer movements
|
||||||
-- isolated to top left row of keys on keyboard and all begin
|
-- isolated to top left row of keys on keyboard and all begin
|
||||||
-- with the <Control> key.
|
-- with the <Control> key.
|
||||||
|
|
||||||
-- Select buffer numbers.
|
-- Select buffer numbers.
|
||||||
vim.keymap.set("n", "<C-S-Y>",
|
vim.keymap.set("n", "<A-y>", function()
|
||||||
function() harpoon:list():select(1) end,
|
harpoon:list():select(1)
|
||||||
{ desc = "Select first harpoon buffer." }
|
end, { desc = "Select first harpoon buffer." })
|
||||||
)
|
vim.keymap.set("n", "<A-u>", function()
|
||||||
vim.keymap.set("n", "<C-S-U>",
|
harpoon:list():select(2)
|
||||||
function() harpoon:list():select(2) end,
|
end, { desc = "Select second harpoon buffer." })
|
||||||
{ desc = "Select second harpoon buffer." }
|
vim.keymap.set("n", "<A-i>", function()
|
||||||
)
|
harpoon:list():select(3)
|
||||||
vim.keymap.set("n", "<C-S-I>",
|
end, { desc = "Select third harpoon buffer." })
|
||||||
function() harpoon:list():select(3) end,
|
vim.keymap.set("n", "<A-o>", function()
|
||||||
{ desc = "Select third harpoon buffer." }
|
harpoon:list():select(4)
|
||||||
)
|
end, { desc = "Select fourth harpoon buffer." })
|
||||||
vim.keymap.set("n", "<C-S-O>",
|
|
||||||
function() harpoon:list():select(3) end,
|
|
||||||
{ desc = "Select third harpoon buffer." }
|
|
||||||
)
|
|
||||||
|
|
||||||
|
-- Toggle previous and next buffers.
|
||||||
|
vim.keymap.set("n", "<C-[>", function()
|
||||||
|
harpoon:list():prev()
|
||||||
|
end, { desc = "[P]revious harpoon buffer." })
|
||||||
|
vim.keymap.set("n", "<C-]>", function()
|
||||||
|
harpoon:list():next()
|
||||||
|
end, { desc = "[N]ext harpoon buffer." })
|
||||||
|
|
||||||
-- Toggle previous and next buffers.
|
-- Extensions
|
||||||
vim.keymap.set("n", "<C-[>",
|
harpoon:extend({
|
||||||
function() harpoon:list():prev() end,
|
UI_CREATE = function(cx)
|
||||||
{ desc = "[P]revious harpoon buffer." }
|
vim.keymap.set("n", "<C-v>", function()
|
||||||
)
|
harpoon.ui:select_menu_item({ vsplit = true })
|
||||||
vim.keymap.set("n", "<C-]>",
|
end, { buffer = cx.buffer, desc = "Open in [V]split" })
|
||||||
function() harpoon:list():next() end,
|
end,
|
||||||
{ desc = "[N]ext harpoon buffer." }
|
})
|
||||||
)
|
end,
|
||||||
|
|
||||||
-- Extensions
|
|
||||||
harpoon:extend({
|
|
||||||
UI_CREATE = function(cx)
|
|
||||||
vim.keymap.set("n", "<C-v>",
|
|
||||||
function() harpoon.ui:select_menu_item({ vsplit = true }) end,
|
|
||||||
{ buffer = cx.buffer, desc = "Open in [V]split" }
|
|
||||||
)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,332 +1,90 @@
|
|||||||
return {
|
return {
|
||||||
{
|
"neovim/nvim-lspconfig",
|
||||||
"williamboman/nvim-lsp-installer",
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
dependencies = {
|
||||||
require("nvim-lsp-installer").setup({})
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
end
|
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||||
},
|
},
|
||||||
{
|
config = function()
|
||||||
"williamboman/mason-lspconfig.nvim",
|
local lspconfig = require("lspconfig")
|
||||||
dependencies = {
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
"williamboman/mason.nvim",
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
"onsails/lspkind-nvim",
|
local opts = { noremap = true, silent = true }
|
||||||
"famiu/bufdelete.nvim",
|
local on_attach =
|
||||||
"ray-x/lsp_signature.nvim",
|
function(_, bufnr)
|
||||||
"neovim/nvim-lspconfig",
|
opts.buffer = bufnr
|
||||||
"folke/neodev.nvim",
|
|
||||||
"mhartington/formatter.nvim",
|
|
||||||
"ray-x/go.nvim",
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
ensure_installed = {
|
|
||||||
"bashls",
|
|
||||||
"clangd",
|
|
||||||
"dockerls",
|
|
||||||
"gopls",
|
|
||||||
"jsonls",
|
|
||||||
"jedi_language_server",
|
|
||||||
"lua_ls",
|
|
||||||
"marksman",
|
|
||||||
"terraformls",
|
|
||||||
"ts_ls",
|
|
||||||
"texlab",
|
|
||||||
"yamlls",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
opts.desc = "Show line diagnostics"
|
||||||
"neovim/nvim-lspconfig",
|
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
|
||||||
event = { "BufReadPost", "BufNewFile" },
|
|
||||||
cmd = { "LspInfo", "LspInstall", "LspUninstall", "LspStart", "LspStop", "LspRestart" },
|
|
||||||
config = function()
|
|
||||||
require('neodev').setup()
|
|
||||||
require("mason").setup()
|
|
||||||
require("mason-lspconfig").setup()
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
|
|
||||||
lspconfig.bashls.setup {}
|
opts.desc = "Show diagnostics in Telescope"
|
||||||
lspconfig.clangd.setup {}
|
vim.keymaps.set("n", "<leader><leader>d", "<CMD>Telescope diagnostics bufnr=0<CR>", opts)
|
||||||
lspconfig.dockerls.setup {}
|
|
||||||
lspconfig.gopls.setup {}
|
|
||||||
lspconfig.jsonls.setup {}
|
|
||||||
lspconfig.lua_ls.setup {}
|
|
||||||
lspconfig.marksman.setup {}
|
|
||||||
lspconfig.yamlls.setup {}
|
|
||||||
lspconfig.sourcekit.setup({
|
|
||||||
capabilities = {
|
|
||||||
workspace = {
|
|
||||||
didChangeWatchedFiles = {
|
|
||||||
dynamicRegistration = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
cmd = { "/usr/bin/sourcekit-lsp" }
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
opts.desc = "Show documentation for what is under cursor"
|
||||||
desc = 'LSP Actions',
|
vim.keymap.set("n", "<C-k>", vim.lsp.buf.hover, opts)
|
||||||
callback = function(args)
|
|
||||||
-- Configure keybindings once we've attached.
|
|
||||||
local wk = require('which-key')
|
|
||||||
|
|
||||||
-- Normal mode keymaps
|
opts.desc = "[G]oto [D]efinition"
|
||||||
wk.add({
|
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions trim_text=true<cr>", opts)
|
||||||
{ "<C-k>", vim.lsp.buf.hover, desc = "LSP hover info" },
|
|
||||||
{ "<leader>ca", vim.lsp.buf.code_action, desc = "LSP [C]ode [A]ction" },
|
|
||||||
{ "gd", vim.lsp.buf.definition, desc = "[G]oto [D]efinition" },
|
|
||||||
{ "gD", vim.lsp.buf.declaration, desc = "[G]oto [D]eclaration" },
|
|
||||||
{ "gi", vim.lsp.buf.implementation, desc = "[G]oto [I]mplementation" },
|
|
||||||
{ "gr", vim.lsp.buf.references, desc = "List [R]eferences" },
|
|
||||||
{"gs", vim.lsp.buf.signature_help, desc = "[S]ignature help" },
|
|
||||||
{ "<leader>rn", vim.lsp.buf.rename, desc = "[R]e[N]ame" },
|
|
||||||
{ "<leader>rl", ":LspRestart | :LspStart<CR>", desc = "[R]estart or start lsp." },
|
|
||||||
{ "<leader><leader>d", "<CMD>Telescope diagnostics bufnr=0<CR>", desc = "[D]iagnostics" },
|
|
||||||
{ "[d", vim.diagnostic.goto_prev, desc = "Go to previous diagnostic" },
|
|
||||||
{ "]d", vim.diagnostic.goto_prev, desc = "Go to next diagnostic" },
|
|
||||||
}, {
|
|
||||||
mode = 'n',
|
|
||||||
silent = true,
|
|
||||||
noremap = true
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Visual mode keymaps
|
opts.desc = "[G]oto [D]eclaration"
|
||||||
wk.add({
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||||
{ "<leader>ca", vim.lsp.buf.code_action, desc = "LSP [C]ode [A]ction" },
|
|
||||||
},
|
opts.desc = "LSP [C]ode [A]ction"
|
||||||
{ mode = 'v', silent = true }
|
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||||
)
|
|
||||||
end,
|
--opts.desc = "[R]e-[N]ame"
|
||||||
})
|
--vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||||
end
|
|
||||||
}
|
opts.desc = "[R]eload or start LSP"
|
||||||
|
vim.keymap.set("n", "<leader>rl", ":LspRestart | :LspStart<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Goto previous diagnostic"
|
||||||
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||||
|
|
||||||
|
opts.desc = "Goto next diagnostic"
|
||||||
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||||
|
end, lspconfig["sourcekit"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
on_init = function(client)
|
||||||
|
-- HACK: to fix some issues with LSP
|
||||||
|
-- more details: https://github.com/neovim/neovim/issues/19237#issuecomment-2237037154
|
||||||
|
client.offset_encoding = "utf-8"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- nice 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
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "[R]e-[N]ame" })
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
-- return {
|
|
||||||
-- {
|
|
||||||
-- "williamboman/nvim-lsp-installer",
|
|
||||||
-- config = function()
|
|
||||||
-- require("nvim-lsp-installer").setup({})
|
|
||||||
-- end
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- "williamboman/mason-lspconfig.nvim",
|
|
||||||
-- dependencies = {
|
|
||||||
-- "williamboman/mason.nvim",
|
|
||||||
-- "onsails/lspkind-nvim",
|
|
||||||
-- "famiu/bufdelete.nvim",
|
|
||||||
-- "ray-x/lsp_signature.nvim",
|
|
||||||
-- "neovim/nvim-lspconfig",
|
|
||||||
-- "folke/neodev.nvim",
|
|
||||||
-- "mhartington/formatter.nvim",
|
|
||||||
-- "ray-x/go.nvim",
|
|
||||||
-- },
|
|
||||||
-- opts = {
|
|
||||||
-- ensure_installed = {
|
|
||||||
-- "bashls",
|
|
||||||
-- "clangd",
|
|
||||||
-- "dockerls",
|
|
||||||
-- "gopls",
|
|
||||||
-- "jsonls",
|
|
||||||
-- "jedi_language_server",
|
|
||||||
-- "lua_ls",
|
|
||||||
-- "marksman",
|
|
||||||
-- "terraformls",
|
|
||||||
-- "ts_ls",
|
|
||||||
-- "texlab",
|
|
||||||
-- "yamlls",
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- "neovim/nvim-lspconfig",
|
|
||||||
-- dependencies = {
|
|
||||||
-- "hrsh7th/cmp-nvim-lsp",
|
|
||||||
-- },
|
|
||||||
-- config = function()
|
|
||||||
-- require('neodev').setup()
|
|
||||||
-- require("mason").setup()
|
|
||||||
-- require("mason-lspconfig").setup()
|
|
||||||
-- local nvim_lsp = require("lspconfig")
|
|
||||||
-- local telescope_builtin = require('telescope.builtin')
|
|
||||||
--
|
--
|
||||||
-- vim.api.nvim_create_autocmd('LspAttach', {
|
-- -- Normal mode keymaps
|
||||||
-- group = vim.api.nvim_create_augroup('my-lsp-attach', { clear = true }),
|
-- wk.add({
|
||||||
-- callback = function(event)
|
-- { "<C-k>", vim.lsp.buf.hover, desc = "LSP hover info" },
|
||||||
-- -- Helper function to create a keymap.
|
-- { "<leader>ca", vim.lsp.buf.code_action, desc = "LSP [C]ode [A]ction" },
|
||||||
-- local map = function(keys, func, desc)
|
-- { "gi", vim.lsp.buf.implementation, desc = "[G]oto [I]mplementation" },
|
||||||
-- vim.keymap.set('n', keys, func, { buffer = true, desc = 'LSP: ' .. desc })
|
-- { "gr", vim.lsp.buf.references, desc = "List [R]eferences" },
|
||||||
-- end
|
-- { "gs", vim.lsp.buf.signature_help, desc = "[S]ignature help" },
|
||||||
|
-- }, {
|
||||||
|
-- mode = "n",
|
||||||
|
-- silent = true,
|
||||||
|
-- noremap = true,
|
||||||
|
-- })
|
||||||
--
|
--
|
||||||
-- -- Mappings.
|
-- -- Visual mode keymaps
|
||||||
-- -- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- wk.add({
|
||||||
--
|
-- { "<leader>ca", vim.lsp.buf.code_action, desc = "LSP [C]ode [A]ction" },
|
||||||
-- map('[d', '<CMD>lua vim.lsp.diagnostic.goto_prev()<CR>', 'Goto previous')
|
-- }, { mode = "v", silent = true })
|
||||||
-- map(']d', '<CMD>lua vim.lsp.diagnostic.goto_next()<CR>', 'Goto next')
|
-- end,
|
||||||
-- map('<space>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
-- })
|
||||||
-- map('<space>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
-- end,
|
||||||
-- map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
-- },
|
||||||
-- map('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
-- }
|
||||||
-- map('gi', telescope_builtin.lsp_implementations, '[G]oto, [I]mplementation')
|
|
||||||
-- map('gr', telescope_builtin.lsp_references, '[G]oto [R]eferences')
|
|
||||||
-- map('gt', telescope_builtin.lsp_type_definitions, '[T]ype Definitions')
|
|
||||||
-- map('K', vim.lsp.buf.hover, 'Hover Documentation')
|
|
||||||
--
|
|
||||||
-- -- -- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
|
||||||
-- -- buf_set_keymap("n", "<space>wa",
|
|
||||||
-- -- "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
|
||||||
-- -- buf_set_keymap("n", "<space>wr",
|
|
||||||
-- -- "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
|
||||||
-- -- buf_set_keymap("n", "<space>wl",
|
|
||||||
-- -- "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
|
|
||||||
-- -- opts)
|
|
||||||
-- -- buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
|
||||||
-- -- buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
|
||||||
-- vim.api.nvim_buf_set_option(event.buf, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
-- end,
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- -- Use a loop to conveniently call 'setup' on multiple servers and
|
|
||||||
-- -- map buffer local keybindings when the language server attaches
|
|
||||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
-- capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
|
||||||
--
|
|
||||||
-- local servers = {
|
|
||||||
-- "bashls",
|
|
||||||
-- "clangd",
|
|
||||||
-- "dockerls",
|
|
||||||
-- "gopls",
|
|
||||||
-- "jsonls",
|
|
||||||
-- "jedi_language_server",
|
|
||||||
-- "lua_ls",
|
|
||||||
-- "marksman",
|
|
||||||
-- "sourcekit",
|
|
||||||
-- "terraformls",
|
|
||||||
-- "ts_ls",
|
|
||||||
-- "texlab",
|
|
||||||
-- "yamlls",
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- for _, lsp in ipairs(servers) do
|
|
||||||
-- nvim_lsp[lsp].setup {
|
|
||||||
-- capabilities = capabilities,
|
|
||||||
-- settings = {
|
|
||||||
-- gopls = {
|
|
||||||
-- experimentalPostfixCompletions = true,
|
|
||||||
-- analyses = {
|
|
||||||
-- unusedparams = true,
|
|
||||||
-- shadow = true
|
|
||||||
-- },
|
|
||||||
-- staticcheck = true
|
|
||||||
-- },
|
|
||||||
-- lua_ls = {
|
|
||||||
-- Lua = {
|
|
||||||
-- completion = {
|
|
||||||
-- callSnippet = "Replace"
|
|
||||||
-- },
|
|
||||||
-- workspace = { checkThirdParty = false },
|
|
||||||
-- telemetry = { enable = false },
|
|
||||||
-- }
|
|
||||||
-- },
|
|
||||||
-- json = {
|
|
||||||
-- format = {enabled = false},
|
|
||||||
-- schemas = {
|
|
||||||
-- {
|
|
||||||
-- description = "ESLint config",
|
|
||||||
-- fileMatch = {".eslintrc.json", ".eslintrc"},
|
|
||||||
-- url = "http://json.schemastore.org/eslintrc"
|
|
||||||
-- }, {
|
|
||||||
-- description = "Package config",
|
|
||||||
-- fileMatch = {"package.json"},
|
|
||||||
-- url = "https://json.schemastore.org/package"
|
|
||||||
-- }, {
|
|
||||||
-- description = "Packer config",
|
|
||||||
-- fileMatch = {"packer.json"},
|
|
||||||
-- url = "https://json.schemastore.org/packer"
|
|
||||||
-- }, {
|
|
||||||
-- description = "Renovate config",
|
|
||||||
-- fileMatch = {
|
|
||||||
-- "renovate.json", "renovate.json5",
|
|
||||||
-- ".github/renovate.json", ".github/renovate.json5",
|
|
||||||
-- ".renovaterc", ".renovaterc.json"
|
|
||||||
-- },
|
|
||||||
-- url = "https://docs.renovatebot.com/renovate-schema"
|
|
||||||
-- }, {
|
|
||||||
-- description = "OpenApi config",
|
|
||||||
-- fileMatch = {"*api*.json"},
|
|
||||||
-- url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
-- },
|
|
||||||
-- redhat = {telemetry = {enabled = false}},
|
|
||||||
-- texlab = {
|
|
||||||
-- auxDirectory = ".",
|
|
||||||
-- bibtexFormatter = "texlab",
|
|
||||||
-- build = {
|
|
||||||
-- args = {
|
|
||||||
-- "--keep-intermediates", "--keep-logs", "--synctex", "%f"
|
|
||||||
-- },
|
|
||||||
-- executable = "tectonic",
|
|
||||||
-- forwardSearchAfter = false,
|
|
||||||
-- onSave = false
|
|
||||||
-- },
|
|
||||||
-- chktex = {onEdit = false, onOpenAndSave = false},
|
|
||||||
-- diagnosticsDelay = 300,
|
|
||||||
-- formatterLineLength = 80,
|
|
||||||
-- forwardSearch = {args = {}},
|
|
||||||
-- latexFormatter = "latexindent",
|
|
||||||
-- latexindent = {modifyLineBreaks = false}
|
|
||||||
-- },
|
|
||||||
-- yaml = {
|
|
||||||
-- schemaStore = {
|
|
||||||
-- enable = true,
|
|
||||||
-- url = "https://www.schemastore.org/api/json/catalog.json"
|
|
||||||
-- },
|
|
||||||
-- schemas = {
|
|
||||||
-- kubernetes = "/*.yaml",
|
|
||||||
-- ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}",
|
|
||||||
-- ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
|
|
||||||
-- ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
|
|
||||||
-- ["http://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}",
|
|
||||||
-- ["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}",
|
|
||||||
-- ["http://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}",
|
|
||||||
-- ["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
|
|
||||||
-- ["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
|
|
||||||
-- ["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}",
|
|
||||||
-- ["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
|
|
||||||
-- ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}",
|
|
||||||
-- ["https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json"] = "*flow*.{yml,yaml}"
|
|
||||||
-- },
|
|
||||||
-- format = {enabled = false},
|
|
||||||
-- validate = false, -- TODO: conflicts between Kubernetes resources and kustomization.yaml
|
|
||||||
-- completion = true,
|
|
||||||
-- hover = true
|
|
||||||
-- }
|
|
||||||
-- },
|
|
||||||
-- flags = {debounce_text_changes = 150}
|
|
||||||
-- }
|
|
||||||
-- require"lsp_signature".setup({
|
|
||||||
-- bind = true, -- This is mandatory, otherwise border config won't get registered.
|
|
||||||
-- floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
|
|
||||||
-- doc_lines = 2, -- Set to 0 for not showing doc
|
|
||||||
-- hint_prefix = "🐼 ",
|
|
||||||
-- -- use_lspsaga = false, -- set to true if you want to use lspsaga popup
|
|
||||||
-- handler_opts = {
|
|
||||||
-- border = "shadow" -- double, single, shadow, none
|
|
||||||
-- }
|
|
||||||
-- })
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- -- Test source-kit
|
|
||||||
-- require('lspconfig').sourcekit.setup{
|
|
||||||
-- capabilities = {
|
|
||||||
-- workspace = {
|
|
||||||
-- didChangeWatchedFiles = {
|
|
||||||
-- dynamicRegistration = true
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- end
|
|
||||||
-- }
|
|
||||||
-- }
|
-- }
|
||||||
|
|||||||
@@ -1,145 +1,217 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
config = function()
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
local colors = {
|
config = function()
|
||||||
red = '#ca1243',
|
local lualine = require("lualine")
|
||||||
grey = '#a0a1a7',
|
|
||||||
black = '#383a42',
|
|
||||||
white = '#f3f3f3',
|
|
||||||
light_green = '#83a598',
|
|
||||||
orange = '#fe8019',
|
|
||||||
green = '#8ec07c',
|
|
||||||
}
|
|
||||||
|
|
||||||
local empty = require('lualine.component'):extend()
|
local function xcodebuild_device()
|
||||||
function empty:draw(default_highlight)
|
if vim.g.xcodebuild_platform == "macOS" then
|
||||||
self.status = ''
|
return " macOS"
|
||||||
self.applied_separator = ''
|
end
|
||||||
self:apply_highlights(default_highlight)
|
|
||||||
self:apply_section_separators()
|
|
||||||
return self.status
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Put proper separators and gaps between components in sections
|
if vim.g.xcodebuild_os then
|
||||||
local function process_sections(sections)
|
return " " .. vim.g.xcodebuild_device_name .. " (" .. vim.g.xcodebuild_os .. ")"
|
||||||
for name, section in pairs(sections) do
|
end
|
||||||
local left = name:sub(9, 10) < 'x'
|
|
||||||
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
|
|
||||||
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
|
|
||||||
end
|
|
||||||
for id, comp in ipairs(section) do
|
|
||||||
if type(comp) ~= 'table' then
|
|
||||||
comp = { comp }
|
|
||||||
section[id] = comp
|
|
||||||
end
|
|
||||||
comp.separator = left and { right = '' } or { left = '' }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return sections
|
|
||||||
end
|
|
||||||
|
|
||||||
local function search_result()
|
return " " .. vim.g.xcodebuild_device_name
|
||||||
if vim.v.hlsearch == 0 then
|
end
|
||||||
return ''
|
|
||||||
end
|
|
||||||
local last_search = vim.fn.getreg '/'
|
|
||||||
if not last_search or last_search == '' then
|
|
||||||
return ''
|
|
||||||
end
|
|
||||||
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
|
||||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
|
||||||
end
|
|
||||||
|
|
||||||
local function modified()
|
lualine.setup({
|
||||||
if vim.bo.modified then
|
options = {
|
||||||
return '+'
|
globalstatus = true,
|
||||||
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
theme = "auto",
|
||||||
return '-'
|
symbols = {
|
||||||
end
|
alternate_file = "#",
|
||||||
return ''
|
directory = "",
|
||||||
end
|
readonly = "",
|
||||||
|
unnamed = "[No Name]",
|
||||||
local function xcodebuild_device()
|
newfile = "[New]",
|
||||||
if vim.g.xcodebuild_platform == "macOS" then
|
},
|
||||||
return " macOS"
|
disabled_buftypes = { "quickfix", "prompt" },
|
||||||
end
|
component_separators = "",
|
||||||
|
section_separators = { left = "", right = "" },
|
||||||
local deviceIcon = ""
|
},
|
||||||
if vim.g.xcodebuild_platform:match("watch") then
|
sections = {
|
||||||
deviceIcon = ""
|
lualine_a = {
|
||||||
elseif vim.g.xcodebuild_platform:match("tv") then
|
-- { "mode" },
|
||||||
deviceIcon = " "
|
{ "filename" },
|
||||||
elseif vim.g.xcodebuild_platform:match("vision") then
|
},
|
||||||
deviceIcon = " "
|
lualine_b = {
|
||||||
end
|
{ "diagnostics" },
|
||||||
|
{ "diff" },
|
||||||
if vim.g.xcodebuild_os then
|
{
|
||||||
return deviceIcon .. " " .. vim.g.xcodebuild_device_name .. " (" .. vim.g.xcodebuild_os .. ")"
|
"searchcount",
|
||||||
end
|
maxcount = 999,
|
||||||
|
timeout = 500,
|
||||||
return deviceIcon .. " " .. vim.g.xcodebuild_device_name
|
},
|
||||||
end
|
},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {
|
||||||
require('lualine').setup {
|
{ "' ' .. vim.g.xcodebuild_last_status", color = { fg = "#a6e3a1" } },
|
||||||
options = {
|
-- { "' ' .. vim.g.xcodebuild_test_plan", color = { fg = "#a6e3a1", bg = "#161622" } },
|
||||||
theme = 'auto',
|
{ xcodebuild_device, color = { fg = "#f9e2af", bg = "#161622" } },
|
||||||
component_separators = '',
|
},
|
||||||
section_separators = { left = '', right = '' },
|
lualine_y = {
|
||||||
},
|
{ "branch" },
|
||||||
sections = process_sections {
|
},
|
||||||
lualine_a = { 'mode' },
|
lualine_z = {
|
||||||
lualine_b = {
|
{ "location" },
|
||||||
'branch',
|
},
|
||||||
'diff',
|
},
|
||||||
{
|
inactive_sections = {
|
||||||
'diagnostics',
|
lualine_a = {},
|
||||||
source = { 'nvim' },
|
lualine_b = {},
|
||||||
sections = { 'error' },
|
lualine_c = { "filename" },
|
||||||
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
lualine_x = {},
|
||||||
},
|
lualine_y = {},
|
||||||
{
|
lualine_z = {},
|
||||||
'diagnostics',
|
},
|
||||||
source = { 'nvim' },
|
extensions = { "nvim-dap-ui", "quickfix", "trouble", "nvim-tree", "lazy", "mason" },
|
||||||
sections = { 'warn' },
|
})
|
||||||
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
end,
|
||||||
},
|
|
||||||
{ 'filename', file_status = false, path = 1 },
|
|
||||||
{ modified, color = { bg = colors.red } },
|
|
||||||
{
|
|
||||||
'%w',
|
|
||||||
cond = function()
|
|
||||||
return vim.wo.previewwindow
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'%r',
|
|
||||||
cond = function()
|
|
||||||
return vim.bo.readonly
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'%q',
|
|
||||||
cond = function()
|
|
||||||
return vim.bo.buftype == 'quickfix'
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lualine_c = {},
|
|
||||||
lualine_x = {
|
|
||||||
{ "' ' .. vim.g.xcodebuild_last_status", color = { fg = "Gray" } },
|
|
||||||
{ "' ' .. vim.g.xcodebuild_test_plan", color = { fg = "#a6e3a1", bg = "#161622" } },
|
|
||||||
{ xcodebuild_device, color = { fg = "#f9e2af", bg = "#161622" } },
|
|
||||||
},
|
|
||||||
lualine_y = { search_result, 'filetype' },
|
|
||||||
lualine_z = { '%l:%c', '%p%%/%L' },
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_c = { '%f %y %m' },
|
|
||||||
lualine_x = {},
|
|
||||||
},
|
|
||||||
tabline = {},
|
|
||||||
extensions = {"nvim-tree"}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
-- return {
|
||||||
|
-- "nvim-lualine/lualine.nvim",
|
||||||
|
-- config = function()
|
||||||
|
-- local colors = {
|
||||||
|
-- red = '#ca1243',
|
||||||
|
-- grey = '#a0a1a7',
|
||||||
|
-- black = '#383a42',
|
||||||
|
-- white = '#f3f3f3',
|
||||||
|
-- light_green = '#83a598',
|
||||||
|
-- orange = '#fe8019',
|
||||||
|
-- green = '#8ec07c',
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- local empty = require('lualine.component'):extend()
|
||||||
|
-- function empty:draw(default_highlight)
|
||||||
|
-- self.status = ''
|
||||||
|
-- self.applied_separator = ''
|
||||||
|
-- self:apply_highlights(default_highlight)
|
||||||
|
-- self:apply_section_separators()
|
||||||
|
-- return self.status
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- -- Put proper separators and gaps between components in sections
|
||||||
|
-- local function process_sections(sections)
|
||||||
|
-- for name, section in pairs(sections) do
|
||||||
|
-- local left = name:sub(9, 10) < 'x'
|
||||||
|
-- for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
|
||||||
|
-- table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
|
||||||
|
-- end
|
||||||
|
-- for id, comp in ipairs(section) do
|
||||||
|
-- if type(comp) ~= 'table' then
|
||||||
|
-- comp = { comp }
|
||||||
|
-- section[id] = comp
|
||||||
|
-- end
|
||||||
|
-- comp.separator = left and { right = '' } or { left = '' }
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- return sections
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- local function search_result()
|
||||||
|
-- if vim.v.hlsearch == 0 then
|
||||||
|
-- return ''
|
||||||
|
-- end
|
||||||
|
-- local last_search = vim.fn.getreg '/'
|
||||||
|
-- if not last_search or last_search == '' then
|
||||||
|
-- return ''
|
||||||
|
-- end
|
||||||
|
-- local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||||
|
-- return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- local function modified()
|
||||||
|
-- if vim.bo.modified then
|
||||||
|
-- return '+'
|
||||||
|
-- elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
||||||
|
-- return '-'
|
||||||
|
-- end
|
||||||
|
-- return ''
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- local function xcodebuild_device()
|
||||||
|
-- if vim.g.xcodebuild_platform == "macOS" then
|
||||||
|
-- return " macOS"
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- local deviceIcon = ""
|
||||||
|
-- if vim.g.xcodebuild_platform:match("watch") then
|
||||||
|
-- deviceIcon = ""
|
||||||
|
-- elseif vim.g.xcodebuild_platform:match("tv") then
|
||||||
|
-- deviceIcon = " "
|
||||||
|
-- elseif vim.g.xcodebuild_platform:match("vision") then
|
||||||
|
-- deviceIcon = " "
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- if vim.g.xcodebuild_os then
|
||||||
|
-- return deviceIcon .. " " .. vim.g.xcodebuild_device_name .. " (" .. vim.g.xcodebuild_os .. ")"
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- return deviceIcon .. " " .. vim.g.xcodebuild_device_name
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- require('lualine').setup {
|
||||||
|
-- options = {
|
||||||
|
-- theme = 'auto',
|
||||||
|
-- component_separators = '',
|
||||||
|
-- section_separators = { left = '', right = '' },
|
||||||
|
-- },
|
||||||
|
-- sections = process_sections {
|
||||||
|
-- lualine_a = { 'mode' },
|
||||||
|
-- lualine_b = {
|
||||||
|
-- 'branch',
|
||||||
|
-- 'diff',
|
||||||
|
-- {
|
||||||
|
-- 'diagnostics',
|
||||||
|
-- source = { 'nvim' },
|
||||||
|
-- sections = { 'error' },
|
||||||
|
-- diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- 'diagnostics',
|
||||||
|
-- source = { 'nvim' },
|
||||||
|
-- sections = { 'warn' },
|
||||||
|
-- diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||||
|
-- },
|
||||||
|
-- { 'filename', file_status = false, path = 1 },
|
||||||
|
-- { modified, color = { bg = colors.red } },
|
||||||
|
-- {
|
||||||
|
-- '%w',
|
||||||
|
-- cond = function()
|
||||||
|
-- return vim.wo.previewwindow
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- '%r',
|
||||||
|
-- cond = function()
|
||||||
|
-- return vim.bo.readonly
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- '%q',
|
||||||
|
-- cond = function()
|
||||||
|
-- return vim.bo.buftype == 'quickfix'
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- lualine_c = {},
|
||||||
|
-- lualine_x = {
|
||||||
|
-- { "' ' .. vim.g.xcodebuild_last_status", color = { fg = "Gray" } },
|
||||||
|
-- { "' ' .. vim.g.xcodebuild_test_plan", color = { fg = "#a6e3a1", bg = "#161622" } },
|
||||||
|
-- { xcodebuild_device, color = { fg = "#f9e2af", bg = "#161622" } },
|
||||||
|
-- },
|
||||||
|
-- lualine_y = { search_result, 'filetype' },
|
||||||
|
-- lualine_z = { '%l:%c', '%p%%/%L' },
|
||||||
|
-- },
|
||||||
|
-- inactive_sections = {
|
||||||
|
-- lualine_c = { '%f %y %m' },
|
||||||
|
-- lualine_x = {},
|
||||||
|
-- },
|
||||||
|
-- tabline = {},
|
||||||
|
-- extensions = {"nvim-tree"}
|
||||||
|
-- }
|
||||||
|
-- end
|
||||||
|
-- }
|
||||||
|
|||||||
70
nvim/m-housh/lua/user/plugin/nvim-dap.lua
Normal file
70
nvim/m-housh/lua/user/plugin/nvim-dap.lua
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
local function setupListeners()
|
||||||
|
local dap = require("dap")
|
||||||
|
local areSet = false
|
||||||
|
|
||||||
|
dap.listeners.after["event_initialized"]["me"] = function()
|
||||||
|
if not areSet then
|
||||||
|
areSet = true
|
||||||
|
vim.keymap.set("n", "<leader>dc", dap.continue, { desc = "Continue", noremap = true })
|
||||||
|
vim.keymap.set("n", "<leader>dC", dap.run_to_cursor, { desc = "Run To Cursor" })
|
||||||
|
vim.keymap.set("n", "<leader>ds", dap.step_over, { desc = "Step Over" })
|
||||||
|
vim.keymap.set("n", "<leader>di", dap.step_into, { desc = "Step Into" })
|
||||||
|
vim.keymap.set("n", "<leader>do", dap.step_out, { desc = "Step Out" })
|
||||||
|
vim.keymap.set({ "n", "v" }, "<Leader>dh", require("dap.ui.widgets").hover, { desc = "Hover" })
|
||||||
|
vim.keymap.set({ "n", "v" }, "<Leader>de", require("dapui").eval, { desc = "Eval" })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
dap.listeners.after["event_terminated"]["me"] = function()
|
||||||
|
if areSet then
|
||||||
|
areSet = false
|
||||||
|
vim.keymap.del("n", "<leader>dc")
|
||||||
|
vim.keymap.del("n", "<leader>dC")
|
||||||
|
vim.keymap.del("n", "<leader>ds")
|
||||||
|
vim.keymap.del("n", "<leader>di")
|
||||||
|
vim.keymap.del("n", "<leader>do")
|
||||||
|
vim.keymap.del({ "n", "v" }, "<Leader>dh")
|
||||||
|
vim.keymap.del({ "n", "v" }, "<Leader>de")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
dependencies = {
|
||||||
|
"wojciech-kulik/xcodebuild.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local xcodebuild = require("xcodebuild.integrations.dap")
|
||||||
|
|
||||||
|
-- TODO: make sure to set path to your codelldb
|
||||||
|
local codelldbPath = os.getenv("HOME") .. "/tools/codelldb-aarch64-darwin/extension/adapter/codelldb"
|
||||||
|
xcodebuild.setup(codelldbPath)
|
||||||
|
|
||||||
|
local define = vim.fn.sign_define
|
||||||
|
define("DapBreakpoint", { text = "", texthl = "DiagnosticError", linehl = "", numhl = "" })
|
||||||
|
define("DapBreakpointRejected", { text = "", texthl = "DiagnosticError", linehl = "", numhl = "" })
|
||||||
|
define("DapStopped", { text = "", texthl = "DiagnosticOk", linehl = "", numhl = "" })
|
||||||
|
define("DapLogPoint", { text = "", texthl = "DiagnosticInfo", linehl = "", numhl = "" })
|
||||||
|
define("DapLogPoint", { text = "", texthl = "DiagnosticInfo", linehl = "", numhl = "" })
|
||||||
|
|
||||||
|
setupListeners()
|
||||||
|
|
||||||
|
--when breakpoint is hit, it sets the focus to the buffer with the breakpoint
|
||||||
|
require("dap").defaults.fallback.switchbuf = "usetab,uselast"
|
||||||
|
|
||||||
|
--stylua: ignore start
|
||||||
|
vim.keymap.set("n", "<leader>dd", xcodebuild.build_and_debug, { desc = "Build & Debug" })
|
||||||
|
vim.keymap.set("n", "<leader>dr", xcodebuild.debug_without_build, { desc = "Debug Without Building" })
|
||||||
|
vim.keymap.set("n", "<leader>dt", xcodebuild.debug_tests, { desc = "Debug Tests" })
|
||||||
|
vim.keymap.set("n", "<leader>dT", xcodebuild.debug_class_tests, { desc = "Debug Class Tests" })
|
||||||
|
vim.keymap.set("n", "<leader>b", xcodebuild.toggle_breakpoint, { desc = "Toggle Breakpoint" })
|
||||||
|
vim.keymap.set("n", "<leader>B", xcodebuild.toggle_message_breakpoint, { desc = "Toggle Message Breakpoint" })
|
||||||
|
--stylua: ignore end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>dx", function()
|
||||||
|
xcodebuild.terminate_session()
|
||||||
|
require("dap").listeners.after["event_terminated"]["me"]()
|
||||||
|
end, { desc = "Terminate debugger" })
|
||||||
|
end,
|
||||||
|
}
|
||||||
87
nvim/m-housh/lua/user/plugin/nvim-dapui.lua
Normal file
87
nvim/m-housh/lua/user/plugin/nvim-dapui.lua
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
return {
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
"nvim-neotest/nvim-nio",
|
||||||
|
},
|
||||||
|
lazy = true,
|
||||||
|
config = function()
|
||||||
|
require("dapui").setup({
|
||||||
|
controls = {
|
||||||
|
element = "repl",
|
||||||
|
enabled = true,
|
||||||
|
icons = {
|
||||||
|
disconnect = "",
|
||||||
|
run_last = "",
|
||||||
|
terminate = "⏹︎",
|
||||||
|
pause = "⏸︎",
|
||||||
|
play = "",
|
||||||
|
step_into = "",
|
||||||
|
step_out = "",
|
||||||
|
step_over = "",
|
||||||
|
step_back = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
floating = {
|
||||||
|
border = "single",
|
||||||
|
mappings = {
|
||||||
|
close = { "q", "<Esc>" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
icons = {
|
||||||
|
collapsed = "",
|
||||||
|
expanded = "",
|
||||||
|
current_frame = "",
|
||||||
|
},
|
||||||
|
layouts = {
|
||||||
|
{
|
||||||
|
elements = {
|
||||||
|
{ id = "stacks", size = 0.25 },
|
||||||
|
{ id = "scopes", size = 0.25 },
|
||||||
|
{ id = "breakpoints", size = 0.25 },
|
||||||
|
{ id = "watches", size = 0.25 },
|
||||||
|
},
|
||||||
|
position = "left",
|
||||||
|
size = 40,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
elements = {
|
||||||
|
{ id = "repl", size = 0.4 },
|
||||||
|
{ id = "console", size = 0.6 },
|
||||||
|
},
|
||||||
|
position = "bottom",
|
||||||
|
size = 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local dap, dapui = require("dap"), require("dapui")
|
||||||
|
local group = vim.api.nvim_create_augroup("dapui_config", { clear = true })
|
||||||
|
|
||||||
|
-- hide ~ in DAPUI
|
||||||
|
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||||
|
group = group,
|
||||||
|
pattern = "DAP*",
|
||||||
|
callback = function()
|
||||||
|
vim.wo.fillchars = "eob: "
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||||
|
group = group,
|
||||||
|
pattern = "\\[dap\\-repl\\]",
|
||||||
|
callback = function()
|
||||||
|
vim.wo.fillchars = "eob: "
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
|
dapui.open()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
|
dapui.close()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
|
dapui.close()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -1,75 +1,78 @@
|
|||||||
return {
|
return {
|
||||||
'nvim-telescope/telescope.nvim',
|
"nvim-telescope/telescope.nvim",
|
||||||
branch = '0.1.x',
|
branch = "0.1.x",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim'
|
"nvim-lua/plenary.nvim",
|
||||||
},
|
},
|
||||||
lazy = true,
|
lazy = true,
|
||||||
config = function()
|
config = function()
|
||||||
local actions = require('telescope.actions')
|
local actions = require("telescope.actions")
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require("telescope.builtin")
|
||||||
|
|
||||||
require('telescope').setup({
|
require("telescope").setup({
|
||||||
defaults = {
|
ensure_installed = {
|
||||||
file_ignore_patterns = {"node_modules", "%.jpg", "%.png", ".swiftpm"},
|
"swift",
|
||||||
vimgrep_arguments = {
|
},
|
||||||
'rg',
|
defaults = {
|
||||||
'--follow',
|
file_ignore_patterns = { "node_modules", "%.jpg", "%.png", ".swiftpm" },
|
||||||
'--color=never',
|
vimgrep_arguments = {
|
||||||
'--no-heading',
|
"rg",
|
||||||
'--with-filename',
|
"--follow",
|
||||||
'--line-number',
|
"--color=never",
|
||||||
'--column',
|
"--no-heading",
|
||||||
'--smart-case'
|
"--with-filename",
|
||||||
},
|
"--line-number",
|
||||||
mappings = {
|
"--column",
|
||||||
i = {
|
"--smart-case",
|
||||||
-- Close on first esc instead of gonig to normal mode
|
},
|
||||||
["<esc>"] = actions.close,
|
mappings = {
|
||||||
["<A-q>"] = actions.send_selected_to_qflist,
|
i = {
|
||||||
["<C-q>"] = actions.send_to_qflist,
|
-- Close on first esc instead of gonig to normal mode
|
||||||
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
|
["<esc>"] = actions.close,
|
||||||
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
|
["<A-q>"] = actions.send_selected_to_qflist,
|
||||||
},
|
["<C-q>"] = actions.send_to_qflist,
|
||||||
n = {
|
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
|
||||||
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
|
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
|
||||||
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
|
},
|
||||||
["<A-q>"] = actions.send_selected_to_qflist,
|
n = {
|
||||||
["<C-q>"] = actions.send_to_qflist,
|
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
|
||||||
},
|
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
|
||||||
},
|
["<A-q>"] = actions.send_selected_to_qflist,
|
||||||
prompt_prefix = " ",
|
["<C-q>"] = actions.send_to_qflist,
|
||||||
selection_caret = " ",
|
},
|
||||||
entry_prefix = " ",
|
},
|
||||||
initial_mode = "insert",
|
prompt_prefix = " ",
|
||||||
selection_strategy = "reset",
|
selection_caret = " ",
|
||||||
sorting_strategy = "descending",
|
entry_prefix = " ",
|
||||||
layout_strategy = "flex",
|
initial_mode = "insert",
|
||||||
layout_config = {
|
selection_strategy = "reset",
|
||||||
width = 0.75,
|
sorting_strategy = "descending",
|
||||||
prompt_position = "bottom",
|
layout_strategy = "flex",
|
||||||
preview_cutoff = 120,
|
layout_config = {
|
||||||
horizontal = { mirror = false },
|
width = 0.75,
|
||||||
vertical = { mirror = true },
|
prompt_position = "bottom",
|
||||||
},
|
preview_cutoff = 120,
|
||||||
file_sorter = require'telescope.sorters'.get_fuzzy_file,
|
horizontal = { mirror = false },
|
||||||
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
vertical = { mirror = true },
|
||||||
-- path_display = true, -- strange behaviour not showing the files in result window
|
},
|
||||||
winblend = 0,
|
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||||
border = {},
|
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||||
borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' },
|
-- path_display = true, -- strange behaviour not showing the files in result window
|
||||||
color_devicons = true,
|
winblend = 0,
|
||||||
use_less = true,
|
border = {},
|
||||||
set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
|
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||||
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
color_devicons = true,
|
||||||
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
use_less = true,
|
||||||
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||||
|
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||||
|
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||||
|
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||||
|
|
||||||
-- Developer configurations: Not meant for general override
|
-- Developer configurations: Not meant for general override
|
||||||
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
|
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-A-j>", builtin.jumplist, { silent = true, noremap = true, desc = "Open [J]ump List."})
|
vim.keymap.set("n", "<C-A-j>", builtin.jumplist, { silent = true, noremap = true, desc = "Open [J]ump List." })
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,44 @@
|
|||||||
return {
|
return {
|
||||||
"folke/trouble.nvim",
|
"folke/trouble.nvim",
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>tt", "<cmd>Trouble quickfix toggle<cr>", { desc = "Open a quickfix" } },
|
{ "<leader>tt", "<cmd>Trouble quickfix toggle<cr>", { desc = "Open a quickfix" } },
|
||||||
},
|
},
|
||||||
|
|
||||||
opts = {},
|
opts = {},
|
||||||
config = function()
|
config = function()
|
||||||
require("trouble").setup({
|
require("trouble").setup({
|
||||||
auto_open = false,
|
auto_open = false,
|
||||||
auto_close = false,
|
auto_close = false,
|
||||||
auto_preview = true,
|
auto_preview = true,
|
||||||
auto_jump = false,
|
auto_jump = false,
|
||||||
mode = "quickfix",
|
mode = "quickfix",
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
severity = vim.diagnostic.severity.ERROR,
|
||||||
cycle_results = false,
|
cycle_results = false,
|
||||||
})
|
})
|
||||||
-- Jump to diagnostic issues across the whole project.
|
vim.api.nvim_create_autocmd("User", {
|
||||||
vim.keymap.set("n", "<A-d>", "<cmd>silent cc | silent cn<cr>zz", { desc = "Jump to next issue" })
|
pattern = { "XcodebuildBuildFinished", "XcodebuildTestsFinished" },
|
||||||
vim.keymap.set("n", "<A-s>", "<cmd>silent cc | silent cp<cr>zz", { desc = "Jump to previous issue" })
|
callback = function(event)
|
||||||
end,
|
if event.data.cancelled then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if event.data.success then
|
||||||
|
require("trouble").close()
|
||||||
|
elseif not event.data.failedCount or event.data.failedCount > 0 then
|
||||||
|
if next(vim.fn.getqflist()) then
|
||||||
|
require("trouble").open("quickfix")
|
||||||
|
else
|
||||||
|
require("trouble").close()
|
||||||
|
end
|
||||||
|
|
||||||
|
require("trouble").refresh()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
-- Jump to diagnostic issues across the whole project.
|
||||||
|
vim.keymap.set("n", "<A-d>", "<cmd>silent cc | silent cn<cr>zz", { desc = "Jump to next issue" })
|
||||||
|
vim.keymap.set("n", "<A-s>", "<cmd>silent cc | silent cp<cr>zz", { desc = "Jump to previous issue" })
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,57 @@
|
|||||||
return {
|
local progress_handle
|
||||||
"wojciech-kulik/xcodebuild.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
"MunifTanjim/nui.nvim",
|
|
||||||
"nvim-neo-tree/neo-tree.nvim", -- (optional) to manage project files
|
|
||||||
"stevearc/oil.nvim", -- (optional) to manage project files
|
|
||||||
"nvim-treesitter/nvim-treesitter", -- (optional) for Quick tests support (required Swift parser)
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require("xcodebuild").setup({
|
|
||||||
-- put some options here or leave it empty to use default settings
|
|
||||||
code_coverage = {
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
"wojciech-kulik/xcodebuild.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("xcodebuild").setup({
|
||||||
|
show_build_progress_bar = false,
|
||||||
|
logs = {
|
||||||
|
auto_open_on_success_tests = false,
|
||||||
|
auto_open_on_failed_tests = false,
|
||||||
|
auto_open_on_success_build = false,
|
||||||
|
auto_open_on_failed_build = false,
|
||||||
|
auto_focus = false,
|
||||||
|
auto_close_on_app_launch = true,
|
||||||
|
only_summary = true,
|
||||||
|
notify = function(message, severity)
|
||||||
|
local fidget = require("fidget")
|
||||||
|
if progress_handle then
|
||||||
|
progress_handle.message = message
|
||||||
|
if not message:find("Loading") then
|
||||||
|
progress_handle:finish()
|
||||||
|
progress_handle = nil
|
||||||
|
if vim.trim(message) ~= "" then
|
||||||
|
fidget.notify(message, severity)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fidget.notify(message, severity)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
notify_progress = function(message)
|
||||||
|
local progress = require("fidget.progress")
|
||||||
|
|
||||||
|
if progress_handle then
|
||||||
|
progress_handle.title = ""
|
||||||
|
progress_handle.message = message
|
||||||
|
else
|
||||||
|
progress_handle = progress.handle.create({
|
||||||
|
message = message,
|
||||||
|
lsp_client = { name = "xcodebuild.nvim" },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
code_coverage = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- stylua: ignore start
|
||||||
vim.keymap.set("n", "<leader>X", "<cmd>XcodebuildPicker<cr>", { desc = "Show Xcodebuild Actions" })
|
vim.keymap.set("n", "<leader>X", "<cmd>XcodebuildPicker<cr>", { desc = "Show Xcodebuild Actions" })
|
||||||
vim.keymap.set("n", "<leader>xf", "<cmd>XcodebuildProjectManager<cr>", { desc = "Show Project Manager Actions" })
|
vim.keymap.set("n", "<leader>xf", "<cmd>XcodebuildProjectManager<cr>", { desc = "Show Project Manager Actions" })
|
||||||
|
|
||||||
@@ -24,8 +61,7 @@ return {
|
|||||||
|
|
||||||
vim.keymap.set("n", "<leader>xt", "<cmd>XcodebuildTest<cr>", { desc = "Run Tests" })
|
vim.keymap.set("n", "<leader>xt", "<cmd>XcodebuildTest<cr>", { desc = "Run Tests" })
|
||||||
vim.keymap.set("v", "<leader>xt", "<cmd>XcodebuildTestSelected<cr>", { desc = "Run Selected Tests" })
|
vim.keymap.set("v", "<leader>xt", "<cmd>XcodebuildTestSelected<cr>", { desc = "Run Selected Tests" })
|
||||||
vim.keymap.set("n", "<leader>xT", "<cmd>XcodebuildTestClass<cr>", { desc = "Run Current Test Class" })
|
vim.keymap.set("n", "<leader>xT", "<cmd>XcodebuildTestClass<cr>", { desc = "Run This Test Class" })
|
||||||
vim.keymap.set("n", "<leader>x.", "<cmd>XcodebuildTestRepeat<cr>", { desc = "Repeat Last Test Run" })
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>xl", "<cmd>XcodebuildToggleLogs<cr>", { desc = "Toggle Xcodebuild Logs" })
|
vim.keymap.set("n", "<leader>xl", "<cmd>XcodebuildToggleLogs<cr>", { desc = "Toggle Xcodebuild Logs" })
|
||||||
vim.keymap.set("n", "<leader>xc", "<cmd>XcodebuildToggleCodeCoverage<cr>", { desc = "Toggle Code Coverage" })
|
vim.keymap.set("n", "<leader>xc", "<cmd>XcodebuildToggleCodeCoverage<cr>", { desc = "Toggle Code Coverage" })
|
||||||
@@ -39,5 +75,48 @@ return {
|
|||||||
|
|
||||||
vim.keymap.set("n", "<leader>xx", "<cmd>XcodebuildQuickfixLine<cr>", { desc = "Quickfix Line" })
|
vim.keymap.set("n", "<leader>xx", "<cmd>XcodebuildQuickfixLine<cr>", { desc = "Quickfix Line" })
|
||||||
vim.keymap.set("n", "<leader>xa", "<cmd>XcodebuildCodeActions<cr>", { desc = "Show Code Actions" })
|
vim.keymap.set("n", "<leader>xa", "<cmd>XcodebuildCodeActions<cr>", { desc = "Show Code Actions" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
-- return {
|
||||||
|
-- "wojciech-kulik/xcodebuild.nvim",
|
||||||
|
-- dependencies = {
|
||||||
|
-- "nvim-telescope/telescope.nvim",
|
||||||
|
-- "MunifTanjim/nui.nvim",
|
||||||
|
-- "nvim-neo-tree/neo-tree.nvim", -- (optional) to manage project files
|
||||||
|
-- "stevearc/oil.nvim", -- (optional) to manage project files
|
||||||
|
-- "nvim-treesitter/nvim-treesitter", -- (optional) for Quick tests support (required Swift parser)
|
||||||
|
-- },
|
||||||
|
-- config = function()
|
||||||
|
-- require("xcodebuild").setup({
|
||||||
|
-- -- put some options here or leave it empty to use default settings
|
||||||
|
-- code_coverage = {
|
||||||
|
-- enabled = true
|
||||||
|
-- }
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<leader>X", "<cmd>XcodebuildPicker<cr>", { desc = "Show Xcodebuild Actions" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xf", "<cmd>XcodebuildProjectManager<cr>", { desc = "Show Project Manager Actions" })
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<leader>xb", "<cmd>XcodebuildBuild<cr>", { desc = "Build Project" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xB", "<cmd>XcodebuildBuildForTesting<cr>", { desc = "Build For Testing" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xr", "<cmd>XcodebuildBuildRun<cr>", { desc = "Build & Run Project" })
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<leader>xt", "<cmd>XcodebuildTest<cr>", { desc = "Run Tests" })
|
||||||
|
-- vim.keymap.set("v", "<leader>xt", "<cmd>XcodebuildTestSelected<cr>", { desc = "Run Selected Tests" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xT", "<cmd>XcodebuildTestClass<cr>", { desc = "Run Current Test Class" })
|
||||||
|
-- vim.keymap.set("n", "<leader>x.", "<cmd>XcodebuildTestRepeat<cr>", { desc = "Repeat Last Test Run" })
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<leader>xl", "<cmd>XcodebuildToggleLogs<cr>", { desc = "Toggle Xcodebuild Logs" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xc", "<cmd>XcodebuildToggleCodeCoverage<cr>", { desc = "Toggle Code Coverage" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xC", "<cmd>XcodebuildShowCodeCoverageReport<cr>", { desc = "Show Code Coverage Report" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xe", "<cmd>XcodebuildTestExplorerToggle<cr>", { desc = "Toggle Test Explorer" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xs", "<cmd>XcodebuildFailingSnapshots<cr>", { desc = "Show Failing Snapshots" })
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<leader>xd", "<cmd>XcodebuildSelectDevice<cr>", { desc = "Select Device" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xp", "<cmd>XcodebuildSelectTestPlan<cr>", { desc = "Select Test Plan" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xq", "<cmd>Telescope quickfix<cr>", { desc = "Show QuickFix List" })
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<leader>xx", "<cmd>XcodebuildQuickfixLine<cr>", { desc = "Quickfix Line" })
|
||||||
|
-- vim.keymap.set("n", "<leader>xa", "<cmd>XcodebuildCodeActions<cr>", { desc = "Show Code Actions" })
|
||||||
|
-- end,
|
||||||
|
-- }
|
||||||
|
|||||||
Reference in New Issue
Block a user