vim.g.mapleader = " " vim.keymap.set("n", "pv", vim.cmd.Ex) -- Text input vim.keymap.set('n', 'pt', ":pu!=strftime('%R')"); vim.keymap.set('n', 'pd', ":pu!=strftime('%F')"); vim.keymap.set('n', 'pD', ":pu!=strftime('%c')"); -- Telescope local builtin = require('telescope.builtin') local telescope = require('telescope') vim.keymap.set('n', 'tf', builtin.find_files, {}) -- Open files vim.keymap.set('n', 'ts', builtin.live_grep, {}) -- Grep files vim.keymap.set('n', 'tb', builtin.buffers, {}) -- Neovim buffers vim.keymap.set('n', 'tm', builtin.man_pages, {}) -- man pages vim.keymap.set('n', 'tp', builtin.registers, {}) -- Paste from registers vim.keymap.set('n', 'tt', builtin.resume, {}) -- Last open Telescope vim.keymap.set('n', 'to', builtin.oldfiles, {}) -- Recently opened files -- Git functionality (tg prefix) vim.keymap.set('n', 'tgf', builtin.git_files, {}) vim.keymap.set('n', 'tgc', builtin.git_commits, {}) vim.keymap.set('n', 'tgh', builtin.git_bcommits, {}) -- Current buffer's commits vim.keymap.set('n', 'tgb', builtin.git_branches, {}) -- CR: checkout, C-t: track, C-r: rebase, C-a: create, C-s: switch, C-d: delete, C-y: merge vim.keymap.set('n', 'tgs', builtin.git_stash, {}) -- List stash, apply with CR -- LSP functionality (tl prefix) vim.keymap.set('n', 'tlr', builtin.lsp_references, {}) vim.keymap.set('n', 'tli', builtin.lsp_incoming_calls, {}) vim.keymap.set('n', 'tlo', builtin.lsp_outgoing_calls, {}) vim.keymap.set('n', 'tld', builtin.lsp_definitions, {}) vim.keymap.set('n', 'tlt', builtin.lsp_type_definitions, {}) vim.keymap.set('n', 'tls', builtin.lsp_document_symbols, {}) vim.keymap.set('n', 'tlm', builtin.lsp_implementations, {}) vim.keymap.set('n', 'tlw', builtin.lsp_workspace_symbols, {}) vim.keymap.set('n', 'tlD', builtin.diagnostics, {}) vim.keymap.set('n', 'tlK', vim.lsp.buf.signature_help, {}) vim.keymap.set('n', 'tlq', vim.diagnostic.setloclist, {}) vim.keymap.set('n', 'E', vim.diagnostic.open_float, {}) vim.keymap.set('n', 'H', function() vim.lsp.buf.hover() end, opts) vim.keymap.set("n", "tlf", vim.lsp.buf.format) -- Format code -- DAP vim.keymap.set('n', 'db', require('dap').toggle_breakpoint) vim.keymap.set('n', 'dc', require('dap').continue) vim.keymap.set('n', 'di', require('dap').step_into) vim.keymap.set('n', 'do', require('dap').step_over) vim.keymap.set('n', 'dr', require('dap').repl.open) vim.keymap.set('n', 'dx', require('dap').terminate) -- Zen mode vim.keymap.set('n', 'zz', require('zen-mode').toggle) -- AAAARGH vim.keymap.set("n", "fml", "CellularAutomaton make_it_rain") vim.keymap.set("n", "cnw", "CellularAutomaton game_of_life") -- Custom Telescope commands for Rails vim.keymap.set('n', 'trj', function() builtin.find_files({ search_dirs = { "app/javascript", "app/assets/javascripts" } }) end, { desc = "Open Rails Javascripts" } ) vim.keymap.set('n', 'trsj', function() builtin.live_grep({ search_dirs = { "app/javascript", "app/assets/javascripts" } }) end, { desc = "Grep Rails Javascripts" } ) vim.keymap.set('n', 'trm', function() builtin.find_files({ search_dirs = { "app/models" } }) end, { desc = "Open Rails Models" } ) vim.keymap.set('n', 'trsm', function() builtin.live_grep({ search_dirs = { "app/models" } }) end, { desc = "Grep Rails Models" } ) vim.keymap.set('n', 'trc', function() builtin.find_files({ search_dirs = { "app/controllers" } }) end, { desc = "Open Rails Controllers" } ) vim.keymap.set('n', 'trsc', function() builtin.live_grep({ search_dirs = { "app/controllers" } }) end, { desc = "Grep Rails Controllers" } ) vim.keymap.set('n', 'trv', function() builtin.find_files({ search_dirs = { "app/views" } }) end, { desc = "Open Rails Views" } ) vim.keymap.set('n', 'trsv', function() builtin.live_grep({ search_dirs = { "app/views" } }) end, { desc = "Grep Rails Views" } ) -- Fugitive vim.keymap.set('n', 'gs', vim.cmd.Git); vim.keymap.set('n', 'ds', ':Gvdiffsplit!'); vim.keymap.set('n', 'gl', ':diffget //2'); -- 'Get left' window vim.keymap.set('n', 'gr', ':diffget //3'); -- 'Get right' window -- Nvim-tree vim.keymap.set("n", "nt", vim.cmd.NvimTreeToggle, {})