129 lines
3.1 KiB
Lua
129 lines
3.1 KiB
Lua
vim.opt.tabstop = 2
|
|
vim.opt.softtabstop = 2
|
|
vim.opt.shiftwidth = 2
|
|
vim.opt.expandtab = true
|
|
|
|
vim.opt.number = true
|
|
vim.o.relativenumber = true
|
|
vim.o.numberwidth = 2
|
|
vim.o.ruler = false
|
|
|
|
vim.opt.autoindent = smartindent
|
|
vim.opt.syntax = enable
|
|
|
|
vim.o.cursorline = true
|
|
vim.o.cursorlineopt = "number"
|
|
vim.o.ignorecase = true
|
|
vim.o.smartcase = true
|
|
vim.o.mouse = "a"
|
|
|
|
vim.o.cmdheight = 0
|
|
vim.opt.laststatus = 0
|
|
|
|
-- vim.opt.foldmethod = "expr"
|
|
-- vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
|
vim.o.foldcolumn = "1" -- '0' is not bad
|
|
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
|
vim.o.foldlevelstart = 99
|
|
vim.o.foldenable = true
|
|
|
|
vim.opt.fillchars = { eob = " " }
|
|
|
|
vim.o.undofile = true
|
|
|
|
plugin({
|
|
"folke/which-key.nvim",
|
|
event = "VeryLazy",
|
|
opts = {},
|
|
keys = {
|
|
{
|
|
"<leader>?",
|
|
function()
|
|
require("which-key").show({ global = false })
|
|
end,
|
|
desc = "Buffer Local Keymaps (which-key)",
|
|
},
|
|
},
|
|
})
|
|
|
|
plugin({
|
|
"lewis6991/gitsigns.nvim",
|
|
})
|
|
|
|
plugin({
|
|
"tpope/vim-abolish",
|
|
})
|
|
|
|
plugin({
|
|
{
|
|
"kevinhwang91/nvim-ufo",
|
|
dependencies = {
|
|
{ "kevinhwang91/promise-async" },
|
|
},
|
|
config = function()
|
|
require("ufo").setup({
|
|
provider_selector = function(bufnr, filetype, buftype)
|
|
return { "treesitter", "indent" }
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
})
|
|
|
|
plugin({
|
|
"vim-test/vim-test",
|
|
})
|
|
|
|
map("n", "<leader>tt", "<cmd>:TestNearest<cr>", { desc = "Test Nearest" })
|
|
|
|
plugin({
|
|
"kelly-lin/ranger.nvim",
|
|
config = function()
|
|
require("ranger-nvim").setup({ replace_netrw = true })
|
|
vim.api.nvim_set_keymap("n", "<leader>ff", "", {
|
|
noremap = true,
|
|
callback = function()
|
|
require("ranger-nvim").open(true)
|
|
end,
|
|
})
|
|
end,
|
|
})
|
|
|
|
plugin({
|
|
"rachartier/tiny-inline-diagnostic.nvim",
|
|
event = "VeryLazy", -- Or `LspAttach`
|
|
priority = 1000, -- needs to be loaded in first
|
|
config = function()
|
|
require("tiny-inline-diagnostic").setup()
|
|
vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics
|
|
end,
|
|
})
|
|
|
|
map("n", "<leader>x", function()
|
|
Snacks.bufdelete()
|
|
end, { desc = "Delete Buffer" })
|
|
map("n", "<Esc>", "<cmd>noh<CR>", { desc = "general clear highlights" })
|
|
|
|
map("n", "dm", function()
|
|
local bufnr = vim.api.nvim_get_current_buf()
|
|
local cur_line = vim.fn.line(".")
|
|
---@type { mark: string, pos: number[] }[]
|
|
local all_marks_local = vim.fn.getmarklist(bufnr)
|
|
for _, mark in ipairs(all_marks_local) do
|
|
if mark.pos[2] == cur_line and string.match(mark.mark, "'[a-z]") then
|
|
vim.notify("Deleting mark: " .. string.sub(mark.mark, 2, 2))
|
|
vim.api.nvim_buf_del_mark(bufnr, string.sub(mark.mark, 2, 2))
|
|
end
|
|
end
|
|
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
|
---@type { file: string, mark: string, pos: number[] }[]
|
|
local all_marks_global = vim.fn.getmarklist()
|
|
for _, mark in ipairs(all_marks_global) do
|
|
local expanded_file_name = vim.fn.fnamemodify(mark.file, ":p")
|
|
if bufname == expanded_file_name and mark.pos[2] == cur_line and string.match(mark.mark, "'[A-Z]") then
|
|
vim.notify("Deleting mark: " .. string.sub(mark.mark, 2, 2))
|
|
vim.api.nvim_del_mark(string.sub(mark.mark, 2, 2))
|
|
end
|
|
end
|
|
end, { desc = "delete marks" })
|