nvchad/lua/mappings.lua

72 lines
2.6 KiB
Lua
Raw Normal View History

2024-03-09 11:03:44 -05:00
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
2024-03-17 21:11:03 -04:00
map("i", "jk", "<ESC>")
2024-03-09 11:03:44 -05:00
2024-03-17 21:11:03 -04:00
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
2024-10-14 10:33:11 -04:00
-- local custom_telescope = require('custom_telescope')
-- Add a keybinding for searching Markdown tasks
vim.api.nvim_set_keymap('n', '<leader>mt', ':lua require("custom_telescope").search_markdown_tasks()<CR>', { noremap = true, silent = true })
2024-10-17 10:11:00 -04:00
-- Add a keybinding for calling ObsidianTag
vim.api.nvim_set_keymap('n', '<leader>tt', ':ObsidianTag<CR>', { noremap = true, silent = true })
-- Add a keybinding for calling ObsidianBacklinks
vim.api.nvim_set_keymap('n', '<leader>lb', ':ObsidianBacklinks<CR>', { noremap = true, silent = true })
2024-11-04 12:14:33 -05:00
-- Add a keybinding for calling ObsidianLink
vim.api.nvim_set_keymap('v', '<leader>fl', ':ObsidianLink<CR>', { noremap = true, silent = true })
2024-11-08 16:30:40 -05:00
-- priority task
vim.api.nvim_set_keymap("n", "<leader>p1", "A 🔼<Esc>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>p2", "A ⏫<Esc>", { noremap = true, silent = true })
2024-10-14 10:33:11 -04:00
-- Configure Telescope to scroll files with ctrl+j/k
local actions = require('telescope.actions')
-- local sorters = require('telescope.sorters')
require('telescope').setup {
defaults = {
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
},
},
}
-- make leader-e toggle the tree view as opposed to just setting focus
vim.api.nvim_set_keymap('n', '<leader>e', ':NvimTreeToggle<CR>', {noremap = true, silent = true})
-- move the whole page without moving the cursor
vim.api.nvim_set_keymap('n', 'J', '<C-e>', { noremap = true })
vim.api.nvim_set_keymap('n', 'K', '<C-y>', { noremap = true })
-- Resize windows
vim.api.nvim_set_keymap('n', '<Up>', '5<C-w>+', { silent = true })
vim.api.nvim_set_keymap('n', '<Down>', '5<C-w>-', { silent = true })
vim.api.nvim_set_keymap('n', '<Right>', '10<C-w>>', { silent = true })
vim.api.nvim_set_keymap('n', '<Left>', '10<C-w><', { silent = true })
-- Set the tab width to 4 spaces
vim.cmd('set tabstop=4')
vim.cmd('set shiftwidth=4')
vim.cmd('set expandtab')
vim.o.hidden = true
2024-12-16 17:38:30 -05:00
-- wrap selected text in single quotes
vim.keymap.set('x', "<leader>'", function()
local text = vim.fn.getreg('"') -- Get the visually selected text
vim.cmd("normal! c'" .. text .. "'")
end, { desc = "Wrap selected text in single quotes" })
-- wrap selected text in double quotes
vim.keymap.set('x', '<leader>"', function()
local text = vim.fn.getreg('"') -- Get the visually selected text
vim.cmd('normal! c"' .. text .. '"')
end, { desc = "Wrap selected text in double quotes" })