nviiim/lua/sherlock5512/globalBindings.lua
Robert Morrison d032e3e274
chore(repo): First contentful commit
This is the first commit that actually adds files to the repo.
Yes it's a bad commit but now the major features are here
2023-03-03 17:11:36 +00:00

76 lines
1.6 KiB
Lua

-- Global bindings
-- NOTE: A binding MUST only use neovim features to be loaded here.
-- Any plugin bindings MUST be declared WITH the plugin config.
-- This is to ensure plugins are loaded before binding anything
-- IMPORTANT: ALL keymaps MUST set the desc attribute
-- It is advisable that where possible the keybinds call lua functions
-- this is to make things easier to expand later
local map = vim.keymap.set
map('n',
'<leader>o',
function ()
vim.o.spell = not vim.o.spell
end ,
{desc = "Toggle Spelling"}
)
local function ModHeight(inc)
local win = vim.api.nvim_get_current_win()
local height = vim.api.nvim_win_get_height(win)
if inc then
height = height + 1
else
height = height - 1
end
end
local function ModWidth(inc)
local win = vim.api.nvim_get_current_win()
local width = vim.api.nvim_win_get_width(win)
if inc then
width = width + 1
else
width = width - 1
end
vim.api.nvim_win_set_width(win,width)
end
map('n',
'H',
function() ModWidth(false) end,
{desc = "Decrease Width"})
map('n',
'J',
function() ModHeight(false) end,
{desc = "Decrease Height"})
map('n',
'K',
function() ModHeight(true) end,
{desc = "Increase Height"})
map('n',
'L',
function() ModWidth(true) end,
{desc = "Increase Width"})
map('n',
'<M-h>',
function() vim.cmd.wincmd("h") end,
{desc = "Change window "})
map('n',
'<M-j>',
function() vim.cmd.wincmd("j") end,
{desc = "Change window "})
map('n',
'<M-k>',
function() vim.cmd.wincmd("k") end,
{desc = "Change Window "})
map('n',
'<M-l>',
function() vim.cmd.wincmd("l") end,
{desc = "Change Window "})