local utils = require('utils.funcs') local async = require("plenary.async") local map = utils.map -- Telescope mappings map('n', 'tw', ':Telescope live_grep') map('n', 'gs', ':Telescope git_status') map('n', 'gc', ':Telescope git_commits') map('n', 'gb', ':Telescope git_branches') map('n', 'gw', ":lua require('telescope').extensions.git_worktree.create_git_worktree()") 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', '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', 'lT', ':lua vim.lsp.buf.type_definition()') map('n', 'ln', ':lua vim.lsp.buf.rename()') 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') -- 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 })