mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
feat: Reworking nvim configuration
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
return {
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
enabeld = false,
|
||||
enabled = false,
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
--"L3MON4D3/LuaSnip",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
return {
|
||||
'numToStr/Comment.nvim',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
opts = {
|
||||
-- add any options here
|
||||
},
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
}
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
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
|
||||
},
|
||||
opts = {
|
||||
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,7 +1,19 @@
|
||||
return {
|
||||
"mhartington/formatter.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
":Format",
|
||||
desc = "[F]ormat",
|
||||
},
|
||||
{
|
||||
"<leader>F",
|
||||
":FormatWrite",
|
||||
desc = "[F]ormat write",
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local util = require("formatter.util")
|
||||
require("formatter").setup({
|
||||
filetype = {
|
||||
@@ -50,13 +62,6 @@ return {
|
||||
},
|
||||
})
|
||||
|
||||
-- Keymaps
|
||||
local wk = require("which-key")
|
||||
wk.add({
|
||||
{ "<space>f", ":Format", desc = "[F]ormat" },
|
||||
{ "<space>F", ":FormateWrite", desc = "[F]ormat write" },
|
||||
}, { mode = "n", silent = true })
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
|
||||
@@ -1,86 +1,86 @@
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup({
|
||||
settings = {
|
||||
save_on_toggle = true,
|
||||
sync_on_ui_close = true,
|
||||
key = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
},
|
||||
})
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup({
|
||||
settings = {
|
||||
save_on_toggle = true,
|
||||
sync_on_ui_close = true,
|
||||
key = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
local conf = require("telescope.config").values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
local conf = require("telescope.config").values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
require("telescope.pickers")
|
||||
.new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer({}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
require("telescope.pickers")
|
||||
.new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer({}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
-- Keymaps
|
||||
vim.keymap.set("n", "<C-e>", function()
|
||||
toggle_telescope(harpoon:list())
|
||||
end, { desc = "Open Harpoon window" })
|
||||
-- Keymaps
|
||||
vim.keymap.set("n", "<C-e>", function()
|
||||
toggle_telescope(harpoon:list())
|
||||
end, { desc = "Open Harpoon window" })
|
||||
|
||||
vim.keymap.set("n", "<leader>a", function()
|
||||
harpoon:list():add()
|
||||
end, { desc = "[A]dd to harpoon list." })
|
||||
vim.keymap.set("n", "<C-e>", function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end, { desc = "Toggle quick menu." })
|
||||
vim.keymap.set("n", "<leader>a", function()
|
||||
harpoon:list():add()
|
||||
end, { desc = "[A]dd to harpoon list." })
|
||||
vim.keymap.set("n", "<C-e>", function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end, { desc = "Toggle quick menu." })
|
||||
|
||||
-- Buffer key maps. Currently keeping all buffer movements
|
||||
-- isolated to top left row of keys on keyboard and all begin
|
||||
-- with the <Control> key.
|
||||
-- Buffer key maps. Currently keeping all buffer movements
|
||||
-- isolated to top left row of keys on keyboard and all begin
|
||||
-- with the <Control> key.
|
||||
|
||||
-- Select buffer numbers.
|
||||
vim.keymap.set("n", "<A-y>", function()
|
||||
harpoon:list():select(1)
|
||||
end, { desc = "Select first harpoon buffer." })
|
||||
vim.keymap.set("n", "<A-u>", function()
|
||||
harpoon:list():select(2)
|
||||
end, { desc = "Select second harpoon buffer." })
|
||||
vim.keymap.set("n", "<A-i>", function()
|
||||
harpoon:list():select(3)
|
||||
end, { desc = "Select third harpoon buffer." })
|
||||
vim.keymap.set("n", "<A-o>", function()
|
||||
harpoon:list():select(4)
|
||||
end, { desc = "Select fourth harpoon buffer." })
|
||||
-- Select buffer numbers.
|
||||
vim.keymap.set("n", "<A-y>", function()
|
||||
harpoon:list():select(1)
|
||||
end, { desc = "Select first harpoon buffer." })
|
||||
vim.keymap.set("n", "<A-u>", function()
|
||||
harpoon:list():select(2)
|
||||
end, { desc = "Select second harpoon buffer." })
|
||||
vim.keymap.set("n", "<A-i>", function()
|
||||
harpoon:list():select(3)
|
||||
end, { desc = "Select third harpoon buffer." })
|
||||
vim.keymap.set("n", "<A-o>", function()
|
||||
harpoon:list():select(4)
|
||||
end, { desc = "Select fourth 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.
|
||||
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." })
|
||||
|
||||
-- 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,
|
||||
-- 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,105 +1,118 @@
|
||||
-- The language servers to setup.
|
||||
local lsp_servers = {
|
||||
"bashls",
|
||||
"clangd",
|
||||
"dockerls",
|
||||
"gopls",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"sourcekit",
|
||||
"yamlls",
|
||||
}
|
||||
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
-- "hrsh7th/cmp-nvim-lsp",
|
||||
"saghen/blink.cmp",
|
||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
opts = {
|
||||
library = {
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
--"saghen/blink.cmp",
|
||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
opts = {
|
||||
library = {
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
opts = {
|
||||
ensure_installed = lsp_servers,
|
||||
},
|
||||
})
|
||||
local lspconfig = require("lspconfig")
|
||||
--local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
--local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
local opts = { noremap = true, silent = true }
|
||||
local on_attach = function(_, bufnr)
|
||||
opts.buffer = bufnr
|
||||
|
||||
opts.desc = "Show line diagnostics"
|
||||
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
|
||||
|
||||
opts.desc = "Show diagnostics in Telescope"
|
||||
vim.keymap.set("n", "<leader><leader>d", "<CMD>Telescope diagnostics bufnr=0<CR>", opts)
|
||||
|
||||
opts.desc = "Show documentation for what is under cursor"
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.hover, opts)
|
||||
|
||||
opts.desc = "[G]oto [D]efinition"
|
||||
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions trim_text=true<cr>", opts)
|
||||
|
||||
opts.desc = "[G]oto [D]eclaration"
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
|
||||
opts.desc = "[G]oto [R]eferences"
|
||||
vim.keymap.set("n", "gr", "<CMD>Telescope lsp_references<CR>", opts)
|
||||
|
||||
opts.desc = "LSP [C]ode [A]ction"
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
|
||||
--opts.desc = "[R]e-[N]ame"
|
||||
--vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
|
||||
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
|
||||
|
||||
for _, lsp in ipairs(lsp_servers) do
|
||||
lspconfig[lsp].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,
|
||||
cmd = lsp == "sourcekit" and { vim.trim(vim.fn.system("xcrun -f sourcekit-lsp")) } or nil,
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"bashls",
|
||||
"clangd",
|
||||
"dockerls",
|
||||
"gopls",
|
||||
"jinja_lsp",
|
||||
"jqls",
|
||||
"jsonls",
|
||||
"ltex",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"yamlls",
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
end
|
||||
local lspconfig = require("lspconfig")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
--local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
local opts = { noremap = true, silent = true }
|
||||
local on_attach = function(_, bufnr)
|
||||
opts.buffer = bufnr
|
||||
|
||||
-- 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
|
||||
opts.desc = "Show line diagnostics"
|
||||
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
|
||||
|
||||
-- For some reason I was having trouble getting this to work inside the on-attach, so it's here.
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "[R]e-[N]ame" })
|
||||
end,
|
||||
opts.desc = "Show diagnostics in Telescope"
|
||||
vim.keymap.set("n", "<leader><leader>d", "<CMD>Telescope diagnostics bufnr=0<CR>", opts)
|
||||
|
||||
opts.desc = "Show documentation for what is under cursor"
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.hover, opts)
|
||||
|
||||
opts.desc = "[G]oto [D]efinition"
|
||||
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions trim_text=true<cr>", opts)
|
||||
|
||||
opts.desc = "[G]oto [D]eclaration"
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
|
||||
opts.desc = "[G]oto [R]eferences"
|
||||
vim.keymap.set("n", "gr", "<CMD>Telescope lsp_references<CR>", opts)
|
||||
|
||||
opts.desc = "LSP [C]ode [A]ction"
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
|
||||
--opts.desc = "[R]e-[N]ame"
|
||||
--vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
|
||||
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
|
||||
|
||||
-- The language servers to setup.
|
||||
local lsp_servers = {
|
||||
"bashls",
|
||||
"clangd",
|
||||
"dockerls",
|
||||
"gopls",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"sourcekit",
|
||||
"yamlls",
|
||||
}
|
||||
|
||||
for _, lsp in ipairs(lsp_servers) do
|
||||
lspconfig[lsp].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,
|
||||
cmd = lsp == "sourcekit" and { vim.trim(vim.fn.system("xcrun -f sourcekit-lsp")) } or nil,
|
||||
})
|
||||
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
|
||||
|
||||
-- For some reason I was having trouble getting this to work inside the on-attach, so it's here.
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "[R]e-[N]ame" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
local function xcodebuild_device()
|
||||
if vim.g.xcodebuild_platform == "macOS" then
|
||||
return " macOS"
|
||||
end
|
||||
|
||||
if vim.g.xcodebuild_os then
|
||||
return " " .. vim.g.xcodebuild_device_name .. " (" .. vim.g.xcodebuild_os .. ")"
|
||||
end
|
||||
|
||||
return " " .. vim.g.xcodebuild_device_name
|
||||
end
|
||||
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local lualine = require("lualine")
|
||||
|
||||
local function xcodebuild_device()
|
||||
if vim.g.xcodebuild_platform == "macOS" then
|
||||
return " macOS"
|
||||
end
|
||||
|
||||
if vim.g.xcodebuild_os then
|
||||
return " " .. vim.g.xcodebuild_device_name .. " (" .. vim.g.xcodebuild_os .. ")"
|
||||
end
|
||||
|
||||
return " " .. vim.g.xcodebuild_device_name
|
||||
end
|
||||
|
||||
lualine.setup({
|
||||
opts = {
|
||||
options = {
|
||||
globalstatus = true,
|
||||
theme = "auto",
|
||||
@@ -67,151 +64,6 @@ return {
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = { "nvim-dap-ui", "quickfix", "trouble", "nvim-tree", "lazy", "mason" },
|
||||
})
|
||||
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
|
||||
-- }
|
||||
|
||||
@@ -2,44 +2,45 @@ return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local ls = require("luasnip")
|
||||
local types = require("luasnip.util.types")
|
||||
ls.setup({
|
||||
history = true,
|
||||
enable_autosnippets = false,
|
||||
updatevents = "TextChanged,TextChangedI",
|
||||
extra_opts = {
|
||||
[types.choiceNode] = {
|
||||
active = {
|
||||
virt_text = { { "choiceNode", "Comment" } },
|
||||
},
|
||||
opts = {
|
||||
history = true,
|
||||
enable_autosnippets = false,
|
||||
updatevents = "TextChanged,TextChangedI",
|
||||
extra_opts = {
|
||||
[require("luasnip.utl.types").choiceNode] = {
|
||||
active = {
|
||||
virt_text = { { "choiceNode", "Comment" } },
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<C-k>",
|
||||
mode = { "i", "s" },
|
||||
function()
|
||||
local ls = require("luasnip")
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<C-j>",
|
||||
mode = { "i", "s" },
|
||||
function()
|
||||
local ls = require("luasnip")
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local ls = require("luasnip")
|
||||
ls.setup(opts)
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_lua").lazy_load({ paths = vim.fn.stdpath("config") .. "/snippets" })
|
||||
|
||||
-- Keymaps
|
||||
local opts = { silent = true }
|
||||
|
||||
-- Use <Ctrl>k to expand snippets.
|
||||
-- This will expand the current item or jump to the next item within the snippet.
|
||||
vim.keymap.set({ "i", "s" }, "<C-k>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, opts)
|
||||
|
||||
-- Use <Ctrl>j to jump backwards in a snippet.
|
||||
-- This always moves to the previous item within a snippet.
|
||||
vim.keymap.set({ "i", "s" }, "<C-j>", function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, opts)
|
||||
|
||||
-- Reload snippets.
|
||||
vim.keymap.set("n", "<leader><leader>s", "<CMD>source ~/.config/m-housh/lua/user/plugin/luasnip.lua<CR>")
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,47 +1,46 @@
|
||||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
-- config.lsp.signature.enabled = false
|
||||
opts = {
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
signature = { enabled = false },
|
||||
},
|
||||
routes = {
|
||||
{ -- enables messages for showing macro recording.
|
||||
view = "notify",
|
||||
filter = { event = "msg_showmode" },
|
||||
},
|
||||
{ -- Hide the written messages.
|
||||
view = 'notify',
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
kind = "",
|
||||
find = "written"
|
||||
},
|
||||
opts = { skip = true }
|
||||
}
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- OPTIONAL:
|
||||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- If not available, we use `mini` as the fallback
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- OPTIONAL:
|
||||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- If not available, we use `mini` as the fallback
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
opts = {
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
signature = { enabled = false },
|
||||
},
|
||||
routes = {
|
||||
{ -- enables messages for showing macro recording.
|
||||
view = "notify",
|
||||
filter = { event = "msg_showmode" },
|
||||
},
|
||||
{ -- Hide the written messages.
|
||||
view = "notify",
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
kind = "",
|
||||
find = "written",
|
||||
},
|
||||
opts = { skip = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -35,34 +35,4 @@ return {
|
||||
desc = "Open directory in float.",
|
||||
},
|
||||
},
|
||||
-- config = function()
|
||||
-- require("oil").setup({
|
||||
-- columns = { "icon" },
|
||||
-- keymaps = {
|
||||
-- ["<C-h>"] = false,
|
||||
-- ["<M-h>"] = "actions.select_split",
|
||||
-- ["<C-v>"] = {
|
||||
-- "actions.select",
|
||||
-- opts = { vertical = true },
|
||||
-- desc = "Open the entry in a vertical split",
|
||||
-- },
|
||||
-- },
|
||||
-- view_options = {
|
||||
-- is_hidden_file = function(name, _) -- second arg is bufnr, but not currently used.
|
||||
-- -- Don't show .DS_Store in output.
|
||||
-- local is_ds_store = name ~= ".DS_Store"
|
||||
-- return not is_ds_store
|
||||
-- end,
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- -- Show the parent directory in current window.
|
||||
-- vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory." })
|
||||
--
|
||||
-- -- Open parent directory in floating window.
|
||||
-- vim.keymap.set("n", "<space>-", require("oil").toggle_float)
|
||||
--
|
||||
-- -- Old habits die hard, map what used to toggle neo-tree to just open a float.
|
||||
-- vim.keymap.set("n", "<C-n>", require("oil").toggle_float)
|
||||
-- end,
|
||||
}
|
||||
|
||||
@@ -4,26 +4,42 @@ return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"folke/trouble.nvim",
|
||||
},
|
||||
opts = {},
|
||||
config = function()
|
||||
local todos = require("todo-comments")
|
||||
|
||||
todos.setup({
|
||||
keywords = {
|
||||
-- Adds the important keyword, I primarily use this in markdown
|
||||
-- documents to be able to jump and color appropriately.
|
||||
FIX = { alt = { "IMPORTANT" } },
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>tq", "<CMD>Trouble todo toggle<CR>", { desc = "[T]odo [Q]uick fix list." })
|
||||
vim.keymap.set("n", "<leader><leader>t", "<CMD>TodoTelescope<CR>", { desc = "[T]odo telescope list." })
|
||||
vim.keymap.set("n", "<leader>tl", "<CMD>TodoLocList<CR>", { desc = "[T]odo [L]ocation list." })
|
||||
vim.keymap.set("n", "]t", function()
|
||||
todos.jump_next()
|
||||
end, { desc = "Next [T]odo" })
|
||||
vim.keymap.set("n", "[t", function()
|
||||
todos.jump_prev()
|
||||
end, { desc = "Previous [T]odo" })
|
||||
end,
|
||||
opts = {
|
||||
keywords = {
|
||||
-- Adds the important keyword, I primarily use this in markdown
|
||||
-- documents to be able to jump and color appropriately.
|
||||
FIX = { alt = { "IMPORTANT" } },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>tq",
|
||||
"<CMD>Trouble todo toggle<CR>",
|
||||
desc = "Todo quick fix list.",
|
||||
},
|
||||
{
|
||||
"<leader><leader>t",
|
||||
"<CMD>TodoTelescope<CR>",
|
||||
desc = "Todo telescope list.",
|
||||
},
|
||||
{
|
||||
"<leader>tl",
|
||||
"<CMD>TodoLocList<CR>",
|
||||
desc = "Todo location list.",
|
||||
},
|
||||
{
|
||||
"]t",
|
||||
function()
|
||||
require("todo-comments").jump_next()
|
||||
end,
|
||||
desc = "Next todo.",
|
||||
},
|
||||
{
|
||||
"[t",
|
||||
function()
|
||||
require("todo-comments").jump_prev()
|
||||
end,
|
||||
desc = "Previous todo.",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -6,73 +6,71 @@ return {
|
||||
},
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"cmake",
|
||||
"dockerfile",
|
||||
"go",
|
||||
"hcl",
|
||||
"html",
|
||||
"java",
|
||||
"javascript",
|
||||
"json",
|
||||
"latex",
|
||||
"ledger",
|
||||
"llvm",
|
||||
"lua",
|
||||
"make",
|
||||
"markdown",
|
||||
"python",
|
||||
"swift",
|
||||
"toml",
|
||||
"xml",
|
||||
"yaml",
|
||||
}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ignore_install = {}, -- List of parsers to ignore installing
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
disable = {}, -- list of language that will be disabled
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"cmake",
|
||||
"dockerfile",
|
||||
"go",
|
||||
"hcl",
|
||||
"html",
|
||||
"java",
|
||||
"javascript",
|
||||
"json",
|
||||
"latex",
|
||||
"ledger",
|
||||
"llvm",
|
||||
"lua",
|
||||
"make",
|
||||
"markdown",
|
||||
"python",
|
||||
"swift",
|
||||
"toml",
|
||||
"xml",
|
||||
"yaml",
|
||||
}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ignore_install = {}, -- List of parsers to ignore installing
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
disable = {}, -- list of language that will be disabled
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
scope_incremental = "<CR>",
|
||||
node_incremental = "<TAB>",
|
||||
node_decremental = "<S-TAB>",
|
||||
},
|
||||
incremental_selection = {
|
||||
},
|
||||
indent = { enable = true },
|
||||
autopairs = { { enable = true } },
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
-- Automatically jump forward to textobj, similar to targets.vim
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
scope_incremental = "<CR>",
|
||||
node_incremental = "<TAB>",
|
||||
node_decremental = "<S-TAB>",
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
["al"] = "@loop.outer",
|
||||
["il"] = "@loop.inner",
|
||||
["ib"] = "@block.inner",
|
||||
["ab"] = "@block.outer",
|
||||
["ir"] = "@parameter.inner",
|
||||
["ar"] = "@parameter.outer",
|
||||
["a="] = "@assignment.outer",
|
||||
["i="] = "@assignment.inner",
|
||||
},
|
||||
},
|
||||
indent = { enable = true },
|
||||
autopairs = { { enable = true } },
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
-- Automatically jump forward to textobj, similar to targets.vim
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
["al"] = "@loop.outer",
|
||||
["il"] = "@loop.inner",
|
||||
["ib"] = "@block.inner",
|
||||
["ab"] = "@block.outer",
|
||||
["ir"] = "@parameter.inner",
|
||||
["ar"] = "@parameter.outer",
|
||||
["a="] = "@assignment.outer",
|
||||
["i="] = "@assignment.inner",
|
||||
},
|
||||
},
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
|
||||
max_file_lines = 2000, -- Do not enable for files with more than specified lines
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
|
||||
max_file_lines = 2000, -- Do not enable for files with more than specified lines
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
}
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
preset = "helix",
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user