Something went wrong. Try again.
my dotfiles for arch
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109local map = function(keys, func, desc, mode) mode = mode or "n" vim.keymap.set(mode, keys, func, { desc = desc })end
-- Project view (mini.files)map("<leader>pv", function() MiniFiles.open(vim.api.nvim_buf_get_name(0))end, "Open file explorer")
-- Move lines aroundmap("J", ":m '>+1<CR>gv=gv", "Move line down", "v")map("<S-Down>", ":m '>+1<CR>gv=gv", "Move line down", "v")map("K", ":m '<-2<CR>gv=gv", "Move line up", "v")map("<S-Up>", ":m '<-2<CR>gv=gv", "Move line up", "v")
-- Keep cursor in center throughout operationsmap("J", "mzJ`z", "Join lines and keep cursor")map("<C-d>", "<C-d>zz", "Scroll down and center")map("<C-u>", "<C-u>zz", "Scroll up and center")map("n", "nzzzv", "Next search result and center")map("N", "Nzzzv", "Previous search result and center")
-- Clipboard operationsmap("<leader>p", '"_dP', "Paste without updating register", "x")map("<leader>pc", '"+p', "Paste from system clipboard")map("<leader>y", '"+y', "Yank to system clipboard")map("<leader>y", '"+y', "Yank to system clipboard", "v")map("<leader>Y", '"+Y', "Yank line to system clipboard")map("<C-v>", '<Esc>"+pa', "Paste from system clipboard", "i")
-- Delete without registermap("<leader>d", '"_d', "Delete without updating register")map("<leader>d", '"_d', "Delete without updating register", "v")
-- Disable Qmap("Q", "<nop>", "Disable Q")
-- Formattingmap("<leader>fo", function() vim.cmd("Format") vim.notify("Formatted file", vim.log.levels.INFO, { title = "Formatting" })end, "Format file")map("<leader>fe", function() vim.cmd("FormatEnable") vim.notify("Enabled auto-format", vim.log.levels.INFO, { title = "Formatting" })end, "Enable auto-format")map("<leader>fd", function() vim.cmd("FormatDisable") vim.notify("Disabled auto-format", vim.log.levels.INFO, { title = "Formatting" })end, "Disable auto-format")
-- Organize Importsmap("<leader>oi", function() vim.lsp.buf.code_action({ context = { only = { "source.organizeImports" }, diagnostics = vim.diagnostic.get(0), }, apply = true, })end, "Organize Imports")
-- map("<leader>l", function()-- local lint = require("lint")-- lint.try_lint()-- end, "Lint file")
map("<leader>esf", function() vim.cmd("EslintFixAll")end, "Fix ESLint issues")
-- Window managementmap("<leader>ws", "<C-w>s", "Split window horizontally")map("<leader>wv", "<C-w>v", "Split window vertically")map("<leader>wh", "<C-w>h", "Move to left window")map("<leader>w<Left>", "<C-w>h", "Move to left window")map("<leader>wj", "<C-w>j", "Move to bottom window")map("<leader>w<Down>", "<C-w>j", "Move to bottom window")map("<leader>wk", "<C-w>k", "Move to top window")map("<leader>w<Up>", "<C-w>k", "Move to top window")map("<leader>wl", "<C-w>l", "Move to right window")map("<leader>w<Right>", "<C-w>l", "Move to right window")map("<leader>wq", "<C-w>q", "Close window")map("<leader>wf", "<C-w>f <C-w>L", "Open file under cursor in new window")
-- Buffer operationsmap("<leader>rf", ":e<CR>", "Refresh buffer")map("<leader>sf", ":w<CR>", "Save file")
-- Terminalmap("<Esc>", [[<C-\><C-n>]], "Exit terminal insert mode", "t")
-- Close quickfix menu after selecting choicevim.api.nvim_create_autocmd("FileType", { pattern = { "qf" }, command = [[nnoremap <buffer> <CR> <CR>:cclose<CR>]],})
vim.api.nvim_create_user_command("Cppath", function() local path = vim.fn.expand("%:p") vim.fn.setreg("+", path) vim.notify('Copied "' .. path .. '" to the clipboard!')end, {})
-- Kickstart keymaps
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })