mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-15 06:32:40 +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,9 +1,7 @@
|
||||
return {
|
||||
"j-hui/fidget.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local fidget = require("fidget")
|
||||
fidget.setup({
|
||||
opts = {
|
||||
notification = {
|
||||
window = {
|
||||
normal_hl = "String", -- Base highlight group in the notification window
|
||||
@@ -18,6 +16,5 @@ return {
|
||||
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,22 +1,10 @@
|
||||
-- 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",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
--"saghen/blink.cmp",
|
||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
@@ -33,14 +21,25 @@ return {
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
opts = {
|
||||
ensure_installed = lsp_servers,
|
||||
ensure_installed = {
|
||||
"bashls",
|
||||
"clangd",
|
||||
"dockerls",
|
||||
"gopls",
|
||||
"jinja_lsp",
|
||||
"jqls",
|
||||
"jsonls",
|
||||
"ltex",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"yamlls",
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
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 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
|
||||
@@ -79,6 +78,19 @@ return {
|
||||
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,
|
||||
@@ -102,4 +114,5 @@ return {
|
||||
-- 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,10 +1,4 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local lualine = require("lualine")
|
||||
|
||||
local function xcodebuild_device()
|
||||
local function xcodebuild_device()
|
||||
if vim.g.xcodebuild_platform == "macOS" then
|
||||
return " macOS"
|
||||
end
|
||||
@@ -14,9 +8,12 @@ return {
|
||||
end
|
||||
|
||||
return " " .. vim.g.xcodebuild_device_name
|
||||
end
|
||||
end
|
||||
|
||||
lualine.setup({
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
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({
|
||||
opts = {
|
||||
history = true,
|
||||
enable_autosnippets = false,
|
||||
updatevents = "TextChanged,TextChangedI",
|
||||
extra_opts = {
|
||||
[types.choiceNode] = {
|
||||
[require("luasnip.utl.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()
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<C-k>",
|
||||
mode = { "i", "s" },
|
||||
function()
|
||||
local ls = require("luasnip")
|
||||
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()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<C-j>",
|
||||
mode = { "i", "s" },
|
||||
function()
|
||||
local ls = require("luasnip")
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, opts)
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local ls = require("luasnip")
|
||||
ls.setup(opts)
|
||||
|
||||
-- Reload snippets.
|
||||
vim.keymap.set("n", "<leader><leader>s", "<CMD>source ~/.config/m-housh/lua/user/plugin/luasnip.lua<CR>")
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_lua").lazy_load({ paths = vim.fn.stdpath("config") .. "/snippets" })
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
-- config.lsp.signature.enabled = false
|
||||
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**
|
||||
@@ -26,22 +33,14 @@ return {
|
||||
filter = { event = "msg_showmode" },
|
||||
},
|
||||
{ -- Hide the written messages.
|
||||
view = 'notify',
|
||||
view = "notify",
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
kind = "",
|
||||
find = "written"
|
||||
find = "written",
|
||||
},
|
||||
opts = { skip = true }
|
||||
}
|
||||
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",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
opts = {
|
||||
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" })
|
||||
},
|
||||
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,8 +6,7 @@ return {
|
||||
},
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"cmake",
|
||||
@@ -73,6 +72,5 @@ return {
|
||||
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,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
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