local function map(m, k, v) vim.keymap.set(m, k, v, { noremap = true, silent = true }) end local builtin = require('telescope.builtin') map('', '', 'gk') map('', '', 'gj') map('n', 'J', 'mzJ`z') map('', 'o', 'o') map('', 'O', 'O') map('t', '', '') map('v', '', "m '>+1gv=gv") map('v', '', "m '<-2gv=gv") -- telescope map('n', 'pf', builtin.find_files, {}) map('n', 'pg', function() -- If the directory is not a git repository, fallback to regular find_files. if pcall(builtin.git_files) then else pcall(builtin.find_files) end end, {}) map('n', 'fs', function() builtin.grep_string({ search = vim.fn.input("Grep > ") }) end, {}) -- mini map('n', '-', 'lua MiniFiles.open()') map('n', 'wt', 'lua MiniTrailspace.trim()') -- toggleterm map('n', 'g', 'lua _lazygit_toggle()') -- misc plugin keymaps map('n', 'u', vim.cmd.UndotreeToggle) map('n', '', vim.cmd.HopWord) map('n', 'vv', vim.cmd.VimtexCompile) map('n', 'vc', 'VimtexClean!') map('n', 'tw', 'Twilight') -- buffers map('n', '', 'bnext') map('n', '', 'bprevious') map('n', 'br', 'BufferClose') map('n', 'Q', 'BufferClose!') map('n', 'bn', 'BufferOrderByBufferNumber') map('n', 'U', 'bufdo bd') --close all map('n', 'vs', 'vsplitbnext') --ver split + open next buffer -- buffer position nav + reorder map('n', '', 'BufferMovePrevious') map('n', '', 'BufferMoveNext') map('n', '', 'BufferGoto 1') map('n', '', 'BufferGoto 2') map('n', '', 'BufferGoto 3') map('n', '', 'BufferGoto 4') map('n', '', 'BufferGoto 5') map('n', '', 'BufferGoto 6') map('n', '', 'BufferGoto 7') map('n', '', 'BufferGoto 8') map('n', '', 'BufferGoto 9') map('n', '', 'BufferLast') map('n', '', 'BufferPin') -- window resizing map('n', '', ':vertical resize -2') map('n', '', ':vertical resize +2') map('n', '', ':resize +2') map('n', '', ':resize -2') -- clipboard management map('x', 'p', '\"_dP') map('n', 'y', '\"+y') map('v', 'y', '\"+y') map('n', 'Y', '\"+Y') map('n', 'd', '\"+d') map('v', 'd', '\"+d') -- luasnip vim.cmd([[ imap luasnip#expand_or_jumpable() ? 'luasnip-expand-or-jump' : '' inoremap lua require'luasnip'.jump(-1) snoremap lua require('luasnip').jump(1) snoremap lua require('luasnip').jump(-1) ]])