local utils = require('utils.funcs') local loaded, async = pcall(require, 'plenary.async') local map = utils.map if not loaded then return end -- Telescope mappings map('n', 'tw', ':Telescope live_grep') map('n', 'tgs', ':Telescope git_status') map('n', 'tgc', ':Telescope git_commits') map('n', 'tgb', ':Telescope git_branches') map('n', 'tf', ':Telescope find_files') map('n', 'td', ':Telescope find_directories') map('n', 'tb', ':Telescope buffers') map('n', 'th', ':Telescope help_tags') map('n', 'to', ':Telescope oldfiles') map('n', 'tc', ':Telescope neoclip default') map('n', 'tr', ':Telescope registers') map('n', 'tt', ':Telescope file_browser') map('n', 'ts', ':Telescope spell_suggest') map('n', 'tl', ':Telescope resume') map('n', 'tT', ':TodoTelescope') -- Lsp Mappings map('n', 'lD', ':lua vim.lsp.buf.declaration()') map('n', 'ld', ':lua vim.lsp.buf.definition()') map('n', 'k', ':lua vim.lsp.buf.hover()') map('n', 'K', ':lua vim.lsp.buf.signature_help()') map('n', 'li', ':lua vim.lsp.buf.implementation()') map('n', 'la', ':lua vim.lsp.buf.add_workspace_folder()') map('n', 'lx', ':lua vim.lsp.buf.remove_workspace_folder()') map('n', 'll', ':lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))') map('n', 'ln', ':IncRename ') map('n', 'lc', ':CodeActionMenu') map('n', 'lr', ':lua vim.lsp.buf.references()') map('n', 'lR', ':LspRestart') map('n', 'ls', ":lua vim.diagnostic.open_float(nil, {focus=false, scope='cursor'})") map('n', 'lf', ':lua vim.lsp.buf.format({ async = true })') map('n', '[l', ':lua vim.diagnostic.goto_prev()') map('n', ']l', ':lua vim.diagnostic.goto_next()') map('n', 'lq', ':Telescope diagnostics bufnr=0') -- Formatter map('n', 'nf', ':Neoformat') -- DAP Mappings map('n', 'dR', ':lua require("dap").continue()') map('n', 'de', ':lua require("dap").terminate()') map('n', 'db', ':lua require("dap").toggle_breakpoint()') map('n', 'dr', ':lua require("dap").set_breakpoint(vim.fn.input(\'Breakpoint condition: \'))') map('n', 'dp', ':lua require("dap").set_breakpoint(nil, nil, vim.fn.input(\'Log point message: \'))') map('n', '', ':lua require("dap").step_over()') map('n', '', ':lua require("dap").step_into()') map('n', '', ':lua require("dap").step_out()') map('n', 'dB', ':lua require("dap").step_back()') map('n', 'dc', ':lua require("dap").run_to_cursor()') map('n', 'do', ':lua require("dap").repl.open()') map('n', 'dt', ':lua require("dapui").toggle()') map('n', 'dl', ':lua require("dap").run_last()') -- Comments map('n', '/', ':CommentToggle') map('v', '/', ":'<,'>CommentToggle") -- Code Outline map('n', 'co', ':SymbolsOutline') -- Bufferline mappings map('n', '', ':BufferLineCyclePrev') map('n', '', ':BufferLineCycleNext') map('n', '', ":lua require('utils.funcs').close_buffer()") -- Vim Notify Mappings map('n', 'nv', ":lua require('telescope').extensions.notify.notify()") map('n', 'nd', ":lua require('notify').dismiss()") -- Whichkey Mappings map('n', 'ww', ':WhichKey') map('n', 'wk', ':Telescope keymaps') map('n', 'wc', ':Telescope commands') -- Neogen Mappings map('n', 'ng', ':Neogen') -- Nvim Tree Mappings map('n', 'nt', ':Neotree show toggle focus') -- Plenary Mappings map('n', 'pt', 'PlenaryTestFile', {}) -- Zenmode Mappings map('n', 'zm', ':ZenMode') -- Neogit Mappings map('n', 'gg', ':Neogit') -- Gitsigns Mappings map('n', ']g', 'Gitsigns next_hunk') map('n', '[g', 'Gitsigns prev_hunk') map('n', 'gs', 'Gitsigns stage_hunk') map('n', 'gr', 'Gitsigns reset_hunk') map('n', 'gu', 'Gitsigns undo_stage_hunk') -- SnipRun Mappings local run_snip = function() async.run(function() vim.notify.async('Running snippet, saving current buffer.', 'info', { title = 'SnipRun', }) end) vim.cmd('w') vim.cmd('SnipRun') end map('n', 'sr', '', { callback = run_snip, }) map('v', 'sr', '', { callback = run_snip, }) -- Packer Mappings local packer = require('packer') local packer_sync = function() async.run(function() vim.notify.async('Syncing packer.', 'info', { title = 'Packer', }) end) local snap_shot_time = os.date('!%Y-%m-%dT%TZ') packer.snapshot(snap_shot_time) packer.sync() end local packer_compile = function() async.run(function() vim.notify.async('Compiling packer.', 'info', { title = 'Packer', }) end) packer.compile() end map('n', 'ps', '', { callback = packer_sync, }) map('n', 'pc', '', { callback = packer_compile, }) -- Undotree mappings map('n', 'ut', ':UndotreeToggle') -- Trouble mappings map('n', 'lt', ':TroubleToggle')