rework qalc mappings

This commit is contained in:
2025-02-08 20:06:11 -05:00
parent 191f0cb798
commit 36febe9fe3
+8 -10
View File
@@ -17,12 +17,11 @@ local autocmd = vim.api.nvim_create_autocmd
-- end -- end
-- ━━━━━━━━━━━━━━━━━━━━━━━ Set up Qalc keymappings ━━━━━━━━━━━━━━━━━━━━━━━ -- ━━━━━━━━━━━━━━━━━━━━━━━ Set up Qalc keymappings ━━━━━━━━━━━━━━━━━━━━━━━
if pcall(require, 'qalc') then -- Create a group for filetype-specific mappings
-- Create a group for filetype-specific mappings autogrp('QalcFileTypeMappings', { clear = true })
autogrp('QalcFileTypeMappings', { clear = true })
-- Create an autocommand for the qalc filetype -- Create an autocommand for the qalc filetype
autocmd('FileType', { autocmd('FileType', {
pattern = 'qalc', pattern = 'qalc',
group = 'QalcFileTypeMappings', group = 'QalcFileTypeMappings',
callback = function() callback = function()
@@ -41,10 +40,10 @@ if pcall(require, 'qalc') then
{ noremap = true, silent = true } { noremap = true, silent = true }
) )
end, end,
}) })
-- Define a custom command to close the Qalc buffer -- Define a custom command to close the Qalc buffer
vim.api.nvim_create_user_command('QalcClose', function() vim.api.nvim_create_user_command('QalcClose', function()
local buf_name = vim.api.nvim_buf_get_name(0) local buf_name = vim.api.nvim_buf_get_name(0)
if buf_name ~= '' then if buf_name ~= '' then
vim.cmd('bd!') vim.cmd('bd!')
@@ -52,8 +51,7 @@ if pcall(require, 'qalc') then
-- If the buffer has no name, just remove it without invoking :bd! -- If the buffer has no name, just remove it without invoking :bd!
vim.api.nvim_buf_delete(0, { force = true }) vim.api.nvim_buf_delete(0, { force = true })
end end
end, { bang = true }) end, { bang = true })
end
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━ Set up highlights ━━━━━━━━━━━━━━━━━━━━━━━━━━ -- ━━━━━━━━━━━━━━━━━━━━━━━━━━ Set up highlights ━━━━━━━━━━━━━━━━━━━━━━━━━━
local load_highlight = require('utils.highlight') local load_highlight = require('utils.highlight')