mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 14:12:41 +00:00
feat: Rearranges nvim configuration
This commit is contained in:
58
nvim/m-housh/lua/plugins/blink.lua
Normal file
58
nvim/m-housh/lua/plugins/blink.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
return {
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
enabeld = false,
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
--"L3MON4D3/LuaSnip",
|
||||
},
|
||||
version = "v0.*",
|
||||
opts = {
|
||||
appearance = {
|
||||
use_nvim_cmp_as_default = true,
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
signature = { enabled = true },
|
||||
keymap = {
|
||||
preset = "default",
|
||||
["<CR>"] = { "accept", "fallback" },
|
||||
["<C-space>"] = {
|
||||
function(cmp)
|
||||
cmp.show({ providers = { "snippets" } })
|
||||
end,
|
||||
},
|
||||
--["<C-k>"] = { "select_prev", "fallback" },
|
||||
--["<C-j>"] = { "select_next", "fallback" },
|
||||
["<C-n>"] = {
|
||||
function(cmp)
|
||||
if cmp.snippet_active() then
|
||||
return cmp.accept()
|
||||
else
|
||||
return cmp.select_and_accept()
|
||||
end
|
||||
end,
|
||||
"snippet_forward",
|
||||
"fallback",
|
||||
},
|
||||
},
|
||||
-- snippets = {
|
||||
-- expand = function(snippet)
|
||||
-- require("luasnip").lsp_expand(snippet)
|
||||
-- end,
|
||||
-- active = function(filter)
|
||||
-- if filter and filter.direction then
|
||||
-- return require("luasnip").jumpable(filter.direction)
|
||||
-- end
|
||||
-- return require("luasnip").in_snippet()
|
||||
-- end,
|
||||
-- jump = function(direction)
|
||||
-- require("luasnip").jump(direction)
|
||||
-- end,
|
||||
-- },
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer" },
|
||||
},
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
},
|
||||
}
|
||||
91
nvim/m-housh/lua/plugins/cmp.lua
Executable file
91
nvim/m-housh/lua/plugins/cmp.lua
Executable file
@@ -0,0 +1,91 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
enabled = true,
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
"L3MON4D3/LuaSnip", -- snippet engine
|
||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||
"rafamadriz/friendly-snippets", -- useful snippets
|
||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- TODO: This is implemented in LuaSnip config, does it need to be here?
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
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.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}), -- select completion, this makes it so it doesn't auto complete when suggesting.
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping({
|
||||
i = function(fallback)
|
||||
if cmp.visible() then
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
else
|
||||
cmp.mapping.confirm({ select = false })
|
||||
fallback()
|
||||
end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm({ select = true }),
|
||||
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||
}),
|
||||
-- TODO:
|
||||
-- The next two mappings are also implemented in the LuaSnip configuration,
|
||||
-- as <C-j> and <C-k> do they actually need to be here??
|
||||
["<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
|
||||
}),
|
||||
-- configure lspkind for vs-code like pictograms in completion menu
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
7
nvim/m-housh/lua/plugins/comment.lua
Executable file
7
nvim/m-housh/lua/plugins/comment.lua
Executable file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {
|
||||
-- add any options here
|
||||
},
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
}
|
||||
23
nvim/m-housh/lua/plugins/fidget.lua
Normal file
23
nvim/m-housh/lua/plugins/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,
|
||||
}
|
||||
69
nvim/m-housh/lua/plugins/formatter.lua
Executable file
69
nvim/m-housh/lua/plugins/formatter.lua
Executable file
@@ -0,0 +1,69 @@
|
||||
return {
|
||||
"mhartington/formatter.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local util = require("formatter.util")
|
||||
require("formatter").setup({
|
||||
filetype = {
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
function()
|
||||
return {
|
||||
exe = "stylua",
|
||||
args = {
|
||||
"--search-parent-directories",
|
||||
"--stdin-filepath",
|
||||
util.escape_path(util.get_current_buffer_file_path()),
|
||||
"--",
|
||||
"-",
|
||||
},
|
||||
stdin = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
markdown = function()
|
||||
return {
|
||||
exe = "prettier",
|
||||
args = {
|
||||
"--stdin-filepath",
|
||||
util.escape_path(util.get_current_buffer_file_path()),
|
||||
"--print-width",
|
||||
"100",
|
||||
"--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
|
||||
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
|
||||
|
||||
augroup("__formatter__", { clear = true })
|
||||
autocmd("BufWritePost", {
|
||||
group = "__formatter__",
|
||||
command = ":FormatWrite",
|
||||
})
|
||||
end,
|
||||
}
|
||||
19
nvim/m-housh/lua/plugins/go.lua
Executable file
19
nvim/m-housh/lua/plugins/go.lua
Executable file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
"ray-x/go.nvim",
|
||||
enabled = false,
|
||||
lazy = true,
|
||||
dependencies = { -- optional packages
|
||||
"ray-x/guihua.lua",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
'mfussenegger/nvim-dap',
|
||||
'rcarriga/nvim-dap-ui',
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
},
|
||||
config = function()
|
||||
require("go").setup()
|
||||
end,
|
||||
--event = {'BufReadPre', 'BufNewFile'},
|
||||
ft = {"go", 'gomod'},
|
||||
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
||||
}
|
||||
86
nvim/m-housh/lua/plugins/harpoon.lua
Normal file
86
nvim/m-housh/lua/plugins/harpoon.lua
Normal file
@@ -0,0 +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,
|
||||
},
|
||||
})
|
||||
|
||||
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
|
||||
|
||||
-- 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." })
|
||||
|
||||
-- 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." })
|
||||
|
||||
-- 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,
|
||||
}
|
||||
2
nvim/m-housh/lua/plugins/init.lua
Executable file
2
nvim/m-housh/lua/plugins/init.lua
Executable file
@@ -0,0 +1,2 @@
|
||||
-- This file contains plugin's that don't require much configuration.
|
||||
return {}
|
||||
11
nvim/m-housh/lua/plugins/lazygit.lua
Executable file
11
nvim/m-housh/lua/plugins/lazygit.lua
Executable file
@@ -0,0 +1,11 @@
|
||||
return {}
|
||||
-- return {
|
||||
-- "kdheepak/lazygit.nvim",
|
||||
-- dependencies = {
|
||||
-- "nvim-telescope/telescope.nvim",
|
||||
-- "nvim-lua/plenary.nvim"
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require("telescope").load_extension("lazygit")
|
||||
-- end,
|
||||
-- }
|
||||
105
nvim/m-housh/lua/plugins/lsp.lua
Executable file
105
nvim/m-housh/lua/plugins/lsp.lua
Executable file
@@ -0,0 +1,105 @@
|
||||
-- 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" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
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,
|
||||
})
|
||||
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,
|
||||
}
|
||||
217
nvim/m-housh/lua/plugins/lualine.lua
Executable file
217
nvim/m-housh/lua/plugins/lualine.lua
Executable file
@@ -0,0 +1,217 @@
|
||||
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({
|
||||
options = {
|
||||
globalstatus = true,
|
||||
theme = "auto",
|
||||
symbols = {
|
||||
alternate_file = "#",
|
||||
directory = "",
|
||||
readonly = "",
|
||||
unnamed = "[No Name]",
|
||||
newfile = "[New]",
|
||||
},
|
||||
disabled_buftypes = { "quickfix", "prompt" },
|
||||
component_separators = "",
|
||||
section_separators = { left = "", right = "" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
-- { "mode" },
|
||||
{ "filename" },
|
||||
},
|
||||
lualine_b = {
|
||||
{ "diagnostics" },
|
||||
{ "diff" },
|
||||
{
|
||||
"searchcount",
|
||||
maxcount = 999,
|
||||
timeout = 500,
|
||||
},
|
||||
},
|
||||
lualine_c = {},
|
||||
lualine_x = {
|
||||
{ "' ' .. vim.g.xcodebuild_last_status", color = { fg = "#a6e3a1" } },
|
||||
-- { "' ' .. vim.g.xcodebuild_test_plan", color = { fg = "#a6e3a1", bg = "#161622" } },
|
||||
{ xcodebuild_device, color = { fg = "#f9e2af", bg = "#161622" } },
|
||||
},
|
||||
lualine_y = {
|
||||
{ "branch" },
|
||||
},
|
||||
lualine_z = {
|
||||
{ "location" },
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
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
|
||||
-- }
|
||||
45
nvim/m-housh/lua/plugins/luasnip.lua
Normal file
45
nvim/m-housh/lua/plugins/luasnip.lua
Normal file
@@ -0,0 +1,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" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
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,
|
||||
}
|
||||
47
nvim/m-housh/lua/plugins/noice.lua
Executable file
47
nvim/m-housh/lua/plugins/noice.lua
Executable file
@@ -0,0 +1,47 @@
|
||||
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",
|
||||
},
|
||||
}
|
||||
71
nvim/m-housh/lua/plugins/nvim-dap.lua
Normal file
71
nvim/m-housh/lua/plugins/nvim-dap.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
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",
|
||||
--event = "VeryLazy",
|
||||
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/plugins/nvim-dapui.lua
Normal file
87
nvim/m-housh/lua/plugins/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,
|
||||
}
|
||||
24
nvim/m-housh/lua/plugins/nvim-lint.lua
Normal file
24
nvim/m-housh/lua/plugins/nvim-lint.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters_by_ft = {
|
||||
swift = { "swiftlint" },
|
||||
}
|
||||
|
||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost", "BufReadPost", "InsertLeave", "TextChanged" }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
require("lint").try_lint()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>ml", function()
|
||||
require("lint").try_lint()
|
||||
end, { desc = "[L]int file" })
|
||||
end,
|
||||
}
|
||||
68
nvim/m-housh/lua/plugins/oil.lua
Normal file
68
nvim/m-housh/lua/plugins/oil.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
return {
|
||||
"stevearc/oil.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
opts = {
|
||||
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,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- Show the parent directory in current window.
|
||||
{ "-", "<CMD>Oil<CR>", desc = "Open directory." },
|
||||
-- Open parent directory in floating window.
|
||||
{
|
||||
"<leader>-",
|
||||
function()
|
||||
require("oil").toggle_float()
|
||||
end,
|
||||
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,
|
||||
}
|
||||
16
nvim/m-housh/lua/plugins/swift.lua
Executable file
16
nvim/m-housh/lua/plugins/swift.lua
Executable file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
"m-housh/swift.nvim",
|
||||
dependencies = {
|
||||
"akinsho/toggleterm.nvim",
|
||||
},
|
||||
ft = { "swift" },
|
||||
config = function()
|
||||
require("swift").setup()
|
||||
local default_options = { noremap = true, silent = true }
|
||||
local actions = require("swift.actions")
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.keymap.set("n", "<C-b>", actions.build, default_options)
|
||||
vim.keymap.set("n", "<C-S-U>", actions.test, default_options)
|
||||
end,
|
||||
}
|
||||
102
nvim/m-housh/lua/plugins/telescope.lua
Executable file
102
nvim/m-housh/lua/plugins/telescope.lua
Executable file
@@ -0,0 +1,102 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
lazy = true,
|
||||
config = function()
|
||||
local actions = require("telescope.actions")
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
require("telescope").setup({
|
||||
ensure_installed = {
|
||||
"swift",
|
||||
},
|
||||
defaults = {
|
||||
file_ignore_patterns = { "node_modules", "%.jpg", "%.png", ".swiftpm" },
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--follow",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
-- Close on first esc instead of going to normal mode
|
||||
["<esc>"] = actions.close,
|
||||
["<A-q>"] = actions.send_selected_to_qflist,
|
||||
["<C-q>"] = actions.send_to_qflist,
|
||||
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
|
||||
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
},
|
||||
n = {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
|
||||
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
|
||||
["<A-q>"] = actions.send_selected_to_qflist,
|
||||
["<C-q>"] = actions.send_to_qflist,
|
||||
},
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "descending",
|
||||
layout_strategy = "flex",
|
||||
layout_config = {
|
||||
width = 0.75,
|
||||
prompt_position = "bottom",
|
||||
preview_cutoff = 120,
|
||||
horizontal = { mirror = false },
|
||||
vertical = { mirror = true },
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
-- path_display = true, -- strange behaviour not showing the files in result window
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
color_devicons = true,
|
||||
use_less = true,
|
||||
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
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
},
|
||||
})
|
||||
|
||||
local map = function(keys, action, desc)
|
||||
local opts = { silent = true, noremap = true, desc = desc }
|
||||
vim.keymap.set("n", keys, action, opts)
|
||||
end
|
||||
|
||||
local find_files = function(dir)
|
||||
return function()
|
||||
builtin.find_files({ cwd = dir, hidden = true, no_ignore = true })
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<C-A-j>", builtin.jumplist, { silent = true, noremap = true, desc = "Open [J]ump List." })
|
||||
map("<leader>ff", builtin.find_files, "[F]ind [F]iles")
|
||||
map("<leader>fg", builtin.live_grep, "[F]ind [G]rep")
|
||||
map("<leader>fb", builtin.buffers, "[F]ind [B]uffers")
|
||||
map("<leader>fh", builtin.help_tags, "[F]ind [H]elp")
|
||||
map("<leader>fd", find_files("$DOTFILES"), "[F]ind [D]otfiles")
|
||||
map("<leader>fn", find_files("$DOTFILES/nvim/m-housh"), "[F]ind [N]vim file")
|
||||
map("<leader>fs", find_files("$DOTFILES/scripts/scripts"), "[F]ind [S]cript")
|
||||
map("<leader>fz", find_files("$DOTFILES/zsh/config"), "[F]ind [Z]sh config file")
|
||||
map("<leader>gf", builtin.git_files, "Find [G]it [F]iles")
|
||||
end,
|
||||
}
|
||||
38
nvim/m-housh/lua/plugins/theme.lua
Executable file
38
nvim/m-housh/lua/plugins/theme.lua
Executable file
@@ -0,0 +1,38 @@
|
||||
-- return {
|
||||
-- 'EdenEast/nightfox.nvim',
|
||||
-- lazy = false, -- make sure we load this during startup
|
||||
-- priority = 1000, -- make sure to load this before all other plugins.
|
||||
-- opts = {
|
||||
-- --fox = "terafox", -- change the colorscheme to use terafox
|
||||
-- styles = {
|
||||
-- comments = "italic", -- change style of comments to be italic
|
||||
-- keywords = "bold", -- change style of keywords to be bold
|
||||
-- functions = "italic,bold" -- styles can be a comma separated list
|
||||
-- },
|
||||
-- inverse = {
|
||||
-- match_paren = true, -- inverse the highlighting of match_parens
|
||||
-- },
|
||||
-- colors = {
|
||||
-- red = "#FF0000", -- Override the red color for MAX POWER
|
||||
-- --bg_alt = "#000000",
|
||||
-- },
|
||||
-- hlgroups = {
|
||||
-- TSPunctDelimiter = { fg = "${red}" }, -- Override a highlight group with the color red
|
||||
-- LspCodeLens = { bg = "#000000", style = "italic" },
|
||||
-- }
|
||||
-- },
|
||||
-- }
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
opts = {
|
||||
color_overrides = {
|
||||
all = {
|
||||
text = "#ffffff",
|
||||
strings = "#ffffff"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
nvim/m-housh/lua/plugins/todo-comments.lua
Normal file
29
nvim/m-housh/lua/plugins/todo-comments.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = {
|
||||
"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,
|
||||
}
|
||||
26
nvim/m-housh/lua/plugins/toggleterm.lua
Executable file
26
nvim/m-housh/lua/plugins/toggleterm.lua
Executable file
@@ -0,0 +1,26 @@
|
||||
return {
|
||||
'akinsho/toggleterm.nvim',
|
||||
enable = true,
|
||||
lazy = true,
|
||||
opts = {
|
||||
size = 20,
|
||||
open_mapping = [[<c-\>]],
|
||||
hide_numbers = true,
|
||||
shade_terminals = true,
|
||||
shading_factor = 2,
|
||||
start_in_insert = true,
|
||||
insert_mappings = true,
|
||||
persist_size = true,
|
||||
direction = "float",
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
float_opts = {
|
||||
border = "curved",
|
||||
winblend = 0,
|
||||
highlights = {
|
||||
border = "Normal",
|
||||
background = "Normal",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
78
nvim/m-housh/lua/plugins/treesitter.lua
Executable file
78
nvim/m-housh/lua/plugins/treesitter.lua
Executable file
@@ -0,0 +1,78 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
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
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
scope_incremental = "<CR>",
|
||||
node_incremental = "<TAB>",
|
||||
node_decremental = "<S-TAB>",
|
||||
},
|
||||
},
|
||||
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,
|
||||
}
|
||||
46
nvim/m-housh/lua/plugins/trouble.lua
Normal file
46
nvim/m-housh/lua/plugins/trouble.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
return {
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
keys = {
|
||||
{ "<leader>d", "<cmd>Trouble diagnostics toggle<cr>", { desc = "Trouble [D]iagnostics" } },
|
||||
{ "<leader>dq", "<cmd>Trouble quickfix toggle<cr>", { desc = "Trouble [Q]uikfix." } },
|
||||
{ "<leader>dl", "<cmd>Trouble loclist toggle<cr>", { desc = "Trouble [L]ocation list" } },
|
||||
},
|
||||
|
||||
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,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = { "XcodebuildBuildFinished", "XcodebuildTestsFinished" },
|
||||
callback = function(event)
|
||||
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,
|
||||
}
|
||||
8
nvim/m-housh/lua/plugins/which-key.lua
Executable file
8
nvim/m-housh/lua/plugins/which-key.lua
Executable file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
}
|
||||
17
nvim/m-housh/lua/plugins/wrapping.lua
Executable file
17
nvim/m-housh/lua/plugins/wrapping.lua
Executable file
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
"andrewferrier/wrapping.nvim",
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
opts = {
|
||||
auto_set_mode_filetype_allowlist = {
|
||||
"asciidoc",
|
||||
"gitcommit",
|
||||
"latex",
|
||||
"markdown",
|
||||
"tex",
|
||||
"text"
|
||||
},
|
||||
softener = {
|
||||
markdown = 1.3
|
||||
},
|
||||
},
|
||||
}
|
||||
81
nvim/m-housh/lua/plugins/xcodebuild.lua
Normal file
81
nvim/m-housh/lua/plugins/xcodebuild.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
local progress_handle
|
||||
|
||||
return {
|
||||
"wojciech-kulik/xcodebuild.nvim",
|
||||
event = "VeryLazy",
|
||||
--branch = "fix/issue-249",
|
||||
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>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 This Test Class" })
|
||||
|
||||
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