The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

My Neovim Key Mappings

TODO: Pull subtitle into page object code_start_default_section code_end_default_section

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

My Neovim Key Mappings

These are my custom key mappings for Neovim. 
I use a moonlander keyboard that allow you 
to add "layers" for some advanced functionality. 
For example, when I hold down the <<kbd|Enter>> key 
and press <<kbd|g>> the keyboard sends <<kbd|Option>>
<<kbd|Shift>> <<kbd|g>> to Neovim. I have that
mapped below (via `<M-S-g>``) to open my Grimoire.

Holding down the <<kbd|Enter>> is called a Layer
Shift. I use <<kbd|LS>> below to remind myself
what the speicfic keys to press are since they
aren't necessarily mapped directly. (That's because
I don't want to fight with some of the default 
Neovim configuration so I swap out letters)

-- code/
-- lua
-- type: nonums
-- title: ~/.config/nvim/after/plugin/config-keymappings.lua
-- export: /Users/alan/.config/nvim/after/plugin/keymappings.lua

-- Setup so the Neovim layer on the moonlander
-- j and k jump paragraphs up and down in the
-- same way regular layer j and k move lines

vim.keymap.set('n', '(', "}", {})
vim.keymap.set('o', '(', "}", {})
vim.keymap.set('v', '(', "}", {})
vim.keymap.set('n', '=', "{", {})
vim.keymap.set('o', '=', "{", {})
vim.keymap.set('v', '=', "{", {})

-- Grimoire File Export
vim.keymap.set({'n', 'i' }, '<M-X>', function() 
  require('grimoire_invocations.calls').export_to_file()
end)

-- Run Code Blocks
vim.keymap.set({ 'n', 'i' }, '<M-R>', function() 
  Execute_code_block()
end)

-- Save a file with `s` in normal mode
vim.keymap.set('n', 's', ':wa<cr>', {})

-- This was in my config, but I'm not sure what
-- it was for, leaving it here commented out until
-- I figure out what it does/did
-- vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })

-- Swap most recent files in the main window
vim.keymap.set('n', '<M-S-a>', '<C-^>', {})
vim.keymap.set('i', '<M-S-a>', '<C-^>', {})
vim.keymap.set('n', '<M-S-b>', '<C-^>', {})
vim.keymap.set('i', '<M-S-b>', '<C-^>', {})

-- Make a new tab
vim.keymap.set('n', '<M-S-y>', ":tabe<cr>", { desc = 'New Tab Page' })
vim.keymap.set('i', '<M-S-y>', "<ESC>:tabe<cr>", { desc = 'New Tab Page' })
-- vim.keymap.set('n', '<M-S-n>', ":tabe<cr>", { desc = 'New Tab Page' })
-- vim.keymap.set('i', '<M-S-n>', "<ESC>:tabe<cr>", { desc = 'New Tab Page' })
-- vim.keymap.set('n', '<M-S-F6>', ":tabe<cr>", { desc = 'New Tab Page' })
-- vim.keymap.set('i', '<M-S-F6>', "<ESC>:tabe<cr>", { desc = 'New Tab Page' })

-- Previous/Next Tab
vim.keymap.set('n', '<M-S-u>', "gT<cr>", { desc = 'Previous tab' })
vim.keymap.set('i', '<M-S-u>', "<ESC>gT<cr>", { desc = 'Previous tab' })
vim.keymap.set('n', '<M-S-m>', "gT<cr>", { desc = 'Previous tab' })
vim.keymap.set('i', '<M-S-m>', "<ESC>gT<cr>", { desc = 'Previous tab' })
vim.keymap.set('n', '<M-S-i>', "gt<cr>", { desc = 'Previous tab' })
vim.keymap.set('i', '<M-S-i>', "<ESC>gt<cr>", { desc = 'Previous tab' })

-- Save (write) and Close (delete) a buffer
vim.keymap.set('n', '<M-S-w>', ":w<cr>:bd<cr>", { desc = 'Close (delete) buffer' })
vim.keymap.set('i', '<M-S-w>', "<ESC>:w<cr>:bd<cr>", { desc = 'Close (delete) buffer' })

-- Save and close a tab quit
vim.keymap.set('n', '<M-S-q>', ":wa<cr>:bd<cr>", { desc = 'Close (delete) buffer' })
vim.keymap.set('i', '<M-S-q>', "<ESC>:wa<cr>:bd<cr>", { desc = 'Close (delete) buffer' })

-- Ignore space in normal and visual mode
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })


-- Remap for dealing with word wrap
-- This is from kickstart.nvim. I'm not sure yet
-- what it does
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })

-- Grimiore Hotkeys 
-- TODO: See about switching these to function calls
vim.keymap.set('n', '<M-G>', ":Telescope grimoire<cr>", { desc = 'Grimoire' })
vim.keymap.set('i', '<M-G>', "<ESC>:Telescope grimoire<cr>", { desc = 'Grimoire' })

-- Telescope Help
vim.keymap.set({'n', 'i'}, '<M-S-t>', function()
  require('telescope.builtin').help_tags({ initial_mode = 'insert' })
end, { desc = 'Search Help' })

-- Telescope Recent Files
vim.keymap.set({'n', 'i'}, '<M-S-d>', function()
  require('telescope.builtin').oldfiles({ initial_mode = 'insert' })
end, { desc = 'Telescope: Recent files' })

-- Telescope File Search
vim.keymap.set({'n', 'i'}, '<M-F>', function()
  require('telescope.builtin').find_files({ initial_mode = 'insert' })
end, { desc = 'File search' })

-- Diagnostic keymaps
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
-- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
-- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })

-- /code

-- h2

Currently Off

These are some keymaps that came with Telescope, etc...
that I've turned off for now becuase it was too much
at the start. I want to play with them again though so
I'm keeping them around

-- code/
-- lua
-- type: nonums

-- Telescope Currently Open Files
-- (I haven't been using this so it's off, but
-- I want to keep it around for when I need it)

-- vim.keymap.set('n', '<M-S-f>', function()
--   require('telescope.builtin').buffers({ initial_mode = 'normal' })
-- end, { desc = 'Telescope: Current buffers' })
-- 
-- vim.keymap.set('i', '<M-S-f>', function()
--   require('telescope.builtin').buffers({ initial_mode = 'normal' })
-- end, { desc = 'Telescope: Current buffers' })


-- Telescope Search Current Buffer
-- Currently off, but I want to look more into how
-- this works

-- vim.keymap.set('n', '<A-m>', function()
--   require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
--     winblend = 10,
--     previewer = false,
--   })
-- end, { desc = 'Fuzzily search in current buffer' })

-- Telescope Live Grep
-- Not currently in use

--vim.keymap.set('n', '<M-S-e>', function()
--  require('telescope.builtin').live_grep()
-- end, { desc = 'Grep search' })
--
-- vim.keymap.set('i', '<M-S-e>', function()
--  require('telescope.builtin').live_grep()
-- end, { desc = 'Grep search' })

-- Stuff to look at
-- vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
-- vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })

-- /code

-- ref
-- title: My Grimoire
-- url: /grimoire/

My personal book of spells and incantations for getting
computers to do things. Some folks wold call it a developers
noteboook or a notes app. I find it more magical than that

-- ref
-- title: My Moonlander Layout
-- url: https://configure.zsa.io/moonlander/layouts/APODe/latest/1

There's like 200 variations of this as I've tweaked it over
time. One of these days I'm going to make an animation out of that. 
What you see is up to date though since this is the site
that generates the firmware

-- ref
-- title: Moonlander Keyboards
-- url: https://www.zsa.io/moonlander/

Some of the best money I've spent is on this keyboard. They key
features are: 1. it's a split keyboard, 2. it has an ortholinear
key layout (i.e. they are in straight lines), and 3. Key mapping.

The first two are for ergonomics that help prevent RSI. The last
is kinda the same as it lets me make common things that would 
otherwise require a weird move to be mapped to a basic keypress


-- categories
-- Neovim 
-- Neovim Config
-- Dotfiles

-- metadata
-- date: 2023-10-19 12:21:14
-- id: 2wzpxwwr
-- site: aws
-- type: dotfile 
-- status: draft