nixos/lua/keymaps.lua

54 lines
1.9 KiB
Lua
Raw Normal View History

2022-11-02 09:05:01 +00:00
local function map(mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
end
2022-11-02 09:05:01 +00:00
local function nmap(shortcut, command)
map('n', shortcut, command)
end
2022-11-02 09:05:01 +00:00
local function imap(shortcut, command)
map('i', shortcut, command)
end
vim.g.mapleader=' '
-- Misc
imap('jk','<Esc>')
nmap('<leader>a', ':Ack!<Space>')
nmap('<leader>sr', ':SnipRun<cr>')
2022-11-01 16:22:40 +00:00
nmap('<leader>g', ':G<cr>')
-- Telescope
nmap('<leader>;', '<cmd>Telescope builtin<cr>')
nmap('<leader>ff', '<cmd>Telescope find_files<cr>')
nmap('<leader>fr', '<cmd>Telescope resume<cr>')
nmap('<leader>fb', '<cmd>Telescope buffers<cr>')
nmap('<leader>fh', '<cmd>Telescope help_tags<cr>')
nmap('<leader>fk', '<cmd>Telescope aerial<cr>')
nmap('<leader>fd', '<cmd>Telescope lsp_document_symbols<cr>')
nmap('<leader>fe', '<cmd>Telescope diagnostics<cr>')
nmap('<leader>fn', '<cmd>Telescope notify<cr>')
nmap('<leader>ft', '<cmd>Telescope treesitter<cr>')
nmap('<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>')
nmap('<leader>fgr', '<cmd>Telescope live_grep<cr>')
nmap('<leader>fgf', '<cmd>Telescope git_files<cr>')
nmap('<leader>fgs', '<cmd>Telescope git_status<cr>')
nmap('<leader>fgb', '<cmd>Telescope git_branches<cr>')
-- Hop
nmap('<leader>hl', '<cmd>HopLine<cr>')
nmap('<leader>hw', '<cmd>HopWord<cr>')
-- Nvim-tree
nmap('<leader>nt', '<cmd>NvimTreeToggle<cr>')
nmap('<leader>nf', '<cmd>NvimTreeFindFile<cr>')
-- Trouble
nmap('<leader>tq', '<cmd>TroubleToggle quickfix<cr>')
nmap('<leader>tl', '<cmd>TroubleToggle loclist<cr>')
nmap('<leader>tr', '<cmd>TroubleToggle lsp_references<cr>')
nmap('<leader>td', '<cmd>TroubleToggle lsp_definitions<cr>')
nmap('<leader>tt', '<cmd>TroubleToggle lsp_type_definitions<cr>')
nmap('<leader>ti', '<cmd>TroubleToggle lsp_implementations<cr>')
nmap('<leader>tdd', '<cmd>TroubleToggle document_diagnostics<cr>')
nmap('<leader>twd', '<cmd>TroubleToggle workspace_diagnostics<cr>')