mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
feat: Updates plugins for nvim
This commit is contained in:
@@ -12,10 +12,10 @@ return {
|
|||||||
"f3fora/cmp-spell",
|
"f3fora/cmp-spell",
|
||||||
"hrsh7th/cmp-calc",
|
"hrsh7th/cmp-calc",
|
||||||
"hrsh7th/cmp-emoji",
|
"hrsh7th/cmp-emoji",
|
||||||
--"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
|
|
||||||
-- Adds a number of user-friendly snippets
|
-- Adds a number of user-friendly snippets
|
||||||
'rafamadriz/friendly-snippets',
|
'rafamadriz/friendly-snippets',
|
||||||
|
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||||
},
|
},
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
event = { 'BufReadPre', 'BufNewFile' },
|
||||||
config = function()
|
config = function()
|
||||||
@@ -24,24 +24,13 @@ return {
|
|||||||
local lspkind = require("lspkind")
|
local lspkind = require("lspkind")
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||||
--local luasnip = require('luasnip')
|
local luasnip = require('luasnip')
|
||||||
|
|
||||||
local has_words_before = function()
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0
|
|
||||||
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
|
|
||||||
col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local feedkey = function(key, mode)
|
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true),
|
|
||||||
mode, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
require('lspconfig').sourcekit.setup {
|
require('lspconfig').sourcekit.setup {
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
|
|
||||||
lspkind.init({
|
lspkind.init({
|
||||||
symbol_map = {
|
symbol_map = {
|
||||||
@@ -74,84 +63,55 @@ return {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Configure nvim-cmp.
|
cmp.setup({
|
||||||
--require('luasnip.loaders.from_vscode').lazy_load()
|
completion = {
|
||||||
--luasnip.config.setup {}
|
completeopt = "menu,menuone,preview",
|
||||||
cmp.setup({
|
},
|
||||||
formatting = {
|
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||||
format = lspkind.cmp_format {
|
expand = function(args)
|
||||||
with_text = false,
|
luasnip.lsp_expand(args.body)
|
||||||
maxwidth = 50,
|
end,
|
||||||
menu = {
|
},
|
||||||
buffer = "BUF",
|
mapping = cmp.mapping.preset.insert({
|
||||||
nvim_lsp = "LSP",
|
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||||
path = "PATH",
|
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||||
vsnip = "SNIP",
|
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||||
calc = "CALC",
|
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||||
spell = "SPELL",
|
["<CR>"] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }),
|
||||||
emoji = "EMOJI"
|
["<C-b>"] = cmp.mapping(function(fallback)
|
||||||
}
|
if luasnip.jumpable(-1) then
|
||||||
}
|
luasnip.jump(-1)
|
||||||
},
|
else
|
||||||
experimental = {native_menu = false, ghost_text = false},
|
fallback()
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
vim.fn["vsnip#anonymous"](args.body)
|
|
||||||
--luasnip.lsp_expand(args.body)
|
|
||||||
--require('luasnip').lsp_expand(args.body)
|
|
||||||
end
|
end
|
||||||
},
|
end, { "i", "s" }),
|
||||||
mapping = {
|
["<C-f>"] = cmp.mapping(function(fallback)
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
if luasnip.jumpable(1) then
|
||||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
luasnip.jump(1)
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
else
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
fallback()
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
end
|
||||||
["<C-e>"] = cmp.mapping.abort(),
|
end, { "i", "s" }),
|
||||||
["<CR>"] = cmp.mapping.confirm {
|
}),
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
-- sources for autocompletion
|
||||||
select = true
|
sources = cmp.config.sources({
|
||||||
},
|
{ name = "nvim_lsp" },
|
||||||
-- Accept ([y]es) the completions.
|
{ name = "luasnip" }, -- snippets
|
||||||
['<C-y'] = cmp.mapping.confirm { select = true },
|
{ name = "buffer" }, -- text within current buffer
|
||||||
-- ["<Tab>"] = cmp.mapping(function(fallback)
|
{ name = "path" }, -- file system paths
|
||||||
-- if cmp.visible() then
|
{ name = "calc" },
|
||||||
-- cmp.select_next_item()
|
{ name = "emoji" },
|
||||||
-- -- elseif luasnip.expandable() then
|
{ name = "spell" },
|
||||||
-- -- luasnip.expand()
|
}),
|
||||||
-- -- elseif luasnip.expand_or_jumpable() then
|
-- configure lspkind for vs-code like pictograms in completion menu
|
||||||
-- -- luasnip.expand_or_jump()
|
formatting = {
|
||||||
-- elseif has_words_before() then
|
expandable_indicator = true,
|
||||||
-- cmp.complete()
|
fields = { 'abbr', 'kind', 'menu' },
|
||||||
-- else
|
format = lspkind.cmp_format({
|
||||||
-- fallback()
|
maxwidth = 50,
|
||||||
-- end
|
ellipsis_char = "...",
|
||||||
-- end, {"i", "s"}),
|
}),
|
||||||
["<S-Tab>"] = cmp.mapping(function()
|
},
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
-- elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
|
||||||
-- feedkey("<Plug>(vsnip-jump-prev)", "")
|
|
||||||
end
|
|
||||||
end, {"i", "s"})
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{name = "nvim_lsp"},
|
|
||||||
{name = "buffer", keyword_length = 5},
|
|
||||||
{name = 'luasnip', option = { show_autosnippets = true } },
|
|
||||||
{name = "calc"},
|
|
||||||
{name = "emoji"},
|
|
||||||
{name = "spell"},
|
|
||||||
{name = "path"}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
end,
|
||||||
-- Use buffer source for `/`.
|
}
|
||||||
cmp.setup.cmdline("/", {sources = {{name = "buffer"}}})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':'.
|
|
||||||
cmp.setup.cmdline(":", {
|
|
||||||
sources = cmp.config.sources({{name = "path"}}, {{name = "cmdline"}})
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -70,14 +70,18 @@ return {
|
|||||||
-- Configure keybindings once we've attached.
|
-- Configure keybindings once we've attached.
|
||||||
local wk = require('which-key')
|
local wk = require('which-key')
|
||||||
|
|
||||||
|
-- Normal mode keymaps
|
||||||
wk.add({
|
wk.add({
|
||||||
{ "<C-k>", vim.lsp.buf.hover, desc = "LSP hover info" },
|
{ "<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.definition, desc = "[G]oto [D]efinition" },
|
||||||
{ "gD", vim.lsp.buf.declaration, desc = "[G]oto [D]eclaration" },
|
{ "gD", vim.lsp.buf.declaration, desc = "[G]oto [D]eclaration" },
|
||||||
{ "gi", vim.lsp.buf.implementation, desc = "[G]oto [I]mplementation" },
|
{ "gi", vim.lsp.buf.implementation, desc = "[G]oto [I]mplementation" },
|
||||||
{ "gr", vim.lsp.buf.references, desc = "List [R]eferences" },
|
{ "gr", vim.lsp.buf.references, desc = "List [R]eferences" },
|
||||||
{"gs", vim.lsp.buf.signature_help, desc = "[S]ignature help" },
|
{"gs", vim.lsp.buf.signature_help, desc = "[S]ignature help" },
|
||||||
{ "<space>rn", vim.lsp.buf.rename, desc = "[R]e[N]ame" },
|
{ "<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 previous diagnostic" },
|
||||||
{ "]d", vim.diagnostic.goto_prev, desc = "Go to next diagnostic" },
|
{ "]d", vim.diagnostic.goto_prev, desc = "Go to next diagnostic" },
|
||||||
}, {
|
}, {
|
||||||
@@ -85,6 +89,13 @@ return {
|
|||||||
silent = true,
|
silent = true,
|
||||||
noremap = true
|
noremap = true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Visual mode keymaps
|
||||||
|
wk.add({
|
||||||
|
{ "<leader>ca", vim.lsp.buf.code_action, desc = "LSP [C]ode [A]ction" },
|
||||||
|
},
|
||||||
|
{ mode = 'v', silent = true }
|
||||||
|
)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -59,6 +59,28 @@ return {
|
|||||||
return ''
|
return ''
|
||||||
end
|
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 {
|
require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
theme = 'auto',
|
theme = 'auto',
|
||||||
@@ -104,7 +126,11 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
lualine_c = {},
|
lualine_c = {},
|
||||||
lualine_x = {},
|
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_y = { search_result, 'filetype' },
|
||||||
lualine_z = { '%l:%c', '%p%%/%L' },
|
lualine_z = { '%l:%c', '%p%%/%L' },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,6 +19,6 @@ return {
|
|||||||
|
|
||||||
vim.keymap.set("n", "<leader>ml", function()
|
vim.keymap.set("n", "<leader>ml", function()
|
||||||
require("lint").try_lint()
|
require("lint").try_lint()
|
||||||
end, { desc = "Lint file" })
|
end, { desc = "[L]int file" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
return {
|
return {
|
||||||
"folke/todo-comments.nvim",
|
"folke/todo-comments.nvim",
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
opts = { }
|
opts = { },
|
||||||
|
config = function()
|
||||||
|
require('todo-comments').setup({})
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>tq', '<CMD>TodoQuickFix<CR>',
|
||||||
|
{ desc = "[T]odo [Q]uick fix list." }
|
||||||
|
)
|
||||||
|
vim.keymap.set('n', '<leader><leader>t', '<CMD>TodoTelescope<CR>',
|
||||||
|
{ desc = "[T]odo [Q]uick fix list." }
|
||||||
|
)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
24
nvim/m-housh/lua/user/plugin/trouble.lua
Normal file
24
nvim/m-housh/lua/user/plugin/trouble.lua
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
keys = {
|
||||||
|
{ "<leader>tt", "<cmd>Trouble quickfix toggle<cr>", { desc = "Open a quickfix" } },
|
||||||
|
},
|
||||||
|
|
||||||
|
opts = {},
|
||||||
|
config = function()
|
||||||
|
require("trouble").setup({
|
||||||
|
auto_open = false,
|
||||||
|
auto_close = false,
|
||||||
|
auto_preview = true,
|
||||||
|
auto_jump = false,
|
||||||
|
mode = "quickfix",
|
||||||
|
severity = vim.diagnostic.severity.ERROR,
|
||||||
|
cycle_results = false,
|
||||||
|
})
|
||||||
|
-- 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,
|
||||||
|
}
|
||||||
@@ -17,28 +17,9 @@ require("lazy").setup({
|
|||||||
path = '~/LocalProjects/plugins',
|
path = '~/LocalProjects/plugins',
|
||||||
fallback = true
|
fallback = true
|
||||||
},
|
},
|
||||||
|
-- Import all the plugin configs in the 'plugin' directory
|
||||||
-- Theme --
|
{ import = 'user.plugin' },
|
||||||
{ import = 'user.plugin.theme' },
|
-- Plugins that don't have a configuration file.
|
||||||
|
|
||||||
-- Completions --
|
|
||||||
{ import = 'user.plugin.cmp' },
|
|
||||||
|
|
||||||
-- Git --
|
|
||||||
{ import = 'user.plugin.lazygit' },
|
|
||||||
|
|
||||||
-- Navigation --
|
|
||||||
{ import = 'user.plugin.neo-tree' },
|
|
||||||
{ import = 'user.plugin.telescope' },
|
|
||||||
{ import = 'user.plugin.harpoon' },
|
|
||||||
|
|
||||||
-- Utilities --
|
|
||||||
{ import = 'user.plugin.comment' },
|
|
||||||
{ import = 'user.plugin.noice' },
|
|
||||||
{ import = 'user.plugin.swift' },
|
|
||||||
{ import = 'user.plugin.toggleterm' },
|
|
||||||
{ import = 'user.plugin.which-key' },
|
|
||||||
{ import = 'user.plugin.wrapping' },
|
|
||||||
{
|
{
|
||||||
"folke/zen-mode.nvim",
|
"folke/zen-mode.nvim",
|
||||||
opts = { }
|
opts = { }
|
||||||
@@ -51,7 +32,6 @@ require("lazy").setup({
|
|||||||
"NMAC427/guess-indent.nvim",
|
"NMAC427/guess-indent.nvim",
|
||||||
opts = { }
|
opts = { }
|
||||||
},
|
},
|
||||||
{ import = 'user.plugin.todo-comments' },
|
|
||||||
{ "NoahTheDuke/vim-just", ft = { "just" } },
|
{ "NoahTheDuke/vim-just", ft = { "just" } },
|
||||||
{
|
{
|
||||||
'chipsenkbeil/distant.nvim',
|
'chipsenkbeil/distant.nvim',
|
||||||
@@ -63,14 +43,15 @@ require("lazy").setup({
|
|||||||
|
|
||||||
-- LSP, formatting, etc. --
|
-- LSP, formatting, etc. --
|
||||||
{ 'folke/neodev.nvim', opts = {} },
|
{ 'folke/neodev.nvim', opts = {} },
|
||||||
{ import = 'user.plugin.lsp' },
|
|
||||||
{ import = 'user.plugin.xcodebuild' },
|
|
||||||
{ import = 'user.plugin.lualine' },
|
|
||||||
{ import = 'user.plugin.treesitter' },
|
|
||||||
{ import = 'user.plugin.formatter' },
|
|
||||||
{ import = 'user.plugin.go' },
|
|
||||||
{ import = 'user.plugin.nvim-lint' },
|
|
||||||
--{'fladson/vim-kitty', lazy=true, },
|
|
||||||
|
|
||||||
|
|
||||||
|
}, {
|
||||||
|
checker = {
|
||||||
|
enabled = true,
|
||||||
|
notify = false
|
||||||
|
},
|
||||||
|
change_detection = {
|
||||||
|
notify = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>ll", "<CMD>Lazy<CR>", { desc = "Open [L]azy" })
|
||||||
|
|||||||
Reference in New Issue
Block a user