promote nvim_unstable
This commit is contained in:
parent
f1430fa64d
commit
a6c0b4b867
66 changed files with 489 additions and 498 deletions
|
|
@ -1,7 +1,33 @@
|
|||
-- Loadnoptions before anything
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("aleidk.options")
|
||||
|
||||
require("aleidk.lazy")
|
||||
|
||||
require("aleidk.keymaps")
|
||||
require("aleidk.autocmds")
|
||||
require("aleidk.keymaps")
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "aleidk/plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
-- checker = { enabled = true },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,57 +1,28 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" },
|
||||
"blink.cmp": { "branch": "main", "commit": "81069e3955a8b4d5063287a2a6a47a844e9ca2cb" },
|
||||
"blink.compat": { "branch": "main", "commit": "08943fdf2eb00432d6205db6d0239434135416bd" },
|
||||
"catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" },
|
||||
"ccc.nvim": { "branch": "main", "commit": "7c639042583c7bdc7ce2e37e5a0e0aa6d0659c6a" },
|
||||
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
|
||||
"conform.nvim": { "branch": "master", "commit": "a203480a350b03092e473bf3001733d547160a73" },
|
||||
"copilot-lualine": { "branch": "main", "commit": "f40450c3e138766026327e7807877ea860618258" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
|
||||
"fzf-lua": { "branch": "main", "commit": "8adf950093af5361621cf52208d64995b1af78b5" },
|
||||
"grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
||||
"luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"mini.clue": { "branch": "main", "commit": "8e329f586a7cfd06085859066a4b60965fc4ecce" },
|
||||
"mini.comment": { "branch": "main", "commit": "03c13e37318bdb18481311c0ac1adc9ed731caf1" },
|
||||
"mini.surround": { "branch": "main", "commit": "0e67c4bc147f2a15cee94e7c94dcc0e115b9f55e" },
|
||||
"mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" },
|
||||
"neogen": { "branch": "main", "commit": "dc50715c009f89b8111197fd2f282f6042daa7ea" },
|
||||
"noice.nvim": { "branch": "main", "commit": "c6f6fb178ebe9b4fd90383de743c3399f8c3a37c" },
|
||||
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
|
||||
"nvim-lint": { "branch": "master", "commit": "6b46370d02cd001509a765591a3ffc481b538794" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "4ae9796c4e95ca84ec77946a9f9089b8f1a3eec9" },
|
||||
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "8d4fdc5e47e2a4e00179e43f56221250ce365973" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "6b081ea63a3711243d11540ce28ccdb6f35ecd33" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "edbe0a65cfacbbfff6a4a1e98ddd60c28c560509" },
|
||||
"overseer.nvim": { "branch": "master", "commit": "10ee48ff96c8d1049efb278ea4c8cf9f3b0e4326" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"remote-nvim.nvim": { "branch": "main", "commit": "66fc20fd259401c7bb6ac5189ecb6283c2eb65d2" },
|
||||
"remote-sshfs.nvim": { "branch": "main", "commit": "03f6c40c4032eeb1ab91368e06db9c3f3a97a75d" },
|
||||
"render-markdown": { "branch": "main", "commit": "6096cf3608b576a38fd1396227dbc0473091714d" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "fc7bb00fe67ab504356bed4310d23c2e4cb4b06b" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"treesj": { "branch": "main", "commit": "03415ac60791d48e120a80d37e080744faf3ac15" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
|
||||
"ts-node-action": { "branch": "master", "commit": "6d3b60754fd87963d70eadaa2f77873b447eac26" },
|
||||
"typescript-tools.nvim": { "branch": "master", "commit": "346062e8cd06e82776b60785a040dfbbdcb6de77" },
|
||||
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "fe5a55e92b2dded7c404006147ef97fb073d8b1b" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "da0e75c09c27a82aad078d993bb1b2f4afd43427" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "28a16902cb2134c934b85da5250033ee43b0dee5" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"yazi.nvim": { "branch": "main", "commit": "053867916a9be3cb46f84b6f095ee731bbddd213" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,34 @@
|
|||
-- Highlight on yank
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = "*",
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
|
||||
vim.bo[args.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp'
|
||||
|
||||
-- Prefer LSP folding if client supports it
|
||||
if client:supports_method('textDocument/foldingRange') then
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
||||
end
|
||||
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>la", vim.lsp.buf.code_action, { buffer = args.buf, desc = "Code Action" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>ld", vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>lc", function()
|
||||
local curpos = vim.fn.getcurpos()
|
||||
local diagnostics = vim.diagnostic.get(0, { lnum = curpos[2] - 1 })
|
||||
|
||||
if #diagnostics == 0 then
|
||||
vim.notify("No diagnostic under cursor")
|
||||
return
|
||||
end
|
||||
|
||||
local diagnostic = diagnostics[1]
|
||||
local msg = string.format("%s [%s]: %s", diagnostic.source, diagnostic.code, diagnostic.message)
|
||||
vim.fn.setreg("+", msg)
|
||||
vim.notify("Diagnostic saved to clipboard:\n\n" .. msg)
|
||||
end, { buffer = args.buf, desc = "Copy diagnostic to clipboard" })
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,77 +1,34 @@
|
|||
-- [[ Basic Keymaps ]]
|
||||
|
||||
function MAP(mode, l, r, desc)
|
||||
vim.keymap.set(mode, l, r, { desc = desc, silent = true })
|
||||
end
|
||||
|
||||
function ReloadModule(module)
|
||||
package.loaded[module] = nil
|
||||
require(module)
|
||||
end
|
||||
|
||||
local function default(desc)
|
||||
return {
|
||||
silent = true,
|
||||
desc = desc,
|
||||
}
|
||||
end
|
||||
|
||||
local function fixIndentation()
|
||||
local indent = 2
|
||||
vim.opt.tabstop = indent
|
||||
vim.opt.shiftwidth = indent
|
||||
vim.opt.softtabstop = indent
|
||||
|
||||
vim.cmd("retab")
|
||||
end
|
||||
|
||||
-- Keymaps for better default experience
|
||||
-- See `:help vim.keymap.set()`
|
||||
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true })
|
||||
|
||||
-- vim.keymap.set("n", "<C-s>", "<CMD>w<CR>", default("Keep cursor centered while junping"))
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z", default("Keep cursor in column while joining lines"))
|
||||
|
||||
vim.keymap.set("n", "|", ":vs<CR>", default("Open vsplit"))
|
||||
vim.keymap.set("n", "°", ":sp<CR>", default("Open split"))
|
||||
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz", default("Keep cursor centered while junping"))
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz", default("Keep cursor centered while junping"))
|
||||
|
||||
vim.keymap.set("n", "n", "nzzzv", default("Keep cursor centered while searching"))
|
||||
vim.keymap.set("n", "N", "Nzzzv", default("Keep cursor centered while searching"))
|
||||
|
||||
-- stylua: ignore start
|
||||
-- QoL normalization's
|
||||
vim.keymap.set("n", "Q", "<nop>", {})
|
||||
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { desc = "Prevent cursor movement", silent = true })
|
||||
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'",
|
||||
{ desc = "Move cursor regardless of word wrap", expr = true, silent = true })
|
||||
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'",
|
||||
{ desc = "Move cursor regardless of word wrap", expr = true, silent = true })
|
||||
vim.keymap.set("n", "J", "mzJ`z", { desc = "Keep cursor in column while joining lines", silent = true })
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>rw",
|
||||
[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
|
||||
default("Search and replace current word")
|
||||
)
|
||||
-- vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Keep cursor centered while junping", silent = true })
|
||||
-- vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = "Keep cursor centered while junping", silent = true })
|
||||
-- vim.keymap.set("n", "n", "nzzzv", { desc = "Keep cursor centered while searching", silent = true })
|
||||
-- vim.keymap.set("n", "N", "Nzzzv", { desc = "Keep cursor centered while searching", silent = true })
|
||||
|
||||
-- vim.keymap.set("n", "<leader>rR", ":s/", default("Search and replace inline"))
|
||||
-- vim.keymap.set("n", "<leader>rr", ":%s/", default("Search and replace globally"))
|
||||
-- vim.keymap.set("v", "<leader>r", ":s/", default("Search and replace in selection"))
|
||||
-- Utils
|
||||
vim.keymap.set("n", "|", ":vs<CR>", { desc = "Create vsplit", silent = true })
|
||||
vim.keymap.set("n", "°", ":sp<CR>", { desc = "Create split", silent = true })
|
||||
|
||||
vim.keymap.set("v", "p", [["_dP]], default("Paste without lossing yanked text"))
|
||||
vim.keymap.set("v", "p", [["_dP]], { desc = "Paste without lossing yanked text", silent = true })
|
||||
vim.keymap.set("n", "<Leader>uh", ":nohl<CR>", { desc = "Remove search highlight", silent = true })
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", default("Move selection down"))
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", default("Move selection up"))
|
||||
vim.keymap.set("n", "<Leader>uI", fixIndentation, default("Fix indentation"))
|
||||
vim.keymap.set("n", "<Leader>uO", function() ReloadModule('aleidk.options') end,
|
||||
default("Reload the options configuration"))
|
||||
-- Buffer manipulation
|
||||
vim.keymap.set("n", "<leader>bc", "<Cmd>bd<CR>", { desc = "Close buffer", silent = true })
|
||||
vim.keymap.set("n", "<leader>bh", "<Cmd>bp<CR>", { desc = "Prev buffer", silent = true })
|
||||
vim.keymap.set("n", "<leader>bl", "<Cmd>bn<CR>", { desc = "Next buffer", silent = true })
|
||||
vim.keymap.set("n", "<leader>bA", "<Cmd>bufdo bd<CR>", { desc = "Close all buffers", silent = true })
|
||||
|
||||
vim.keymap.set("n", "<Leader>uh", ":nohl<CR>", default("Remove search highlight"))
|
||||
vim.keymap.set("n", "<C-h>", "<C-w>h", { desc = "Move to left window", silent = true })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w>j", { desc = "Move to bottom window", silent = true })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w>k", { desc = "Move to top window", silent = true })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w>l", { desc = "Move to right window", silent = true })
|
||||
|
||||
vim.keymap.set("t", "<ESC>", "<C-\\><C-n>", default("Exit insert mode on terminal"))
|
||||
|
||||
vim.keymap.set("n", "<leader>bc", "<Cmd>bd<CR>", default("Close buffer"))
|
||||
vim.keymap.set("n", "<leader>bh", "<Cmd>bp<CR>", default("Prev buffer"))
|
||||
vim.keymap.set("n", "<leader>bl", "<Cmd>bn<CR>", default("Next buffer"))
|
||||
vim.keymap.set("n", "<leader>bA", "<Cmd>bufdo bd<CR>", default("Close all buffers"))
|
||||
-- stylua: ignore end
|
||||
|
|
|
|||
|
|
@ -9,10 +9,15 @@ vim.o.diffopt = "vertical,closeoff,filler"
|
|||
|
||||
local opt = vim.opt
|
||||
|
||||
-- stylua: ignore
|
||||
opt.autowrite = true -- Enable auto write
|
||||
opt.clipboard = "unnamedplus" -- Sync with system clipboard
|
||||
opt.completeopt = "menu,menuone,noselect"
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
vim.o.winborder = 'rounded'
|
||||
opt.breakindent = true -- Every wrapped line will continue visually indented
|
||||
opt.autowrite = true -- Enable auto write
|
||||
-- opt.completeopt = "menu,menuone,noselect"
|
||||
vim.o.completeopt = 'noselect,menu,menuone,noinsert,popup'
|
||||
opt.conceallevel = 2 -- Hide * markup for bold and italic
|
||||
opt.confirm = true -- Confirm to save changes before exiting modified buffer
|
||||
opt.cursorline = true -- Enable highlighting of the current line
|
||||
|
|
@ -23,7 +28,8 @@ opt.grepprg = "rg --vimgrep"
|
|||
opt.ignorecase = true -- Ignore case
|
||||
opt.inccommand = "nosplit" -- preview incremental substitute
|
||||
opt.laststatus = 0
|
||||
opt.list = true -- Show some invisible characters (tabs...
|
||||
vim.opt.list = true -- Sets how neovim will display certain whitespace characters in the editor.
|
||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||
opt.mouse = "a" -- Enable mouse mode
|
||||
opt.number = true -- Print line number
|
||||
opt.pumblend = 10 -- Popup blend
|
||||
|
|
@ -34,7 +40,7 @@ opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
|||
opt.shiftround = true -- Round indent
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
-- opt.shortmess:append({ W = true, I = true, c = true }) -- INFO: this control the format of some messages
|
||||
opt.showmode = false -- Dont show mode since we have a statusline
|
||||
opt.showmode = false -- Don't show mode since we have a statusline
|
||||
opt.sidescrolloff = 8 -- Columns of context
|
||||
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||
opt.smartcase = true -- Don't ignore case with capitals
|
||||
|
|
@ -44,101 +50,112 @@ opt.splitbelow = true -- Put new windows below current
|
|||
opt.splitright = true -- Put new windows right of current
|
||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||
opt.termguicolors = true -- True color support
|
||||
opt.timeoutlen = 300
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
opt.wildmode = "longest,list:full" -- Command-line completion mode
|
||||
opt.winminwidth = 5 -- Minimum window width
|
||||
opt.wrap = false -- Disable line wrap
|
||||
vim.opt.inccommand = 'split' -- Preview substitutions live, as you type!
|
||||
|
||||
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||
|
||||
-- Nice and simple folding:
|
||||
vim.o.foldenable = true
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.opt.fillchars:append({ fold = " " })
|
||||
|
||||
local fn = vim.fn
|
||||
|
||||
-- Quickfix customization
|
||||
function _G.qftf(info)
|
||||
local items
|
||||
local ret = {}
|
||||
-- The name of item in list is based on the directory of quickfix window.
|
||||
-- Change the directory for quickfix window make the name of item shorter.
|
||||
-- It's a good opportunity to change current directory in quickfixtextfunc :)
|
||||
--
|
||||
-- local alterBufnr = fn.bufname('#') -- alternative buffer is the buffer before enter qf window
|
||||
-- local root = getRootByAlterBufnr(alterBufnr)
|
||||
-- vim.cmd(('noa lcd %s'):format(fn.fnameescape(root)))
|
||||
--
|
||||
if info.quickfix == 1 then
|
||||
items = fn.getqflist({ id = info.id, items = 0 }).items
|
||||
else
|
||||
items = fn.getloclist(info.winid, { id = info.id, items = 0 }).items
|
||||
end
|
||||
local limit = 31
|
||||
local fnameFmt1, fnameFmt2 = "%-" .. limit .. "s", "…%." .. (limit - 1) .. "s"
|
||||
local validFmt = "%s │%5d:%-3d│%s %s"
|
||||
for i = info.start_idx, info.end_idx do
|
||||
local e = items[i]
|
||||
local fname = ""
|
||||
local str
|
||||
if e.valid == 1 then
|
||||
if e.bufnr > 0 then
|
||||
fname = fn.bufname(e.bufnr)
|
||||
if fname == "" then
|
||||
fname = "[No Name]"
|
||||
else
|
||||
fname = fname:gsub("^" .. vim.env.HOME, "~")
|
||||
end
|
||||
-- char in fname may occur more than 1 width, ignore this issue in order to keep performance
|
||||
if #fname <= limit then
|
||||
fname = fnameFmt1:format(fname)
|
||||
else
|
||||
fname = fnameFmt2:format(fname:sub(1 - limit))
|
||||
end
|
||||
end
|
||||
local lnum = e.lnum > 99999 and -1 or e.lnum
|
||||
local col = e.col > 999 and -1 or e.col
|
||||
local qtype = e.type == "" and "" or " " .. e.type:sub(1, 1):upper()
|
||||
str = validFmt:format(fname, lnum, col, qtype, e.text)
|
||||
else
|
||||
str = e.text
|
||||
end
|
||||
table.insert(ret, str)
|
||||
end
|
||||
return ret
|
||||
local items
|
||||
local ret = {}
|
||||
-- The name of item in list is based on the directory of quickfix window.
|
||||
-- Change the directory for quickfix window make the name of item shorter.
|
||||
-- It's a good opportunity to change current directory in quickfixtextfunc :)
|
||||
--
|
||||
-- local alterBufnr = fn.bufname('#') -- alternative buffer is the buffer before enter qf window
|
||||
-- local root = getRootByAlterBufnr(alterBufnr)
|
||||
-- vim.cmd(('noa lcd %s'):format(fn.fnameescape(root)))
|
||||
--
|
||||
if info.quickfix == 1 then
|
||||
items = fn.getqflist({ id = info.id, items = 0 }).items
|
||||
else
|
||||
items = fn.getloclist(info.winid, { id = info.id, items = 0 }).items
|
||||
end
|
||||
local limit = 31
|
||||
local fnameFmt1, fnameFmt2 = "%-" .. limit .. "s", "…%." .. (limit - 1) .. "s"
|
||||
local validFmt = "%s │%5d:%-3d│%s %s"
|
||||
for i = info.start_idx, info.end_idx do
|
||||
local e = items[i]
|
||||
local fname = ""
|
||||
local str
|
||||
if e.valid == 1 then
|
||||
if e.bufnr > 0 then
|
||||
fname = fn.bufname(e.bufnr)
|
||||
if fname == "" then
|
||||
fname = "[No Name]"
|
||||
else
|
||||
fname = fname:gsub("^" .. vim.env.HOME, "~")
|
||||
end
|
||||
-- char in fname may occur more than 1 width, ignore this issue in order to keep performance
|
||||
if #fname <= limit then
|
||||
fname = fnameFmt1:format(fname)
|
||||
else
|
||||
fname = fnameFmt2:format(fname:sub(1 - limit))
|
||||
end
|
||||
end
|
||||
local lnum = e.lnum > 99999 and -1 or e.lnum
|
||||
local col = e.col > 999 and -1 or e.col
|
||||
local qtype = e.type == "" and "" or " " .. e.type:sub(1, 1):upper()
|
||||
str = validFmt:format(fname, lnum, col, qtype, e.text)
|
||||
else
|
||||
str = e.text
|
||||
end
|
||||
table.insert(ret, str)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
-- TODO: how to customize?
|
||||
vim.o.qftf = "{info -> v:lua._G.qftf(info)}"
|
||||
|
||||
vim.filetype.add({
|
||||
-- Detect and assign filetype based on the extension of the filename
|
||||
extension = {
|
||||
mdx = "mdx",
|
||||
log = "log",
|
||||
conf = "conf",
|
||||
env = "dotenv"
|
||||
},
|
||||
-- Detect and apply filetypes based on the entire filename
|
||||
filename = {
|
||||
[".env"] = "dotenv",
|
||||
["env"] = "dotenv",
|
||||
["tsconfig.json"] = "jsonc",
|
||||
},
|
||||
-- Detect and apply filetypes based on certain patterns of the filenames
|
||||
pattern = {
|
||||
-- INFO: Match filenames like - ".env.example", ".env.local" and so on
|
||||
["%.env%.[%w_.-]+"] = "dotenv",
|
||||
[".*%.blade%.php"] = "blade",
|
||||
[".*%.hurl.*"] = "hurl",
|
||||
[".*/hypr/.*%.conf"] = "hyprlang",
|
||||
['.*/systemd/.*%.(%a+)'] = function(path, bufnr, ext)
|
||||
vim.print(ext)
|
||||
local allowed = { "container", "volume", "network", "build", "pod", "kube" }
|
||||
for _, v in ipairs(allowed) do
|
||||
if v == ext then
|
||||
return "ini"
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
-- Detect and assign filetype based on the extension of the filename
|
||||
extension = {
|
||||
mdx = "mdx",
|
||||
log = "log",
|
||||
conf = "conf",
|
||||
env = "dotenv",
|
||||
},
|
||||
-- Detect and apply filetypes based on the entire filename
|
||||
filename = {
|
||||
[".env"] = "dotenv",
|
||||
["env"] = "dotenv",
|
||||
["tsconfig.json"] = "jsonc",
|
||||
},
|
||||
-- Detect and apply filetypes based on certain patterns of the filenames
|
||||
pattern = {
|
||||
-- INFO: Match filenames like - ".env.example", ".env.local" and so on
|
||||
["%.env%.[%w_.-]+"] = "dotenv",
|
||||
[".*%.blade%.php"] = "blade",
|
||||
[".*%.hurl.*"] = "hurl",
|
||||
[".*/hypr/.*%.conf"] = "hyprlang",
|
||||
},
|
||||
})
|
||||
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ LSP │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.lsp.enable({
|
||||
"rust_analyzer",
|
||||
"lua_ls",
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = { current_line = true },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ return {
|
|||
},
|
||||
sources = {
|
||||
providers = {
|
||||
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
||||
lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" },
|
||||
luasnip = {
|
||||
name = 'luasnip',
|
||||
|
|
@ -54,7 +53,6 @@ return {
|
|||
"path",
|
||||
"snippets",
|
||||
"buffer",
|
||||
"dadbod",
|
||||
"lazydev",
|
||||
},
|
||||
},
|
||||
7
Configs/nvim_old/.config/nvim_old/init.lua
Normal file
7
Configs/nvim_old/.config/nvim_old/init.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- Loadnoptions before anything
|
||||
require("aleidk.options")
|
||||
|
||||
require("aleidk.lazy")
|
||||
|
||||
require("aleidk.keymaps")
|
||||
require("aleidk.autocmds")
|
||||
57
Configs/nvim_old/.config/nvim_old/lazy-lock.json
Normal file
57
Configs/nvim_old/.config/nvim_old/lazy-lock.json
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" },
|
||||
"blink.cmp": { "branch": "main", "commit": "81069e3955a8b4d5063287a2a6a47a844e9ca2cb" },
|
||||
"blink.compat": { "branch": "main", "commit": "08943fdf2eb00432d6205db6d0239434135416bd" },
|
||||
"catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" },
|
||||
"ccc.nvim": { "branch": "main", "commit": "7c639042583c7bdc7ce2e37e5a0e0aa6d0659c6a" },
|
||||
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
|
||||
"conform.nvim": { "branch": "master", "commit": "a203480a350b03092e473bf3001733d547160a73" },
|
||||
"copilot-lualine": { "branch": "main", "commit": "f40450c3e138766026327e7807877ea860618258" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
|
||||
"grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
||||
"luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"mini.clue": { "branch": "main", "commit": "8e329f586a7cfd06085859066a4b60965fc4ecce" },
|
||||
"mini.comment": { "branch": "main", "commit": "03c13e37318bdb18481311c0ac1adc9ed731caf1" },
|
||||
"mini.surround": { "branch": "main", "commit": "0e67c4bc147f2a15cee94e7c94dcc0e115b9f55e" },
|
||||
"neogen": { "branch": "main", "commit": "dc50715c009f89b8111197fd2f282f6042daa7ea" },
|
||||
"noice.nvim": { "branch": "main", "commit": "c6f6fb178ebe9b4fd90383de743c3399f8c3a37c" },
|
||||
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
|
||||
"nvim-lint": { "branch": "master", "commit": "6b46370d02cd001509a765591a3ffc481b538794" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "4ae9796c4e95ca84ec77946a9f9089b8f1a3eec9" },
|
||||
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "8d4fdc5e47e2a4e00179e43f56221250ce365973" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "6b081ea63a3711243d11540ce28ccdb6f35ecd33" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "edbe0a65cfacbbfff6a4a1e98ddd60c28c560509" },
|
||||
"overseer.nvim": { "branch": "master", "commit": "10ee48ff96c8d1049efb278ea4c8cf9f3b0e4326" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"remote-nvim.nvim": { "branch": "main", "commit": "66fc20fd259401c7bb6ac5189ecb6283c2eb65d2" },
|
||||
"remote-sshfs.nvim": { "branch": "main", "commit": "03f6c40c4032eeb1ab91368e06db9c3f3a97a75d" },
|
||||
"render-markdown": { "branch": "main", "commit": "6096cf3608b576a38fd1396227dbc0473091714d" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "fc7bb00fe67ab504356bed4310d23c2e4cb4b06b" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"treesj": { "branch": "main", "commit": "03415ac60791d48e120a80d37e080744faf3ac15" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
|
||||
"ts-node-action": { "branch": "master", "commit": "6d3b60754fd87963d70eadaa2f77873b447eac26" },
|
||||
"typescript-tools.nvim": { "branch": "master", "commit": "346062e8cd06e82776b60785a040dfbbdcb6de77" },
|
||||
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "fe5a55e92b2dded7c404006147ef97fb073d8b1b" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "da0e75c09c27a82aad078d993bb1b2f4afd43427" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "28a16902cb2134c934b85da5250033ee43b0dee5" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"yazi.nvim": { "branch": "main", "commit": "053867916a9be3cb46f84b6f095ee731bbddd213" }
|
||||
}
|
||||
10
Configs/nvim_old/.config/nvim_old/lua/aleidk/autocmds.lua
Normal file
10
Configs/nvim_old/.config/nvim_old/lua/aleidk/autocmds.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
-- Highlight on yank
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = "*",
|
||||
})
|
||||
77
Configs/nvim_old/.config/nvim_old/lua/aleidk/keymaps.lua
Normal file
77
Configs/nvim_old/.config/nvim_old/lua/aleidk/keymaps.lua
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
-- [[ Basic Keymaps ]]
|
||||
|
||||
function MAP(mode, l, r, desc)
|
||||
vim.keymap.set(mode, l, r, { desc = desc, silent = true })
|
||||
end
|
||||
|
||||
function ReloadModule(module)
|
||||
package.loaded[module] = nil
|
||||
require(module)
|
||||
end
|
||||
|
||||
local function default(desc)
|
||||
return {
|
||||
silent = true,
|
||||
desc = desc,
|
||||
}
|
||||
end
|
||||
|
||||
local function fixIndentation()
|
||||
local indent = 2
|
||||
vim.opt.tabstop = indent
|
||||
vim.opt.shiftwidth = indent
|
||||
vim.opt.softtabstop = indent
|
||||
|
||||
vim.cmd("retab")
|
||||
end
|
||||
|
||||
-- Keymaps for better default experience
|
||||
-- See `:help vim.keymap.set()`
|
||||
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true })
|
||||
|
||||
-- vim.keymap.set("n", "<C-s>", "<CMD>w<CR>", default("Keep cursor centered while junping"))
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z", default("Keep cursor in column while joining lines"))
|
||||
|
||||
vim.keymap.set("n", "|", ":vs<CR>", default("Open vsplit"))
|
||||
vim.keymap.set("n", "°", ":sp<CR>", default("Open split"))
|
||||
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz", default("Keep cursor centered while junping"))
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz", default("Keep cursor centered while junping"))
|
||||
|
||||
vim.keymap.set("n", "n", "nzzzv", default("Keep cursor centered while searching"))
|
||||
vim.keymap.set("n", "N", "Nzzzv", default("Keep cursor centered while searching"))
|
||||
|
||||
vim.keymap.set("n", "Q", "<nop>", {})
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>rw",
|
||||
[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
|
||||
default("Search and replace current word")
|
||||
)
|
||||
|
||||
-- vim.keymap.set("n", "<leader>rR", ":s/", default("Search and replace inline"))
|
||||
-- vim.keymap.set("n", "<leader>rr", ":%s/", default("Search and replace globally"))
|
||||
-- vim.keymap.set("v", "<leader>r", ":s/", default("Search and replace in selection"))
|
||||
|
||||
vim.keymap.set("v", "p", [["_dP]], default("Paste without lossing yanked text"))
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", default("Move selection down"))
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", default("Move selection up"))
|
||||
vim.keymap.set("n", "<Leader>uI", fixIndentation, default("Fix indentation"))
|
||||
vim.keymap.set("n", "<Leader>uO", function() ReloadModule('aleidk.options') end,
|
||||
default("Reload the options configuration"))
|
||||
|
||||
vim.keymap.set("n", "<Leader>uh", ":nohl<CR>", default("Remove search highlight"))
|
||||
|
||||
vim.keymap.set("t", "<ESC>", "<C-\\><C-n>", default("Exit insert mode on terminal"))
|
||||
|
||||
vim.keymap.set("n", "<leader>bc", "<Cmd>bd<CR>", default("Close buffer"))
|
||||
vim.keymap.set("n", "<leader>bh", "<Cmd>bp<CR>", default("Prev buffer"))
|
||||
vim.keymap.set("n", "<leader>bl", "<Cmd>bn<CR>", default("Next buffer"))
|
||||
vim.keymap.set("n", "<leader>bA", "<Cmd>bufdo bd<CR>", default("Close all buffers"))
|
||||
144
Configs/nvim_old/.config/nvim_old/lua/aleidk/options.lua
Normal file
144
Configs/nvim_old/.config/nvim_old/lua/aleidk/options.lua
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
|
||||
-- Set <space> as the leader key
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
vim.o.diffopt = "vertical,closeoff,filler"
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
-- stylua: ignore
|
||||
opt.autowrite = true -- Enable auto write
|
||||
opt.clipboard = "unnamedplus" -- Sync with system clipboard
|
||||
opt.completeopt = "menu,menuone,noselect"
|
||||
opt.conceallevel = 2 -- Hide * markup for bold and italic
|
||||
opt.confirm = true -- Confirm to save changes before exiting modified buffer
|
||||
opt.cursorline = true -- Enable highlighting of the current line
|
||||
opt.expandtab = true -- Use spaces instead of tabs
|
||||
opt.formatoptions = "jcroqlnt" -- tcqj
|
||||
opt.grepformat = "%f:%l:%c:%m"
|
||||
opt.grepprg = "rg --vimgrep"
|
||||
opt.ignorecase = true -- Ignore case
|
||||
opt.inccommand = "nosplit" -- preview incremental substitute
|
||||
opt.laststatus = 0
|
||||
opt.list = true -- Show some invisible characters (tabs...
|
||||
opt.mouse = "a" -- Enable mouse mode
|
||||
opt.number = true -- Print line number
|
||||
opt.pumblend = 10 -- Popup blend
|
||||
opt.pumheight = 10 -- Maximum number of entries in a popup
|
||||
opt.relativenumber = true -- Relative line numbers
|
||||
opt.scrolloff = 15 -- Lines of context
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
opt.shiftround = true -- Round indent
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
-- opt.shortmess:append({ W = true, I = true, c = true }) -- INFO: this control the format of some messages
|
||||
opt.showmode = false -- Dont show mode since we have a statusline
|
||||
opt.sidescrolloff = 8 -- Columns of context
|
||||
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||
opt.smartcase = true -- Don't ignore case with capitals
|
||||
opt.smartindent = true -- Insert indents automatically
|
||||
opt.spelllang = { "en" }
|
||||
opt.splitbelow = true -- Put new windows below current
|
||||
opt.splitright = true -- Put new windows right of current
|
||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||
opt.termguicolors = true -- True color support
|
||||
opt.timeoutlen = 300
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
opt.wildmode = "longest,list:full" -- Command-line completion mode
|
||||
opt.winminwidth = 5 -- Minimum window width
|
||||
opt.wrap = false -- Disable line wrap
|
||||
|
||||
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||
|
||||
local fn = vim.fn
|
||||
|
||||
-- Quickfix customization
|
||||
function _G.qftf(info)
|
||||
local items
|
||||
local ret = {}
|
||||
-- The name of item in list is based on the directory of quickfix window.
|
||||
-- Change the directory for quickfix window make the name of item shorter.
|
||||
-- It's a good opportunity to change current directory in quickfixtextfunc :)
|
||||
--
|
||||
-- local alterBufnr = fn.bufname('#') -- alternative buffer is the buffer before enter qf window
|
||||
-- local root = getRootByAlterBufnr(alterBufnr)
|
||||
-- vim.cmd(('noa lcd %s'):format(fn.fnameescape(root)))
|
||||
--
|
||||
if info.quickfix == 1 then
|
||||
items = fn.getqflist({ id = info.id, items = 0 }).items
|
||||
else
|
||||
items = fn.getloclist(info.winid, { id = info.id, items = 0 }).items
|
||||
end
|
||||
local limit = 31
|
||||
local fnameFmt1, fnameFmt2 = "%-" .. limit .. "s", "…%." .. (limit - 1) .. "s"
|
||||
local validFmt = "%s │%5d:%-3d│%s %s"
|
||||
for i = info.start_idx, info.end_idx do
|
||||
local e = items[i]
|
||||
local fname = ""
|
||||
local str
|
||||
if e.valid == 1 then
|
||||
if e.bufnr > 0 then
|
||||
fname = fn.bufname(e.bufnr)
|
||||
if fname == "" then
|
||||
fname = "[No Name]"
|
||||
else
|
||||
fname = fname:gsub("^" .. vim.env.HOME, "~")
|
||||
end
|
||||
-- char in fname may occur more than 1 width, ignore this issue in order to keep performance
|
||||
if #fname <= limit then
|
||||
fname = fnameFmt1:format(fname)
|
||||
else
|
||||
fname = fnameFmt2:format(fname:sub(1 - limit))
|
||||
end
|
||||
end
|
||||
local lnum = e.lnum > 99999 and -1 or e.lnum
|
||||
local col = e.col > 999 and -1 or e.col
|
||||
local qtype = e.type == "" and "" or " " .. e.type:sub(1, 1):upper()
|
||||
str = validFmt:format(fname, lnum, col, qtype, e.text)
|
||||
else
|
||||
str = e.text
|
||||
end
|
||||
table.insert(ret, str)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
-- TODO: how to customize?
|
||||
vim.o.qftf = "{info -> v:lua._G.qftf(info)}"
|
||||
|
||||
vim.filetype.add({
|
||||
-- Detect and assign filetype based on the extension of the filename
|
||||
extension = {
|
||||
mdx = "mdx",
|
||||
log = "log",
|
||||
conf = "conf",
|
||||
env = "dotenv"
|
||||
},
|
||||
-- Detect and apply filetypes based on the entire filename
|
||||
filename = {
|
||||
[".env"] = "dotenv",
|
||||
["env"] = "dotenv",
|
||||
["tsconfig.json"] = "jsonc",
|
||||
},
|
||||
-- Detect and apply filetypes based on certain patterns of the filenames
|
||||
pattern = {
|
||||
-- INFO: Match filenames like - ".env.example", ".env.local" and so on
|
||||
["%.env%.[%w_.-]+"] = "dotenv",
|
||||
[".*%.blade%.php"] = "blade",
|
||||
[".*%.hurl.*"] = "hurl",
|
||||
[".*/hypr/.*%.conf"] = "hyprlang",
|
||||
['.*/systemd/.*%.(%a+)'] = function(path, bufnr, ext)
|
||||
vim.print(ext)
|
||||
local allowed = { "container", "volume", "network", "build", "pod", "kube" }
|
||||
for _, v in ipairs(allowed) do
|
||||
if v == ext then
|
||||
return "ini"
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("aleidk.options")
|
||||
require("aleidk.autocmds")
|
||||
require("aleidk.keymaps")
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "aleidk/plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
-- checker = { enabled = true },
|
||||
})
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
|
||||
"blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" },
|
||||
"catppuccin": { "branch": "main", "commit": "8162a4bd9afb42837a655e404d1f937a87ba95e6" },
|
||||
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
|
||||
"conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"fzf-lua": { "branch": "main", "commit": "8adf950093af5361621cf52208d64995b1af78b5" },
|
||||
"grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"mason.nvim": { "branch": "main", "commit": "9eaedb864cdadc29c6eb7d761a6c0d8aee26c91b" },
|
||||
"mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" },
|
||||
"neogen": { "branch": "main", "commit": "b2e78708876f4da507839726816010a68e33fec8" },
|
||||
"nvim-lint": { "branch": "master", "commit": "f3a55c8da6317327a08b698018b786f8c4dce691" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f610208989e9c03561f9f601db3133f6ae398fcd" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "4976d8b90401cba9b85f6861e4e5a6edef2f2086" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"remote-sshfs.nvim": { "branch": "main", "commit": "01b89636d18a65f8bbd77749aecf4fc124e051aa" },
|
||||
"render-markdown": { "branch": "main", "commit": "dac01bd6660af337613e8cfcb23a4aec5d3c0e38" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "3af62ec991b972379833022c496abe96d727aa35" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"ts-node-action": { "branch": "master", "commit": "bfaa787cc85d753af3c19245b4142ed727a534b5" },
|
||||
"typescript-tools.nvim": { "branch": "master", "commit": "3c501d7c7f79457932a8750a2a1476a004c5c1a9" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "460432301a5cb280ea265ddfa15c9f3dcd1d26b7" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"yazi.nvim": { "branch": "main", "commit": "454525c33339881c574c2f35f488a13d0d6a1491" }
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
|
||||
vim.bo[args.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp'
|
||||
|
||||
-- Prefer LSP folding if client supports it
|
||||
if client:supports_method('textDocument/foldingRange') then
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
||||
end
|
||||
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>la", vim.lsp.buf.code_action, { buffer = args.buf, desc = "Code Action" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>ld", vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" })
|
||||
vim.keymap.set({ "n", "x", "v" }, "<leader>lc", function()
|
||||
local curpos = vim.fn.getcurpos()
|
||||
local diagnostics = vim.diagnostic.get(0, { lnum = curpos[2] - 1 })
|
||||
|
||||
if #diagnostics == 0 then
|
||||
vim.notify("No diagnostic under cursor")
|
||||
return
|
||||
end
|
||||
|
||||
local diagnostic = diagnostics[1]
|
||||
local msg = string.format("%s [%s]: %s", diagnostic.source, diagnostic.code, diagnostic.message)
|
||||
vim.fn.setreg("+", msg)
|
||||
vim.notify("Diagnostic saved to clipboard:\n\n" .. msg)
|
||||
end, { buffer = args.buf, desc = "Copy diagnostic to clipboard" })
|
||||
end,
|
||||
})
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
-- stylua: ignore start
|
||||
-- QoL normalization's
|
||||
vim.keymap.set("n", "Q", "<nop>", {})
|
||||
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { desc = "Prevent cursor movement", silent = true })
|
||||
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'",
|
||||
{ desc = "Move cursor regardless of word wrap", expr = true, silent = true })
|
||||
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'",
|
||||
{ desc = "Move cursor regardless of word wrap", expr = true, silent = true })
|
||||
vim.keymap.set("n", "J", "mzJ`z", { desc = "Keep cursor in column while joining lines", silent = true })
|
||||
|
||||
-- vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Keep cursor centered while junping", silent = true })
|
||||
-- vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = "Keep cursor centered while junping", silent = true })
|
||||
-- vim.keymap.set("n", "n", "nzzzv", { desc = "Keep cursor centered while searching", silent = true })
|
||||
-- vim.keymap.set("n", "N", "Nzzzv", { desc = "Keep cursor centered while searching", silent = true })
|
||||
|
||||
-- Utils
|
||||
vim.keymap.set("n", "|", ":vs<CR>", { desc = "Create vsplit", silent = true })
|
||||
vim.keymap.set("n", "°", ":sp<CR>", { desc = "Create split", silent = true })
|
||||
|
||||
vim.keymap.set("v", "p", [["_dP]], { desc = "Paste without lossing yanked text", silent = true })
|
||||
vim.keymap.set("n", "<Leader>uh", ":nohl<CR>", { desc = "Remove search highlight", silent = true })
|
||||
|
||||
-- Buffer manipulation
|
||||
vim.keymap.set("n", "<leader>bc", "<Cmd>bd<CR>", { desc = "Close buffer", silent = true })
|
||||
vim.keymap.set("n", "<leader>bh", "<Cmd>bp<CR>", { desc = "Prev buffer", silent = true })
|
||||
vim.keymap.set("n", "<leader>bl", "<Cmd>bn<CR>", { desc = "Next buffer", silent = true })
|
||||
vim.keymap.set("n", "<leader>bA", "<Cmd>bufdo bd<CR>", { desc = "Close all buffers", silent = true })
|
||||
|
||||
vim.keymap.set("n", "<C-h>", "<C-w>h", { desc = "Move to left window", silent = true })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w>j", { desc = "Move to bottom window", silent = true })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w>k", { desc = "Move to top window", silent = true })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w>l", { desc = "Move to right window", silent = true })
|
||||
|
||||
-- stylua: ignore end
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
|
||||
-- Set <space> as the leader key
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
vim.o.diffopt = "vertical,closeoff,filler"
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
vim.o.winborder = 'rounded'
|
||||
opt.breakindent = true -- Every wrapped line will continue visually indented
|
||||
opt.autowrite = true -- Enable auto write
|
||||
-- opt.completeopt = "menu,menuone,noselect"
|
||||
vim.o.completeopt = 'noselect,menu,menuone,noinsert,popup'
|
||||
opt.conceallevel = 2 -- Hide * markup for bold and italic
|
||||
opt.confirm = true -- Confirm to save changes before exiting modified buffer
|
||||
opt.cursorline = true -- Enable highlighting of the current line
|
||||
opt.expandtab = true -- Use spaces instead of tabs
|
||||
opt.formatoptions = "jcroqlnt" -- tcqj
|
||||
opt.grepformat = "%f:%l:%c:%m"
|
||||
opt.grepprg = "rg --vimgrep"
|
||||
opt.ignorecase = true -- Ignore case
|
||||
opt.inccommand = "nosplit" -- preview incremental substitute
|
||||
opt.laststatus = 0
|
||||
vim.opt.list = true -- Sets how neovim will display certain whitespace characters in the editor.
|
||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||
opt.mouse = "a" -- Enable mouse mode
|
||||
opt.number = true -- Print line number
|
||||
opt.pumblend = 10 -- Popup blend
|
||||
opt.pumheight = 10 -- Maximum number of entries in a popup
|
||||
opt.relativenumber = true -- Relative line numbers
|
||||
opt.scrolloff = 15 -- Lines of context
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
opt.shiftround = true -- Round indent
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
-- opt.shortmess:append({ W = true, I = true, c = true }) -- INFO: this control the format of some messages
|
||||
opt.showmode = false -- Don't show mode since we have a statusline
|
||||
opt.sidescrolloff = 8 -- Columns of context
|
||||
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||
opt.smartcase = true -- Don't ignore case with capitals
|
||||
opt.smartindent = true -- Insert indents automatically
|
||||
opt.spelllang = { "en" }
|
||||
opt.splitbelow = true -- Put new windows below current
|
||||
opt.splitright = true -- Put new windows right of current
|
||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||
opt.termguicolors = true -- True color support
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
opt.wildmode = "longest,list:full" -- Command-line completion mode
|
||||
opt.winminwidth = 5 -- Minimum window width
|
||||
opt.wrap = false -- Disable line wrap
|
||||
vim.opt.inccommand = 'split' -- Preview substitutions live, as you type!
|
||||
|
||||
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||
|
||||
-- Nice and simple folding:
|
||||
vim.o.foldenable = true
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.opt.fillchars:append({ fold = " " })
|
||||
|
||||
local fn = vim.fn
|
||||
|
||||
-- Quickfix customization
|
||||
function _G.qftf(info)
|
||||
local items
|
||||
local ret = {}
|
||||
-- The name of item in list is based on the directory of quickfix window.
|
||||
-- Change the directory for quickfix window make the name of item shorter.
|
||||
-- It's a good opportunity to change current directory in quickfixtextfunc :)
|
||||
--
|
||||
-- local alterBufnr = fn.bufname('#') -- alternative buffer is the buffer before enter qf window
|
||||
-- local root = getRootByAlterBufnr(alterBufnr)
|
||||
-- vim.cmd(('noa lcd %s'):format(fn.fnameescape(root)))
|
||||
--
|
||||
if info.quickfix == 1 then
|
||||
items = fn.getqflist({ id = info.id, items = 0 }).items
|
||||
else
|
||||
items = fn.getloclist(info.winid, { id = info.id, items = 0 }).items
|
||||
end
|
||||
local limit = 31
|
||||
local fnameFmt1, fnameFmt2 = "%-" .. limit .. "s", "…%." .. (limit - 1) .. "s"
|
||||
local validFmt = "%s │%5d:%-3d│%s %s"
|
||||
for i = info.start_idx, info.end_idx do
|
||||
local e = items[i]
|
||||
local fname = ""
|
||||
local str
|
||||
if e.valid == 1 then
|
||||
if e.bufnr > 0 then
|
||||
fname = fn.bufname(e.bufnr)
|
||||
if fname == "" then
|
||||
fname = "[No Name]"
|
||||
else
|
||||
fname = fname:gsub("^" .. vim.env.HOME, "~")
|
||||
end
|
||||
-- char in fname may occur more than 1 width, ignore this issue in order to keep performance
|
||||
if #fname <= limit then
|
||||
fname = fnameFmt1:format(fname)
|
||||
else
|
||||
fname = fnameFmt2:format(fname:sub(1 - limit))
|
||||
end
|
||||
end
|
||||
local lnum = e.lnum > 99999 and -1 or e.lnum
|
||||
local col = e.col > 999 and -1 or e.col
|
||||
local qtype = e.type == "" and "" or " " .. e.type:sub(1, 1):upper()
|
||||
str = validFmt:format(fname, lnum, col, qtype, e.text)
|
||||
else
|
||||
str = e.text
|
||||
end
|
||||
table.insert(ret, str)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
-- TODO: how to customize?
|
||||
vim.o.qftf = "{info -> v:lua._G.qftf(info)}"
|
||||
|
||||
vim.filetype.add({
|
||||
-- Detect and assign filetype based on the extension of the filename
|
||||
extension = {
|
||||
mdx = "mdx",
|
||||
log = "log",
|
||||
conf = "conf",
|
||||
env = "dotenv",
|
||||
},
|
||||
-- Detect and apply filetypes based on the entire filename
|
||||
filename = {
|
||||
[".env"] = "dotenv",
|
||||
["env"] = "dotenv",
|
||||
["tsconfig.json"] = "jsonc",
|
||||
},
|
||||
-- Detect and apply filetypes based on certain patterns of the filenames
|
||||
pattern = {
|
||||
-- INFO: Match filenames like - ".env.example", ".env.local" and so on
|
||||
["%.env%.[%w_.-]+"] = "dotenv",
|
||||
[".*%.blade%.php"] = "blade",
|
||||
[".*%.hurl.*"] = "hurl",
|
||||
[".*/hypr/.*%.conf"] = "hyprlang",
|
||||
},
|
||||
})
|
||||
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ LSP │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.lsp.enable({
|
||||
"rust_analyzer",
|
||||
"lua_ls",
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = { current_line = true },
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue