absvim/lua/mappings.lua
2023-03-13 18:28:55 -07:00

47 lines
1.3 KiB
Lua

local vimp = require('vimp')
-- tabs and stuff
vimp.vnoremap("<C-b>", [[<C-a>]])
vimp.noremap("<Tab>", [[>gv]])
vimp.noremap("<S-Tab>", [[<gv]])
-- Remove search highlight on Enter
vimp.nnoremap("<CR>", [[:nohlsearch<CR><CR>]])
-- Don't lose selection on < or >
vimp.xnoremap("<", [[<gv]])
vimp.xnoremap(">", [[>gv]])
-- Toggle Lines
vimp.nnoremap({ 'silent' }, '<leader>l', function()
if vim.b.lnstatus == nil then
vim.b.lnstatus = "number"
end
if vim.b.lnstatus == "number" then
vim.o.number = false
vim.o.relativenumber = false
vim.b.lnstatus = "nonumber"
else
vim.o.number = true
vim.o.relativenumber = true
vim.b.lnstatus = "number"
end
end)
-- plugins
vimp.noremap('<leader>md', [[:MarkdownPreviewToggle<CR>]])
vimp.nnoremap({ 'silent' }, '<A-Right>', [[:BufferNext<CR>]])
vimp.nnoremap({ 'silent' }, '<A-Left>', [[:BufferPrevious<CR>]])
vimp.nnoremap({ 'silent' }, '<leader>a', [[:ArgWrap<CR>]])
vimp.noremap({ 'silent' }, '<leader>n', [[:NvimTreeToggle<CR>]])
vimp.noremap({ 'silent' }, '<leader>ff', [[:Telescope find_files<CR>]])
vimp.noremap({ 'silent' }, '<leader>fg', [[:Telescope live_grep<CR>]])
vimp.noremap({ 'silent' }, '<leader>fb', [[:Telescope buffers<CR>]])
vimp.noremap({ 'silent' }, '<leader>fp', function() require 'telescope'.extensions.projects.projects {} end)