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

View file

@ -1,5 +1,3 @@
local mapSilent = require("my.keymaps").mapSilent
local M = {} local M = {}
local bindings = { local bindings = {
@ -13,7 +11,7 @@ local bindings = {
function M.setup() function M.setup()
for action, keybind in pairs(bindings) do for action, keybind in pairs(bindings) do
-- Maps the keybind to the action -- 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
end end

View file

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

View file

@ -1,10 +1,9 @@
local A = require("my.helpers.augroup") local A = require("my.helpers.augroup")
local map = require("my.keymaps").mapSilent
local arpeggio = require("my.plugins.arpeggio") local arpeggio = require("my.plugins.arpeggio")
local M = {} local M = {}
local extraBrackets = { local extraBrackets = {
lean = {{"", ""}}, -- lean lean = { { "", "" } }, -- lean
all = { all = {
-- {"(", ")"}, {"[", "]"}, {"'", "'"}, {'"', '"'}, {"{", "}"}, {"`", "`"} -- {"(", ")"}, {"[", "]"}, {"'", "'"}, {'"', '"'}, {"{", "}"}, {"`", "`"}
} -- more general stuff } -- more general stuff

View file

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