1
Fork 0

Modified a bunch of stuff to work with the native vim.keymap.set function

This commit is contained in:
Matei Adriel 2022-08-24 14:29:04 +03:00
parent cc6a209d8d
commit 7c77d3a8dd
6 changed files with 45 additions and 67 deletions

View file

@ -3,11 +3,11 @@ local arpeggio = require("my.plugins.arpeggio")
local M = {}
function M.map(mode, lhs, rhs, opts)
local function map(mode, lhs, rhs, opts)
if string.len(mode) > 1 then
for i = 1, #mode do
local c = mode:sub(i, i)
M.map(c, lhs, rhs, opts)
map(c, lhs, rhs, opts)
end
else
local options = helpers.mergeTables(opts, { noremap = true })
@ -17,11 +17,11 @@ end
function M.mapSilent(mode, lhs, rhs, opts)
local options = helpers.mergeTables(opts, { silent = true })
M.map(mode, lhs, rhs, options)
map(mode, lhs, rhs, options)
end
function M.setup()
M.map("n", "qq", ":wq<cr>") -- Save and quit
vim.keymap.set("n", "qq", ":wq<cr>") -- Save and quit
-- Create chords
if arpeggio ~= nil then

View file

@ -1,5 +1,3 @@
local mapSilent = require("my.keymaps").mapSilent
local M = {}
local bindings = {
@ -13,7 +11,7 @@ local bindings = {
function M.setup()
for action, keybind in pairs(bindings) do
-- Maps the keybind to the action
mapSilent('n', keybind, "<cmd>lua require('fzf-lua')." .. action .. "()<CR>")
vim.keymap.set('n', keybind, require('fzf-lua')[action])
end
end

View file

@ -5,7 +5,6 @@ function M.setup()
require('nvim-autopairs').setup()
require "gitlinker".setup()
vscode.unless(function()
require("presence"):setup({})
require("my.plugins.dashboard").setup()
@ -20,7 +19,6 @@ function M.setup()
require("my.plugins.vimux").setup()
end)
require("my.plugins.vim-tmux-navigator").setup()
require("my.plugins.neogit").setup()
require("my.plugins.comment").setup()
require("my.plugins.telescope").setup()

View file

@ -1,5 +1,4 @@
local A = require("my.helpers.augroup")
local map = require("my.keymaps").mapSilent
local arpeggio = require("my.plugins.arpeggio")
local M = {}

View file

@ -1,11 +1,9 @@
local mapSilent = require("my.keymaps").mapSilent
local M = {}
function M.setup()
require 'nvim-tree'.setup()
-- Toggle nerdtree with Control-t
mapSilent("n", "<C-n>", ":NvimTreeToggle<CR>")
-- Toggle nerdtree with Control-n
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>")
end
return M

View file

@ -1,15 +0,0 @@
local map = require("my.keymaps").map
local M = {}
-- For some reason the default mappings do not work for me
function M.setup()
vim.g.tmux_navigator_no_mappings = 1
map("n", "<C-h>", ":TmuxNavigateLeft<cr>")
map("n", "<C-j>", ":TmuxNavigateDown<cr>")
map("n", "<C-k>", ":TmuxNavigateUp<cr>")
map("n", "<C-l>", ":TmuxNavigateRight<cr>")
end
return M