Major change to use mini suit of plugins.
This commit is contained in:
+16
-29
@@ -1,36 +1,23 @@
|
||||
require("vim._core.ui2").enable({})
|
||||
map = vim.keymap.set
|
||||
vim.g.mapleader = " "
|
||||
vim.g.termguicolors = true -- Enable 24-bit RGB colors
|
||||
vim.o.nu = true -- Show line numbers
|
||||
vim.o.relativenumber = true -- Show relative line numbers
|
||||
vim.o.cursorline = true -- Highlight the line where the cursor is
|
||||
vim.o.wrap = false -- Don't wrap long lines to the next line
|
||||
vim.o.list = true -- Show invisible characters (tabs, trailing spaces)
|
||||
vim.o.scrolloff = 15 -- Keep 15 lines above/below cursor when scrolling
|
||||
vim.o.winborder = 'rounded' -- Use rounded borders for floating windows
|
||||
vim.o.ignorecase = true -- Ignore case in search patterns
|
||||
vim.o.smartcase = true -- ...unless search contains an uppercase letter
|
||||
vim.o.hlsearch = true -- Keep search results highlighted
|
||||
vim.o.incsearch = true -- Show search results as you type
|
||||
vim.o.path = "**" -- Search down into subdirectories (classic Vim)
|
||||
vim.o.expandtab = true -- Use spaces instead of tabs
|
||||
vim.o.shiftwidth = 4 -- 4 spaces per indent
|
||||
vim.o.tabstop = 4 -- 4 spaces for a tab
|
||||
vim.o.softtabstop = 4 -- Tab key inserts 4 spaces
|
||||
vim.o.swapfile = false -- Disable creation of .swp files
|
||||
vim.o.backup = false -- Disable backup files
|
||||
vim.o.undofile = true -- Save undo history to a file
|
||||
vim.o.splitright = true -- Open vertical splits to the right
|
||||
vim.o.splitbelow = true -- Open horizontal splits below
|
||||
vim.o.timeoutlen = 300 -- Time (ms) to wait for a mapped sequence to complete
|
||||
vim.o.autocomplete = true
|
||||
vim.o.showmode = false
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
vim.o.undodir = os.getenv("HOME") .. "/.cache/nvim/undodir"
|
||||
vim.g.termguicolors = true
|
||||
-- mini.basics sets defaults see plugin folder for more
|
||||
vim.o.winblend = 0
|
||||
vim.o.pumblend = 0
|
||||
vim.o.winborder = 'rounded'
|
||||
vim.o.scrolloff = 20
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.path = "**"
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.o.completeopt = "menuone,noselect,fuzzy,nosort"
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.o.undodir = os.getenv("HOME") .. "/.cache/nvim/undodir"
|
||||
|
||||
map("t", "<ESC><ESC>", "<C-\\><C-n>")
|
||||
map({"t", "n"}, "<C-h>", "<C-\\><C-n><C-w><C-h>")
|
||||
|
||||
@@ -19,21 +19,6 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set absolute numbers when in insert mode otherwise relativenumbers
|
||||
local nums = vim.api.nvim_create_augroup('smart_numbers', {})
|
||||
vim.api.nvim_create_autocmd('InsertEnter', {
|
||||
group = nums,
|
||||
callback = function()
|
||||
vim.opt.relativenumber = false
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('InsertLeave', {
|
||||
group = nums,
|
||||
callback = function()
|
||||
vim.opt.relativenumber = true
|
||||
end,
|
||||
})
|
||||
|
||||
-- removes trailing whitespace on save
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function()
|
||||
@@ -42,81 +27,3 @@ vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
vim.fn.setpos(".", save_cursor)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Lsp autocomplete
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
if not client then return end
|
||||
|
||||
-- Set completeopt for a better experience
|
||||
vim.opt.completeopt = { 'menu', 'menuone', 'noinsert', 'noselect' }
|
||||
|
||||
-- Enable completion if the server supports it
|
||||
if client:supports_method('textDocument/completion') then
|
||||
vim.lsp.completion.enable(true, client.id, ev.buf, {
|
||||
autotrigger = true, -- false = manual trigger only
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Define highlight groups
|
||||
vim.api.nvim_set_hl(0, "TodoFix", { fg = "#FF5555", bold = true })
|
||||
vim.api.nvim_set_hl(0, "TodoTodo", { fg = "#FFB86C", bold = true })
|
||||
vim.api.nvim_set_hl(0, "TodoNote", { fg = "#A8D8FF", bold = true })
|
||||
vim.api.nvim_set_hl(0, "TodoInfo", { fg = "#98DB6F", bold = true })
|
||||
|
||||
-- Match and highlight keywords in comments
|
||||
local keywords = {
|
||||
{ pattern = "FIX:.*", group = "TodoFix" },
|
||||
{ pattern = "TODO:.*", group = "TodoTodo" },
|
||||
{ pattern = "NOTE:.*", group = "TodoNote" },
|
||||
{ pattern = "INFO:.*", group = "TodoInfo" },
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {
|
||||
callback = function()
|
||||
for _, kw in ipairs(keywords) do
|
||||
vim.fn.matchadd(kw.group, kw.pattern)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Format: whole file or visual selection via :Fc
|
||||
local function smart_format()
|
||||
local mode = vim.fn.mode()
|
||||
local in_visual = mode == "v" or mode == "V" or mode == "\22"
|
||||
|
||||
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||
local has_formatter = false
|
||||
for _, client in ipairs(clients) do
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
has_formatter = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if in_visual then
|
||||
if has_formatter then
|
||||
vim.lsp.buf.format({
|
||||
range = {
|
||||
start = vim.api.nvim_buf_get_mark(0, "<"),
|
||||
["end"] = vim.api.nvim_buf_get_mark(0, ">"),
|
||||
},
|
||||
})
|
||||
else
|
||||
vim.cmd("normal! gv=")
|
||||
end
|
||||
else
|
||||
if has_formatter then
|
||||
vim.lsp.buf.format({ async = false })
|
||||
else
|
||||
local view = vim.fn.winsaveview()
|
||||
vim.cmd("normal! gg=G")
|
||||
vim.fn.winrestview(view)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_user_command("FF", smart_format, { range = true })
|
||||
|
||||
@@ -1,53 +1,59 @@
|
||||
vim.pack.add({
|
||||
{ src = "https://github.com/ibhagwan/fzf-lua" },
|
||||
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||
{ src = "https://github.com/romus204/tree-sitter-manager.nvim" },
|
||||
{ src = "https://github.com/rebelot/kanagawa.nvim" },
|
||||
{ src = "https://github.com/tribela/transparent.nvim" },
|
||||
{ src = "https://github.com/nvim-lualine/lualine.nvim" }
|
||||
{ src = "https://github.com/nvim-mini/mini.nvim" },
|
||||
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||
{ src = "https://github.com/romus204/tree-sitter-manager.nvim" },
|
||||
{ src = "https://github.com/brenoprata10/nvim-highlight-colors" },
|
||||
{ src = 'https://github.com/vague-theme/vague.nvim' }
|
||||
})
|
||||
|
||||
vim.cmd(":colorscheme kanagawa")
|
||||
|
||||
require("tree-sitter-manager").setup({})
|
||||
local theme = require('lualine.themes.kanagawa')
|
||||
|
||||
for _, mode in pairs(theme) do
|
||||
if mode.b then mode.b.bg = '#16161D' end
|
||||
if mode.c then mode.c.bg = '#16161D' end
|
||||
if mode.x then mode.x.bg = '#16161D' end
|
||||
if mode.y then mode.y.bg = '#16161D' end
|
||||
if mode.z then mode.z.bg = '#16161D' end
|
||||
end
|
||||
|
||||
require('lualine').setup({
|
||||
options = {
|
||||
theme = theme,
|
||||
component_separators = '',
|
||||
section_separators = '',
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'diagnostics'},
|
||||
lualine_y = {},
|
||||
lualine_z = {'lsp_status', 'location'},
|
||||
},
|
||||
require('vague').setup({ transparent = true })
|
||||
require("tree-sitter-manager").setup()
|
||||
require('nvim-highlight-colors').setup()
|
||||
-- Mini setups
|
||||
require("mini.extra").setup({})
|
||||
require("mini.pairs").setup({})
|
||||
require("mini.statusline").setup({})
|
||||
require('mini.basics').setup({
|
||||
options = { basic = true, extra_ui = true, win_borders = 'rounded', },
|
||||
mappings = { basic = true },
|
||||
autocommands = { basic = true },
|
||||
})
|
||||
require('mini.completion').setup({ lsp_completion = { auto_setup = true }, })
|
||||
require("mini.pick").setup({
|
||||
window = { config = function()
|
||||
local height = math.floor(0.50 * vim.o.lines)
|
||||
local width = math.floor(0.50 * vim.o.columns)
|
||||
return {
|
||||
anchor = 'NW', height = height, width = width,
|
||||
row = math.floor(0.5 * (vim.o.lines - height)),
|
||||
col = math.floor(0.5 * (vim.o.columns - width)),
|
||||
}
|
||||
end }
|
||||
})
|
||||
|
||||
require("fzf-lua").setup()
|
||||
map("n", "<leader>f", ":lua FzfLua.files()<CR>")
|
||||
map("n", "<leader>o", ":lua FzfLua.buffers()<CR>")
|
||||
map("n", "<leader>h", ":lua FzfLua.help_tags()<CR>")
|
||||
map("n", "<leader>d", ":lua FzfLua.diagnostics_document()<CR>")
|
||||
map("n", "<leader>a", ":lua FzfLua.lsp_code_actions()<CR>")
|
||||
map("n", "<leader>ss", ":lua FzfLua.grep_project()<CR>")
|
||||
map("n", "<leader>sf", ":lua FzfLua.grep_curbuf()<CR>")
|
||||
map("n", "<leader>sw", ":lua FzfLua.grep_cword()<CR>")
|
||||
vim.cmd(":HighlightColors Off")
|
||||
vim.cmd(":colorscheme vague")
|
||||
|
||||
-- Lsp specific, uses nvim-lspconfigs with the below
|
||||
vim.lsp.enable({ "gopls", "ols" })
|
||||
map("n", "L", ":lua vim.diagnostic.open_float()<CR>")
|
||||
map("n", "gd", ":lua vim.lsp.buf.definition()<CR>")
|
||||
map("n", "<leader>r", ":lua vim.lsp.buf.rename()<CR>")
|
||||
map("n", "<leader>a", ":lua vim.lsp.buf.code_action()<CR>")
|
||||
-- Mini Keybinds
|
||||
map("n", "<leader>f", ":lua MiniPick.builtin.files()<CR>")
|
||||
map("n", "<leader>o", ":lua MiniPick.builtin.buffers()<CR>")
|
||||
map("n", "<leader>h", ":lua MiniPick.builtin.help()<CR>")
|
||||
map("n", "<leader>d", ":lua MiniExtra.pickers.diagnostic()<CR>")
|
||||
map("n", "<leader>ss", ":lua MiniPick.builtin.grep_live()<CR>")
|
||||
map("n", "<leader>tc", ":HighlightColors Toggle<CR>")
|
||||
|
||||
-- Highlight Overrides
|
||||
local bg = "#1b1b1b"
|
||||
local border = "#96A6C8"
|
||||
vim.api.nvim_set_hl(0, "MiniPickBorder", { bg = bg, fg = border })
|
||||
vim.api.nvim_set_hl(0, "MiniPickNormal", { bg = bg })
|
||||
-- Completion popup background
|
||||
vim.api.nvim_set_hl(0, "Pmenu", { bg = bg })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = bg })
|
||||
vim.api.nvim_set_hl(0, 'FloatBorder', { bg = bg, fg = border })
|
||||
|
||||
Reference in New Issue
Block a user