2021-12-08 09:38:24 -06:00
|
|
|
-- Map a key with optional options
|
2022-02-03 16:58:34 -06:00
|
|
|
local function map(mode, keys, action, options)
|
2021-12-08 09:38:24 -06:00
|
|
|
if options == nil then
|
2022-02-03 16:58:34 -06:00
|
|
|
options = {noremap=true}
|
2021-12-08 09:38:24 -06:00
|
|
|
end
|
|
|
|
vim.api.nvim_set_keymap(mode,keys,action,options)
|
|
|
|
end
|
|
|
|
|
2022-02-03 16:58:34 -06:00
|
|
|
vim.g.mapleader = " "
|
|
|
|
|
2021-12-08 09:38:24 -06:00
|
|
|
map('i','jk','<Esc>',{noremap=true})
|
|
|
|
map('v','jk','<Esc>',{noremap=true})
|
2022-01-24 00:03:41 -06:00
|
|
|
|
2022-02-03 16:58:34 -06:00
|
|
|
map('n', "H", "^",{noremap=true})
|
|
|
|
map('n', "L", "$",{noremap=true})
|
|
|
|
|
2022-06-04 11:50:57 -05:00
|
|
|
map('n','j',"v:count ? 'j' : 'gj'",{expr=true,noremap=true})
|
|
|
|
map('n','k',"v:count ? 'k' : 'gk'",{expr=true,noremap=true})
|
|
|
|
|
2022-02-03 16:58:34 -06:00
|
|
|
-- zettelkasten keybindings
|
|
|
|
|
|
|
|
|
|
|
|
-- 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>")
|
|
|
|
|
2022-02-08 13:42:16 -06:00
|
|
|
local mappings = lvim.builtin.which_key.mappings
|
|
|
|
|
|
|
|
mappings["z"] = {
|
2022-02-03 16:58:34 -06:00
|
|
|
name = "zk",
|
|
|
|
n = { "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", "New"},
|
|
|
|
o = { "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", "Open" },
|
|
|
|
t = { "<Cmd>ZkTags<CR>", "Tags"},
|
|
|
|
f = { "<Cmd>ZkNotes { sort = { 'modified' }, match = vim.fn.input('Search: ') }<CR>", "Fuzzy Search" },
|
|
|
|
}
|
2022-02-08 13:42:16 -06:00
|
|
|
mappings["s"]["p"] = {"<cmd>Telescope projects<CR>","Recent Projects"}
|
|
|
|
mappings["s"]["w"] = {"<cmd>Telescope live_grep<CR>","Find Word"}
|
|
|
|
mappings[';'] = { "<cmd>Alpha<CR>", "Dashboard"}
|
2022-02-03 16:58:34 -06:00
|
|
|
|
|
|
|
|
2022-01-24 00:03:41 -06:00
|
|
|
-- keymappings [view all the defaults by pressing <leader>Lk]
|
|
|
|
-- lvim.leader = "space"
|
|
|
|
-- add your own keymapping
|
|
|
|
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
|