nixos/lua/keymaps.lua

54 lines
1.7 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
2022-11-07 16:41:35 +00:00
vim.g.mapleader = ' '
-- Misc
2022-11-07 16:41:35 +00:00
imap('jk', '<Esc>')
2022-11-08 16:46:15 +00:00
nmap('<leader>gf', '<cmd>Git fetch<cr>')
nmap('<leader>gp', '<cmd>Git pull<cr>')
nmap('<leader>gP', '<cmd>Git push<cr>')
nmap('<leader>cc', '<cmd>Git commit<cr>')
nmap('<leader>co', ':Git checkout')
-- 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>fg', '<cmd>Telescope git_status<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>xx', '<cmd>TroubleToggle<cr>')
nmap('<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>')
nmap('<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>')
nmap('<leader>xq', '<cmd>TroubleToggle quickfix<cr>')
nmap('<leader>xl', '<cmd>TroubleToggle loclist<cr>')
2022-11-08 16:46:15 +00:00
-- SnipRun
nmap('<leader>srs', '<cmd>SnipRun<cr>')
nmap('<leader>srr', '<cmd>%SnipRun<cr>')