dotfiles/dot_config/nvim/lua/config/keymaps.lua
2024-12-24 23:07:16 +01:00

36 lines
1.4 KiB
Lua

-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
local map = vim.keymap.set
-- replace ex mode map and use it for repeating 'q' macro
map("n", "Q", "@q")
map("v", "Q", "<cmd>norm @q<CR>")
-- Easier in-file navigation with Tab and S-Tab
map("n", "<S-Tab>", "<C-U>")
map("n", "<Tab>", "<C-D>")
map("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
-- Testing
map("n", "<leader>tr", "require('neotest').run.run()<CR>")
map("n", "<leader>td", "require('dap-go').debug_test()<CR>")
map("n", "<leader>to", "require('neotest').output.open({enter = true})<CR>")
map("n", "<leader>tS", "require('neotest').run.stop()<CR>")
map("n", "<leader>ts", "require('neotest').summary.toggle()<CR>")
-- zk
-- Create a new note after asking for its title.
map("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>")
-- Open notes.
map("n", "<leader>zo", "<Cmd>ZkNotes { sort = { 'modified' } }<CR>")
-- Open notes associated with the selected tags.
map("n", "<leader>zt", "<Cmd>ZkTags<CR>")
-- Search for the notes matching a given query.
map("n", "<leader>zf", "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>")
-- Search for the notes matching the current visual selection.
map("v", "<leader>zf", ":'<,'>ZkMatch<CR>")