mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
breaking: Remove setup script and use chezmoi
This commit is contained in:
parent
02bbb24cac
commit
0051a163c3
190 changed files with 118 additions and 3456 deletions
33
dot_config/nvim/lua/keymaps/utils.lua
Normal file
33
dot_config/nvim/lua/keymaps/utils.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
local M = {}
|
||||
-- local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
|
||||
local default_opts = { noremap = true, silent = true }
|
||||
local default_mode = { "n" }
|
||||
|
||||
M.set_keymaps = function(maps)
|
||||
for _, map in ipairs(maps) do
|
||||
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
|
||||
local mode = map.mode or default_mode
|
||||
vim.keymap.set(mode, map.keys, map.cmd, opts)
|
||||
end
|
||||
end
|
||||
|
||||
M.set_lang_keymaps = function(maps)
|
||||
vim.api.create_autocmd("FileType", {
|
||||
pattern = maps.filetype,
|
||||
callback = function()
|
||||
M.set_keymaps(maps.keymaps)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
M.set_buf_keymaps = function(maps)
|
||||
vim.api.create_autocmd("BufEnter", {
|
||||
pattern = maps.filetype,
|
||||
callback = function()
|
||||
M.set_keymaps(maps.keymaps)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue