Create and push an initial working version of this repo before I change things on this machine Signed-off-by: Robert Morrison <robert@closedless.xyz>
63 lines
1.8 KiB
Lua
63 lines
1.8 KiB
Lua
local map = vim.keymap.set
|
|
|
|
-- Control the CursorLine option
|
|
local auGroupCursorLine = vim.api.nvim_create_augroup('CursorLine', { clear = true })
|
|
local set_cursorline = function(event, value, pattern)
|
|
vim.api.nvim_create_autocmd(event, {
|
|
group = auGroupCursorLine,
|
|
pattern = pattern,
|
|
callback = function()
|
|
vim.opt_local.cursorline = value
|
|
end,
|
|
})
|
|
end
|
|
set_cursorline('WinLeave', false)
|
|
set_cursorline('WinEnter', true)
|
|
set_cursorline('FileType', false, 'TelescopePrompt')
|
|
|
|
-- Wrangle format options to work how I want
|
|
local auGroupFormatOptions = vim.api.nvim_create_augroup('FormatOptions', { clear = true })
|
|
vim.api.nvim_create_autocmd('Filetype', {
|
|
group = auGroupFormatOptions,
|
|
pattern = '*',
|
|
callback = function()
|
|
vim.opt.formatoptions = vim.opt.formatoptions -- whatever is set
|
|
- 'r' -- without auto commenting
|
|
- 'o' -- especially when adding new lines
|
|
end,
|
|
})
|
|
|
|
local auGroupKnapKeybinds = vim.api.nvim_create_augroup('KnapKeybinds', { clear = true })
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
group = auGroupKnapKeybinds,
|
|
pattern = { 'markdown', 'latex', 'html' },
|
|
callback = function()
|
|
require('lazy').load { plugins = { 'knap' } }
|
|
vim.notify('Triggered KnapKeybinds autocmd')
|
|
map({ 'n' }, '<localleader>ko', function()
|
|
require('knap').process_once()
|
|
end, {
|
|
desc = '[Knap] process once',
|
|
buffer = 0,
|
|
})
|
|
map({ 'n' }, '<localleader>kc', function()
|
|
require('knap').close_viewer()
|
|
end, {
|
|
desc = '[Knap] close viewer',
|
|
buffer = 0,
|
|
})
|
|
map({ 'n' }, '<localleader>kk', function()
|
|
require('knap').toggle_autopreviewing()
|
|
end, {
|
|
desc = '[Knap] toggle autopreview',
|
|
buffer = 0,
|
|
})
|
|
map({ 'n' }, '<localleader>kf', function()
|
|
require('knap').forward_jump()
|
|
end, {
|
|
desc = '[Knap] jump forward',
|
|
buffer = 0,
|
|
})
|
|
end,
|
|
})
|